From c0c4544650ca02477acc9e856b3534d20e23f48c Mon Sep 17 00:00:00 2001 From: Vladslav P Date: Fri, 28 Oct 2022 03:47:19 +0300 Subject: [PATCH 001/499] acquisition: populate gnss_synchro.fs with acquisition sample rate This makes it possible to use GNSS-SDR-Monitor to monitor acquisition process too. Set AcquisitionMonitor.udp_port to the same value as Monitor.udp_port to see acquisition results. The acquisitions will be shown with a red telemetry mark and no tracking data. Signed-off-by: Vladslav P --- .../acquisition/gnuradio_blocks/pcps_acquisition.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index a8ac0428e..91753592c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -686,12 +686,14 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) d_gnss_synchro->Acq_delay_samples -= static_cast(d_acq_parameters.resampler_latency_samples); // account the resampler filter latency d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast(samp_count) * d_acq_parameters.resampler_ratio); + d_gnss_synchro->fs = d_acq_parameters.resampled_fs; } else { d_gnss_synchro->Acq_delay_samples = static_cast(std::fmod(static_cast(indext), d_acq_parameters.samples_per_code)); d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = samp_count; + d_gnss_synchro->fs = d_acq_parameters.fs_in; } } else @@ -745,6 +747,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = rint(static_cast(samp_count) * d_acq_parameters.resampler_ratio); d_gnss_synchro->Acq_doppler_step = d_acq_parameters.doppler_step2; + d_gnss_synchro->fs = d_acq_parameters.resampled_fs; } else { @@ -752,6 +755,7 @@ void pcps_acquisition::acquisition_core(uint64_t samp_count) d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); d_gnss_synchro->Acq_samplestamp_samples = samp_count; d_gnss_synchro->Acq_doppler_step = d_acq_parameters.doppler_step2; + d_gnss_synchro->fs = d_acq_parameters.fs_in; } } From d8a3ae005d290e84e03365738bea3cb173cafa4a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 May 2023 02:23:36 +0200 Subject: [PATCH 002/499] Start work on OSNMA --- .../galileo_telemetry_decoder_gs.cc | 35 ++++---- .../system_parameters/galileo_inav_message.cc | 82 +++++++++++++++---- .../system_parameters/galileo_inav_message.h | 40 +++++++-- 3 files changed, 119 insertions(+), 38 deletions(-) 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 2c2693c44..32f9656fc 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 @@ -430,11 +430,11 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_ephemeris()); if (d_band == '1') { - std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n'; + std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << std::endl; } else if (d_band == '7') { - std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << std::endl; } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set @@ -445,7 +445,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in if ((d_band == '1') && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_reduced_ced()); - std::cout << "New Galileo E1 I/NAV reduced CED message received in channel " << d_channel << " from satellite " << d_satellite << '\n'; + std::cout << "New Galileo E1 I/NAV reduced CED message received in channel " << d_channel << " from satellite " << d_satellite << std::endl; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } } @@ -456,11 +456,11 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_iono()); if (d_band == '1') { - std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n'; + std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << std::endl; } else if (d_band == '7') { - std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << TEXT_RESET << std::endl; } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } @@ -471,11 +471,11 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_utc_model()); if (d_band == '1') { - std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n'; + std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << std::endl; } else if (d_band == '7') { - std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_BLUE << "New Galileo E5b I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << std::endl; } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_delta_t = tmp_obj->A_0G + tmp_obj->A_1G * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G), 64.0))); @@ -489,16 +489,23 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // debug if (d_band == '1') { - std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n'; + std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << std::endl; } else if (d_band == '7') { - std::cout << TEXT_BLUE << "Galileo E5b I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_BLUE << "Galileo E5b I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << std::endl; } DLOG(INFO) << "Current parameters:"; DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms; DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); } + + if (d_band == '1' && d_inav_nav.have_new_nma() == true) + { + const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); + // this->message_port_pub(pmt::mp("whatever"), pmt::make_any(tmp_obj)); + std::cout << "Galileo OSNMA message received in channel " << d_channel << " from satellite " << d_satellite << std::endl; + } } @@ -557,21 +564,21 @@ void galileo_telemetry_decoder_gs::decode_FNAV_word(float *page_symbols, int32_t if (d_fnav_nav.have_new_ephemeris() == true) { const std::shared_ptr tmp_obj = std::make_shared(d_fnav_nav.get_ephemeris()); - std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << std::endl; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } if (d_fnav_nav.have_new_iono_and_GST() == true) { const std::shared_ptr tmp_obj = std::make_shared(d_fnav_nav.get_iono()); - std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << TEXT_RESET << std::endl; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } if (d_fnav_nav.have_new_utc_model() == true) { const std::shared_ptr tmp_obj = std::make_shared(d_fnav_nav.get_utc_model()); - std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n'; + std::cout << TEXT_MAGENTA << "New Galileo E5a F/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << std::endl; this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } } @@ -631,7 +638,7 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(uint64_t time_stamp, float * d_cnav_dummy_page = is_page_dummy; std::cout << TEXT_MAGENTA << "Receiving Galileo E6 CNAV dummy pages in channel " << d_channel << " from satellite " << d_satellite - << TEXT_RESET << '\n'; + << TEXT_RESET << std::endl; } } else @@ -648,7 +655,7 @@ void galileo_telemetry_decoder_gs::decode_CNAV_word(uint64_t time_stamp, float * std::cout << TEXT_MAGENTA << "Receiving Galileo E6 HAS pages" << (d_cnav_nav.is_HAS_in_test_mode() == true ? " (test mode) " : " ") << "in channel " << d_channel << " from satellite " << d_satellite - << TEXT_RESET << '\n'; + << TEXT_RESET << std::endl; } } } diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 3c946b487..d852d9405 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -176,8 +176,6 @@ bool Galileo_Inav_Message::read_navigation_bool(const std::bitset page_type_bits(page_number_bits); // from string to bitset - Page_type = static_cast(read_page_type_unsigned(page_type_bits, TYPE)); - Page_type_time_stamp = Page_type; const std::string Data_jk_ephemeris = Data_k + Data_j; page_jk_decoder(Data_jk_ephemeris.c_str()); + + // Fill OSNMA data + if (page_position_in_inav_subframe != 255) + { + if (page_position_in_inav_subframe == 0) + { + nma_position_filled = std::array{}; + nma_msg.mack = std::array{}; + nma_msg.hkroot = std::array{}; + } + std::bitset<8> hkroot_bs(osnma_sis.substr(0, 8)); + std::bitset<32> mack_bs(osnma_sis.substr(8, 32)); + if (hkroot_bs.count() != 0 && mack_bs.count() != 0) + { + hkroot_sis = static_cast(hkroot_bs.to_ulong()); + mack_sis = static_cast(mack_bs.to_ulong()); + nma_msg.mack[page_position_in_inav_subframe] = mack_sis; + nma_msg.hkroot[page_position_in_inav_subframe] = hkroot_sis; + nma_position_filled[page_position_in_inav_subframe] = 1; + } + } } else { @@ -690,6 +700,7 @@ void Galileo_Inav_Message::read_page_4(const std::bitset& IOD_nav_4 = static_cast(read_navigation_unsigned(data_bits, IOD_NAV_4_BIT)); DLOG(INFO) << "IOD_nav_4= " << IOD_nav_4; SV_ID_PRN_4 = static_cast(read_navigation_unsigned(data_bits, SV_ID_PRN_4_BIT)); + nma_msg.PRN = static_cast(SV_ID_PRN_4); DLOG(INFO) << "SV_ID_PRN_4= " << SV_ID_PRN_4; C_ic_4 = static_cast(read_navigation_signed(data_bits, C_IC_4_BIT)); C_ic_4 = C_ic_4 * C_IC_4_LSB; @@ -844,6 +855,11 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) const auto page_number = static_cast(read_navigation_unsigned(data_jk_bits, PAGE_TYPE_BIT)); DLOG(INFO) << "Page number = " << page_number; + if (page_position_in_inav_subframe != 255) + { + page_position_in_inav_subframe++; + } + switch (page_number) { case 1: // Word type 1: Ephemeris (1/4) @@ -884,6 +900,10 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 2: // Word type 2: Ephemeris (2/4) { + page_position_in_inav_subframe = 0; + nma_msg.mack = std::array{}; + nma_msg.hkroot = std::array{}; + nma_position_filled = std::array{}; read_page_2(data_jk_bits); if (enable_rs) { @@ -1371,5 +1391,35 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) default: break; } + + if (page_position_in_inav_subframe > 14 && page_position_in_inav_subframe != 255) + { + // something weird happened, reset + page_position_in_inav_subframe = 255; + nma_position_filled = std::array{}; + nma_msg.mack = std::array{}; + nma_msg.hkroot = std::array{}; + } + return page_number; } + + +OSNMA_msg Galileo_Inav_Message::get_osnma_msg() const +{ + return nma_msg; +} + + +bool Galileo_Inav_Message::have_new_nma() +{ + if (std::all_of(nma_position_filled.begin(), nma_position_filled.end(), + [](int32_t element) { return element == 1; })) + { + return true; + } + else + { + return false; + } +} diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 1b37e9083..1d986a1b4 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -25,6 +25,7 @@ #include "galileo_iono.h" #include "galileo_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::unique_ptr in C++11 +#include #include #include #include @@ -39,6 +40,14 @@ class ReedSolomon; // Forward declaration of the ReedSolomon class /** \addtogroup System_Parameters * \{ */ +class OSNMA_msg +{ +public: + OSNMA_msg() = default; + std::array mack{}; + std::array hkroot{}; + uint32_t PRN{}; +}; /*! * \brief This class handles the Galileo I/NAV Data message, as described in the @@ -57,13 +66,6 @@ public: */ void split_page(std::string page_string, int32_t flag_even_word); - /* - * \brief Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5 - * - * Takes in input Data_jk (128 bit) and split it in ephemeris parameters according ICD 4.3.5 - */ - int32_t page_jk_decoder(const char* data_jk); - /* * \brief Returns true if new Ephemeris has arrived. The flag is set to false when the function is executed */ @@ -89,6 +91,11 @@ public: */ bool have_new_reduced_ced(); + /* + * \brief Returns true if new NMA data have arrived. The flag is set to false when the function is executed + */ + bool have_new_nma(); + /* * \brief Returns a Galileo_Ephemeris object filled with the latest navigation data received */ @@ -114,6 +121,11 @@ public: */ Galileo_Ephemeris get_reduced_ced() const; + /* + * \brief Returns an OSNMA_msg object filled with the latest NMA message received. Resets msg buffer. + */ + OSNMA_msg get_osnma_msg() const; + inline bool get_flag_CRC_test() const { return flag_CRC_test; @@ -210,6 +222,11 @@ public: inline void init_PRN(uint32_t prn) { SV_ID_PRN_4 = prn; + nma_msg.PRN = prn; + nma_msg.mack = std::array{}; + nma_msg.hkroot = std::array{}; + page_position_in_inav_subframe = 255; + nma_position_filled = std::array{}; } /* @@ -242,7 +259,7 @@ private: std::unique_ptr rs; // The Reed-Solomon decoder std::vector inav_rs_pages; // Pages 1,2,3,4,17,18,19,20. Holds 1 if the page has arrived, 0 otherwise. - int32_t Page_type_time_stamp{}; + int32_t page_jk_decoder(const char* data_jk); int32_t IOD_ephemeris{}; // Word type 1: Ephemeris (1/4) @@ -394,6 +411,13 @@ private: int32_t current_IODnav{}; + // OSNMA + uint32_t mack_sis{}; + uint8_t hkroot_sis{}; + uint8_t page_position_in_inav_subframe{255}; + std::array nma_position_filled{}; + OSNMA_msg nma_msg{}; + uint8_t IODnav_LSB17{}; uint8_t IODnav_LSB18{}; uint8_t IODnav_LSB19{}; From 916dde2174fe33eee7c2be252b02f25b6599a40e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 May 2023 12:11:53 +0200 Subject: [PATCH 003/499] Add work on OSNMA receiver --- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 27 ++++ .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 2 + .../galileo_telemetry_decoder_gs.cc | 30 ++++- .../galileo_telemetry_decoder_gs.h | 1 + .../telemetry_decoder/libs/tlm_conf.cc | 5 + .../telemetry_decoder/libs/tlm_conf.h | 1 + src/core/libs/CMakeLists.txt | 2 + src/core/libs/osnma_msg_receiver.cc | 124 ++++++++++++++++++ src/core/libs/osnma_msg_receiver.h | 66 ++++++++++ src/core/receiver/gnss_flowgraph.cc | 63 +++++++++ src/core/receiver/gnss_flowgraph.h | 4 + src/core/system_parameters/CMakeLists.txt | 2 + src/core/system_parameters/osnma_data.cc | 17 +++ src/core/system_parameters/osnma_data.h | 69 ++++++++++ 14 files changed, 411 insertions(+), 2 deletions(-) create mode 100644 src/core/libs/osnma_msg_receiver.cc create mode 100644 src/core/libs/osnma_msg_receiver.h create mode 100644 src/core/system_parameters/osnma_data.cc create mode 100644 src/core/system_parameters/osnma_data.h diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 8f6f1648a..6f882448c 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -213,6 +213,19 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, #else boost::bind(&rtklib_pvt_gs::msg_handler_has_data, this, _1)); #endif +#endif + + // Galileo OSNMA messages port in + this->message_port_register_in(pmt::mp("OSNMA_to_PVT")); + this->set_msg_handler(pmt::mp("OSNMA_to_PVT"), +#if HAS_GENERIC_LAMBDA + [this](auto&& PH1) { msg_handler_osnma(PH1); }); +#else +#if USE_BOOST_BIND_PLACEHOLDERS + boost::bind(&rtklib_pvt_gs::msg_handler_osnma, this, boost::placeholders::_1)); +#else + boost::bind(&rtklib_pvt_gs::msg_handler_osnma, this, _1)); +#endif #endif d_initial_carrier_phase_offset_estimation_rads = std::vector(nchannels, 0.0); @@ -1633,6 +1646,20 @@ void rtklib_pvt_gs::msg_handler_has_data(const pmt::pmt_t& msg) } +void rtklib_pvt_gs::msg_handler_osnma(const pmt::pmt_t& msg) +{ + try + { + const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code(); + // Process NMA data + } + catch (const wht::bad_any_cast& e) + { + LOG(WARNING) << "msg_handler_osnma Bad any_cast: " << e.what(); + } +} + + std::map rtklib_pvt_gs::get_gps_ephemeris_map() const { return d_internal_pvt_solver->gps_ephemeris_map; diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 747c31c65..3bbccd0cc 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -144,6 +144,8 @@ private: void msg_handler_has_data(const pmt::pmt_t& msg); + void msg_handler_osnma(const pmt::pmt_t& msg); + void initialize_and_apply_carrier_phase_offset(); void apply_rx_clock_offset(std::map& observables_map, 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 32f9656fc..e041d2c99 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 @@ -105,6 +105,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_enable_reed_solomon_inav(false), d_valid_timetag(false), d_E6_TOW_set(false), + d_there_are_e1_channels(conf.there_are_e1_channels), d_there_are_e6_channels(conf.there_are_e6_channels) { // prevent telemetry symbols accumulation in output buffers @@ -114,12 +115,19 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( // Control messages to tracking block this->message_port_register_out(pmt::mp("telemetry_to_trk")); + if (d_there_are_e1_channels) + { + // register OSM out + this->message_port_register_out(pmt::mp("OSNMA_from_TLM")); + } + if (d_there_are_e6_channels) { // register Gal E6 messages HAS out this->message_port_register_out(pmt::mp("E6_HAS_from_TLM")); // register TOW from map out this->message_port_register_out(pmt::mp("TOW_from_TLM")); + // register TOW to TLM input this->message_port_register_in(pmt::mp("TOW_to_TLM")); // handler for input port @@ -503,8 +511,26 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in if (d_band == '1' && d_inav_nav.have_new_nma() == true) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); - // this->message_port_pub(pmt::mp("whatever"), pmt::make_any(tmp_obj)); - std::cout << "Galileo OSNMA message received in channel " << d_channel << " from satellite " << d_satellite << std::endl; + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); + uint8_t nma_status = (tmp_obj->hkroot[0] & 0b11000000) << 6; + std::string nma_status_string; + if (nma_status == 0) + { + nma_status_string = std::string("(Reserved mode)"); + } + else if (nma_status == 1) + { + nma_status_string = std::string("(Test mode)"); + } + else if (nma_status == 2) + { + nma_status_string = std::string("(Operational mode)"); + } + else if (nma_status == 3) + { + nma_status_string = std::string("(Do not use mode)"); + } + std::cout << "Galileo OSNMA message " << nma_status_string << " received in channel " << d_channel << " from satellite " << d_satellite << std::endl; } } 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 dd6253829..eee7dd4b4 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 @@ -151,6 +151,7 @@ private: bool d_enable_reed_solomon_inav; bool d_valid_timetag; bool d_E6_TOW_set; + bool d_there_are_e1_channels; bool d_there_are_e6_channels; }; diff --git a/src/algorithms/telemetry_decoder/libs/tlm_conf.cc b/src/algorithms/telemetry_decoder/libs/tlm_conf.cc index 2b9b3c59d..cf4a248c9 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_conf.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_conf.cc @@ -30,6 +30,11 @@ void Tlm_Conf::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string default_crc_stats_dumpname("telemetry_crc_stats"); dump_crc_stats_filename = configuration->property(role + ".dump_crc_stats_filename", default_crc_stats_dumpname); enable_navdata_monitor = configuration->property("NavDataMonitor.enable_monitor", false); + if (configuration->property("Channels_1B.count", 0) > 0) + { + there_are_e1_channels = true; + } + if (configuration->property("Channels_E6.count", 0) > 0) { there_are_e6_channels = true; diff --git a/src/algorithms/telemetry_decoder/libs/tlm_conf.h b/src/algorithms/telemetry_decoder/libs/tlm_conf.h index abac3ac87..c0e14695c 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_conf.h +++ b/src/algorithms/telemetry_decoder/libs/tlm_conf.h @@ -42,6 +42,7 @@ public: bool enable_reed_solomon{false}; // for INAV message in Galileo E1B bool dump_crc_stats{false}; // telemetry CRC statistics bool enable_navdata_monitor{false}; + bool there_are_e1_channels{false}; bool there_are_e6_channels{false}; }; diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 994501ecf..1c0c6e811 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -21,6 +21,7 @@ set(CORE_LIBS_SOURCES nav_message_monitor.cc nav_message_udp_sink.cc galileo_tow_map.cc + osnma_msg_receiver.cc ) set(CORE_LIBS_HEADERS @@ -37,6 +38,7 @@ set(CORE_LIBS_HEADERS serdes_nav_message.h nav_message_monitor.h galileo_tow_map.h + osnma_msg_receiver.h ) if(ENABLE_FPGA) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc new file mode 100644 index 000000000..79ebcc48d --- /dev/null +++ b/src/core/libs/osnma_msg_receiver.cc @@ -0,0 +1,124 @@ +/*! + * \file osnma_msg_receiver.cc + * \brief GNU Radio block that processes Galileo OSNMA data received from + * Galileo E1B telemetry blocks. After successful decoding, sends the content to + * the PVT block. + * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#include "osnma_msg_receiver.h" +#include "display.h" // for colors in terminal +#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 +#include // for DLOG +#include // for gr::io_signature::make +#include +#include +#include +#include // for typeid + +#if HAS_GENERIC_LAMBDA +#else +#include +#endif + +#if PMT_USES_BOOST_ANY +#include +namespace wht = boost; +#else +#include +namespace wht = std; +#endif + +osnma_msg_receiver_sptr osnma_msg_receiver_make() +{ + return osnma_msg_receiver_sptr(new osnma_msg_receiver()); +} + + +osnma_msg_receiver::osnma_msg_receiver() : gr::block("osnma_msg_receiver", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(0, 0, 0)) +{ + // register OSNMA input message port from telemetry blocks + this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); + // register OSNMA output message port to PVT block + this->message_port_register_out(pmt::mp("OSNMA_to_PVT")); + + this->set_msg_handler(pmt::mp("OSNMA_from_TLM"), +#if HAS_GENERIC_LAMBDA + [this](auto&& PH1) { msg_handler_osnma(PH1); }); +#else +#if USE_BOOST_BIND_PLACEHOLDERS + boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, boost::placeholders::_1)); +#else + boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, _1)); +#endif +#endif +} + + +void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_osnma function called by the scheduler + try + { + const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code(); + if (msg_type_hash_code == typeid(OSNMA_msg).hash_code()) + { + const auto nma_msg = wht::any_cast(pmt::any_ref(msg)); + process_osnma_message(nma_msg); + } + else + { + LOG(WARNING) << "osnma_msg_receiver received an unknown object type!"; + } + } + catch (const wht::bad_any_cast& e) + { + LOG(WARNING) << "osnma_msg_receiver Bad any_cast: " << e.what(); + } + + // Send the resulting decoded NMA data (if available) to PVT + if (d_new_data == true) + { + auto osnma_data_ptr = std::make_shared(d_osnma_data); + this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); + d_new_data = false; + DLOG(INFO) << "NMA info sent to the PVT block through the OSNMA_to_PVT async message port"; + } +} + + +void osnma_msg_receiver::process_osnma_message(const OSNMA_msg& osnma_msg) +{ + auto hkroot_msg = osnma_msg.hkroot; + read_nma_header(hkroot_msg[0]); + read_dsm_header(hkroot_msg[1]); +} + + +void osnma_msg_receiver::read_nma_header(uint8_t nma_header) +{ + d_osnma_data.d_nma_header.nmas = (nma_header & 0b11000000) << 6; + d_osnma_data.d_nma_header.cid = (nma_header & 0b00110000) << 4; + d_osnma_data.d_nma_header.cpks = (nma_header & 0b00001110) << 1; + d_osnma_data.d_nma_header.reserved = ((nma_header & 0b00000001) ? true : false); +} + + +void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) +{ + d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) << 4; + d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; +} \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h new file mode 100644 index 000000000..f9629d133 --- /dev/null +++ b/src/core/libs/osnma_msg_receiver.h @@ -0,0 +1,66 @@ +/*! + * \file osnma_msg_receiver.h + * \brief GNU Radio block that processes Galileo OSNMA data received from + * Galileo E1B telemetry blocks. After successful decoding, sends the content to + * the PVT block. + * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_OSNMA_MSG_RECEIVER_H +#define GNSS_SDR_OSNMA_MSG_RECEIVER_H + +#include "galileo_inav_message.h" // for OSNMA_msg +#include "gnss_block_interface.h" // for gnss_shared_ptr +#include "osnma_data.h" +#include // for gr::block +#include // for pmt::pmt_t + + +/** \addtogroup Core + * \{ */ +/** \addtogroup Core_Receiver_Library + * \{ */ + +class osnma_msg_receiver; + +using osnma_msg_receiver_sptr = gnss_shared_ptr; + +osnma_msg_receiver_sptr osnma_msg_receiver_make(); + +/*! + * \brief GNU Radio block that receives asynchronous OSNMA messages + * from the telemetry blocks, stores them in memory, and decodes OSNMA info + * when enough data have been received. + * The decoded OSNMA data is sent to the PVT block. + */ +class osnma_msg_receiver : public gr::block +{ +public: + ~osnma_msg_receiver() = default; //!< Default destructor + +private: + friend osnma_msg_receiver_sptr osnma_msg_receiver_make(); + osnma_msg_receiver(); + + void msg_handler_osnma(const pmt::pmt_t& msg); + void process_osnma_message(const OSNMA_msg& osnma_msg); + void read_nma_header(uint8_t nma_header); + void read_dsm_header(uint8_t dsm_header); + OSNMA_data d_osnma_data{}; + bool d_new_data{false}; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_OSNMA_MSG_RECEIVER_H diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index d5505b4f9..4fde5eea3 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -76,6 +76,7 @@ GNSSFlowgraph::GNSSFlowgraph(std::shared_ptr configurati connected_(false), running_(false), multiband_(GNSSFlowgraph::is_multiband()), + enable_osnma_rx_(false), enable_e6_has_rx_(false) { enable_fpga_offloading_ = configuration_->property("GNSS-SDR.enable_FPGA", false); @@ -114,6 +115,16 @@ void GNSSFlowgraph::init() galileo_tow_map_ = nullptr; } + if (configuration_->property("Channels_1B.count", 0) > 0) + { + enable_osnma_rx_ = true; + osnma_rx_ = osnma_msg_receiver_make(); + } + else + { + osnma_rx_ = nullptr; + } + // 1. read the number of RF front-ends available (one file_source per RF front-end) int sources_count_deprecated = configuration_->property("Receiver.sources_count", 1); sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated); @@ -490,6 +501,14 @@ int GNSSFlowgraph::connect_desktop_flowgraph() } } + if (enable_osnma_rx_) + { + if (connect_osnma() != 0) + { + return 1; + } + } + // Activate acquisition in enabled channels for (int i = 0; i < channels_count_; i++) { @@ -609,6 +628,14 @@ int GNSSFlowgraph::connect_fpga_flowgraph() } } + if (enable_osnma_rx_) + { + if (connect_osnma() != 0) + { + return 1; + } + } + check_desktop_conf_in_fpga_env(); LOG(INFO) << "The GNU Radio flowgraph for the current GNSS-SDR configuration with FPGA off-loading has been successfully connected"; @@ -1334,6 +1361,42 @@ int GNSSFlowgraph::connect_monitors() } +int GNSSFlowgraph::connect_osnma() +{ + try + { + bool gal_e1_channels = false; + for (int i = 0; i < channels_count_; i++) + { + const std::string gnss_signal = channels_.at(i)->get_signal().get_signal_str(); + switch (mapStringValues_[gnss_signal]) + { + case evGAL_1B: + top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("OSNMA_from_TLM"), osnma_rx_, pmt::mp("OSNMA_from_TLM")); + gal_e1_channels = true; + break; + + default: + break; + } + } + + if (gal_e1_channels == true) + { + top_block_->msg_connect(osnma_rx_, pmt::mp("OSNMA_to_PVT"), pvt_->get_left_block(), pmt::mp("OSNMA_to_PVT")); + } + } + catch (const std::exception& e) + { + LOG(ERROR) << "Can't connect Galileo OSNMA msg ports: " << e.what(); + top_block_->disconnect_all(); + return 1; + } + DLOG(INFO) << "Galileo OSNMA message ports connected"; + return 0; +} + + int GNSSFlowgraph::connect_gal_e6_has() { try diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index be7c5e8bf..2616c8025 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -30,6 +30,7 @@ #include "galileo_tow_map.h" #include "gnss_sdr_sample_counter.h" #include "gnss_signal.h" +#include "osnma_msg_receiver.h" #include "pvt_interface.h" #include // for null_sink #include // for basic_block_sptr, top_block_sptr @@ -179,6 +180,7 @@ private: int connect_channels_to_observables(); int connect_observables_to_pvt(); int connect_monitors(); + int connect_osnma(); int connect_gal_e6_has(); int connect_gnss_synchro_monitor(); int connect_acquisition_monitor(); @@ -234,6 +236,7 @@ private: channel_status_msg_receiver_sptr channels_status_; // class that receives and stores the current status of the receiver channels galileo_e6_has_msg_receiver_sptr gal_e6_has_rx_; galileo_tow_map_sptr galileo_tow_map_; + osnma_msg_receiver_sptr osnma_rx_; gnss_sdr_sample_counter_sptr ch_out_sample_counter_; #if ENABLE_FPGA @@ -290,6 +293,7 @@ private: bool enable_tracking_monitor_; bool enable_navdata_monitor_; bool enable_fpga_offloading_; + bool enable_osnma_rx_; bool enable_e6_has_rx_; }; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 3e25387ed..51b64b18e 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -27,6 +27,7 @@ set(SYSTEM_PARAMETERS_SOURCES glonass_gnav_ephemeris.cc glonass_gnav_utc_model.cc glonass_gnav_navigation_message.cc + osnma_data.cc reed_solomon.cc ) @@ -89,6 +90,7 @@ set(SYSTEM_PARAMETERS_HEADERS MATH_CONSTANTS.h reed_solomon.h galileo_has_page.h + osnma_data.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc new file mode 100644 index 000000000..dde58b44a --- /dev/null +++ b/src/core/system_parameters/osnma_data.cc @@ -0,0 +1,17 @@ +/*! + * \file osnma_data.cc + * \brief Class for Galileo OSNMA data storage + * \author Carles Fernandez-Prades, 2020-2023 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "osnma_data.h" diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h new file mode 100644 index 000000000..3fa6b6232 --- /dev/null +++ b/src/core/system_parameters/osnma_data.h @@ -0,0 +1,69 @@ +/*! + * \file osnma_data.h + * \brief Class for Galileo OSNMA data storage + * \author Carles Fernandez-Prades, 2020-2023 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_OSNMA_DATA_H +#define GNSS_SDR_OSNMA_DATA_H + +#include +#include +#include +#include + +/** \addtogroup Core + * \{ */ +/** \addtogroup System_Parameters + * \{ */ + +struct nma_header +{ + uint8_t nmas; + uint8_t cid; + uint8_t cpks; + bool reserved; +}; + +struct dsm_header +{ + uint8_t dsm_id; + uint8_t dsm_block_id; +}; + + +/*! + * \brief This class handles ONSMA data + * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo_OSNMA_User_ICD_for_Test_Phase_v1.0.pdf + */ +class OSNMA_data +{ +public: + OSNMA_data() = default; + + std::string itn; // bitset<1024> + std::string npk; + std::string p_dp; + nma_header d_nma_header; + dsm_header d_dsm_header; + uint8_t nb_dp; + uint8_t mid; + uint8_t npkt; + uint8_t npktid; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_OSNMA_DATA_H From 29f43b72c5d1499a5ecfdd200705f230d9790a4c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 May 2023 12:45:36 +0200 Subject: [PATCH 004/499] Fix shift direction --- .../gnuradio_blocks/galileo_telemetry_decoder_gs.cc | 4 ++-- src/core/libs/osnma_msg_receiver.cc | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) 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 e041d2c99..fedef7456 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 @@ -512,7 +512,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - uint8_t nma_status = (tmp_obj->hkroot[0] & 0b11000000) << 6; + uint8_t nma_status = (tmp_obj->hkroot[0] & 0b11000000) >> 6; std::string nma_status_string; if (nma_status == 0) { @@ -526,7 +526,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in { nma_status_string = std::string("(Operational mode)"); } - else if (nma_status == 3) + else { nma_status_string = std::string("(Do not use mode)"); } diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 79ebcc48d..e26dc51f8 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -110,15 +110,15 @@ void osnma_msg_receiver::process_osnma_message(const OSNMA_msg& osnma_msg) void osnma_msg_receiver::read_nma_header(uint8_t nma_header) { - d_osnma_data.d_nma_header.nmas = (nma_header & 0b11000000) << 6; - d_osnma_data.d_nma_header.cid = (nma_header & 0b00110000) << 4; - d_osnma_data.d_nma_header.cpks = (nma_header & 0b00001110) << 1; + d_osnma_data.d_nma_header.nmas = (nma_header & 0b11000000) >> 6; + d_osnma_data.d_nma_header.cid = (nma_header & 0b00110000) >> 4; + d_osnma_data.d_nma_header.cpks = (nma_header & 0b00001110) >> 1; d_osnma_data.d_nma_header.reserved = ((nma_header & 0b00000001) ? true : false); } void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { - d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) << 4; + d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) >> 4; d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; } \ No newline at end of file From 9f2264a9709f3845d47f6ba6c758fc0289ed9e01 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 May 2023 12:58:51 +0200 Subject: [PATCH 005/499] Do not repeat NMA messages --- src/core/system_parameters/galileo_inav_message.cc | 3 ++- src/core/system_parameters/galileo_inav_message.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index d852d9405..581f55a7f 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1405,8 +1405,9 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) } -OSNMA_msg Galileo_Inav_Message::get_osnma_msg() const +OSNMA_msg Galileo_Inav_Message::get_osnma_msg() { + nma_position_filled = std::array{}; return nma_msg; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 1d986a1b4..043b05a14 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -124,7 +124,7 @@ public: /* * \brief Returns an OSNMA_msg object filled with the latest NMA message received. Resets msg buffer. */ - OSNMA_msg get_osnma_msg() const; + OSNMA_msg get_osnma_msg(); inline bool get_flag_CRC_test() const { From 6408d7428838f50ee12c01445e51b78eb24f0658 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 May 2023 14:11:20 +0200 Subject: [PATCH 006/499] Fix internal communications --- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 6 +++++- src/core/libs/osnma_msg_receiver.cc | 13 +++++++------ src/core/libs/osnma_msg_receiver.h | 10 ++++++---- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 6f882448c..0e64c4c64 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -52,6 +52,7 @@ #include "monitor_pvt.h" #include "monitor_pvt_udp_sink.h" #include "nmea_printer.h" +#include "osnma_data.h" #include "pvt_conf.h" #include "rinex_printer.h" #include "rtcm_printer.h" @@ -1651,7 +1652,10 @@ void rtklib_pvt_gs::msg_handler_osnma(const pmt::pmt_t& msg) try { const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code(); - // Process NMA data + if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) + { + // Act according to NMA data + } } catch (const wht::bad_any_cast& e) { diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e26dc51f8..756b89b5b 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -70,13 +70,14 @@ osnma_msg_receiver::osnma_msg_receiver() : gr::block("osnma_msg_receiver", void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { - gr::thread::scoped_lock lock(d_setlock); // require mutex with msg_handler_osnma function called by the scheduler + // requires mutex with msg_handler_osnma function called by the scheduler + gr::thread::scoped_lock lock(d_setlock); try { const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code(); - if (msg_type_hash_code == typeid(OSNMA_msg).hash_code()) + if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { - const auto nma_msg = wht::any_cast(pmt::any_ref(msg)); + const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); process_osnma_message(nma_msg); } else @@ -100,9 +101,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } -void osnma_msg_receiver::process_osnma_message(const OSNMA_msg& osnma_msg) +void osnma_msg_receiver::process_osnma_message(std::shared_ptr osnma_msg) { - auto hkroot_msg = osnma_msg.hkroot; + const auto hkroot_msg = osnma_msg->hkroot; read_nma_header(hkroot_msg[0]); read_dsm_header(hkroot_msg[1]); } @@ -120,5 +121,5 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) >> 4; - d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; + d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; // BID } \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index f9629d133..b9b51293b 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -21,9 +21,10 @@ #include "galileo_inav_message.h" // for OSNMA_msg #include "gnss_block_interface.h" // for gnss_shared_ptr -#include "osnma_data.h" -#include // for gr::block -#include // for pmt::pmt_t +#include "osnma_data.h" // for OSNMA_data +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::shared_ptr /** \addtogroup Core @@ -53,9 +54,10 @@ private: osnma_msg_receiver(); void msg_handler_osnma(const pmt::pmt_t& msg); - void process_osnma_message(const OSNMA_msg& osnma_msg); + void process_osnma_message(std::shared_ptr osnma_msg); void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); + OSNMA_data d_osnma_data{}; bool d_new_data{false}; }; From 0ba7b1611e449a0a7d507d6b0fd855849f037427 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 25 May 2023 07:48:27 +0200 Subject: [PATCH 007/499] Add work on retrieving OSNMA data --- src/core/libs/osnma_msg_receiver.cc | 244 +++++++++++++++++++++++- src/core/libs/osnma_msg_receiver.h | 10 +- src/core/system_parameters/osnma_data.h | 40 +++- 3 files changed, 281 insertions(+), 13 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 756b89b5b..759c2db0b 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -18,14 +18,18 @@ #include "osnma_msg_receiver.h" -#include "display.h" // for colors in terminal #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include // for DLOG #include // for gr::io_signature::make #include +#include #include #include +#include +#include #include // for typeid +#include +#include #if HAS_GENERIC_LAMBDA #else @@ -40,6 +44,96 @@ namespace wht = boost; namespace wht = std; #endif + +// OSNMA SIS ICD v1.0 Table 3 +const std::unordered_map> OSNMA_TABLE_3 = { + {0, {0, 0}}, + {1, {0, 0}}, + {2, {0, 0}}, + {3, {0, 0}}, + {4, {0, 0}}, + {5, {0, 0}}, + {6, {0, 0}}, + {7, {13, 1352}}, + {8, {14, 1456}}, + {9, {15, 1560}}, + {10, {16, 1664}}, + {11, {0, 0}}, + {12, {0, 0}}, + {13, {0, 0}}, + {14, {0, 0}}, + {15, {0, 0}}}; // key: nb_dp, value: {num_blocks, l_dp_bits} + +const std::unordered_map OSNMA_TABLE_5 = { + {0, std::string("Reserved")}, + {1, std::string("ECDSA P-256")}, + {2, std::string("Reserved")}, + {3, std::string("ECDSA P-521")}, + {4, std::string("OAM")}, + {5, std::string("Reserved")}, + {6, std::string("Reserved")}, + {7, std::string("Reserved")}, + {8, std::string("Reserved")}, + {9, std::string("Reserved")}, + {10, std::string("Reserved")}, + {11, std::string("Reserved")}, + {12, std::string("Reserved")}, + {13, std::string("Reserved")}, + {14, std::string("Reserved")}, + {15, std::string("Reserved")}}; // key: nptk, value: message + +const std::unordered_map OSNMA_TABLE_6 = { + {std::string("ECDSA P-256"), 264}, + {std::string("ECDSA P-521"), 536}}; + +// OSNMA SIS ICD v1.0 Table 7 +const std::unordered_map> OSNMA_TABLE_7 = { + {0, {0, 0}}, + {1, {7, 728}}, + {2, {8, 832}}, + {3, {9, 936}}, + {4, {10, 1040}}, + {5, {11, 1144}}, + {6, {12, 1248}}, + {7, {13, 1352}}, + {8, {14, 1456}}, + {9, {0, 0}}, + {10, {0, 0}}, + {11, {0, 0}}, + {12, {0, 0}}, + {13, {0, 0}}, + {14, {0, 0}}, + {15, {0, 0}}}; // key: nb_dk, value: {num_blocks, l_dk_bits} + +const std::unordered_map OSNMA_TABLE_8 = { + {0, std::string("SHA-256")}, + {1, std::string("Reserved")}, + {2, std::string("SHA3-256")}, + {3, std::string("Reserved")}}; // key: hs, value: hash_function + +const std::unordered_map OSNMA_TABLE_10 = { + {0, 96}, + {1, 104}, + {2, 112}, + {3, 120}, + {4, 128}, + {5, 160}, + {6, 192}, + {7, 224}, + {8, 256}, + {9, 0}, + {10, 0}, + {11, 0}, + {12, 0}, + {13, 0}, + {15, 0}, + {15, 0}}; // key: ks, value: lk_bits + +const std::unordered_map> OSNMA_TABLE_15 = { + {std::string("ECDSA P-256"), {512, 256}}, + {std::string("ECDSA P-521"), {1059, 521}}}; // key: ECDSA Curve and hash function, value: {l_ds_bits, key_lenght_bits} + + osnma_msg_receiver_sptr osnma_msg_receiver_make() { return osnma_msg_receiver_sptr(new osnma_msg_receiver()); @@ -101,11 +195,12 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } -void osnma_msg_receiver::process_osnma_message(std::shared_ptr osnma_msg) +void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { const auto hkroot_msg = osnma_msg->hkroot; read_nma_header(hkroot_msg[0]); read_dsm_header(hkroot_msg[1]); + read_dsm_block(osnma_msg); } @@ -122,4 +217,147 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) >> 4; d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; // BID -} \ No newline at end of file +} + + +void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) +{ + size_t i = 0; + for (auto it = osnma_msg->hkroot.cbegin() + 2; it != osnma_msg->hkroot.cend(); ++it) + { + d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][13 * d_osnma_data.d_dsm_header.dsm_block_id + i] = *it; + i++; + } + if (d_osnma_data.d_dsm_header.dsm_block_id == 0) + { + // Get number of blocks in message + uint8_t nb = (osnma_msg->hkroot[2] & 0b11110000) >> 4; + uint16_t number_of_blocks = 0; + if (d_osnma_data.d_dsm_header.dsm_id >= 0 && d_osnma_data.d_dsm_header.dsm_id < 12) + { + // Table 3 + const auto it = OSNMA_TABLE_3.find(nb); + if (it != OSNMA_TABLE_3.cend()) + { + number_of_blocks = it->second.first; + } + } + else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) + { + // Table 7 + const auto it = OSNMA_TABLE_7.find(nb); + if (it != OSNMA_TABLE_7.cend()) + { + number_of_blocks = it->second.first; + } + } + + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = number_of_blocks; + } + // Annotate bid + d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; + // is message complete? -> process_dsm_message(osnma_msg) + if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].begin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].end(), 0))) + { + std::vector dsm_msg(std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * 13, 0); + for (uint32_t i = 0; i < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; i++) + { + for (uint32_t j = 0; j < 14; j++) + { + dsm_msg[i * 13 + j] = d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][i * 13 + j]; + } + } + process_dsm_message(osnma_msg, dsm_msg); + } +} + + +void osnma_msg_receiver::process_dsm_message(const std::shared_ptr& osnma_msg, const std::vector& dsm_msg) +{ + if (d_osnma_data.d_dsm_header.dsm_id >= 0 && d_osnma_data.d_dsm_header.dsm_id < 12) + { + // DSM-KROOT message + d_osnma_data.d_dsm_kroot_message.nb_dk = (dsm_msg[0] & 0b11110000) >> 4; + d_osnma_data.d_dsm_kroot_message.pkid = (dsm_msg[0] & 0b00001111); + d_osnma_data.d_dsm_kroot_message.cidkr = (dsm_msg[1] & 0b11000000) >> 6; + d_osnma_data.d_dsm_kroot_message.reserved1 = (dsm_msg[1] & 0b00110000) >> 4; + d_osnma_data.d_dsm_kroot_message.hf = (dsm_msg[1] & 0b00001100) >> 2; + + d_osnma_data.d_dsm_kroot_message.mf = (dsm_msg[1] & 0b00000011); + d_osnma_data.d_dsm_kroot_message.ks = (dsm_msg[2] & 0b11110000) >> 4; + d_osnma_data.d_dsm_kroot_message.ts = (dsm_msg[2] & 0b00001111); + d_osnma_data.d_dsm_kroot_message.maclt = dsm_msg[3]; + d_osnma_data.d_dsm_kroot_message.reserved = (dsm_msg[4] & 0b11110000) >> 4; + d_osnma_data.d_dsm_kroot_message.wn_k = static_cast((dsm_msg[4] & 0b00001111) << 8) + + static_cast(dsm_msg[5]); + d_osnma_data.d_dsm_kroot_message.towh_k = dsm_msg[6]; + + uint32_t lk = 0; + const auto it = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); + if (it != OSNMA_TABLE_10.cend()) + { + lk = it->second; + } + + d_osnma_data.d_dsm_kroot_message.alpha = (static_cast(dsm_msg[7]) << 40) + + (static_cast(dsm_msg[8]) << 32) + + (static_cast(dsm_msg[9]) << 24) + + (static_cast(dsm_msg[10]) << 16) + + (static_cast(dsm_msg[11]) << 8) + + static_cast(dsm_msg[12]); + uint32_t bytes_lk = lk / 8; + d_osnma_data.d_dsm_kroot_message.kroot = std::vector(bytes_lk, 0); + for (uint32_t k = 0; k < bytes_lk; k++) + { + d_osnma_data.d_dsm_kroot_message.kroot[k] = dsm_msg[13 + k]; + } + // uint32_t l_ld = 0; + // const auto it2 = OSNMA_TABLE_5.find() + // d_osnma_data.d_dsm_kroot_message.ds = "0"; + // d_osnma_data.d_dsm_kroot_message.p_dk; + } + else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) + { + // DSM-PKR message + d_osnma_data.d_dsm_pkr_message.nb_dp = (dsm_msg[0] & 0b11110000) >> 4; + d_osnma_data.d_dsm_pkr_message.mid = (dsm_msg[0] & 0b00001111); + for (int k = 0; k > 128; k++) + { + d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1]; + } + + d_osnma_data.d_dsm_pkr_message.npkt = (dsm_msg[129] & 0b11110000) >> 4; + d_osnma_data.d_dsm_pkr_message.npktid = (dsm_msg[129] & 0b00001111); + + // Table 5 + uint32_t l_npk = 0; + const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); + if (it != OSNMA_TABLE_5.cend()) + { + const auto it2 = OSNMA_TABLE_6.find(it->second); + if (it2 != OSNMA_TABLE_6.cend()) + { + l_npk = it2->second / 8; + } + } + + if (d_osnma_data.d_dsm_pkr_message.npkt == 4) + { + // OAM + l_npk = 0; // ? + } + + d_osnma_data.d_dsm_pkr_message.npk = std::vector(l_npk, 0); + for (uint32_t k = 0; k > l_npk; k++) + { + d_osnma_data.d_dsm_pkr_message.npk[k] = dsm_msg[k + 130]; + } + uint32_t l_dp = dsm_msg.size(); + uint32_t l_pd = l_dp - 130 - l_npk; + d_osnma_data.d_dsm_pkr_message.p_dp = std::vector(l_pd, 0); + for (uint32_t k = 0; k > l_pd; k++) + { + d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; + } + } +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index b9b51293b..ba51a874b 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -24,8 +24,9 @@ #include "osnma_data.h" // for OSNMA_data #include // for gr::block #include // for pmt::pmt_t +#include // for std::array #include // for std::shared_ptr - +#include /** \addtogroup Core * \{ */ @@ -54,10 +55,15 @@ private: osnma_msg_receiver(); void msg_handler_osnma(const pmt::pmt_t& msg); - void process_osnma_message(std::shared_ptr osnma_msg); + void process_osnma_message(const std::shared_ptr& osnma_msg); void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); + void read_dsm_block(const std::shared_ptr& osnma_msg); + void process_dsm_message(const std::shared_ptr& osnma_msg, const std::vector& dsm_msg); + std::array, 16> d_dsm_message{}; + std::array, 16> d_dsm_id_received{}; + std::array d_number_of_blocks{}; OSNMA_data d_osnma_data{}; bool d_new_data{false}; }; diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 3fa6b6232..966e425ac 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -42,6 +42,36 @@ struct dsm_header uint8_t dsm_block_id; }; +struct DSM_PKR_message +{ + uint8_t nb_dp; + uint8_t mid; + std::array itn; // bitset<1024> + uint8_t npkt; + uint8_t npktid; + std::vector npk; + std::vector p_dp; +}; + +struct DSM_KROOT_message +{ + uint8_t nb_dk; + uint8_t pkid; + uint8_t cidkr; + uint8_t reserved1; + uint8_t hf; + uint8_t mf; + uint8_t ks; + uint8_t ts; + uint8_t maclt; + uint8_t reserved; + uint16_t wn_k; + uint8_t towh_k; + uint64_t alpha; + std::vector kroot; + std::vector ds; + std::vector p_dk; +}; /*! * \brief This class handles ONSMA data @@ -51,16 +81,10 @@ class OSNMA_data { public: OSNMA_data() = default; - - std::string itn; // bitset<1024> - std::string npk; - std::string p_dp; nma_header d_nma_header; dsm_header d_dsm_header; - uint8_t nb_dp; - uint8_t mid; - uint8_t npkt; - uint8_t npktid; + DSM_PKR_message d_dsm_pkr_message; + DSM_KROOT_message d_dsm_kroot_message; }; From f7c14e3041cc4757d54e7380b3f5d17396e01255 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 25 May 2023 07:53:11 +0200 Subject: [PATCH 008/499] Remove comparisons that are always true --- src/core/libs/osnma_msg_receiver.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 759c2db0b..0baedb6a1 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -233,7 +233,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ // Get number of blocks in message uint8_t nb = (osnma_msg->hkroot[2] & 0b11110000) >> 4; uint16_t number_of_blocks = 0; - if (d_osnma_data.d_dsm_header.dsm_id >= 0 && d_osnma_data.d_dsm_header.dsm_id < 12) + if (d_osnma_data.d_dsm_header.dsm_id < 12) { // Table 3 const auto it = OSNMA_TABLE_3.find(nb); @@ -274,7 +274,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ void osnma_msg_receiver::process_dsm_message(const std::shared_ptr& osnma_msg, const std::vector& dsm_msg) { - if (d_osnma_data.d_dsm_header.dsm_id >= 0 && d_osnma_data.d_dsm_header.dsm_id < 12) + if (d_osnma_data.d_dsm_header.dsm_id < 12) { // DSM-KROOT message d_osnma_data.d_dsm_kroot_message.nb_dk = (dsm_msg[0] & 0b11110000) >> 4; From 78847e33a32f853e5e8b5c69bf100b36702a6631 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 27 May 2023 10:22:13 +0200 Subject: [PATCH 009/499] Add work on osnma receiver --- src/core/libs/osnma_msg_receiver.cc | 149 ++++----------- src/core/libs/osnma_msg_receiver.h | 2 +- src/core/system_parameters/CMakeLists.txt | 1 + src/core/system_parameters/Galileo_OSNMA.h | 180 ++++++++++++++++++ .../system_parameters/galileo_inav_message.cc | 4 +- 5 files changed, 226 insertions(+), 110 deletions(-) create mode 100644 src/core/system_parameters/Galileo_OSNMA.h diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 0baedb6a1..c551ae1b0 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -18,6 +18,7 @@ #include "osnma_msg_receiver.h" +#include "Galileo_OSNMA.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include // for DLOG #include // for gr::io_signature::make @@ -28,8 +29,7 @@ #include #include #include // for typeid -#include -#include + #if HAS_GENERIC_LAMBDA #else @@ -44,96 +44,6 @@ namespace wht = boost; namespace wht = std; #endif - -// OSNMA SIS ICD v1.0 Table 3 -const std::unordered_map> OSNMA_TABLE_3 = { - {0, {0, 0}}, - {1, {0, 0}}, - {2, {0, 0}}, - {3, {0, 0}}, - {4, {0, 0}}, - {5, {0, 0}}, - {6, {0, 0}}, - {7, {13, 1352}}, - {8, {14, 1456}}, - {9, {15, 1560}}, - {10, {16, 1664}}, - {11, {0, 0}}, - {12, {0, 0}}, - {13, {0, 0}}, - {14, {0, 0}}, - {15, {0, 0}}}; // key: nb_dp, value: {num_blocks, l_dp_bits} - -const std::unordered_map OSNMA_TABLE_5 = { - {0, std::string("Reserved")}, - {1, std::string("ECDSA P-256")}, - {2, std::string("Reserved")}, - {3, std::string("ECDSA P-521")}, - {4, std::string("OAM")}, - {5, std::string("Reserved")}, - {6, std::string("Reserved")}, - {7, std::string("Reserved")}, - {8, std::string("Reserved")}, - {9, std::string("Reserved")}, - {10, std::string("Reserved")}, - {11, std::string("Reserved")}, - {12, std::string("Reserved")}, - {13, std::string("Reserved")}, - {14, std::string("Reserved")}, - {15, std::string("Reserved")}}; // key: nptk, value: message - -const std::unordered_map OSNMA_TABLE_6 = { - {std::string("ECDSA P-256"), 264}, - {std::string("ECDSA P-521"), 536}}; - -// OSNMA SIS ICD v1.0 Table 7 -const std::unordered_map> OSNMA_TABLE_7 = { - {0, {0, 0}}, - {1, {7, 728}}, - {2, {8, 832}}, - {3, {9, 936}}, - {4, {10, 1040}}, - {5, {11, 1144}}, - {6, {12, 1248}}, - {7, {13, 1352}}, - {8, {14, 1456}}, - {9, {0, 0}}, - {10, {0, 0}}, - {11, {0, 0}}, - {12, {0, 0}}, - {13, {0, 0}}, - {14, {0, 0}}, - {15, {0, 0}}}; // key: nb_dk, value: {num_blocks, l_dk_bits} - -const std::unordered_map OSNMA_TABLE_8 = { - {0, std::string("SHA-256")}, - {1, std::string("Reserved")}, - {2, std::string("SHA3-256")}, - {3, std::string("Reserved")}}; // key: hs, value: hash_function - -const std::unordered_map OSNMA_TABLE_10 = { - {0, 96}, - {1, 104}, - {2, 112}, - {3, 120}, - {4, 128}, - {5, 160}, - {6, 192}, - {7, 224}, - {8, 256}, - {9, 0}, - {10, 0}, - {11, 0}, - {12, 0}, - {13, 0}, - {15, 0}, - {15, 0}}; // key: ks, value: lk_bits - -const std::unordered_map> OSNMA_TABLE_15 = { - {std::string("ECDSA P-256"), {512, 256}}, - {std::string("ECDSA P-521"), {1059, 521}}}; // key: ECDSA Curve and hash function, value: {l_ds_bits, key_lenght_bits} - - osnma_msg_receiver_sptr osnma_msg_receiver_make() { return osnma_msg_receiver_sptr(new osnma_msg_receiver()); @@ -190,6 +100,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) auto osnma_data_ptr = std::make_shared(d_osnma_data); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); d_new_data = false; + d_osnma_data = OSNMA_data(); DLOG(INFO) << "NMA info sent to the PVT block through the OSNMA_to_PVT async message port"; } } @@ -197,36 +108,42 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { - const auto hkroot_msg = osnma_msg->hkroot; - read_nma_header(hkroot_msg[0]); - read_dsm_header(hkroot_msg[1]); + read_nma_header(osnma_msg->hkroot[0]); + read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); } void osnma_msg_receiver::read_nma_header(uint8_t nma_header) { - d_osnma_data.d_nma_header.nmas = (nma_header & 0b11000000) >> 6; - d_osnma_data.d_nma_header.cid = (nma_header & 0b00110000) >> 4; - d_osnma_data.d_nma_header.cpks = (nma_header & 0b00001110) >> 1; - d_osnma_data.d_nma_header.reserved = ((nma_header & 0b00000001) ? true : false); + d_osnma_data.d_nma_header.nmas = get_nmas(nma_header); + d_osnma_data.d_nma_header.cid = get_cid(nma_header); + d_osnma_data.d_nma_header.cpks = get_cpks(nma_header); + d_osnma_data.d_nma_header.reserved = get_nma_header_reserved(nma_header); + + // debug + const auto it = OSNMA_TABLE_2.find(d_osnma_data.d_nma_header.cpks); + if (it != OSNMA_TABLE_2.cend()) + { + LOG(WARNING) << "Chain and Public Key Status: " << it->second; + } } void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { - d_osnma_data.d_dsm_header.dsm_id = (dsm_header & 0b11110000) >> 4; - d_osnma_data.d_dsm_header.dsm_block_id = dsm_header & 0b00001111; // BID + d_osnma_data.d_dsm_header.dsm_id = get_dsm_id(dsm_header); + d_osnma_data.d_dsm_header.dsm_block_id = get_dsm_block_id(dsm_header); // BID } void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) { - size_t i = 0; - for (auto it = osnma_msg->hkroot.cbegin() + 2; it != osnma_msg->hkroot.cend(); ++it) + size_t index = 0; + for (const auto* it = osnma_msg->hkroot.cbegin() + 2; it != osnma_msg->hkroot.cend(); ++it) { - d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][13 * d_osnma_data.d_dsm_header.dsm_block_id + i] = *it; - i++; + d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][13 * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; + index++; } if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { @@ -256,8 +173,17 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; + + std::cout << "d_dsm_id_received"; + for (auto v : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) + { + std::cout << " " << static_cast(v); + } + std::cout << std::endl; + LOG(WARNING) << "d_number_of blocks: " << static_cast(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) << " BID: " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) << " DSM ID: " << static_cast(d_osnma_data.d_dsm_header.dsm_id); // is message complete? -> process_dsm_message(osnma_msg) - if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].begin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].end(), 0))) + if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && + (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].begin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].end(), 0))) { std::vector dsm_msg(std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * 13, 0); for (uint32_t i = 0; i < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; i++) @@ -267,15 +193,16 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ dsm_msg[i * 13 + j] = d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][i * 13 + j]; } } - process_dsm_message(osnma_msg, dsm_msg); + process_dsm_message(dsm_msg); } } -void osnma_msg_receiver::process_dsm_message(const std::shared_ptr& osnma_msg, const std::vector& dsm_msg) +void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg) { if (d_osnma_data.d_dsm_header.dsm_id < 12) { + LOG(WARNING) << "OSNMA: DSM-KROOT message received."; // DSM-KROOT message d_osnma_data.d_dsm_kroot_message.nb_dk = (dsm_msg[0] & 0b11110000) >> 4; d_osnma_data.d_dsm_kroot_message.pkid = (dsm_msg[0] & 0b00001111); @@ -318,6 +245,7 @@ void osnma_msg_receiver::process_dsm_message(const std::shared_ptr& o } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { + LOG(WARNING) << "OSNMA: DSM-PKR message received."; // DSM-PKR message d_osnma_data.d_dsm_pkr_message.nb_dp = (dsm_msg[0] & 0b11110000) >> 4; d_osnma_data.d_dsm_pkr_message.mid = (dsm_msg[0] & 0b00001111); @@ -360,4 +288,9 @@ void osnma_msg_receiver::process_dsm_message(const std::shared_ptr& o d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; } } + else + { + // Reserved message? + d_osnma_data = OSNMA_data(); + } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index ba51a874b..59c65bfe2 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -59,7 +59,7 @@ private: void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); - void process_dsm_message(const std::shared_ptr& osnma_msg, const std::vector& dsm_msg); + void process_dsm_message(const std::vector& dsm_msg); std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 51b64b18e..81fd4318a 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -90,6 +90,7 @@ set(SYSTEM_PARAMETERS_HEADERS MATH_CONSTANTS.h reed_solomon.h galileo_has_page.h + Galileo_OSNMA.h osnma_data.h ) diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h new file mode 100644 index 000000000..7c233a294 --- /dev/null +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -0,0 +1,180 @@ +/*! + * \file Galileo_OSNMA.h + * \brief Galileo OSNMA mesage constants + * \author Carles Fernandez, 2023. cfernandez(at)cttc.es + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_GALILEO_OSNMA_H +#define GNSS_SDR_GALILEO_OSNMA_H + +#include +#include +#include +#include + +/** \addtogroup Core + * \{ */ +/** \addtogroup System_Parameters + * \{ */ + +// OSNMA User ICD for the Test Phase, Issue 1.0, Table 2 +const std::unordered_map OSNMA_TABLE_2 = { + {0, std::string("Reserved")}, + {1, std::string("Nominal")}, + {2, std::string("End of Chain (EOC)")}, + {3, std::string("Chain Revoked (CREV)")}, + {4, std::string("New Public Key (NPK)")}, + {5, std::string("Public Key Revoked (PKREV)")}, + {6, std::string("Reserved")}, + {7, std::string("Reserved")}}; // key: cpks, value: Chain and Public Key Status + +// OSNMA User ICD for the Test Phase, Issue 1.0, Table 3 +const std::unordered_map> OSNMA_TABLE_3 = { + {0, {0, 0}}, + {1, {0, 0}}, + {2, {0, 0}}, + {3, {0, 0}}, + {4, {0, 0}}, + {5, {0, 0}}, + {6, {0, 0}}, + {7, {13, 1352}}, + {8, {14, 1456}}, + {9, {15, 1560}}, + {10, {16, 1664}}, + {11, {0, 0}}, + {12, {0, 0}}, + {13, {0, 0}}, + {14, {0, 0}}, + {15, {0, 0}}}; // key: nb_dp, value: {num_blocks, l_dp_bits} + +const std::unordered_map OSNMA_TABLE_5 = { + {0, std::string("Reserved")}, + {1, std::string("ECDSA P-256")}, + {2, std::string("Reserved")}, + {3, std::string("ECDSA P-521")}, + {4, std::string("OAM")}, + {5, std::string("Reserved")}, + {6, std::string("Reserved")}, + {7, std::string("Reserved")}, + {8, std::string("Reserved")}, + {9, std::string("Reserved")}, + {10, std::string("Reserved")}, + {11, std::string("Reserved")}, + {12, std::string("Reserved")}, + {13, std::string("Reserved")}, + {14, std::string("Reserved")}, + {15, std::string("Reserved")}}; // key: nptk, value: message + +const std::unordered_map OSNMA_TABLE_6 = { + {std::string("ECDSA P-256"), 264}, + {std::string("ECDSA P-521"), 536}}; + +// OSNMA User ICD for the Test Phase, Issue 1.0, Table 7 +const std::unordered_map> OSNMA_TABLE_7 = { + {0, {0, 0}}, + {1, {7, 728}}, + {2, {8, 832}}, + {3, {9, 936}}, + {4, {10, 1040}}, + {5, {11, 1144}}, + {6, {12, 1248}}, + {7, {13, 1352}}, + {8, {14, 1456}}, + {9, {0, 0}}, + {10, {0, 0}}, + {11, {0, 0}}, + {12, {0, 0}}, + {13, {0, 0}}, + {14, {0, 0}}, + {15, {0, 0}}}; // key: nb_dk, value: {num_blocks, l_dk_bits} + +const std::unordered_map OSNMA_TABLE_8 = { + {0, std::string("SHA-256")}, + {1, std::string("Reserved")}, + {2, std::string("SHA3-256")}, + {3, std::string("Reserved")}}; // key: hs, value: hash_function + +const std::unordered_map OSNMA_TABLE_10 = { + {0, 96}, + {1, 104}, + {2, 112}, + {3, 120}, + {4, 128}, + {5, 160}, + {6, 192}, + {7, 224}, + {8, 256}, + {9, 0}, + {10, 0}, + {11, 0}, + {12, 0}, + {13, 0}, + {15, 0}, + {15, 0}}; // key: ks, value: lk_bits + +const std::unordered_map> OSNMA_TABLE_15 = { + {std::string("ECDSA P-256"), {512, 256}}, + {std::string("ECDSA P-521"), {1059, 521}}}; // key: ECDSA Curve and hash function, value: {l_ds_bits, key_lenght_bits} + +#if __cplusplus == 201103L +constexpr std::uint8_t mask_nmas{0xC0}; +constexpr std::uint8_t mask_cid{0x30}; +constexpr std::uint8_t mask_cpks{0x07}; +constexpr std::uint8_t mask_nma_header_reserved{0x01}; +constexpr std::uint8_t mask_dsm_id{0x01}; +constexpr std::uint8_t mask_dsm_block_id{0x0F}; +#else +constexpr std::uint8_t mask_nmas{0b1100'0000}; +constexpr std::uint8_t mask_cid{0b0011'0000}; +constexpr std::uint8_t mask_cpks{0b0000'1110}; +constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; +constexpr std::uint8_t mask_dsm_id{0b0000'0001}; +constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; + +#endif + +inline uint8_t get_nmas(uint8_t nma_header) +{ + return (nma_header & mask_nmas) >> 6; +} + +inline uint8_t get_cid(uint8_t nma_header) +{ + return (nma_header & mask_cid) >> 4; +} + +inline uint8_t get_cpks(uint8_t nma_header) +{ + return (nma_header & mask_cpks) >> 1; +} + +inline bool get_nma_header_reserved(uint8_t nma_header) +{ + return ((nma_header & mask_nma_header_reserved) ? true : false); +} + +inline uint8_t get_dsm_id(uint8_t dsm_header) +{ + return (dsm_header & mask_dsm_id) >> 4; +} + +inline uint8_t get_dsm_block_id(uint8_t dsm_header) +{ + return dsm_header & mask_dsm_block_id; +} + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_GALILEO_OSNMA_H \ No newline at end of file diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 581f55a7f..dd9f9df6a 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1392,7 +1392,9 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; } - if (page_position_in_inav_subframe > 14 && page_position_in_inav_subframe != 255) + if (page_position_in_inav_subframe != 0 && + page_position_in_inav_subframe > 14 && + page_position_in_inav_subframe != 255) { // something weird happened, reset page_position_in_inav_subframe = 255; From ee13784dd2780c7275ce6cbd10c76cd83f4ce43f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 27 May 2023 10:27:44 +0200 Subject: [PATCH 010/499] Avoid string literals (not available in C++11) --- .../gnuradio_blocks/galileo_telemetry_decoder_gs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 fedef7456..60b83efc8 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 @@ -512,7 +512,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - uint8_t nma_status = (tmp_obj->hkroot[0] & 0b11000000) >> 6; + uint8_t nma_status = (tmp_obj->hkroot[0] & 0xC0) >> 6; std::string nma_status_string; if (nma_status == 0) { From 46aca38adec96cb96dd15bcd4f08596233bddd9f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 27 May 2023 11:43:41 +0200 Subject: [PATCH 011/499] Add work on osnma receiver --- src/core/libs/osnma_msg_receiver.cc | 5 ++++- src/core/system_parameters/Galileo_OSNMA.h | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index c551ae1b0..ec875d696 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -148,7 +148,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { // Get number of blocks in message - uint8_t nb = (osnma_msg->hkroot[2] & 0b11110000) >> 4; + uint8_t nb = get_number_blocks(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); uint16_t number_of_blocks = 0; if (d_osnma_data.d_dsm_header.dsm_id < 12) { @@ -194,6 +194,9 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } } process_dsm_message(dsm_msg); + d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; + d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } } diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 7c233a294..89cc06d92 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -134,6 +134,7 @@ constexpr std::uint8_t mask_cpks{0x07}; constexpr std::uint8_t mask_nma_header_reserved{0x01}; constexpr std::uint8_t mask_dsm_id{0x01}; constexpr std::uint8_t mask_dsm_block_id{0x0F}; +constexpr std::uint8_t mask_dsm_number_blocks{0XF0}; #else constexpr std::uint8_t mask_nmas{0b1100'0000}; constexpr std::uint8_t mask_cid{0b0011'0000}; @@ -141,6 +142,7 @@ constexpr std::uint8_t mask_cpks{0b0000'1110}; constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; constexpr std::uint8_t mask_dsm_id{0b0000'0001}; constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; +constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000}; #endif @@ -174,6 +176,10 @@ inline uint8_t get_dsm_block_id(uint8_t dsm_header) return dsm_header & mask_dsm_block_id; } +inline uint8_t get_number_blocks(uint8_t dsm_message_0) +{ + return (dsm_message_0 & mask_dsm_number_blocks) >> 4; +} /** \} */ /** \} */ From e6419a2063d1cdc5f621072ac1688a4efff4d650 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 29 May 2023 14:52:30 +0200 Subject: [PATCH 012/499] Add work on OSNMA receiver --- .../system_parameters/galileo_inav_message.cc | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index dd9f9df6a..48d973d97 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -195,6 +195,11 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even // const std::string Reserved_2 = page_INAV.substr(220, 8); // const std::string Tail_odd = page_INAV.substr(228, 6); + if (page_position_in_inav_subframe != 255) + { + page_position_in_inav_subframe++; + } + // ************ CRC checksum control *******/ std::stringstream TLM_word_for_CRC_stream; TLM_word_for_CRC_stream << page_INAV; @@ -855,15 +860,11 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) const auto page_number = static_cast(read_navigation_unsigned(data_jk_bits, PAGE_TYPE_BIT)); DLOG(INFO) << "Page number = " << page_number; - if (page_position_in_inav_subframe != 255) - { - page_position_in_inav_subframe++; - } - switch (page_number) { case 1: // Word type 1: Ephemeris (1/4) { + page_position_in_inav_subframe = 10; read_page_1(data_jk_bits); if (enable_rs) { @@ -935,6 +936,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) } case 3: // Word type 3: Ephemeris (3/4) and SISA { + page_position_in_inav_subframe = 11; read_page_3(data_jk_bits); if (enable_rs) { @@ -967,6 +969,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 4: // Word type 4: Ephemeris (4/4) and Clock correction parameters { + page_position_in_inav_subframe = 1; read_page_4(data_jk_bits); if (enable_rs) { @@ -998,6 +1001,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) } case 5: // Word type 5: Ionospheric correction, BGD, signal health and data validity status and GST + page_position_in_inav_subframe = 12; // Ionospheric correction ai0_5 = static_cast(read_navigation_unsigned(data_jk_bits, AI0_5_BIT)); ai0_5 = ai0_5 * AI0_5_LSB; @@ -1048,6 +1052,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; case 6: // Word type 6: GST-UTC conversion parameters + page_position_in_inav_subframe = 2; A0_6 = static_cast(read_navigation_signed(data_jk_bits, A0_6_BIT)); A0_6 = A0_6 * A0_6_LSB; DLOG(INFO) << "A0_6= " << A0_6; @@ -1076,6 +1081,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; case 7: // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number + page_position_in_inav_subframe = 3; IOD_a_7 = static_cast(read_navigation_unsigned(data_jk_bits, IOD_A_7_BIT)); DLOG(INFO) << "IOD_a_7= " << IOD_a_7; WN_a_7 = static_cast(read_navigation_unsigned(data_jk_bits, WN_A_7_BIT)); @@ -1110,7 +1116,8 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) DLOG(INFO) << "flag_tow_set" << flag_TOW_set; break; - case 8: // Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2)*/ + case 8: // Word type 8: Almanac for SVID1 (2/2) and SVID2 (1/2) + page_position_in_inav_subframe = 4; IOD_a_8 = static_cast(read_navigation_unsigned(data_jk_bits, IOD_A_8_BIT)); DLOG(INFO) << "IOD_a_8= " << IOD_a_8; af0_8 = static_cast(read_navigation_signed(data_jk_bits, AF0_8_BIT)); @@ -1148,6 +1155,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; case 9: // Word type 9: Almanac for SVID2 (2/2) and SVID3 (1/2) + page_position_in_inav_subframe = 3; IOD_a_9 = static_cast(read_navigation_unsigned(data_jk_bits, IOD_A_9_BIT)); DLOG(INFO) << "IOD_a_9= " << IOD_a_9; WN_a_9 = static_cast(read_navigation_unsigned(data_jk_bits, WN_A_9_BIT)); @@ -1187,6 +1195,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; case 10: // Word type 10: Almanac for SVID3 (2/2) and GST-GPS conversion parameters + page_position_in_inav_subframe = 4; IOD_a_10 = static_cast(read_navigation_unsigned(data_jk_bits, IOD_A_10_BIT)); DLOG(INFO) << "IOD_a_10= " << IOD_a_10; Omega0_10 = static_cast(read_navigation_signed(data_jk_bits, OMEGA0_10_BIT)); @@ -1258,6 +1267,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 17: // Word type 17: FEC2 Reed-Solomon for CED { + page_position_in_inav_subframe = 5; if (enable_rs) { IODnav_LSB17 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS); @@ -1287,6 +1297,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 18: // Word type 18: FEC2 Reed-Solomon for CED { + page_position_in_inav_subframe = 5; if (enable_rs) { IODnav_LSB18 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS); @@ -1316,6 +1327,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 19: // Word type 19: FEC2 Reed-Solomon for CED { + page_position_in_inav_subframe = 6; if (enable_rs) { IODnav_LSB19 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS); @@ -1345,6 +1357,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 20: // Word type 20: FEC2 Reed-Solomon for CED { + page_position_in_inav_subframe = 6; if (enable_rs) { IODnav_LSB20 = read_octet_unsigned(data_jk_bits, RS_IODNAV_LSBS); @@ -1392,8 +1405,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; } - if (page_position_in_inav_subframe != 0 && - page_position_in_inav_subframe > 14 && + if (page_position_in_inav_subframe > 14 && page_position_in_inav_subframe != 255) { // something weird happened, reset @@ -1416,8 +1428,7 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() bool Galileo_Inav_Message::have_new_nma() { - if (std::all_of(nma_position_filled.begin(), nma_position_filled.end(), - [](int32_t element) { return element == 1; })) + if (std::all_of(nma_position_filled.begin(), nma_position_filled.end(), [](int8_t element) { return element == 1; })) { return true; } From c6c0fc651a944867c2e32e657e1be386a2becc12 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 1 Jun 2023 11:52:27 +0200 Subject: [PATCH 013/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 62 +++++++++++++--------- src/core/system_parameters/Galileo_OSNMA.h | 24 ++++----- 2 files changed, 49 insertions(+), 37 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index ec875d696..5ea504e4a 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -145,42 +145,42 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][13 * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; index++; } + if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { // Get number of blocks in message - uint8_t nb = get_number_blocks(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); + uint8_t nb = get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); uint16_t number_of_blocks = 0; if (d_osnma_data.d_dsm_header.dsm_id < 12) { - // Table 3 - const auto it = OSNMA_TABLE_3.find(nb); - if (it != OSNMA_TABLE_3.cend()) - { - number_of_blocks = it->second.first; - } - } - else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) - { - // Table 7 + // DSM-KROOT Table 7 const auto it = OSNMA_TABLE_7.find(nb); if (it != OSNMA_TABLE_7.cend()) { number_of_blocks = it->second.first; } } + else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) + { + // DSM-PKR Table 3 + const auto it = OSNMA_TABLE_3.find(nb); + if (it != OSNMA_TABLE_3.cend()) + { + number_of_blocks = it->second.first; + } + } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = number_of_blocks; + if (number_of_blocks == 0) + { + // Something is wrong, start over + d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; + d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; + } } // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; - std::cout << "d_dsm_id_received"; - for (auto v : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) - { - std::cout << " " << static_cast(v); - } - std::cout << std::endl; - LOG(WARNING) << "d_number_of blocks: " << static_cast(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) << " BID: " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) << " DSM ID: " << static_cast(d_osnma_data.d_dsm_header.dsm_id); // is message complete? -> process_dsm_message(osnma_msg) if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].begin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].end(), 0))) @@ -196,7 +196,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ process_dsm_message(dsm_msg); d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; - d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; + // d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } } @@ -207,7 +207,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(WARNING) << "OSNMA: DSM-KROOT message received."; // DSM-KROOT message - d_osnma_data.d_dsm_kroot_message.nb_dk = (dsm_msg[0] & 0b11110000) >> 4; + d_osnma_data.d_dsm_kroot_message.nb_dk = get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_kroot_message.pkid = (dsm_msg[0] & 0b00001111); d_osnma_data.d_dsm_kroot_message.cidkr = (dsm_msg[1] & 0b11000000) >> 6; d_osnma_data.d_dsm_kroot_message.reserved1 = (dsm_msg[1] & 0b00110000) >> 4; @@ -222,11 +222,17 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg static_cast(dsm_msg[5]); d_osnma_data.d_dsm_kroot_message.towh_k = dsm_msg[6]; - uint32_t lk = 0; - const auto it = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); - if (it != OSNMA_TABLE_10.cend()) + uint16_t l_dk_bits = 0; + const auto it = OSNMA_TABLE_7.find(d_osnma_data.d_dsm_kroot_message.nb_dk); + if (it != OSNMA_TABLE_7.cend()) { - lk = it->second; + l_dk_bits = it->second.second; + } + uint16_t lk_bits = 0; + const auto it2 = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); + if (it2 != OSNMA_TABLE_10.cend()) + { + lk_bits = it2->second; } d_osnma_data.d_dsm_kroot_message.alpha = (static_cast(dsm_msg[7]) << 40) + @@ -235,12 +241,18 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg (static_cast(dsm_msg[10]) << 16) + (static_cast(dsm_msg[11]) << 8) + static_cast(dsm_msg[12]); - uint32_t bytes_lk = lk / 8; + uint16_t bytes_lk = lk_bits / 8; d_osnma_data.d_dsm_kroot_message.kroot = std::vector(bytes_lk, 0); for (uint32_t k = 0; k < bytes_lk; k++) { d_osnma_data.d_dsm_kroot_message.kroot[k] = dsm_msg[13 + k]; } + uint16_t l_ds_bits; + const auto it3 = OSNMA_TABLE_15.find(""); + if (it3 != OSNMA_TABLE_15.cend()) + { + l_ds_bits = it3->second; + } // uint32_t l_ld = 0; // const auto it2 = OSNMA_TABLE_5.find() // d_osnma_data.d_dsm_kroot_message.ds = "0"; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 89cc06d92..200c722fe 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -123,16 +123,16 @@ const std::unordered_map OSNMA_TABLE_10 = { {15, 0}, {15, 0}}; // key: ks, value: lk_bits -const std::unordered_map> OSNMA_TABLE_15 = { - {std::string("ECDSA P-256"), {512, 256}}, - {std::string("ECDSA P-521"), {1059, 521}}}; // key: ECDSA Curve and hash function, value: {l_ds_bits, key_lenght_bits} +const std::unordered_map OSNMA_TABLE_15 = { + {std::string("ECDSA P-256"), {512}}, + {std::string("ECDSA P-521"), {1056}}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} #if __cplusplus == 201103L constexpr std::uint8_t mask_nmas{0xC0}; constexpr std::uint8_t mask_cid{0x30}; constexpr std::uint8_t mask_cpks{0x07}; constexpr std::uint8_t mask_nma_header_reserved{0x01}; -constexpr std::uint8_t mask_dsm_id{0x01}; +constexpr std::uint8_t mask_dsm_id{0xF0}; constexpr std::uint8_t mask_dsm_block_id{0x0F}; constexpr std::uint8_t mask_dsm_number_blocks{0XF0}; #else @@ -140,43 +140,43 @@ constexpr std::uint8_t mask_nmas{0b1100'0000}; constexpr std::uint8_t mask_cid{0b0011'0000}; constexpr std::uint8_t mask_cpks{0b0000'1110}; constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; -constexpr std::uint8_t mask_dsm_id{0b0000'0001}; +constexpr std::uint8_t mask_dsm_id{0b1111'0000}; constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000}; #endif -inline uint8_t get_nmas(uint8_t nma_header) +uint8_t get_nmas(uint8_t nma_header) { return (nma_header & mask_nmas) >> 6; } -inline uint8_t get_cid(uint8_t nma_header) +uint8_t get_cid(uint8_t nma_header) { return (nma_header & mask_cid) >> 4; } -inline uint8_t get_cpks(uint8_t nma_header) +uint8_t get_cpks(uint8_t nma_header) { return (nma_header & mask_cpks) >> 1; } -inline bool get_nma_header_reserved(uint8_t nma_header) +bool get_nma_header_reserved(uint8_t nma_header) { return ((nma_header & mask_nma_header_reserved) ? true : false); } -inline uint8_t get_dsm_id(uint8_t dsm_header) +uint8_t get_dsm_id(uint8_t dsm_header) { return (dsm_header & mask_dsm_id) >> 4; } -inline uint8_t get_dsm_block_id(uint8_t dsm_header) +uint8_t get_dsm_block_id(uint8_t dsm_header) { return dsm_header & mask_dsm_block_id; } -inline uint8_t get_number_blocks(uint8_t dsm_message_0) +uint8_t get_number_blocks_index(uint8_t dsm_message_0) { return (dsm_message_0 & mask_dsm_number_blocks) >> 4; } From cc8fa9a4d218c32b4ab987c75af927772a3c4b6d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 1 Jun 2023 13:41:30 +0200 Subject: [PATCH 014/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 72 +++++++++++++++++++--- src/core/libs/osnma_msg_receiver.h | 8 +++ src/core/system_parameters/Galileo_OSNMA.h | 6 +- src/core/system_parameters/osnma_data.h | 26 ++++++++ 4 files changed, 102 insertions(+), 10 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 5ea504e4a..0e8996072 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -111,6 +111,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_nma_header(osnma_msg->hkroot[0]); read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); + read_mack_block(osnma_msg); } @@ -247,16 +248,34 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_kroot_message.kroot[k] = dsm_msg[13 + k]; } - uint16_t l_ds_bits; - const auto it3 = OSNMA_TABLE_15.find(""); - if (it3 != OSNMA_TABLE_15.cend()) + + std::string hash_function; + const auto it3 = OSNMA_TABLE_8.find(d_osnma_data.d_dsm_kroot_message.hf); + if (it3 != OSNMA_TABLE_8.cend()) { - l_ds_bits = it3->second; + hash_function = it3->second; } - // uint32_t l_ld = 0; - // const auto it2 = OSNMA_TABLE_5.find() - // d_osnma_data.d_dsm_kroot_message.ds = "0"; - // d_osnma_data.d_dsm_kroot_message.p_dk; + + uint16_t l_ds_bits = 0; + const auto it4 = OSNMA_TABLE_15.find(hash_function); + if (it4 != OSNMA_TABLE_15.cend()) + { + l_ds_bits = it4->second; + } + uint16_t l_ds_bytes = l_ds_bits / 8; + d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); + for (uint32_t k = 0; k < l_ds_bytes; k++) + { + d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k]; + } + uint16_t l_pdk_bytes = (l_dk_bits - 104 - lk_bits - l_ds_bits) / 8; + + d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); + for (uint32_t k = 0; k < l_ds_bytes; k++) + { + d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; + } + // validation? } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { @@ -308,4 +327,41 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // Reserved message? d_osnma_data = OSNMA_data(); } + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } + + +void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma_msg) +{ + uint32_t index = 0; + for (size_t i = 0; i < osnma_msg->mack.size(); i++) + { + uint32_t value = osnma_msg->mack[i]; + d_mack_message[index] = static_cast((value & 0xFF000000) >> 6); + d_mack_message[index + 1] = static_cast((value & 0x00FF0000) >> 4); + d_mack_message[index + 2] = static_cast((value & 0x0000FF00) >> 2); + d_mack_message[index + 3] = static_cast(value & 0x000000FF); + index = index + 4; + } + read_mack_header(osnma_msg); + read_mack_info_and_tags(osnma_msg); + read_mack_key(osnma_msg); + read_mack_padding(osnma_msg); +} + +void osnma_msg_receiver::read_mack_header(const std::shared_ptr& osnma_msg) +{ +} + +void osnma_msg_receiver::read_mack_info_and_tags(const std::shared_ptr& osnma_msg) +{ +} + + +void osnma_msg_receiver::read_mack_key(const std::shared_ptr& osnma_msg) +{ +} + +void osnma_msg_receiver::read_mack_padding(const std::shared_ptr& osnma_msg) +{ +} \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 59c65bfe2..65bcac037 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -59,11 +59,19 @@ private: void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); + void read_mack_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg); + void read_mack_header(const std::shared_ptr& osnma_msg); + void read_mack_info_and_tags(const std::shared_ptr& osnma_msg); + void read_mack_key(const std::shared_ptr& osnma_msg); + void read_mack_padding(const std::shared_ptr& osnma_msg); + std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; std::array d_number_of_blocks{}; + std::array d_mack_message{}; + OSNMA_data d_osnma_data{}; bool d_new_data{false}; }; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 200c722fe..6e0b1a6f8 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -124,8 +124,10 @@ const std::unordered_map OSNMA_TABLE_10 = { {15, 0}}; // key: ks, value: lk_bits const std::unordered_map OSNMA_TABLE_15 = { - {std::string("ECDSA P-256"), {512}}, - {std::string("ECDSA P-521"), {1056}}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} + {std::string("ECDSA P-256"), 512}, + {std::string("ECDSA P-521"), 1056}, + {std::string("SHA-256"), 512}, + {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} #if __cplusplus == 201103L constexpr std::uint8_t mask_nmas{0xC0}; diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 966e425ac..aa4eaf21f 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -42,6 +42,24 @@ struct dsm_header uint8_t dsm_block_id; }; +struct mack_header +{ + std::vector tag0; + uint16_t macsec; + uint8_t cop; +}; + +struct tag +{ + std::vector tag; + uint16_t tag_info; +}; + +struct tag_and_info +{ + std::vector tags; +}; + struct DSM_PKR_message { uint8_t nb_dp; @@ -73,6 +91,14 @@ struct DSM_KROOT_message std::vector p_dk; }; +struct MACK_message +{ + mack_header header; + tag_and_info tag_info; + std::vector key; + std::vector padding; +}; + /*! * \brief This class handles ONSMA data * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo_OSNMA_User_ICD_for_Test_Phase_v1.0.pdf From ce50e160a7658fdab782d5ba3d9b57f81d353120 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 1 Jun 2023 14:41:01 +0200 Subject: [PATCH 015/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 39 +++++++++++----------- src/core/libs/osnma_msg_receiver.h | 8 ++--- src/core/system_parameters/Galileo_OSNMA.h | 19 +++++++++++ 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 0e8996072..89d4789c2 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -28,6 +28,7 @@ #include #include #include +#include #include // for typeid @@ -121,13 +122,6 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) d_osnma_data.d_nma_header.cid = get_cid(nma_header); d_osnma_data.d_nma_header.cpks = get_cpks(nma_header); d_osnma_data.d_nma_header.reserved = get_nma_header_reserved(nma_header); - - // debug - const auto it = OSNMA_TABLE_2.find(d_osnma_data.d_nma_header.cpks); - if (it != OSNMA_TABLE_2.cend()) - { - LOG(WARNING) << "Chain and Public Key Status: " << it->second; - } } @@ -194,10 +188,9 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ dsm_msg[i * 13 + j] = d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][i * 13 + j]; } } - process_dsm_message(dsm_msg); d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; - // d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; + process_dsm_message(dsm_msg); } } @@ -273,7 +266,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); for (uint32_t k = 0; k < l_ds_bytes; k++) { - d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; + d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } // validation? } @@ -291,7 +284,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_pkr_message.npkt = (dsm_msg[129] & 0b11110000) >> 4; d_osnma_data.d_dsm_pkr_message.npktid = (dsm_msg[129] & 0b00001111); - // Table 5 uint32_t l_npk = 0; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); if (it != OSNMA_TABLE_5.cend()) @@ -343,25 +335,34 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } - read_mack_header(osnma_msg); - read_mack_info_and_tags(osnma_msg); - read_mack_key(osnma_msg); - read_mack_padding(osnma_msg); + read_mack_header(); + read_mack_info_and_tags(); + read_mack_key(); + read_mack_padding(); } -void osnma_msg_receiver::read_mack_header(const std::shared_ptr& osnma_msg) + +void osnma_msg_receiver::read_mack_header() { + uint8_t lt_bits = 0; + const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it != OSNMA_TABLE_11.cend()) + { + lt_bits = it->second; + } } -void osnma_msg_receiver::read_mack_info_and_tags(const std::shared_ptr& osnma_msg) + +void osnma_msg_receiver::read_mack_info_and_tags() { } -void osnma_msg_receiver::read_mack_key(const std::shared_ptr& osnma_msg) +void osnma_msg_receiver::read_mack_key() { } -void osnma_msg_receiver::read_mack_padding(const std::shared_ptr& osnma_msg) + +void osnma_msg_receiver::read_mack_padding() { } \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 65bcac037..56790d9df 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -62,10 +62,10 @@ private: void read_mack_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg); - void read_mack_header(const std::shared_ptr& osnma_msg); - void read_mack_info_and_tags(const std::shared_ptr& osnma_msg); - void read_mack_key(const std::shared_ptr& osnma_msg); - void read_mack_padding(const std::shared_ptr& osnma_msg); + void read_mack_header(); + void read_mack_info_and_tags(); + void read_mack_key(); + void read_mack_padding(); std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 6e0b1a6f8..9d243d6fc 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -123,6 +123,25 @@ const std::unordered_map OSNMA_TABLE_10 = { {15, 0}, {15, 0}}; // key: ks, value: lk_bits +const std::unordered_map OSNMA_TABLE_11 = { + {0, 0}, + {1, 0}, + {2, 0}, + {3, 0}, + {4, 0}, + {5, 20}, + {6, 24}, + {7, 26}, + {8, 32}, + {9, 40}, + {10, 0}, + {11, 0}, + {12, 0}, + {13, 0}, + {14, 0}, + {15, 0}, +}; + const std::unordered_map OSNMA_TABLE_15 = { {std::string("ECDSA P-256"), 512}, {std::string("ECDSA P-521"), 1056}, From 7147959186e278642dd0281300972da47faf2116 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 09:49:37 +0200 Subject: [PATCH 016/499] Add work on OSNMA rx --- src/core/libs/CMakeLists.txt | 2 + src/core/libs/osnma_msg_receiver.cc | 104 +++++------ src/core/libs/osnma_msg_receiver.h | 12 +- src/core/libs/sha256.cc | 193 +++++++++++++++++++++ src/core/libs/sha256.h | 68 ++++++++ src/core/system_parameters/Galileo_OSNMA.h | 140 ++++++++++++++- 6 files changed, 458 insertions(+), 61 deletions(-) create mode 100644 src/core/libs/sha256.cc create mode 100644 src/core/libs/sha256.h diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 1c0c6e811..cd6a03ed0 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -22,6 +22,7 @@ set(CORE_LIBS_SOURCES nav_message_udp_sink.cc galileo_tow_map.cc osnma_msg_receiver.cc + sha256.cc ) set(CORE_LIBS_HEADERS @@ -39,6 +40,7 @@ set(CORE_LIBS_HEADERS nav_message_monitor.h galileo_tow_map.h osnma_msg_receiver.h + sha256.h ) if(ENABLE_FPGA) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 89d4789c2..e33f79dee 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -176,9 +176,9 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; - // is message complete? -> process_dsm_message(osnma_msg) + // is message complete? -> Process DSM message if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && - (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].begin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].end(), 0))) + (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cbegin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cend(), 0))) { std::vector dsm_msg(std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * 13, 0); for (uint32_t i = 0; i < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; i++) @@ -190,64 +190,35 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; - process_dsm_message(dsm_msg); + process_dsm_message(dsm_msg, osnma_msg->hkroot[0]); } } -void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg) +void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, uint8_t nma_header) { if (d_osnma_data.d_dsm_header.dsm_id < 12) { LOG(WARNING) << "OSNMA: DSM-KROOT message received."; // DSM-KROOT message d_osnma_data.d_dsm_kroot_message.nb_dk = get_number_blocks_index(dsm_msg[0]); - d_osnma_data.d_dsm_kroot_message.pkid = (dsm_msg[0] & 0b00001111); - d_osnma_data.d_dsm_kroot_message.cidkr = (dsm_msg[1] & 0b11000000) >> 6; - d_osnma_data.d_dsm_kroot_message.reserved1 = (dsm_msg[1] & 0b00110000) >> 4; - d_osnma_data.d_dsm_kroot_message.hf = (dsm_msg[1] & 0b00001100) >> 2; + d_osnma_data.d_dsm_kroot_message.pkid = get_pkid(dsm_msg); // (dsm_msg[0] & 0b00001111); + d_osnma_data.d_dsm_kroot_message.cidkr = get_cidkr(dsm_msg); // (dsm_msg[1] & 0b11000000) >> 6; + d_osnma_data.d_dsm_kroot_message.reserved1 = get_dsm_reserved1(dsm_msg); // (dsm_msg[1] & 0b00110000) >> 4; + d_osnma_data.d_dsm_kroot_message.hf = get_hf(dsm_msg); // (dsm_msg[1] & 0b00001100) >> 2; + d_osnma_data.d_dsm_kroot_message.mf = get_mf(dsm_msg); // (dsm_msg[1] & 0b00000011); + d_osnma_data.d_dsm_kroot_message.ks = get_ks(dsm_msg); // (dsm_msg[2] & 0b11110000) >> 4; + d_osnma_data.d_dsm_kroot_message.ts = get_ts(dsm_msg); // (dsm_msg[2] & 0b00001111); + d_osnma_data.d_dsm_kroot_message.maclt = get_maclt(dsm_msg); // dsm_msg[3]; + d_osnma_data.d_dsm_kroot_message.reserved = get_dsm_reserved(dsm_msg); // (dsm_msg[4] & 0b11110000) >> 4; + d_osnma_data.d_dsm_kroot_message.wn_k = get_wn_k(dsm_msg); // static_cast((dsm_msg[4] & 0b00001111) << 8) + static_cast(dsm_msg[5]); + d_osnma_data.d_dsm_kroot_message.towh_k = get_towh_k(dsm_msg); // dsm_msg[6]; + d_osnma_data.d_dsm_kroot_message.alpha = get_alpha(dsm_msg); - d_osnma_data.d_dsm_kroot_message.mf = (dsm_msg[1] & 0b00000011); - d_osnma_data.d_dsm_kroot_message.ks = (dsm_msg[2] & 0b11110000) >> 4; - d_osnma_data.d_dsm_kroot_message.ts = (dsm_msg[2] & 0b00001111); - d_osnma_data.d_dsm_kroot_message.maclt = dsm_msg[3]; - d_osnma_data.d_dsm_kroot_message.reserved = (dsm_msg[4] & 0b11110000) >> 4; - d_osnma_data.d_dsm_kroot_message.wn_k = static_cast((dsm_msg[4] & 0b00001111) << 8) + - static_cast(dsm_msg[5]); - d_osnma_data.d_dsm_kroot_message.towh_k = dsm_msg[6]; + uint16_t bytes_lk = get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; + d_osnma_data.d_dsm_kroot_message.kroot = get_kroot(dsm_msg, bytes_lk); - uint16_t l_dk_bits = 0; - const auto it = OSNMA_TABLE_7.find(d_osnma_data.d_dsm_kroot_message.nb_dk); - if (it != OSNMA_TABLE_7.cend()) - { - l_dk_bits = it->second.second; - } - uint16_t lk_bits = 0; - const auto it2 = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); - if (it2 != OSNMA_TABLE_10.cend()) - { - lk_bits = it2->second; - } - - d_osnma_data.d_dsm_kroot_message.alpha = (static_cast(dsm_msg[7]) << 40) + - (static_cast(dsm_msg[8]) << 32) + - (static_cast(dsm_msg[9]) << 24) + - (static_cast(dsm_msg[10]) << 16) + - (static_cast(dsm_msg[11]) << 8) + - static_cast(dsm_msg[12]); - uint16_t bytes_lk = lk_bits / 8; - d_osnma_data.d_dsm_kroot_message.kroot = std::vector(bytes_lk, 0); - for (uint32_t k = 0; k < bytes_lk; k++) - { - d_osnma_data.d_dsm_kroot_message.kroot[k] = dsm_msg[13 + k]; - } - - std::string hash_function; - const auto it3 = OSNMA_TABLE_8.find(d_osnma_data.d_dsm_kroot_message.hf); - if (it3 != OSNMA_TABLE_8.cend()) - { - hash_function = it3->second; - } + std::string hash_function = get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); uint16_t l_ds_bits = 0; const auto it4 = OSNMA_TABLE_15.find(hash_function); @@ -257,18 +228,43 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } uint16_t l_ds_bytes = l_ds_bits / 8; d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); - for (uint32_t k = 0; k < l_ds_bytes; k++) + for (uint16_t k = 0; k < l_ds_bytes; k++) { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k]; } - uint16_t l_pdk_bytes = (l_dk_bits - 104 - lk_bits - l_ds_bits) / 8; + uint16_t l_pdk_bytes = (l_ds_bytes - 13 - bytes_lk - l_ds_bytes); d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); - for (uint32_t k = 0; k < l_ds_bytes; k++) + for (uint16_t k = 0; k < l_ds_bytes; k++) { d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } - // validation? + // validation of padding + std::vector M; + M.push_back(nma_header); + for (int i = 1; i < 13; i++) + { + M.push_back(dsm_msg[i]); + } + for (uint16_t i = 0; i < bytes_lk; i++) + { + M.push_back(dsm_msg[13 + i]); + } + for (uint16_t k = 0; k < l_ds_bytes; k++) + { + M.push_back(dsm_msg[13 + bytes_lk + k]); + } + sha256.update(&M[0], M.size()); + uint8_t* digest = sha256.digest(); + std::vector p_dk_computed; + for (uint16_t i = 0; i < l_pdk_bytes; i++) + { + p_dk_computed.push_back(digest[i]); + } + if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_computed) + { + std::cout << "OSNMA: DSM-KROOT message validated" << std::endl; + } } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { @@ -350,6 +346,10 @@ void osnma_msg_receiver::read_mack_header() { lt_bits = it->second; } + if (lt_bits == 0) + { + return; + } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 56790d9df..67aff46e5 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -22,10 +22,11 @@ #include "galileo_inav_message.h" // for OSNMA_msg #include "gnss_block_interface.h" // for gnss_shared_ptr #include "osnma_data.h" // for OSNMA_data -#include // for gr::block -#include // for pmt::pmt_t -#include // for std::array -#include // for std::shared_ptr +#include "sha256.h" +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::array +#include // for std::shared_ptr #include /** \addtogroup Core @@ -60,12 +61,13 @@ private: void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); void read_mack_block(const std::shared_ptr& osnma_msg); - void process_dsm_message(const std::vector& dsm_msg); + void process_dsm_message(const std::vector& dsm_msg, uint8_t nma_header); void read_mack_header(); void read_mack_info_and_tags(); void read_mack_key(); void read_mack_padding(); + SHA256 sha256; std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; diff --git a/src/core/libs/sha256.cc b/src/core/libs/sha256.cc new file mode 100644 index 000000000..e0b90189f --- /dev/null +++ b/src/core/libs/sha256.cc @@ -0,0 +1,193 @@ +/*! + * \file sha256.cc + * \brief Class foir computing SHA256 + * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "sha256.h" +#include +#include +#include + +SHA256::SHA256() : d_blocklen(0), d_bitlen(0) +{ + d_state[0] = 0x6a09e667; + d_state[1] = 0xbb67ae85; + d_state[2] = 0x3c6ef372; + d_state[3] = 0xa54ff53a; + d_state[4] = 0x510e527f; + d_state[5] = 0x9b05688c; + d_state[6] = 0x1f83d9ab; + d_state[7] = 0x5be0cd19; +} + +void SHA256::update(const uint8_t *data, size_t length) +{ + for (size_t i = 0; i < length; i++) + { + d_data[d_blocklen++] = data[i]; + if (d_blocklen == 64) + { + transform(); + + // End of the block + d_bitlen += 512; + d_blocklen = 0; + } + } +} + +void SHA256::update(const std::string &data) +{ + update(reinterpret_cast(data.c_str()), data.size()); +} + +uint8_t *SHA256::digest() +{ + uint8_t *hash = new uint8_t[32]; + + pad(); + revert(hash); + + return hash; +} + +uint32_t SHA256::rotr(uint32_t x, uint32_t n) +{ + return (x >> n) | (x << (32 - n)); +} + +uint32_t SHA256::choose(uint32_t e, uint32_t f, uint32_t g) +{ + return (e & f) ^ (~e & g); +} + +uint32_t SHA256::majority(uint32_t a, uint32_t b, uint32_t c) +{ + return (a & (b | c)) | (b & c); +} + +uint32_t SHA256::sig0(uint32_t x) +{ + return SHA256::rotr(x, 7) ^ SHA256::rotr(x, 18) ^ (x >> 3); +} + +uint32_t SHA256::sig1(uint32_t x) +{ + return SHA256::rotr(x, 17) ^ SHA256::rotr(x, 19) ^ (x >> 10); +} + +void SHA256::transform() +{ + uint32_t maj, xorA, ch, xorE, sum, newA, newE, m[64]; + uint32_t state[8]; + + for (uint8_t i = 0, j = 0; i < 16; i++, j += 4) + { // Split data in 32 bit blocks for the 16 first words + m[i] = (d_data[j] << 24) | (d_data[j + 1] << 16) | (d_data[j + 2] << 8) | (d_data[j + 3]); + } + + for (uint8_t k = 16; k < 64; k++) + { // Remaining 48 blocks + m[k] = SHA256::sig1(m[k - 2]) + m[k - 7] + SHA256::sig0(m[k - 15]) + m[k - 16]; + } + + for (uint8_t i = 0; i < 8; i++) + { + state[i] = d_state[i]; + } + + for (uint8_t i = 0; i < 64; i++) + { + maj = SHA256::majority(state[0], state[1], state[2]); + xorA = SHA256::rotr(state[0], 2) ^ SHA256::rotr(state[0], 13) ^ SHA256::rotr(state[0], 22); + + ch = choose(state[4], state[5], state[6]); + + xorE = SHA256::rotr(state[4], 6) ^ SHA256::rotr(state[4], 11) ^ SHA256::rotr(state[4], 25); + + sum = m[i] + K[i] + state[7] + ch + xorE; + newA = xorA + maj + sum; + newE = state[3] + sum; + + state[7] = state[6]; + state[6] = state[5]; + state[5] = state[4]; + state[4] = newE; + state[3] = state[2]; + state[2] = state[1]; + state[1] = state[0]; + state[0] = newA; + } + + for (uint8_t i = 0; i < 8; i++) + { + d_state[i] += state[i]; + } +} + +void SHA256::pad() +{ + uint64_t i = d_blocklen; + uint8_t end = d_blocklen < 56 ? 56 : 64; + + d_data[i++] = 0x80; // Append a bit 1 + while (i < end) + { + d_data[i++] = 0x00; // Pad with zeros + } + + if (d_blocklen >= 56) + { + transform(); + memset(d_data, 0, 56); + } + + // Append to the padding the total message's length in bits and transform. + d_bitlen += d_blocklen * 8; + d_data[63] = d_bitlen; + d_data[62] = d_bitlen >> 8; + d_data[61] = d_bitlen >> 16; + d_data[60] = d_bitlen >> 24; + d_data[59] = d_bitlen >> 32; + d_data[58] = d_bitlen >> 40; + d_data[57] = d_bitlen >> 48; + d_data[56] = d_bitlen >> 56; + transform(); +} + +void SHA256::revert(uint8_t *hash) +{ + // SHA uses big endian byte ordering + // Revert all bytes + for (uint8_t i = 0; i < 4; i++) + { + for (uint8_t j = 0; j < 8; j++) + { + hash[i + (j * 4)] = (d_state[j] >> (24 - i * 8)) & 0x000000ff; + } + } +} + +std::string SHA256::toString(const uint8_t *digest) +{ + std::stringstream s; + s << std::setfill('0') << std::hex; + + for (uint8_t i = 0; i < 32; i++) + { + s << std::setw(2) << (unsigned int)digest[i]; + } + + return s.str(); +} \ No newline at end of file diff --git a/src/core/libs/sha256.h b/src/core/libs/sha256.h new file mode 100644 index 000000000..8fb6b783c --- /dev/null +++ b/src/core/libs/sha256.h @@ -0,0 +1,68 @@ +/*! + * \file sha256.h + * \brief Class foir computing SHA256 + * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +// https://github.com/System-Glitch/SHA256/blob/master/src/SHA256.cpp +#ifndef SHA256_H +#define SHA256_H + +#include +#include + +class SHA256 +{ +public: + SHA256(); + void update(const uint8_t *data, size_t length); + void update(const std::string &data); + uint8_t *digest(); + + static std::string toString(const uint8_t *digest); + +private: + uint8_t d_data[64]; + uint32_t d_blocklen; + uint64_t d_bitlen; + uint32_t d_state[8]; // A, B, C, D, E, F, G, H + + static constexpr std::array K = { + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; + + static uint32_t rotr(uint32_t x, uint32_t n); + static uint32_t choose(uint32_t e, uint32_t f, uint32_t g); + static uint32_t majority(uint32_t a, uint32_t b, uint32_t c); + static uint32_t sig0(uint32_t x); + static uint32_t sig1(uint32_t x); + void transform(); + void pad(); + void revert(uint8_t *hash); +}; + +#endif \ No newline at end of file diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 9d243d6fc..14ccc6ad4 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -155,7 +155,16 @@ constexpr std::uint8_t mask_cpks{0x07}; constexpr std::uint8_t mask_nma_header_reserved{0x01}; constexpr std::uint8_t mask_dsm_id{0xF0}; constexpr std::uint8_t mask_dsm_block_id{0x0F}; -constexpr std::uint8_t mask_dsm_number_blocks{0XF0}; +constexpr std::uint8_t mask_dsm_number_blocks{0xF0}; +constexpr std::uint8_t mask_dsm_pkid{0x0F}; +constexpr std::uint8_t mask_dsm_cidkr{0xC0}; +constexpr std::uint8_t mask_dsm_reserved1{0x30}; +constexpr std::uint8_t mask_dsm_hf{0x0C}; +constexpr std::uint8_t mask_dsm_mf{0x03}; +constexpr std::uint8_t mask_dsm_ks{0xF0}; +constexpr std::uint8_t mask_dsm_ts{0x0F}; +constexpr std::uint8_t mask_dsm_reserved{0xF0}; +constexpr std::uint8_t mask_dsm_wk_k_msbyte{0x0F}; #else constexpr std::uint8_t mask_nmas{0b1100'0000}; constexpr std::uint8_t mask_cid{0b0011'0000}; @@ -164,9 +173,18 @@ constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; constexpr std::uint8_t mask_dsm_id{0b1111'0000}; constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000}; - +constexpr std::uint8_t mask_dsm_pkid{0b0000'1111}; +constexpr std::uint8_t mask_dsm_cidkr{0b1100'0000}; +constexpr std::uint8_t mask_dsm_reserved1{0b0011'0000}; +constexpr std::uint8_t mask_dsm_hf{0b0000'1100}; +constexpr std::uint8_t mask_dsm_mf{0b0000'0011}; +constexpr std::uint8_t mask_dsm_ks{0b1111'0000}; +constexpr std::uint8_t mask_dsm_ts{0b0000'1111}; +constexpr std::uint8_t mask_dsm_reserved{0b1111'0000}; +constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111}; #endif +// // hf = (dsm_msg[1] & 0b00001100) >> 2; uint8_t get_nmas(uint8_t nma_header) { return (nma_header & mask_nmas) >> 6; @@ -197,11 +215,125 @@ uint8_t get_dsm_block_id(uint8_t dsm_header) return dsm_header & mask_dsm_block_id; } -uint8_t get_number_blocks_index(uint8_t dsm_message_0) +uint8_t get_number_blocks_index(uint8_t dsm_msg_0) { - return (dsm_message_0 & mask_dsm_number_blocks) >> 4; + return (dsm_msg_0 & mask_dsm_number_blocks) >> 4; } +uint8_t get_pkid(const std::vector& dsm_msg) +{ + return (dsm_msg[0] & mask_dsm_pkid); +} + +uint8_t get_cidkr(const std::vector& dsm_msg) +{ + return (dsm_msg[1] & mask_dsm_cidkr) >> 6; +} + +uint8_t get_dsm_reserved1(const std::vector& dsm_msg) +{ + return (dsm_msg[1] & mask_dsm_reserved1) >> 4; +} + +uint8_t get_hf(const std::vector& dsm_msg) +{ + return (dsm_msg[1] & mask_dsm_hf) >> 2; +} + +uint8_t get_mf(const std::vector& dsm_msg) +{ + return (dsm_msg[1] & mask_dsm_mf); +} + +uint8_t get_ks(const std::vector& dsm_msg) +{ + return (dsm_msg[2] & mask_dsm_ks) >> 4; +} + +uint8_t get_ts(const std::vector& dsm_msg) +{ + return (dsm_msg[2] & mask_dsm_ts); +} + +uint8_t get_maclt(const std::vector& dsm_msg) +{ + return dsm_msg[3]; +} + +uint8_t get_dsm_reserved(const std::vector& dsm_msg) +{ + return (dsm_msg[4] & mask_dsm_reserved) >> 4; +} + +uint16_t get_wn_k(const std::vector& dsm_msg) +{ + return (static_cast((dsm_msg[4] & mask_dsm_wk_k_msbyte) << 8) + static_cast(dsm_msg[5])); +} + +uint8_t get_towh_k(const std::vector& dsm_msg) +{ + return dsm_msg[6]; +} + +uint64_t get_alpha(const std::vector& dsm_msg) +{ + uint64_t alpha = (static_cast(dsm_msg[8]) << 32) + + (static_cast(dsm_msg[9]) << 24) + + (static_cast(dsm_msg[10]) << 16) + + (static_cast(dsm_msg[11]) << 8) + + static_cast(dsm_msg[12]); + return alpha; +} + +uint16_t get_l_dk_bits(uint8_t nb_dk) +{ + const auto it = OSNMA_TABLE_7.find(nb_dk); + if (it != OSNMA_TABLE_7.cend()) + { + return it->second.second; + } + return 0; +} + +uint16_t get_lk_bits(uint8_t ks) +{ + const auto it = OSNMA_TABLE_10.find(ks); + if (it != OSNMA_TABLE_10.cend()) + { + return it->second; + } + return 0; +} + +std::vector get_kroot(const std::vector& dsm_msg, uint16_t bytes_lk) +{ + std::vector kroot = std::vector(bytes_lk, 0); + if (dsm_msg.size() > 13 + bytes_lk) + { + for (uint16_t k = 0; k < bytes_lk; k++) + { + kroot[k] = dsm_msg[13 + k]; + } + } + return kroot; +} + +std::string get_hash_function(uint8_t hf) +{ + std::string hash_; + const auto it = OSNMA_TABLE_8.find(hf); + if (it != OSNMA_TABLE_8.cend()) + { + hash_ = it->second; + } + return hash_; +} +// std::string hash_function; +// const auto it3 = OSNMA_TABLE_8.find(d_osnma_data.d_dsm_kroot_message.hf); +// if (it3 != OSNMA_TABLE_8.cend()) +// { +// hash_function = it3->second; +// } /** \} */ /** \} */ #endif // GNSS_SDR_GALILEO_OSNMA_H \ No newline at end of file From 9de1fd39ca25621d5454725698005a117f5026f0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 11:33:58 +0200 Subject: [PATCH 017/499] Improve SHA256 computation --- src/core/libs/CMakeLists.txt | 17 +++++- src/core/libs/osnma_msg_receiver.cc | 64 ++++++++++++++++------ src/core/libs/osnma_msg_receiver.h | 12 ++-- src/core/system_parameters/Galileo_OSNMA.h | 2 +- 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index cd6a03ed0..02d6e31de 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -22,7 +22,6 @@ set(CORE_LIBS_SOURCES nav_message_udp_sink.cc galileo_tow_map.cc osnma_msg_receiver.cc - sha256.cc ) set(CORE_LIBS_HEADERS @@ -40,7 +39,6 @@ set(CORE_LIBS_HEADERS nav_message_monitor.h galileo_tow_map.h osnma_msg_receiver.h - sha256.h ) if(ENABLE_FPGA) @@ -104,6 +102,21 @@ target_link_libraries(core_libs Pugixml::pugixml ) +target_link_libraries(core_libs + PRIVATE + ${GNUTLS_LIBRARIES} + ${GNUTLS_OPENSSL_LIBRARY} +) + +target_include_directories(core_libs + PRIVATE + ${GNUTLS_INCLUDE_DIR} +) + +if(OPENSSL_FOUND) + target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_FALLBACK=1) +endif() + if(USE_GENERIC_LAMBDAS AND NOT GNURADIO_USES_STD_POINTERS) target_link_libraries(core_libs PUBLIC Boost::headers) else() diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e33f79dee..ac6d187b6 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -31,7 +31,6 @@ #include #include // for typeid - #if HAS_GENERIC_LAMBDA #else #include @@ -45,6 +44,13 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_OPENSSL_FALLBACK +#include +#else +#include +#include +#endif + osnma_msg_receiver_sptr osnma_msg_receiver_make() { return osnma_msg_receiver_sptr(new osnma_msg_receiver()); @@ -202,17 +208,17 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(WARNING) << "OSNMA: DSM-KROOT message received."; // DSM-KROOT message d_osnma_data.d_dsm_kroot_message.nb_dk = get_number_blocks_index(dsm_msg[0]); - d_osnma_data.d_dsm_kroot_message.pkid = get_pkid(dsm_msg); // (dsm_msg[0] & 0b00001111); - d_osnma_data.d_dsm_kroot_message.cidkr = get_cidkr(dsm_msg); // (dsm_msg[1] & 0b11000000) >> 6; - d_osnma_data.d_dsm_kroot_message.reserved1 = get_dsm_reserved1(dsm_msg); // (dsm_msg[1] & 0b00110000) >> 4; - d_osnma_data.d_dsm_kroot_message.hf = get_hf(dsm_msg); // (dsm_msg[1] & 0b00001100) >> 2; - d_osnma_data.d_dsm_kroot_message.mf = get_mf(dsm_msg); // (dsm_msg[1] & 0b00000011); - d_osnma_data.d_dsm_kroot_message.ks = get_ks(dsm_msg); // (dsm_msg[2] & 0b11110000) >> 4; - d_osnma_data.d_dsm_kroot_message.ts = get_ts(dsm_msg); // (dsm_msg[2] & 0b00001111); - d_osnma_data.d_dsm_kroot_message.maclt = get_maclt(dsm_msg); // dsm_msg[3]; - d_osnma_data.d_dsm_kroot_message.reserved = get_dsm_reserved(dsm_msg); // (dsm_msg[4] & 0b11110000) >> 4; - d_osnma_data.d_dsm_kroot_message.wn_k = get_wn_k(dsm_msg); // static_cast((dsm_msg[4] & 0b00001111) << 8) + static_cast(dsm_msg[5]); - d_osnma_data.d_dsm_kroot_message.towh_k = get_towh_k(dsm_msg); // dsm_msg[6]; + d_osnma_data.d_dsm_kroot_message.pkid = get_pkid(dsm_msg); + d_osnma_data.d_dsm_kroot_message.cidkr = get_cidkr(dsm_msg); + d_osnma_data.d_dsm_kroot_message.reserved1 = get_dsm_reserved1(dsm_msg); + d_osnma_data.d_dsm_kroot_message.hf = get_hf(dsm_msg); + d_osnma_data.d_dsm_kroot_message.mf = get_mf(dsm_msg); + d_osnma_data.d_dsm_kroot_message.ks = get_ks(dsm_msg); + d_osnma_data.d_dsm_kroot_message.ts = get_ts(dsm_msg); + d_osnma_data.d_dsm_kroot_message.maclt = get_maclt(dsm_msg); + d_osnma_data.d_dsm_kroot_message.reserved = get_dsm_reserved(dsm_msg); + d_osnma_data.d_dsm_kroot_message.wn_k = get_wn_k(dsm_msg); + d_osnma_data.d_dsm_kroot_message.towh_k = get_towh_k(dsm_msg); d_osnma_data.d_dsm_kroot_message.alpha = get_alpha(dsm_msg); uint16_t bytes_lk = get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; @@ -254,12 +260,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { M.push_back(dsm_msg[13 + bytes_lk + k]); } - sha256.update(&M[0], M.size()); - uint8_t* digest = sha256.digest(); + + std::vector hash = computeSHA256(M); std::vector p_dk_computed; for (uint16_t i = 0; i < l_pdk_bytes; i++) { - p_dk_computed.push_back(digest[i]); + p_dk_computed.push_back(hash[i]); } if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_computed) { @@ -365,4 +371,30 @@ void osnma_msg_receiver::read_mack_key() void osnma_msg_receiver::read_mack_padding() { -} \ No newline at end of file +} + + +std::vector osnma_msg_receiver::computeSHA256(const std::vector& input) +{ + std::vector output_vector{32}; + uint8_t output[32]; + const uint8_t* input_ptr = input.data(); + size_t inputLength = input.size(); +#if USE_OPENSSL_FALLBACK + SHA256_CTX sha256Context; + SHA256_Init(&sha256Context); + SHA256_Update(&sha256Context, input_ptr, inputLength); + SHA256_Final(output, &sha256Context); +#else + gnutls_hash_hd_t hashHandle; + gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); + gnutls_hash(hashHandle, input_ptr, inputLength); + gnutls_hash_output(hashHandle, output); + gnutls_hash_deinit(hashHandle, output); +#endif + for (int i = 0; i < 32; i++) + { + output_vector[i] = output[i]; + } + return output_vector; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 67aff46e5..0b8635f7a 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -22,11 +22,10 @@ #include "galileo_inav_message.h" // for OSNMA_msg #include "gnss_block_interface.h" // for gnss_shared_ptr #include "osnma_data.h" // for OSNMA_data -#include "sha256.h" -#include // for gr::block -#include // for pmt::pmt_t -#include // for std::array -#include // for std::shared_ptr +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::array +#include // for std::shared_ptr #include /** \addtogroup Core @@ -67,7 +66,8 @@ private: void read_mack_info_and_tags(); void read_mack_key(); void read_mack_padding(); - SHA256 sha256; + + std::vector computeSHA256(const std::vector& input); std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 14ccc6ad4..a79c88db7 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -308,7 +308,7 @@ uint16_t get_lk_bits(uint8_t ks) std::vector get_kroot(const std::vector& dsm_msg, uint16_t bytes_lk) { std::vector kroot = std::vector(bytes_lk, 0); - if (dsm_msg.size() > 13 + bytes_lk) + if (dsm_msg.size() > static_cast(13 + bytes_lk)) { for (uint16_t k = 0; k < bytes_lk; k++) { From 755045e6681d71c4178688937a701bc78a68c98d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 11:36:15 +0200 Subject: [PATCH 018/499] Remove unused files --- src/core/libs/sha256.cc | 193 ---------------------------------------- src/core/libs/sha256.h | 68 -------------- 2 files changed, 261 deletions(-) delete mode 100644 src/core/libs/sha256.cc delete mode 100644 src/core/libs/sha256.h diff --git a/src/core/libs/sha256.cc b/src/core/libs/sha256.cc deleted file mode 100644 index e0b90189f..000000000 --- a/src/core/libs/sha256.cc +++ /dev/null @@ -1,193 +0,0 @@ -/*! - * \file sha256.cc - * \brief Class foir computing SHA256 - * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "sha256.h" -#include -#include -#include - -SHA256::SHA256() : d_blocklen(0), d_bitlen(0) -{ - d_state[0] = 0x6a09e667; - d_state[1] = 0xbb67ae85; - d_state[2] = 0x3c6ef372; - d_state[3] = 0xa54ff53a; - d_state[4] = 0x510e527f; - d_state[5] = 0x9b05688c; - d_state[6] = 0x1f83d9ab; - d_state[7] = 0x5be0cd19; -} - -void SHA256::update(const uint8_t *data, size_t length) -{ - for (size_t i = 0; i < length; i++) - { - d_data[d_blocklen++] = data[i]; - if (d_blocklen == 64) - { - transform(); - - // End of the block - d_bitlen += 512; - d_blocklen = 0; - } - } -} - -void SHA256::update(const std::string &data) -{ - update(reinterpret_cast(data.c_str()), data.size()); -} - -uint8_t *SHA256::digest() -{ - uint8_t *hash = new uint8_t[32]; - - pad(); - revert(hash); - - return hash; -} - -uint32_t SHA256::rotr(uint32_t x, uint32_t n) -{ - return (x >> n) | (x << (32 - n)); -} - -uint32_t SHA256::choose(uint32_t e, uint32_t f, uint32_t g) -{ - return (e & f) ^ (~e & g); -} - -uint32_t SHA256::majority(uint32_t a, uint32_t b, uint32_t c) -{ - return (a & (b | c)) | (b & c); -} - -uint32_t SHA256::sig0(uint32_t x) -{ - return SHA256::rotr(x, 7) ^ SHA256::rotr(x, 18) ^ (x >> 3); -} - -uint32_t SHA256::sig1(uint32_t x) -{ - return SHA256::rotr(x, 17) ^ SHA256::rotr(x, 19) ^ (x >> 10); -} - -void SHA256::transform() -{ - uint32_t maj, xorA, ch, xorE, sum, newA, newE, m[64]; - uint32_t state[8]; - - for (uint8_t i = 0, j = 0; i < 16; i++, j += 4) - { // Split data in 32 bit blocks for the 16 first words - m[i] = (d_data[j] << 24) | (d_data[j + 1] << 16) | (d_data[j + 2] << 8) | (d_data[j + 3]); - } - - for (uint8_t k = 16; k < 64; k++) - { // Remaining 48 blocks - m[k] = SHA256::sig1(m[k - 2]) + m[k - 7] + SHA256::sig0(m[k - 15]) + m[k - 16]; - } - - for (uint8_t i = 0; i < 8; i++) - { - state[i] = d_state[i]; - } - - for (uint8_t i = 0; i < 64; i++) - { - maj = SHA256::majority(state[0], state[1], state[2]); - xorA = SHA256::rotr(state[0], 2) ^ SHA256::rotr(state[0], 13) ^ SHA256::rotr(state[0], 22); - - ch = choose(state[4], state[5], state[6]); - - xorE = SHA256::rotr(state[4], 6) ^ SHA256::rotr(state[4], 11) ^ SHA256::rotr(state[4], 25); - - sum = m[i] + K[i] + state[7] + ch + xorE; - newA = xorA + maj + sum; - newE = state[3] + sum; - - state[7] = state[6]; - state[6] = state[5]; - state[5] = state[4]; - state[4] = newE; - state[3] = state[2]; - state[2] = state[1]; - state[1] = state[0]; - state[0] = newA; - } - - for (uint8_t i = 0; i < 8; i++) - { - d_state[i] += state[i]; - } -} - -void SHA256::pad() -{ - uint64_t i = d_blocklen; - uint8_t end = d_blocklen < 56 ? 56 : 64; - - d_data[i++] = 0x80; // Append a bit 1 - while (i < end) - { - d_data[i++] = 0x00; // Pad with zeros - } - - if (d_blocklen >= 56) - { - transform(); - memset(d_data, 0, 56); - } - - // Append to the padding the total message's length in bits and transform. - d_bitlen += d_blocklen * 8; - d_data[63] = d_bitlen; - d_data[62] = d_bitlen >> 8; - d_data[61] = d_bitlen >> 16; - d_data[60] = d_bitlen >> 24; - d_data[59] = d_bitlen >> 32; - d_data[58] = d_bitlen >> 40; - d_data[57] = d_bitlen >> 48; - d_data[56] = d_bitlen >> 56; - transform(); -} - -void SHA256::revert(uint8_t *hash) -{ - // SHA uses big endian byte ordering - // Revert all bytes - for (uint8_t i = 0; i < 4; i++) - { - for (uint8_t j = 0; j < 8; j++) - { - hash[i + (j * 4)] = (d_state[j] >> (24 - i * 8)) & 0x000000ff; - } - } -} - -std::string SHA256::toString(const uint8_t *digest) -{ - std::stringstream s; - s << std::setfill('0') << std::hex; - - for (uint8_t i = 0; i < 32; i++) - { - s << std::setw(2) << (unsigned int)digest[i]; - } - - return s.str(); -} \ No newline at end of file diff --git a/src/core/libs/sha256.h b/src/core/libs/sha256.h deleted file mode 100644 index 8fb6b783c..000000000 --- a/src/core/libs/sha256.h +++ /dev/null @@ -1,68 +0,0 @@ -/*! - * \file sha256.h - * \brief Class foir computing SHA256 - * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -// https://github.com/System-Glitch/SHA256/blob/master/src/SHA256.cpp -#ifndef SHA256_H -#define SHA256_H - -#include -#include - -class SHA256 -{ -public: - SHA256(); - void update(const uint8_t *data, size_t length); - void update(const std::string &data); - uint8_t *digest(); - - static std::string toString(const uint8_t *digest); - -private: - uint8_t d_data[64]; - uint32_t d_blocklen; - uint64_t d_bitlen; - uint32_t d_state[8]; // A, B, C, D, E, F, G, H - - static constexpr std::array K = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2}; - - static uint32_t rotr(uint32_t x, uint32_t n); - static uint32_t choose(uint32_t e, uint32_t f, uint32_t g); - static uint32_t majority(uint32_t a, uint32_t b, uint32_t c); - static uint32_t sig0(uint32_t x); - static uint32_t sig1(uint32_t x); - void transform(); - void pad(); - void revert(uint8_t *hash); -}; - -#endif \ No newline at end of file From 6fc334942fcf1b206912f965123df58db552322b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 12:07:25 +0200 Subject: [PATCH 019/499] Add work on OSNMA Rx --- src/core/libs/osnma_msg_receiver.cc | 39 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index ac6d187b6..089a7f0a6 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -221,8 +221,24 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.towh_k = get_towh_k(dsm_msg); d_osnma_data.d_dsm_kroot_message.alpha = get_alpha(dsm_msg); + LOG(WARNING) << "nb_dk=" << static_cast(d_osnma_data.d_dsm_kroot_message.nb_dk); + LOG(WARNING) << "pkid=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid); + LOG(WARNING) << "cidkr=" << static_cast(d_osnma_data.d_dsm_kroot_message.cidkr); + LOG(WARNING) << "reserved1=" << static_cast(d_osnma_data.d_dsm_kroot_message.reserved1); + LOG(WARNING) << "hf=" << static_cast(d_osnma_data.d_dsm_kroot_message.hf); + LOG(WARNING) << "mf=" << static_cast(d_osnma_data.d_dsm_kroot_message.mf); + LOG(WARNING) << "ks=" << static_cast(d_osnma_data.d_dsm_kroot_message.ks); + LOG(WARNING) << "ts=" << static_cast(d_osnma_data.d_dsm_kroot_message.ts); + LOG(WARNING) << "maclt=" << static_cast(d_osnma_data.d_dsm_kroot_message.maclt); + LOG(WARNING) << "reserved=" << static_cast(d_osnma_data.d_dsm_kroot_message.reserved); + LOG(WARNING) << "wn_k=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k); + LOG(WARNING) << "towh_k=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k); + LOG(WARNING) << "alpha=" << d_osnma_data.d_dsm_kroot_message.alpha; + uint16_t bytes_lk = get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; d_osnma_data.d_dsm_kroot_message.kroot = get_kroot(dsm_msg, bytes_lk); + LOG(WARNING) << "lk_bits=" << static_cast(get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)); + LOG(WARNING) << "lk_bytes=" << static_cast(bytes_lk); std::string hash_function = get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); @@ -233,13 +249,15 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg l_ds_bits = it4->second; } uint16_t l_ds_bytes = l_ds_bits / 8; + LOG(WARNING) << "ds_bits=" << static_cast(l_ds_bits); + LOG(WARNING) << "ds_bytes=" << static_cast(l_ds_bytes); d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); for (uint16_t k = 0; k < l_ds_bytes; k++) { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k]; } uint16_t l_pdk_bytes = (l_ds_bytes - 13 - bytes_lk - l_ds_bytes); - + LOG(WARNING) << "pdk_bytes=" << static_cast(l_pdk_bytes); d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); for (uint16_t k = 0; k < l_ds_bytes; k++) { @@ -376,25 +394,18 @@ void osnma_msg_receiver::read_mack_padding() std::vector osnma_msg_receiver::computeSHA256(const std::vector& input) { - std::vector output_vector{32}; - uint8_t output[32]; - const uint8_t* input_ptr = input.data(); - size_t inputLength = input.size(); + std::vector output{32}; // SHA256 hash size #if USE_OPENSSL_FALLBACK SHA256_CTX sha256Context; SHA256_Init(&sha256Context); - SHA256_Update(&sha256Context, input_ptr, inputLength); + SHA256_Update(&sha256Context, input.data(), input.size()); SHA256_Final(output, &sha256Context); #else gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); - gnutls_hash(hashHandle, input_ptr, inputLength); - gnutls_hash_output(hashHandle, output); - gnutls_hash_deinit(hashHandle, output); + gnutls_hash(hashHandle, input.data(), input.size()); + gnutls_hash_output(hashHandle, output.data()); + gnutls_hash_deinit(hashHandle, output.data()); #endif - for (int i = 0; i < 32; i++) - { - output_vector[i] = output[i]; - } - return output_vector; + return output; } From 3d86bde405e4f78802c4331343ce9906f5a8d249 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 12:25:50 +0200 Subject: [PATCH 020/499] Add work on OSNMA Rx --- src/core/libs/osnma_msg_receiver.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 089a7f0a6..684a06000 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -256,7 +256,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k]; } - uint16_t l_pdk_bytes = (l_ds_bytes - 13 - bytes_lk - l_ds_bytes); + uint16_t l_dk_bits = get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); + uint16_t l_dk_bytes = l_dk_bits / 8; + LOG(WARNING) << "dk_bits=" << static_cast(l_dk_bits); + LOG(WARNING) << "dk_bytes=" << static_cast(l_dk_bytes); + + uint16_t l_pdk_bytes = (l_dk_bytes - 13 - bytes_lk - l_ds_bytes); LOG(WARNING) << "pdk_bytes=" << static_cast(l_pdk_bytes); d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); for (uint16_t k = 0; k < l_ds_bytes; k++) From 3a803e01e4ae7e0afc2c1faed481c39e418f4fe5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 13:13:55 +0200 Subject: [PATCH 021/499] Add work on OSNMA Rx --- src/core/libs/osnma_msg_receiver.cc | 76 +++++++++++++--------- src/core/system_parameters/Galileo_OSNMA.h | 29 +++++++-- 2 files changed, 70 insertions(+), 35 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 684a06000..b34186da2 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -23,6 +23,7 @@ #include // for DLOG #include // for gr::io_signature::make #include +#include #include #include #include @@ -268,46 +269,54 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } - // validation of padding - std::vector M; - M.push_back(nma_header); - for (int i = 1; i < 13; i++) - { - M.push_back(dsm_msg[i]); - } - for (uint16_t i = 0; i < bytes_lk; i++) - { - M.push_back(dsm_msg[13 + i]); - } - for (uint16_t k = 0; k < l_ds_bytes; k++) - { - M.push_back(dsm_msg[13 + bytes_lk + k]); - } - std::vector hash = computeSHA256(M); - std::vector p_dk_computed; - for (uint16_t i = 0; i < l_pdk_bytes; i++) + uint16_t check_l_dk = 104 - std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / (104))); + if (l_dk_bits != check_l_dk) { - p_dk_computed.push_back(hash[i]); + std::cout << "OSNMA: Failed length reading" << std::endl; } - if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_computed) + else { - std::cout << "OSNMA: DSM-KROOT message validated" << std::endl; + // validation of padding + std::vector M; + M.push_back(nma_header); + for (int i = 1; i < 13; i++) + { + M.push_back(dsm_msg[i]); + } + for (uint16_t i = 0; i < bytes_lk; i++) + { + M.push_back(dsm_msg[13 + i]); + } + for (uint16_t k = 0; k < l_ds_bytes; k++) + { + M.push_back(dsm_msg[13 + bytes_lk + k]); + } + + std::vector hash = computeSHA256(M); + std::vector p_dk_computed; + for (uint16_t i = 0; i < l_pdk_bytes; i++) + { + p_dk_computed.push_back(hash[i]); + } + if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_computed) + { + std::cout << "OSNMA: DSM-KROOT message validated" << std::endl; + } } } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { LOG(WARNING) << "OSNMA: DSM-PKR message received."; // DSM-PKR message - d_osnma_data.d_dsm_pkr_message.nb_dp = (dsm_msg[0] & 0b11110000) >> 4; - d_osnma_data.d_dsm_pkr_message.mid = (dsm_msg[0] & 0b00001111); + d_osnma_data.d_dsm_pkr_message.nb_dp = get_number_blocks_index(dsm_msg[0]); + d_osnma_data.d_dsm_pkr_message.mid = get_mid(dsm_msg); for (int k = 0; k > 128; k++) { d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1]; } - - d_osnma_data.d_dsm_pkr_message.npkt = (dsm_msg[129] & 0b11110000) >> 4; - d_osnma_data.d_dsm_pkr_message.npktid = (dsm_msg[129] & 0b00001111); + d_osnma_data.d_dsm_pkr_message.npkt = get_npkt(dsm_msg); + d_osnma_data.d_dsm_pkr_message.npktid = get_npktid(dsm_msg); uint32_t l_npk = 0; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); @@ -333,10 +342,19 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } uint32_t l_dp = dsm_msg.size(); uint32_t l_pd = l_dp - 130 - l_npk; - d_osnma_data.d_dsm_pkr_message.p_dp = std::vector(l_pd, 0); - for (uint32_t k = 0; k > l_pd; k++) + + uint32_t check_l_dp = 104 - std::ceil((1040 + l_npk * 8) / 104); + if (l_dp != check_l_dp) { - d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; + std::cout << "OSNMA: Failed length reading" << std::endl; + } + else + { + d_osnma_data.d_dsm_pkr_message.p_dp = std::vector(l_pd, 0); + for (uint32_t k = 0; k > l_pd; k++) + { + d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; + } } } else diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index a79c88db7..39f32752e 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -165,6 +165,9 @@ constexpr std::uint8_t mask_dsm_ks{0xF0}; constexpr std::uint8_t mask_dsm_ts{0x0F}; constexpr std::uint8_t mask_dsm_reserved{0xF0}; constexpr std::uint8_t mask_dsm_wk_k_msbyte{0x0F}; +constexpr std::uint8_t mask_dsm_mid{0x0F}; +constexpr std::uint8_t mask_dsm_npkt{0xF0}; +constexpr std::uint8_t mask_dsm_npktid{0x0F}; #else constexpr std::uint8_t mask_nmas{0b1100'0000}; constexpr std::uint8_t mask_cid{0b0011'0000}; @@ -182,6 +185,9 @@ constexpr std::uint8_t mask_dsm_ks{0b1111'0000}; constexpr std::uint8_t mask_dsm_ts{0b0000'1111}; constexpr std::uint8_t mask_dsm_reserved{0b1111'0000}; constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111}; +constexpr std::uint8_t mask_dsm_mid{0b0000'1111}; +constexpr std::uint8_t mask_dsm_npkt{0b1111'0000}; +constexpr std::uint8_t mask_dsm_npktid{0b0000'1111}; #endif // // hf = (dsm_msg[1] & 0b00001100) >> 2; @@ -328,12 +334,23 @@ std::string get_hash_function(uint8_t hf) } return hash_; } -// std::string hash_function; -// const auto it3 = OSNMA_TABLE_8.find(d_osnma_data.d_dsm_kroot_message.hf); -// if (it3 != OSNMA_TABLE_8.cend()) -// { -// hash_function = it3->second; -// } + +uint8_t get_mid(const std::vector& dsm_msg) +{ + return (dsm_msg[0] & mask_dsm_mid); +} + +uint8_t get_npkt(const std::vector& dsm_msg) +{ + return ((dsm_msg[129] & mask_dsm_npkt) >> 4); +} + +uint8_t get_npktid(const std::vector& dsm_msg) +{ + return (dsm_msg[129] & mask_dsm_npktid); +} + + /** \} */ /** \} */ #endif // GNSS_SDR_GALILEO_OSNMA_H \ No newline at end of file From 602c533c01694ffcafa9a4bb21865fddaf083131 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 13:42:24 +0200 Subject: [PATCH 022/499] Add debug info --- src/core/libs/osnma_msg_receiver.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index b34186da2..61a18d740 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -136,6 +136,8 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = get_dsm_id(dsm_header); d_osnma_data.d_dsm_header.dsm_block_id = get_dsm_block_id(dsm_header); // BID + LOG(WARNING) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); + LOG(WARNING) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); } @@ -173,9 +175,11 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = number_of_blocks; + LOG(WARNING) << "OSNMA: number_of_blocks=" << static_cast(number_of_blocks); if (number_of_blocks == 0) { // Something is wrong, start over + LOG(WARNING) << "OSNMA: Wrong number of blocks, start over"; d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; } @@ -271,6 +275,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } uint16_t check_l_dk = 104 - std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / (104))); + LOG(WARNING) << "check_l_dk_bits=" << static_cast(check_l_dk); if (l_dk_bits != check_l_dk) { std::cout << "OSNMA: Failed length reading" << std::endl; @@ -344,6 +349,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t l_pd = l_dp - 130 - l_npk; uint32_t check_l_dp = 104 - std::ceil((1040 + l_npk * 8) / 104); + if (l_dp != check_l_dp) { std::cout << "OSNMA: Failed length reading" << std::endl; From 277e51b237c7d1c3d9ed819bdee172062509adde Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 14:00:00 +0200 Subject: [PATCH 023/499] Fix lenght check --- src/core/libs/osnma_msg_receiver.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 61a18d740..911522672 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -269,12 +269,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint16_t l_pdk_bytes = (l_dk_bytes - 13 - bytes_lk - l_ds_bytes); LOG(WARNING) << "pdk_bytes=" << static_cast(l_pdk_bytes); d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); - for (uint16_t k = 0; k < l_ds_bytes; k++) + for (uint16_t k = 0; k < l_pdk_bytes; k++) { d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } - uint16_t check_l_dk = 104 - std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / (104))); + uint16_t check_l_dk = 104 * std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / (104))); LOG(WARNING) << "check_l_dk_bits=" << static_cast(check_l_dk); if (l_dk_bits != check_l_dk) { @@ -348,7 +348,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t l_dp = dsm_msg.size(); uint32_t l_pd = l_dp - 130 - l_npk; - uint32_t check_l_dp = 104 - std::ceil((1040 + l_npk * 8) / 104); + uint32_t check_l_dp = 104 * std::ceil((1040 + l_npk * 8) / 104); if (l_dp != check_l_dp) { From da6b2a68318093d81f58f75cd5bcb2512d1f897b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 14:17:29 +0200 Subject: [PATCH 024/499] Fix lenght check --- src/core/libs/osnma_msg_receiver.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 911522672..22db87cb7 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -274,7 +274,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } - uint16_t check_l_dk = 104 * std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / (104))); + uint16_t check_l_dk = 104 * std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / 104)); LOG(WARNING) << "check_l_dk_bits=" << static_cast(check_l_dk); if (l_dk_bits != check_l_dk) { From db4b73724371a24338c348db673184a8b29ff34e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 18:51:21 +0200 Subject: [PATCH 025/499] Add work on OSNMA Rx --- src/core/libs/osnma_msg_receiver.cc | 54 ++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 13 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 22db87cb7..a1583195d 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -274,7 +274,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; } - uint16_t check_l_dk = 104 * std::ceil(1 + (((bytes_lk * 8) + l_ds_bits) / 104)); + uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((bytes_lk * 8.0) + l_ds_bits) / 104.0); LOG(WARNING) << "check_l_dk_bits=" << static_cast(check_l_dk); if (l_dk_bits != check_l_dk) { @@ -283,22 +283,36 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else { // validation of padding - std::vector M; - M.push_back(nma_header); + std::vector MSG; + MSG.push_back(nma_header); for (int i = 1; i < 13; i++) { - M.push_back(dsm_msg[i]); + MSG.push_back(dsm_msg[i]); } for (uint16_t i = 0; i < bytes_lk; i++) { - M.push_back(dsm_msg[13 + i]); + MSG.push_back(dsm_msg[13 + i]); } for (uint16_t k = 0; k < l_ds_bytes; k++) { - M.push_back(dsm_msg[13 + bytes_lk + k]); + MSG.push_back(dsm_msg[13 + bytes_lk + k]); } - std::vector hash = computeSHA256(M); + std::vector hash = computeSHA256(MSG); + std::cout << "hash: "; + for (auto c : hash) + { + std::cout << static_cast(c); + } + std::cout << std::endl; + + std::cout << "pdk: "; + for (auto c : d_osnma_data.d_dsm_kroot_message.p_dk) + { + std::cout << static_cast(c); + } + std::cout << std::endl; + // truncate hash std::vector p_dk_computed; for (uint16_t i = 0; i < l_pdk_bytes; i++) { @@ -308,6 +322,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { std::cout << "OSNMA: DSM-KROOT message validated" << std::endl; } + // Validate signature } } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) @@ -336,11 +351,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (d_osnma_data.d_dsm_pkr_message.npkt == 4) { - // OAM + LOG(WARNING) << "OSNMA: OAM received"; l_npk = 0; // ? } - d_osnma_data.d_dsm_pkr_message.npk = std::vector(l_npk, 0); + d_osnma_data.d_dsm_pkr_message.npk = std::vector(l_npk, 0); // ECDSA Public Key for (uint32_t k = 0; k > l_npk; k++) { d_osnma_data.d_dsm_pkr_message.npk[k] = dsm_msg[k + 130]; @@ -348,7 +363,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t l_dp = dsm_msg.size(); uint32_t l_pd = l_dp - 130 - l_npk; - uint32_t check_l_dp = 104 * std::ceil((1040 + l_npk * 8) / 104); + uint32_t check_l_dp = 104 * std::ceil(static_cast(1040.0 + l_npk * 8.0) / 104.0); if (l_dp != check_l_dp) { @@ -357,7 +372,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else { d_osnma_data.d_dsm_pkr_message.p_dp = std::vector(l_pd, 0); - for (uint32_t k = 0; k > l_pd; k++) + for (uint32_t k = 0; k < l_pd; k++) { d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; } @@ -366,6 +381,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else { // Reserved message? + LOG(WARNING) << "OSNMA Reserved message received"; d_osnma_data = OSNMA_data(); } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; @@ -423,12 +439,12 @@ void osnma_msg_receiver::read_mack_padding() std::vector osnma_msg_receiver::computeSHA256(const std::vector& input) { - std::vector output{32}; // SHA256 hash size + std::vector output(32); // SHA256 hash size #if USE_OPENSSL_FALLBACK SHA256_CTX sha256Context; SHA256_Init(&sha256Context); SHA256_Update(&sha256Context, input.data(), input.size()); - SHA256_Final(output, &sha256Context); + SHA256_Final(output.data(), &sha256Context); #else gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); @@ -438,3 +454,15 @@ std::vector osnma_msg_receiver::computeSHA256(const std::vector& publicKey, const std::vector& publicKey) +// { +// bool success = false; +// #if USE_OPENSSL_FALLBACK +// #else +// gnutls_global_init(); +// int result = gnutls_pubkey_verify_data(publicKey, GNUTLS_SIGN_ECDSA_SHA256, digest, sizeof(digest), signature, signatureSize); +// success = (result == GNUTLS_E_SUCCESS); +// #endif +// return success; +// } From 8c4ae2253a3c1cd217e20ccce0031d0840aaad34 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 20:20:31 +0200 Subject: [PATCH 026/499] Try OpenSSL 3.0 --- src/core/libs/CMakeLists.txt | 42 +++++++++++++++++----- src/core/libs/osnma_msg_receiver.cc | 33 +++++++++++++++-- src/core/system_parameters/Galileo_OSNMA.h | 1 + 3 files changed, 64 insertions(+), 12 deletions(-) diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 02d6e31de..5757a2ddd 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -102,16 +102,40 @@ target_link_libraries(core_libs Pugixml::pugixml ) -target_link_libraries(core_libs - PRIVATE - ${GNUTLS_LIBRARIES} - ${GNUTLS_OPENSSL_LIBRARY} -) - -target_include_directories(core_libs - PRIVATE +if(OPENSSL_FOUND) + if(TARGET OpenSSL::SSL) + target_link_libraries(core_libs + PRIVATE + OpenSSL::SSL + ) + else() + target_link_libraries(core_libs + PRIVATE + ${OPENSSL_LIBRARIES} + ) + target_include_directories(core_libs + PRIVATE + ${OPENSSL_INCLUDE_DIR} + ) + endif() + if(OPENSSL_VERSION) + if(OPENSSL_VERSION VERSION_GREATER "3.0.0") + target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_3=1) + endif() + endif() +else() + target_link_libraries(core_libs + PRIVATE + ${GNUTLS_LIBRARIES} + ${GNUTLS_OPENSSL_LIBRARY} + ) + target_include_directories(core_libs + PRIVATE ${GNUTLS_INCLUDE_DIR} -) + ) +endif() + + if(OPENSSL_FOUND) target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_FALLBACK=1) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index a1583195d..e771d7de8 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -108,7 +108,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) auto osnma_data_ptr = std::make_shared(d_osnma_data); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); d_new_data = false; - d_osnma_data = OSNMA_data(); + // d_osnma_data = OSNMA_data(); DLOG(INFO) << "NMA info sent to the PVT block through the OSNMA_to_PVT async message port"; } } @@ -382,7 +382,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { // Reserved message? LOG(WARNING) << "OSNMA Reserved message received"; - d_osnma_data = OSNMA_data(); + // d_osnma_data = OSNMA_data(); } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } @@ -441,10 +441,37 @@ std::vector osnma_msg_receiver::computeSHA256(const std::vector output(32); // SHA256 hash size #if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + // unsigned char mdVal[EVP_MAX_MD_SIZE]; + // unsigned char* md; + unsigned int mdLen; + EVP_MD_CTX* mdCtx = EVP_MD_CTX_new(); + if (!EVP_DigestInit_ex(mdCtx, EVP_sha256(), OPENSSL_ENGINE)) + { + // printf("Message digest initialization failed.\n"); + // EVP_MD_CTX_free(mdCtx); + // exit(EXIT_FAILURE); + } + if (!EVP_DigestUpdate(mdCtx, input.data(), input.size())) + { + // printf("Message digest update failed.\n"); + // EVP_MD_CTX_free(mdCtx); + // exit(EXIT_FAILURE); + } + if (!EVP_DigestFinal_ex(mdCtx, output.data(), &mdLen)) + { + printf("Message digest finalization failed.\n"); + EVP_MD_CTX_free(mdCtx); + exit(EXIT_FAILURE); + } + EVP_MD_CTX_free(mdCtx); + // md = mdVal; +#else SHA256_CTX sha256Context; SHA256_Init(&sha256Context); SHA256_Update(&sha256Context, input.data(), input.size()); SHA256_Final(output.data(), &sha256Context); +#endif #else gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); @@ -455,7 +482,7 @@ std::vector osnma_msg_receiver::computeSHA256(const std::vector& publicKey, const std::vector& publicKey) +// bool signature(const std::vector& publicKey, const std::vector& digest, const std::vector& signature) // { // bool success = false; // #if USE_OPENSSL_FALLBACK diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 39f32752e..62df5ccb1 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -22,6 +22,7 @@ #include #include #include +#include /** \addtogroup Core * \{ */ From 56031834a9ad3dd8b4cfcb3f3a5adb99338fec68 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 20:44:38 +0200 Subject: [PATCH 027/499] Fix indentation --- src/core/libs/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 5757a2ddd..c5425d027 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -119,9 +119,9 @@ if(OPENSSL_FOUND) ) endif() if(OPENSSL_VERSION) - if(OPENSSL_VERSION VERSION_GREATER "3.0.0") - target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_3=1) - endif() + if(OPENSSL_VERSION VERSION_GREATER "3.0.0") + target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_3=1) + endif() endif() else() target_link_libraries(core_libs From be862bdd236ab7780ef861baa3c0ffc97127f2cd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 21:14:24 +0200 Subject: [PATCH 028/499] Fix includes for openssl --- src/core/libs/osnma_msg_receiver.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e771d7de8..243ccb0ae 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -46,7 +46,11 @@ namespace wht = std; #endif #if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 +#include +#else #include +#endif #else #include #include From fec1468ec4f12ebf60043481698bbcaa751f04ad Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Jun 2023 21:16:45 +0200 Subject: [PATCH 029/499] Fix includes for openssl --- src/core/libs/osnma_msg_receiver.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 243ccb0ae..afa3eb746 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -48,6 +48,7 @@ namespace wht = std; #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 #include +#define OPENSSL_ENGINE NULL #else #include #endif From 1595c5f363684b3bd0d0c16fc95bad525bd8cec3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 3 Jun 2023 12:06:16 +0200 Subject: [PATCH 030/499] Add osnma_dsm_reader --- .../galileo_telemetry_decoder_gs.cc | 2 +- src/core/libs/osnma_msg_receiver.cc | 82 +++---- src/core/libs/osnma_msg_receiver.h | 4 + src/core/system_parameters/CMakeLists.txt | 4 +- src/core/system_parameters/Galileo_OSNMA.h | 203 ----------------- .../system_parameters/osnma_dsm_reader.cc | 204 ++++++++++++++++++ src/core/system_parameters/osnma_dsm_reader.h | 109 ++++++++++ 7 files changed, 362 insertions(+), 246 deletions(-) create mode 100644 src/core/system_parameters/osnma_dsm_reader.cc create mode 100644 src/core/system_parameters/osnma_dsm_reader.h 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 60b83efc8..0868ab5e9 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 @@ -511,8 +511,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in if (d_band == '1' && d_inav_nav.have_new_nma() == true) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); uint8_t nma_status = (tmp_obj->hkroot[0] & 0xC0) >> 6; + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); std::string nma_status_string; if (nma_status == 0) { diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index afa3eb746..41ab86aac 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -19,7 +19,7 @@ #include "osnma_msg_receiver.h" #include "Galileo_OSNMA.h" -#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 +#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include // for DLOG #include // for gr::io_signature::make #include @@ -67,6 +67,7 @@ osnma_msg_receiver::osnma_msg_receiver() : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { + d_dsm_reader = std::make_unique(); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -130,17 +131,17 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& void osnma_msg_receiver::read_nma_header(uint8_t nma_header) { - d_osnma_data.d_nma_header.nmas = get_nmas(nma_header); - d_osnma_data.d_nma_header.cid = get_cid(nma_header); - d_osnma_data.d_nma_header.cpks = get_cpks(nma_header); - d_osnma_data.d_nma_header.reserved = get_nma_header_reserved(nma_header); + d_osnma_data.d_nma_header.nmas = d_dsm_reader->get_nmas(nma_header); + d_osnma_data.d_nma_header.cid = d_dsm_reader->get_cid(nma_header); + d_osnma_data.d_nma_header.cpks = d_dsm_reader->get_cpks(nma_header); + d_osnma_data.d_nma_header.reserved = d_dsm_reader->get_nma_header_reserved(nma_header); } void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { - d_osnma_data.d_dsm_header.dsm_id = get_dsm_id(dsm_header); - d_osnma_data.d_dsm_header.dsm_block_id = get_dsm_block_id(dsm_header); // BID + d_osnma_data.d_dsm_header.dsm_id = d_dsm_reader->get_dsm_id(dsm_header); + d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID LOG(WARNING) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); LOG(WARNING) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); } @@ -158,7 +159,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { // Get number of blocks in message - uint8_t nb = get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); + uint8_t nb = d_dsm_reader->get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); uint16_t number_of_blocks = 0; if (d_osnma_data.d_dsm_header.dsm_id < 12) { @@ -217,19 +218,19 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(WARNING) << "OSNMA: DSM-KROOT message received."; // DSM-KROOT message - d_osnma_data.d_dsm_kroot_message.nb_dk = get_number_blocks_index(dsm_msg[0]); - d_osnma_data.d_dsm_kroot_message.pkid = get_pkid(dsm_msg); - d_osnma_data.d_dsm_kroot_message.cidkr = get_cidkr(dsm_msg); - d_osnma_data.d_dsm_kroot_message.reserved1 = get_dsm_reserved1(dsm_msg); - d_osnma_data.d_dsm_kroot_message.hf = get_hf(dsm_msg); - d_osnma_data.d_dsm_kroot_message.mf = get_mf(dsm_msg); - d_osnma_data.d_dsm_kroot_message.ks = get_ks(dsm_msg); - d_osnma_data.d_dsm_kroot_message.ts = get_ts(dsm_msg); - d_osnma_data.d_dsm_kroot_message.maclt = get_maclt(dsm_msg); - d_osnma_data.d_dsm_kroot_message.reserved = get_dsm_reserved(dsm_msg); - d_osnma_data.d_dsm_kroot_message.wn_k = get_wn_k(dsm_msg); - d_osnma_data.d_dsm_kroot_message.towh_k = get_towh_k(dsm_msg); - d_osnma_data.d_dsm_kroot_message.alpha = get_alpha(dsm_msg); + d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); + d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg); + d_osnma_data.d_dsm_kroot_message.cidkr = d_dsm_reader->get_cidkr(dsm_msg); + d_osnma_data.d_dsm_kroot_message.reserved1 = d_dsm_reader->get_dsm_reserved1(dsm_msg); + d_osnma_data.d_dsm_kroot_message.hf = d_dsm_reader->get_hf(dsm_msg); + d_osnma_data.d_dsm_kroot_message.mf = d_dsm_reader->get_mf(dsm_msg); + d_osnma_data.d_dsm_kroot_message.ks = d_dsm_reader->get_ks(dsm_msg); + d_osnma_data.d_dsm_kroot_message.ts = d_dsm_reader->get_ts(dsm_msg); + d_osnma_data.d_dsm_kroot_message.maclt = d_dsm_reader->get_maclt(dsm_msg); + d_osnma_data.d_dsm_kroot_message.reserved = d_dsm_reader->get_dsm_reserved(dsm_msg); + d_osnma_data.d_dsm_kroot_message.wn_k = d_dsm_reader->get_wn_k(dsm_msg); + d_osnma_data.d_dsm_kroot_message.towh_k = d_dsm_reader->get_towh_k(dsm_msg); + d_osnma_data.d_dsm_kroot_message.alpha = d_dsm_reader->get_alpha(dsm_msg); LOG(WARNING) << "nb_dk=" << static_cast(d_osnma_data.d_dsm_kroot_message.nb_dk); LOG(WARNING) << "pkid=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid); @@ -245,12 +246,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(WARNING) << "towh_k=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k); LOG(WARNING) << "alpha=" << d_osnma_data.d_dsm_kroot_message.alpha; - uint16_t bytes_lk = get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; - d_osnma_data.d_dsm_kroot_message.kroot = get_kroot(dsm_msg, bytes_lk); - LOG(WARNING) << "lk_bits=" << static_cast(get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)); + uint16_t bytes_lk = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; + d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, bytes_lk); + LOG(WARNING) << "lk_bits=" << static_cast(d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)); LOG(WARNING) << "lk_bytes=" << static_cast(bytes_lk); - std::string hash_function = get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); + std::string hash_function = d_dsm_reader->get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); uint16_t l_ds_bits = 0; const auto it4 = OSNMA_TABLE_15.find(hash_function); @@ -266,7 +267,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k]; } - uint16_t l_dk_bits = get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); + uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); uint16_t l_dk_bytes = l_dk_bits / 8; LOG(WARNING) << "dk_bits=" << static_cast(l_dk_bits); LOG(WARNING) << "dk_bytes=" << static_cast(l_dk_bytes); @@ -300,7 +301,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } for (uint16_t k = 0; k < l_ds_bytes; k++) { - MSG.push_back(dsm_msg[13 + bytes_lk + k]); + MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); } std::vector hash = computeSHA256(MSG); @@ -334,14 +335,14 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(WARNING) << "OSNMA: DSM-PKR message received."; // DSM-PKR message - d_osnma_data.d_dsm_pkr_message.nb_dp = get_number_blocks_index(dsm_msg[0]); - d_osnma_data.d_dsm_pkr_message.mid = get_mid(dsm_msg); + d_osnma_data.d_dsm_pkr_message.nb_dp = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); + d_osnma_data.d_dsm_pkr_message.mid = d_dsm_reader->get_mid(dsm_msg); for (int k = 0; k > 128; k++) { d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1]; } - d_osnma_data.d_dsm_pkr_message.npkt = get_npkt(dsm_msg); - d_osnma_data.d_dsm_pkr_message.npktid = get_npktid(dsm_msg); + d_osnma_data.d_dsm_pkr_message.npkt = d_dsm_reader->get_npkt(dsm_msg); + d_osnma_data.d_dsm_pkr_message.npktid = d_dsm_reader->get_npktid(dsm_msg); uint32_t l_npk = 0; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); @@ -396,9 +397,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma_msg) { uint32_t index = 0; - for (size_t i = 0; i < osnma_msg->mack.size(); i++) + for (uint32_t value : osnma_msg->mack) { - uint32_t value = osnma_msg->mack[i]; d_mack_message[index] = static_cast((value & 0xFF000000) >> 6); d_mack_message[index + 1] = static_cast((value & 0x00FF0000) >> 4); d_mack_message[index + 2] = static_cast((value & 0x0000FF00) >> 2); @@ -453,21 +453,21 @@ std::vector osnma_msg_receiver::computeSHA256(const std::vector // for gr::block #include // for pmt::pmt_t @@ -33,6 +34,7 @@ /** \addtogroup Core_Receiver_Library * \{ */ +class OSNMA_DSM_Reader; class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; @@ -69,6 +71,8 @@ private: std::vector computeSHA256(const std::vector& input); + std::unique_ptr d_dsm_reader; + std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; std::array d_number_of_blocks{}; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 81fd4318a..3f2e2a167 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -27,8 +27,9 @@ set(SYSTEM_PARAMETERS_SOURCES glonass_gnav_ephemeris.cc glonass_gnav_utc_model.cc glonass_gnav_navigation_message.cc - osnma_data.cc reed_solomon.cc + osnma_data.cc + osnma_dsm_reader.cc ) set(SYSTEM_PARAMETERS_HEADERS @@ -92,6 +93,7 @@ set(SYSTEM_PARAMETERS_HEADERS galileo_has_page.h Galileo_OSNMA.h osnma_data.h + osnma_dsm_reader.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 62df5ccb1..7d3010308 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -149,209 +149,6 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-256"), 512}, {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} -#if __cplusplus == 201103L -constexpr std::uint8_t mask_nmas{0xC0}; -constexpr std::uint8_t mask_cid{0x30}; -constexpr std::uint8_t mask_cpks{0x07}; -constexpr std::uint8_t mask_nma_header_reserved{0x01}; -constexpr std::uint8_t mask_dsm_id{0xF0}; -constexpr std::uint8_t mask_dsm_block_id{0x0F}; -constexpr std::uint8_t mask_dsm_number_blocks{0xF0}; -constexpr std::uint8_t mask_dsm_pkid{0x0F}; -constexpr std::uint8_t mask_dsm_cidkr{0xC0}; -constexpr std::uint8_t mask_dsm_reserved1{0x30}; -constexpr std::uint8_t mask_dsm_hf{0x0C}; -constexpr std::uint8_t mask_dsm_mf{0x03}; -constexpr std::uint8_t mask_dsm_ks{0xF0}; -constexpr std::uint8_t mask_dsm_ts{0x0F}; -constexpr std::uint8_t mask_dsm_reserved{0xF0}; -constexpr std::uint8_t mask_dsm_wk_k_msbyte{0x0F}; -constexpr std::uint8_t mask_dsm_mid{0x0F}; -constexpr std::uint8_t mask_dsm_npkt{0xF0}; -constexpr std::uint8_t mask_dsm_npktid{0x0F}; -#else -constexpr std::uint8_t mask_nmas{0b1100'0000}; -constexpr std::uint8_t mask_cid{0b0011'0000}; -constexpr std::uint8_t mask_cpks{0b0000'1110}; -constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; -constexpr std::uint8_t mask_dsm_id{0b1111'0000}; -constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; -constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000}; -constexpr std::uint8_t mask_dsm_pkid{0b0000'1111}; -constexpr std::uint8_t mask_dsm_cidkr{0b1100'0000}; -constexpr std::uint8_t mask_dsm_reserved1{0b0011'0000}; -constexpr std::uint8_t mask_dsm_hf{0b0000'1100}; -constexpr std::uint8_t mask_dsm_mf{0b0000'0011}; -constexpr std::uint8_t mask_dsm_ks{0b1111'0000}; -constexpr std::uint8_t mask_dsm_ts{0b0000'1111}; -constexpr std::uint8_t mask_dsm_reserved{0b1111'0000}; -constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111}; -constexpr std::uint8_t mask_dsm_mid{0b0000'1111}; -constexpr std::uint8_t mask_dsm_npkt{0b1111'0000}; -constexpr std::uint8_t mask_dsm_npktid{0b0000'1111}; -#endif - -// // hf = (dsm_msg[1] & 0b00001100) >> 2; -uint8_t get_nmas(uint8_t nma_header) -{ - return (nma_header & mask_nmas) >> 6; -} - -uint8_t get_cid(uint8_t nma_header) -{ - return (nma_header & mask_cid) >> 4; -} - -uint8_t get_cpks(uint8_t nma_header) -{ - return (nma_header & mask_cpks) >> 1; -} - -bool get_nma_header_reserved(uint8_t nma_header) -{ - return ((nma_header & mask_nma_header_reserved) ? true : false); -} - -uint8_t get_dsm_id(uint8_t dsm_header) -{ - return (dsm_header & mask_dsm_id) >> 4; -} - -uint8_t get_dsm_block_id(uint8_t dsm_header) -{ - return dsm_header & mask_dsm_block_id; -} - -uint8_t get_number_blocks_index(uint8_t dsm_msg_0) -{ - return (dsm_msg_0 & mask_dsm_number_blocks) >> 4; -} - -uint8_t get_pkid(const std::vector& dsm_msg) -{ - return (dsm_msg[0] & mask_dsm_pkid); -} - -uint8_t get_cidkr(const std::vector& dsm_msg) -{ - return (dsm_msg[1] & mask_dsm_cidkr) >> 6; -} - -uint8_t get_dsm_reserved1(const std::vector& dsm_msg) -{ - return (dsm_msg[1] & mask_dsm_reserved1) >> 4; -} - -uint8_t get_hf(const std::vector& dsm_msg) -{ - return (dsm_msg[1] & mask_dsm_hf) >> 2; -} - -uint8_t get_mf(const std::vector& dsm_msg) -{ - return (dsm_msg[1] & mask_dsm_mf); -} - -uint8_t get_ks(const std::vector& dsm_msg) -{ - return (dsm_msg[2] & mask_dsm_ks) >> 4; -} - -uint8_t get_ts(const std::vector& dsm_msg) -{ - return (dsm_msg[2] & mask_dsm_ts); -} - -uint8_t get_maclt(const std::vector& dsm_msg) -{ - return dsm_msg[3]; -} - -uint8_t get_dsm_reserved(const std::vector& dsm_msg) -{ - return (dsm_msg[4] & mask_dsm_reserved) >> 4; -} - -uint16_t get_wn_k(const std::vector& dsm_msg) -{ - return (static_cast((dsm_msg[4] & mask_dsm_wk_k_msbyte) << 8) + static_cast(dsm_msg[5])); -} - -uint8_t get_towh_k(const std::vector& dsm_msg) -{ - return dsm_msg[6]; -} - -uint64_t get_alpha(const std::vector& dsm_msg) -{ - uint64_t alpha = (static_cast(dsm_msg[8]) << 32) + - (static_cast(dsm_msg[9]) << 24) + - (static_cast(dsm_msg[10]) << 16) + - (static_cast(dsm_msg[11]) << 8) + - static_cast(dsm_msg[12]); - return alpha; -} - -uint16_t get_l_dk_bits(uint8_t nb_dk) -{ - const auto it = OSNMA_TABLE_7.find(nb_dk); - if (it != OSNMA_TABLE_7.cend()) - { - return it->second.second; - } - return 0; -} - -uint16_t get_lk_bits(uint8_t ks) -{ - const auto it = OSNMA_TABLE_10.find(ks); - if (it != OSNMA_TABLE_10.cend()) - { - return it->second; - } - return 0; -} - -std::vector get_kroot(const std::vector& dsm_msg, uint16_t bytes_lk) -{ - std::vector kroot = std::vector(bytes_lk, 0); - if (dsm_msg.size() > static_cast(13 + bytes_lk)) - { - for (uint16_t k = 0; k < bytes_lk; k++) - { - kroot[k] = dsm_msg[13 + k]; - } - } - return kroot; -} - -std::string get_hash_function(uint8_t hf) -{ - std::string hash_; - const auto it = OSNMA_TABLE_8.find(hf); - if (it != OSNMA_TABLE_8.cend()) - { - hash_ = it->second; - } - return hash_; -} - -uint8_t get_mid(const std::vector& dsm_msg) -{ - return (dsm_msg[0] & mask_dsm_mid); -} - -uint8_t get_npkt(const std::vector& dsm_msg) -{ - return ((dsm_msg[129] & mask_dsm_npkt) >> 4); -} - -uint8_t get_npktid(const std::vector& dsm_msg) -{ - return (dsm_msg[129] & mask_dsm_npktid); -} - - /** \} */ /** \} */ #endif // GNSS_SDR_GALILEO_OSNMA_H \ No newline at end of file diff --git a/src/core/system_parameters/osnma_dsm_reader.cc b/src/core/system_parameters/osnma_dsm_reader.cc new file mode 100644 index 000000000..baf873bbb --- /dev/null +++ b/src/core/system_parameters/osnma_dsm_reader.cc @@ -0,0 +1,204 @@ +/*! + * \file osnma_dsm_reader.cc + * \brief Class for reading OSNMA DSM messages + * \author Carles Fernandez-Prades, 2023 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "osnma_dsm_reader.h" +#include "Galileo_OSNMA.h" + + +uint8_t OSNMA_DSM_Reader::get_nmas(uint8_t nma_header) const +{ + return (nma_header & mask_nmas) >> 6; +} + + +uint8_t OSNMA_DSM_Reader::get_cid(uint8_t nma_header) const +{ + return (nma_header & mask_cid) >> 4; +} + + +uint8_t OSNMA_DSM_Reader::get_cpks(uint8_t nma_header) const +{ + return (nma_header & mask_cpks) >> 1; +} + + +bool OSNMA_DSM_Reader::get_nma_header_reserved(uint8_t nma_header) const +{ + return ((nma_header & mask_nma_header_reserved) ? true : false); +} + + +uint8_t OSNMA_DSM_Reader::get_dsm_id(uint8_t dsm_header) const +{ + return (dsm_header & mask_dsm_id) >> 4; +} + + +uint8_t OSNMA_DSM_Reader::get_dsm_block_id(uint8_t dsm_header) const +{ + return dsm_header & mask_dsm_block_id; +} + + +uint8_t OSNMA_DSM_Reader::get_number_blocks_index(uint8_t dsm_msg_0) const +{ + return (dsm_msg_0 & mask_dsm_number_blocks) >> 4; +} + + +uint8_t OSNMA_DSM_Reader::get_pkid(const std::vector& dsm_msg) const +{ + return (dsm_msg[0] & mask_dsm_pkid); +} + + +uint8_t OSNMA_DSM_Reader::get_cidkr(const std::vector& dsm_msg) const +{ + return (dsm_msg[1] & mask_dsm_cidkr) >> 6; +} + + +uint8_t OSNMA_DSM_Reader::get_dsm_reserved1(const std::vector& dsm_msg) const +{ + return (dsm_msg[1] & mask_dsm_reserved1) >> 4; +} + + +uint8_t OSNMA_DSM_Reader::get_hf(const std::vector& dsm_msg) const +{ + return (dsm_msg[1] & mask_dsm_hf) >> 2; +} + + +uint8_t OSNMA_DSM_Reader::get_mf(const std::vector& dsm_msg) const +{ + return (dsm_msg[1] & mask_dsm_mf); +} + + +uint8_t OSNMA_DSM_Reader::get_ks(const std::vector& dsm_msg) const +{ + return (dsm_msg[2] & mask_dsm_ks) >> 4; +} + + +uint8_t OSNMA_DSM_Reader::get_ts(const std::vector& dsm_msg) const +{ + return (dsm_msg[2] & mask_dsm_ts); +} + + +uint8_t OSNMA_DSM_Reader::get_maclt(const std::vector& dsm_msg) const +{ + return dsm_msg[3]; +} + + +uint8_t OSNMA_DSM_Reader::get_dsm_reserved(const std::vector& dsm_msg) const +{ + return (dsm_msg[4] & mask_dsm_reserved) >> 4; +} + + +uint16_t OSNMA_DSM_Reader::get_wn_k(const std::vector& dsm_msg) const +{ + return (static_cast((dsm_msg[4] & mask_dsm_wk_k_msbyte) << 8) + static_cast(dsm_msg[5])); +} + + +uint8_t OSNMA_DSM_Reader::get_towh_k(const std::vector& dsm_msg) const +{ + return dsm_msg[6]; +} + + +uint64_t OSNMA_DSM_Reader::get_alpha(const std::vector& dsm_msg) const +{ + uint64_t alpha = (static_cast(dsm_msg[8]) << 40) + + (static_cast(dsm_msg[9]) << 32) + + (static_cast(dsm_msg[10]) << 24) + + (static_cast(dsm_msg[11]) << 16) + + (static_cast(dsm_msg[12]) << 8) + + (static_cast(dsm_msg[13])); + return alpha; +} + + +uint16_t OSNMA_DSM_Reader::get_l_dk_bits(uint8_t nb_dk) const +{ + const auto it = OSNMA_TABLE_7.find(nb_dk); + if (it != OSNMA_TABLE_7.cend()) + { + return it->second.second; + } + return 0; +} + + +uint16_t OSNMA_DSM_Reader::get_lk_bits(uint8_t ks) const +{ + const auto it = OSNMA_TABLE_10.find(ks); + if (it != OSNMA_TABLE_10.cend()) + { + return it->second; + } + return 0; +} + + +std::vector OSNMA_DSM_Reader::get_kroot(const std::vector& dsm_msg, uint16_t bytes_lk) const +{ + std::vector kroot = std::vector(bytes_lk, 0); + if (dsm_msg.size() > static_cast(13 + bytes_lk)) + { + for (uint16_t k = 0; k < bytes_lk; k++) + { + kroot[k] = dsm_msg[13 + k]; + } + } + return kroot; +} + + +std::string OSNMA_DSM_Reader::get_hash_function(uint8_t hf) const +{ + std::string hash_; + const auto it = OSNMA_TABLE_8.find(hf); + if (it != OSNMA_TABLE_8.cend()) + { + hash_ = it->second; + } + return hash_; +} + + +uint8_t OSNMA_DSM_Reader::get_mid(const std::vector& dsm_msg) const +{ + return (dsm_msg[0] & mask_dsm_mid); +} + + +uint8_t OSNMA_DSM_Reader::get_npkt(const std::vector& dsm_msg) const +{ + return ((dsm_msg[129] & mask_dsm_npkt) >> 4); +} + + +uint8_t OSNMA_DSM_Reader::get_npktid(const std::vector& dsm_msg) const +{ + return (dsm_msg[129] & mask_dsm_npktid); +} diff --git a/src/core/system_parameters/osnma_dsm_reader.h b/src/core/system_parameters/osnma_dsm_reader.h new file mode 100644 index 000000000..f90bd531b --- /dev/null +++ b/src/core/system_parameters/osnma_dsm_reader.h @@ -0,0 +1,109 @@ +/*! + * \file osnma_dsm_reader.h + * \brief Class for reading OSNMA DSM messages + * \author Carles Fernandez-Prades, 2023 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_OSNMA_DSM_READER_H +#define GNSS_SDR_OSNMA_DSM_READER_H + +#include +#include +#include + +/** \addtogroup Core + * \{ */ +/** \addtogroup System_Parameters + * \{ */ + +class OSNMA_DSM_Reader +{ +public: + OSNMA_DSM_Reader() = default; + uint8_t get_nmas(uint8_t nma_header) const; + uint8_t get_cid(uint8_t nma_header) const; + uint8_t get_cpks(uint8_t nma_header) const; + bool get_nma_header_reserved(uint8_t nma_header) const; + + uint8_t get_dsm_id(uint8_t dsm_header) const; + uint8_t get_dsm_block_id(uint8_t dsm_header) const; + + uint8_t get_number_blocks_index(uint8_t dsm_msg_0) const; + uint8_t get_pkid(const std::vector& dsm_msg) const; + uint8_t get_cidkr(const std::vector& dsm_msg) const; + uint8_t get_dsm_reserved1(const std::vector& dsm_msg) const; + uint8_t get_hf(const std::vector& dsm_msg) const; + uint8_t get_mf(const std::vector& dsm_msg) const; + uint8_t get_ks(const std::vector& dsm_msg) const; + uint8_t get_ts(const std::vector& dsm_msg) const; + uint8_t get_maclt(const std::vector& dsm_msg) const; + uint8_t get_dsm_reserved(const std::vector& dsm_msg) const; + uint16_t get_wn_k(const std::vector& dsm_msg) const; + uint8_t get_towh_k(const std::vector& dsm_msg) const; + uint64_t get_alpha(const std::vector& dsm_msg) const; + uint16_t get_l_dk_bits(uint8_t nb_dk) const; + uint16_t get_lk_bits(uint8_t ks) const; + std::vector get_kroot(const std::vector& dsm_msg, uint16_t bytes_lk) const; + std::string get_hash_function(uint8_t hf) const; + + uint8_t get_mid(const std::vector& dsm_msg) const; + uint8_t get_npkt(const std::vector& dsm_msg) const; + uint8_t get_npktid(const std::vector& dsm_msg) const; + +private: +#if __cplusplus == 201103L + static constexpr std::uint8_t mask_nmas{0xC0}; + static constexpr std::uint8_t mask_cid{0x30}; + static constexpr std::uint8_t mask_cpks{0x07}; + static constexpr std::uint8_t mask_nma_header_reserved{0x01}; + static constexpr std::uint8_t mask_dsm_id{0xF0}; + static constexpr std::uint8_t mask_dsm_block_id{0x0F}; + static constexpr std::uint8_t mask_dsm_number_blocks{0xF0}; + static constexpr std::uint8_t mask_dsm_pkid{0x0F}; + static constexpr std::uint8_t mask_dsm_cidkr{0xC0}; + static constexpr std::uint8_t mask_dsm_reserved1{0x30}; + static constexpr std::uint8_t mask_dsm_hf{0x0C}; + static constexpr std::uint8_t mask_dsm_mf{0x03}; + static constexpr std::uint8_t mask_dsm_ks{0xF0}; + static constexpr std::uint8_t mask_dsm_ts{0x0F}; + static constexpr std::uint8_t mask_dsm_reserved{0xF0}; + static constexpr std::uint8_t mask_dsm_wk_k_msbyte{0x0F}; + static constexpr std::uint8_t mask_dsm_mid{0x0F}; + static constexpr std::uint8_t mask_dsm_npkt{0xF0}; + static constexpr std::uint8_t mask_dsm_npktid{0x0F}; +#else + static constexpr std::uint8_t mask_nmas{0b1100'0000}; + static constexpr std::uint8_t mask_cid{0b0011'0000}; + static constexpr std::uint8_t mask_cpks{0b0000'1110}; + static constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; + static constexpr std::uint8_t mask_dsm_id{0b1111'0000}; + static constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; + static constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000}; + static constexpr std::uint8_t mask_dsm_pkid{0b0000'1111}; + static constexpr std::uint8_t mask_dsm_cidkr{0b1100'0000}; + static constexpr std::uint8_t mask_dsm_reserved1{0b0011'0000}; + static constexpr std::uint8_t mask_dsm_hf{0b0000'1100}; + static constexpr std::uint8_t mask_dsm_mf{0b0000'0011}; + static constexpr std::uint8_t mask_dsm_ks{0b1111'0000}; + static constexpr std::uint8_t mask_dsm_ts{0b0000'1111}; + static constexpr std::uint8_t mask_dsm_reserved{0b1111'0000}; + static constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111}; + static constexpr std::uint8_t mask_dsm_mid{0b0000'1111}; + static constexpr std::uint8_t mask_dsm_npkt{0b1111'0000}; + static constexpr std::uint8_t mask_dsm_npktid{0b0000'1111}; +#endif +}; + +/** \} */ +/** \} */ +#endif // GNSS_SDR_OSNMA_DSM_READER_H \ No newline at end of file From f20f4ede0c4c3482e0f38beec79e6ac48e9a64bc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 3 Jun 2023 12:45:20 +0200 Subject: [PATCH 031/499] Use classes instead of structs --- src/core/system_parameters/osnma_data.h | 82 +++++++++++++++---------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index aa4eaf21f..9c97c1186 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -28,73 +28,91 @@ /** \addtogroup System_Parameters * \{ */ -struct nma_header +class DSM_nma_header { +public: + DSM_nma_header() = default; uint8_t nmas; uint8_t cid; uint8_t cpks; bool reserved; }; -struct dsm_header +class DSM_dsm_header { +public: + DSM_dsm_header() = default; uint8_t dsm_id; uint8_t dsm_block_id; }; -struct mack_header +class MACK_header { +public: + MACK_header() = default; std::vector tag0; - uint16_t macsec; - uint8_t cop; + uint16_t macsec{}; + uint8_t cop{}; }; -struct tag +class MACK_tag { +public: + MACK_tag() = default; std::vector tag; uint16_t tag_info; }; -struct tag_and_info +class MACK_tag_and_info { - std::vector tags; +public: + MACK_tag_and_info() = default; + std::vector tags; }; -struct DSM_PKR_message +class DSM_PKR_message { - uint8_t nb_dp; - uint8_t mid; +public: + DSM_PKR_message() = default; + std::array itn; // bitset<1024> - uint8_t npkt; - uint8_t npktid; std::vector npk; std::vector p_dp; + uint8_t nb_dp; + uint8_t mid; + uint8_t npkt; + uint8_t npktid; }; -struct DSM_KROOT_message +class DSM_KROOT_message { - uint8_t nb_dk; - uint8_t pkid; - uint8_t cidkr; - uint8_t reserved1; - uint8_t hf; - uint8_t mf; - uint8_t ks; - uint8_t ts; - uint8_t maclt; - uint8_t reserved; - uint16_t wn_k; - uint8_t towh_k; - uint64_t alpha; +public: + DSM_KROOT_message() = default; + std::vector kroot; std::vector ds; std::vector p_dk; + uint64_t alpha{}; + uint16_t wn_k{}; + uint8_t nb_dk{}; + uint8_t pkid{}; + uint8_t cidkr{}; + uint8_t reserved1{}; + uint8_t hf{}; + uint8_t mf{}; + uint8_t ks{}; + uint8_t ts{}; + uint8_t maclt{}; + uint8_t reserved{}; + uint8_t towh_k{}; }; -struct MACK_message +class MACK_message { - mack_header header; - tag_and_info tag_info; +public: + MACK_message() = default; + MACK_header header; + MACK_tag_and_info tag_info; std::vector key; std::vector padding; }; @@ -107,8 +125,8 @@ class OSNMA_data { public: OSNMA_data() = default; - nma_header d_nma_header; - dsm_header d_dsm_header; + DSM_nma_header d_nma_header; + DSM_dsm_header d_dsm_header; DSM_PKR_message d_dsm_pkr_message; DSM_KROOT_message d_dsm_kroot_message; }; From c3b36c380a4d344a37cdadfe4214e73f142182ef Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 3 Jun 2023 14:13:31 +0200 Subject: [PATCH 032/499] Fix wrong memory access --- src/core/libs/osnma_msg_receiver.cc | 8 ++++---- src/core/system_parameters/Galileo_OSNMA.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 41ab86aac..78a9135a7 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -152,7 +152,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ size_t index = 0; for (const auto* it = osnma_msg->hkroot.cbegin() + 2; it != osnma_msg->hkroot.cend(); ++it) { - d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][13 * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; + d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][SIZE_DSM_BLOCKS_BYTES * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; index++; } @@ -197,12 +197,12 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cbegin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cend(), 0))) { - std::vector dsm_msg(std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * 13, 0); + std::vector dsm_msg(std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * SIZE_DSM_BLOCKS_BYTES, 0); for (uint32_t i = 0; i < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; i++) { - for (uint32_t j = 0; j < 14; j++) + for (size_t j = 0; j < SIZE_DSM_BLOCKS_BYTES; j++) { - dsm_msg[i * 13 + j] = d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][i * 13 + j]; + dsm_msg[i * SIZE_DSM_BLOCKS_BYTES + j] = d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][i * SIZE_DSM_BLOCKS_BYTES + j]; } } d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 7d3010308..bb3781c3f 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -18,6 +18,7 @@ #ifndef GNSS_SDR_GALILEO_OSNMA_H #define GNSS_SDR_GALILEO_OSNMA_H +#include #include #include #include @@ -29,6 +30,8 @@ /** \addtogroup System_Parameters * \{ */ +constexpr size_t SIZE_DSM_BLOCKS_BYTES = 13; + // OSNMA User ICD for the Test Phase, Issue 1.0, Table 2 const std::unordered_map OSNMA_TABLE_2 = { {0, std::string("Reserved")}, From 66e58de3825e80ffa2cf5887a8a2568eed948371 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 6 Jun 2023 16:22:36 +0200 Subject: [PATCH 033/499] Read DSM-KROOT messages --- src/core/libs/osnma_msg_receiver.cc | 138 ++++++++++++++++------------ src/core/libs/osnma_msg_receiver.h | 1 + 2 files changed, 78 insertions(+), 61 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 78a9135a7..0c3cdd62f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -155,7 +155,12 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][SIZE_DSM_BLOCKS_BYTES * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; index++; } - + std::cout << "dsm_message:"; + for (auto c : d_dsm_message[d_osnma_data.d_dsm_header.dsm_id]) + { + std::cout << " " << static_cast(c); + } + std::cout << std::endl; if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { // Get number of blocks in message @@ -232,56 +237,32 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.towh_k = d_dsm_reader->get_towh_k(dsm_msg); d_osnma_data.d_dsm_kroot_message.alpha = d_dsm_reader->get_alpha(dsm_msg); - LOG(WARNING) << "nb_dk=" << static_cast(d_osnma_data.d_dsm_kroot_message.nb_dk); - LOG(WARNING) << "pkid=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid); - LOG(WARNING) << "cidkr=" << static_cast(d_osnma_data.d_dsm_kroot_message.cidkr); - LOG(WARNING) << "reserved1=" << static_cast(d_osnma_data.d_dsm_kroot_message.reserved1); - LOG(WARNING) << "hf=" << static_cast(d_osnma_data.d_dsm_kroot_message.hf); - LOG(WARNING) << "mf=" << static_cast(d_osnma_data.d_dsm_kroot_message.mf); - LOG(WARNING) << "ks=" << static_cast(d_osnma_data.d_dsm_kroot_message.ks); - LOG(WARNING) << "ts=" << static_cast(d_osnma_data.d_dsm_kroot_message.ts); - LOG(WARNING) << "maclt=" << static_cast(d_osnma_data.d_dsm_kroot_message.maclt); - LOG(WARNING) << "reserved=" << static_cast(d_osnma_data.d_dsm_kroot_message.reserved); - LOG(WARNING) << "wn_k=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k); - LOG(WARNING) << "towh_k=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k); - LOG(WARNING) << "alpha=" << d_osnma_data.d_dsm_kroot_message.alpha; - - uint16_t bytes_lk = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; - d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, bytes_lk); - LOG(WARNING) << "lk_bits=" << static_cast(d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)); - LOG(WARNING) << "lk_bytes=" << static_cast(bytes_lk); + const uint16_t l_lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; + d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, l_lk_bytes); std::string hash_function = d_dsm_reader->get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); - uint16_t l_ds_bits = 0; const auto it4 = OSNMA_TABLE_15.find(hash_function); if (it4 != OSNMA_TABLE_15.cend()) { l_ds_bits = it4->second; } - uint16_t l_ds_bytes = l_ds_bits / 8; - LOG(WARNING) << "ds_bits=" << static_cast(l_ds_bits); - LOG(WARNING) << "ds_bytes=" << static_cast(l_ds_bytes); + const uint16_t l_ds_bytes = l_ds_bits / 8; d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); for (uint16_t k = 0; k < l_ds_bytes; k++) { - d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + bytes_lk + k]; + d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + l_lk_bytes + k]; } - uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); - uint16_t l_dk_bytes = l_dk_bits / 8; - LOG(WARNING) << "dk_bits=" << static_cast(l_dk_bits); - LOG(WARNING) << "dk_bytes=" << static_cast(l_dk_bytes); - - uint16_t l_pdk_bytes = (l_dk_bytes - 13 - bytes_lk - l_ds_bytes); - LOG(WARNING) << "pdk_bytes=" << static_cast(l_pdk_bytes); + const uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); + const uint16_t l_dk_bytes = l_dk_bits / 8; + const uint16_t l_pdk_bytes = (l_dk_bytes - 13 - l_lk_bytes - l_ds_bytes); d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); for (uint16_t k = 0; k < l_pdk_bytes; k++) { - d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + bytes_lk + l_ds_bytes + k]; + d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + l_lk_bytes + l_ds_bytes + k]; } - uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((bytes_lk * 8.0) + l_ds_bits) / 104.0); - LOG(WARNING) << "check_l_dk_bits=" << static_cast(check_l_dk); + const uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((l_lk_bytes * 8.0) + l_ds_bits) / 104.0); if (l_dk_bits != check_l_dk) { std::cout << "OSNMA: Failed length reading" << std::endl; @@ -289,43 +270,44 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else { // validation of padding + const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; + MSG.reserve(size_m + l_ds_bytes + 1); MSG.push_back(nma_header); - for (int i = 1; i < 13; i++) + for (uint16_t i = 1; i < size_m; i++) { MSG.push_back(dsm_msg[i]); } - for (uint16_t i = 0; i < bytes_lk; i++) - { - MSG.push_back(dsm_msg[13 + i]); - } + for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); } - std::vector hash = computeSHA256(MSG); - std::cout << "hash: "; - for (auto c : hash) + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. { - std::cout << static_cast(c); + hash = computeSHA256(MSG); } - std::cout << std::endl; - - std::cout << "pdk: "; - for (auto c : d_osnma_data.d_dsm_kroot_message.p_dk) + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) { - std::cout << static_cast(c); + hash = computeSHA3_256(MSG); + } + else + { + hash = std::vector(32); } - std::cout << std::endl; // truncate hash - std::vector p_dk_computed; + std::vector p_dk_truncated; + p_dk_truncated.reserve(l_pdk_bytes); for (uint16_t i = 0; i < l_pdk_bytes; i++) { - p_dk_computed.push_back(hash[i]); + p_dk_truncated.push_back(hash[i]); } - if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_computed) + // check DS signature + if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { + LOG(WARNING) << "OSNMA: DSM-KROOT message received ok."; std::cout << "OSNMA: DSM-KROOT message validated" << std::endl; } // Validate signature @@ -354,11 +336,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg l_npk = it2->second / 8; } } - + uint32_t l_dp = dsm_msg.size(); if (d_osnma_data.d_dsm_pkr_message.npkt == 4) { LOG(WARNING) << "OSNMA: OAM received"; - l_npk = 0; // ? + l_npk = l_dp - 130; // bytes } d_osnma_data.d_dsm_pkr_message.npk = std::vector(l_npk, 0); // ECDSA Public Key @@ -366,11 +348,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_pkr_message.npk[k] = dsm_msg[k + 130]; } - uint32_t l_dp = dsm_msg.size(); + uint32_t l_pd = l_dp - 130 - l_npk; - uint32_t check_l_dp = 104 * std::ceil(static_cast(1040.0 + l_npk * 8.0) / 104.0); - if (l_dp != check_l_dp) { std::cout << "OSNMA: Failed length reading" << std::endl; @@ -478,23 +458,59 @@ std::vector osnma_msg_receiver::computeSHA256(const std::vector output_aux(32); gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); gnutls_hash(hashHandle, input.data(), input.size()); - gnutls_hash_output(hashHandle, output.data()); - gnutls_hash_deinit(hashHandle, output.data()); + gnutls_hash_output(hashHandle, output_aux.data()); + output = output_aux; + gnutls_hash_deinit(hashHandle, output_aux.data()); #endif return output; } -// bool signature(const std::vector& publicKey, const std::vector& digest, const std::vector& signature) + +std::vector osnma_msg_receiver::computeSHA3_256(const std::vector& input) +{ + std::vector output(32); // SHA256 hash size +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); + const EVP_MD* md = EVP_sha3_256(); + + EVP_DigestInit_ex(mdctx, md, NULL); + EVP_DigestUpdate(mdctx, input.data(), input.size()); + EVP_DigestFinal_ex(mdctx, output.data(), NULL); + EVP_MD_CTX_free(mdctx); +#else + // SHA3-256 not implemented in OpenSSL < 3.0 +#endif +#else + std::vector output_aux(32); + gnutls_hash_hd_t hashHandle; + gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); + gnutls_hash(hashHandle, input.data(), input.size()); + gnutls_hash_output(hashHandle, output_aux.data()); + output = output_aux; + gnutls_hash_deinit(hashHandle, output_aux.data()); +#endif + return output; +} + + +// bool signature(const std::vector& publicKey, const std::vector& digest, std::vector& signature) // { // bool success = false; // #if USE_OPENSSL_FALLBACK // #else // gnutls_global_init(); -// int result = gnutls_pubkey_verify_data(publicKey, GNUTLS_SIGN_ECDSA_SHA256, digest, sizeof(digest), signature, signatureSize); +// int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data, digest.size(), signature.data(), signature.size()); // success = (result == GNUTLS_E_SUCCESS); +// gnutls_global_deinit(); // #endif // return success; // } +// bool verifyDigitalSignature(const unsigned char* signature, size_t signatureSize, const unsigned char* message, size_t messageSize, gnutls_pubkey_t publicKey) +// { +// int verificationStatus = gnutls_pubkey_verify_data(publicKey, GNUTLS_DIG_SHA256, 0, message, messageSize, signature, signatureSize); +// return verificationStatus == 0; \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 9ec3370c4..beb33f50b 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -70,6 +70,7 @@ private: void read_mack_padding(); std::vector computeSHA256(const std::vector& input); + std::vector computeSHA3_256(const std::vector& input); std::unique_ptr d_dsm_reader; From 6d69b9db552a6f54a729c90b5b9d64a528072564 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 00:24:54 +0200 Subject: [PATCH 034/499] Add work on the OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 97 ++++++++++++++++++++++--- src/core/system_parameters/osnma_data.h | 39 +++++----- 2 files changed, 109 insertions(+), 27 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 0c3cdd62f..9c36a3ac4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -242,10 +242,10 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg std::string hash_function = d_dsm_reader->get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); uint16_t l_ds_bits = 0; - const auto it4 = OSNMA_TABLE_15.find(hash_function); - if (it4 != OSNMA_TABLE_15.cend()) + const auto it = OSNMA_TABLE_15.find(hash_function); + if (it != OSNMA_TABLE_15.cend()) { - l_ds_bits = it4->second; + l_ds_bits = it->second; } const uint16_t l_ds_bytes = l_ds_bits / 8; d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); @@ -362,6 +362,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; } + // std::vector mi; // (NPKT + NPKID + NPK) } } else @@ -385,10 +386,13 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } - read_mack_header(); - read_mack_info_and_tags(); - read_mack_key(); - read_mack_padding(); + if (d_osnma_data.d_dsm_kroot_message.ts != 0) + { + read_mack_header(); + read_mack_info_and_tags(); + read_mack_key(); + read_mack_padding(); + } } @@ -404,11 +408,86 @@ void osnma_msg_receiver::read_mack_header() { return; } + uint16_t macseq = 0; + uint8_t cop = 0; + uint64_t first_lt_bits = static_cast(d_mack_message[0]) << (lt_bits - 8); + first_lt_bits += (static_cast(d_mack_message[1]) << (lt_bits - 16)); + if (lt_bits == 20) + { + first_lt_bits += (static_cast(d_mack_message[1] & 0xF0) >> 4); + macseq += (static_cast(d_mack_message[1] & 0x0F) << 8); + macseq += static_cast(d_mack_message[2]); + cop += ((d_mack_message[3] & 0xF0) >> 4); + } + else if (lt_bits == 24) + { + first_lt_bits += static_cast(d_mack_message[2]); + macseq += (static_cast(d_mack_message[3]) << 8); + macseq += (static_cast(d_mack_message[4] & 0xF0) >> 4); + cop += (d_mack_message[4] & 0x0F); + } + else if (lt_bits == 28) + { + first_lt_bits += (static_cast(d_mack_message[2]) << 4); + first_lt_bits += (static_cast(d_mack_message[3] & 0xF0) >> 4); + macseq += (static_cast(d_mack_message[3] & 0x0F) << 8); + macseq += (static_cast(d_mack_message[4])); + cop += ((d_mack_message[5] & 0xF0) >> 4); + } + else if (lt_bits == 32) + { + first_lt_bits += (static_cast(d_mack_message[2]) << 8); + first_lt_bits += static_cast(d_mack_message[3]); + macseq += (static_cast(d_mack_message[4]) << 8); + macseq += (static_cast(d_mack_message[5] & 0xF0) >> 4); + cop += (d_mack_message[5] & 0x0F); + } + else if (lt_bits == 40) + { + first_lt_bits += (static_cast(d_mack_message[2]) << 16); + first_lt_bits += (static_cast(d_mack_message[3]) << 8); + first_lt_bits += static_cast(d_mack_message[4]); + macseq += (static_cast(d_mack_message[5]) << 8); + macseq += (static_cast(d_mack_message[6] & 0xF0) >> 4); + cop += (d_mack_message[6] & 0x0F); + } + d_osnma_data.d_mack_message.header.tag0 = first_lt_bits; + d_osnma_data.d_mack_message.header.macseq = macseq; + d_osnma_data.d_mack_message.header.macseq = cop; } void osnma_msg_receiver::read_mack_info_and_tags() { + uint8_t lt_bits = 0; + const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it != OSNMA_TABLE_11.cend()) + { + lt_bits = it->second; + } + if (lt_bits == 0) + { + return; + } + uint16_t lk_bits = 0; + const auto it2 = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); + if (it2 != OSNMA_TABLE_10.cend()) + { + lk_bits = it2->second; + } + if (lk_bits == 0) + { + return; + } + uint16_t nt = std::floor((480.0 + float(lk_bits)) / (float(lt_bits) + 16.0)); + d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); + for (uint16_t k = 0; k < (nt - 1); k++) + { + d_osnma_data.d_mack_message.tag_and_info[k].tag = 0; + d_osnma_data.d_mack_message.tag_and_info[k].tag_info.PRN_d = 0; + d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = 0; + d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = 0; + } } @@ -478,9 +557,9 @@ std::vector osnma_msg_receiver::computeSHA3_256(const std::vector tag0; - uint16_t macsec{}; + uint64_t tag0{}; + uint16_t macseq{}; uint8_t cop{}; }; -class MACK_tag +class MACK_tag_info { public: - MACK_tag() = default; - std::vector tag; - uint16_t tag_info; + MACK_tag_info() = default; + uint8_t PRN_d{}; + uint8_t ADKD{}; + uint8_t cop{}; }; class MACK_tag_and_info { public: MACK_tag_and_info() = default; - std::vector tags; + uint64_t tag; + MACK_tag_info tag_info; }; class DSM_PKR_message @@ -78,10 +80,10 @@ public: std::array itn; // bitset<1024> std::vector npk; std::vector p_dp; - uint8_t nb_dp; - uint8_t mid; - uint8_t npkt; - uint8_t npktid; + uint8_t nb_dp{}; + uint8_t mid{}; + uint8_t npkt{}; + uint8_t npktid{}; }; class DSM_KROOT_message @@ -112,7 +114,7 @@ class MACK_message public: MACK_message() = default; MACK_header header; - MACK_tag_and_info tag_info; + std::vector tag_and_info; std::vector key; std::vector padding; }; @@ -129,6 +131,7 @@ public: DSM_dsm_header d_dsm_header; DSM_PKR_message d_dsm_pkr_message; DSM_KROOT_message d_dsm_kroot_message; + MACK_message d_mack_message; }; From dafb322018a2584c1a4ca2305389e0e982d633d5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 02:43:34 +0200 Subject: [PATCH 035/499] Read MACK tag and info --- src/core/libs/osnma_msg_receiver.cc | 90 +++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 4 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 9c36a3ac4..d62214848 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -483,10 +483,92 @@ void osnma_msg_receiver::read_mack_info_and_tags() d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); for (uint16_t k = 0; k < (nt - 1); k++) { - d_osnma_data.d_mack_message.tag_and_info[k].tag = 0; - d_osnma_data.d_mack_message.tag_and_info[k].tag_info.PRN_d = 0; - d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = 0; - d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = 0; + uint64_t tag = 0; + uint8_t PRN_d = 0; + uint8_t ADKD = 0; + uint8_t cop = 0; + if (lt_bits == 20) + { + const uint16_t step = std::ceil(4.5 * k); + if (k % 2 == 0) + { + tag += (static_cast((d_mack_message[3 + step] & 0x0F)) << 16); + tag += (static_cast(d_mack_message[4 + step]) << 8); + tag += static_cast(d_mack_message[5 + step]); + PRN_d += d_mack_message[6 + step]; + ADKD += ((d_mack_message[7 + step] & 0xF0) >> 4); + cop += (d_mack_message[7 + step] & 0x0F); + } + else + { + tag += (static_cast(d_mack_message[3 + step]) << 12); + tag += (static_cast(d_mack_message[4 + step]) << 4); + tag += (static_cast((d_mack_message[5 + step] & 0xF0)) >> 4); + PRN_d += (d_mack_message[5 + step] & 0x0F) << 4; + PRN_d += (d_mack_message[6 + step] & 0xF0) >> 4; + ADKD += (d_mack_message[6 + step] & 0x0F); + cop += (d_mack_message[7 + step] & 0xF0) >> 4; + } + } + else if (lt_bits == 24) + { + tag += (static_cast((d_mack_message[5 + k * 5])) << 16); + tag += (static_cast((d_mack_message[6 + k * 5])) << 8); + tag += static_cast(d_mack_message[7 + k * 5]); + PRN_d += d_mack_message[8 + k * 5]; + ADKD += ((d_mack_message[9 + k * 5] & 0xF0) >> 4); + cop += (d_mack_message[9 + k * 5] & 0x0F); + } + else if (lt_bits == 28) + { + const uint16_t step = std::ceil(5.5 * k); + if (k % 2 == 0) + { + tag += (static_cast((d_mack_message[5 + step] & 0x0F)) << 24); + tag += (static_cast(d_mack_message[6 + step]) << 16); + tag += (static_cast(d_mack_message[7 + step]) << 8); + tag += static_cast(d_mack_message[8 + step]); + PRN_d += d_mack_message[9 + step]; + ADKD += ((d_mack_message[10 + step] & 0xF0) >> 4); + cop += (d_mack_message[10 + step] & 0x0F); + } + else + { + tag += (static_cast((d_mack_message[5 + step])) << 20); + tag += (static_cast((d_mack_message[6 + step])) << 12); + tag += (static_cast((d_mack_message[7 + step])) << 4); + tag += (static_cast((d_mack_message[8 + step] & 0xF0)) >> 4); + PRN_d += ((d_mack_message[8 + step] & 0x0F) << 4); + PRN_d += ((d_mack_message[9 + step] & 0xF0) >> 4); + ADKD += (d_mack_message[9 + step] & 0x0F); + cop += ((d_mack_message[10 + step] & 0xF0) >> 4); + } + } + else if (lt_bits == 32) + { + tag += (static_cast((d_mack_message[6 + k * 6])) << 24); + tag += (static_cast((d_mack_message[7 + k * 6])) << 16); + tag += (static_cast((d_mack_message[8 + k * 6])) << 8); + tag += static_cast(d_mack_message[9 + k * 6]); + PRN_d += d_mack_message[10 + k * 6]; + ADKD += ((d_mack_message[11 + k * 6] & 0xF0) >> 4); + cop += (d_mack_message[11 + k * 6] & 0x0F); + } + else if (lt_bits == 40) + { + tag += (static_cast((d_mack_message[7 + k * 7])) << 32); + tag += (static_cast((d_mack_message[8 + k * 7])) << 24); + tag += (static_cast((d_mack_message[9 + k * 7])) << 16); + tag += (static_cast((d_mack_message[10 + k * 7])) << 8); + tag += static_cast(d_mack_message[11 + k * 7]); + PRN_d += d_mack_message[12 + k * 7]; + ADKD += ((d_mack_message[13 + k * 7] & 0xF0) >> 4); + cop += (d_mack_message[13 + k * 7] & 0x0F); + } + d_osnma_data.d_mack_message.tag_and_info[k].tag = tag; + d_osnma_data.d_mack_message.tag_and_info[k].tag_info.PRN_d = PRN_d; + d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = ADKD; + d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; } } From 37fe8eb523bfb8934556a3fc5e11580a7706d71b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 10:19:13 +0200 Subject: [PATCH 036/499] Add more cryptographic functions --- src/core/libs/osnma_msg_receiver.cc | 85 +++++++++++++++++++++++++++++ src/core/libs/osnma_msg_receiver.h | 2 + 2 files changed, 87 insertions(+) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d62214848..75029e95c 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -46,6 +46,7 @@ namespace wht = std; #endif #if USE_OPENSSL_FALLBACK +#include #if USE_OPENSSL_3 #include #define OPENSSL_ENGINE NULL @@ -659,6 +660,90 @@ std::vector osnma_msg_receiver::computeSHA3_256(const std::vector osnma_msg_receiver::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) +{ + std::vector output(32); +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + std::vector hmac(SHA256_DIGEST_LENGTH); // HMAC-SHA256 output size + + // Create HMAC context + EVP_MD_CTX* ctx = EVP_MD_CTX_new(); + HMAC_CTX_reset(ctx); + + // Initialize HMAC context with the key and HMAC algorithm + HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); + + // Update HMAC context with the message + HMAC_Update(ctx, input.data(), input.size()); + + // Finalize HMAC computation and obtain the result + unsigned int hmacLen; + HMAC_Final(ctx, hmac.data(), &hmacLen); + + // Clean up HMAC context + EVP_MD_CTX_free(ctx); + + // Resize the HMAC vector to the actual length + hmac.resize(hmacLen); + output = hmac; +#else + std::vector hmac(SHA256_DIGEST_LENGTH); + // Create HMAC context + HMAC_CTX* ctx = HMAC_CTX_new(); + HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); + + // Update HMAC context with the message + HMAC_Update(ctx, input.data(), input.size()); + + // Finalize HMAC computation + unsigned int hmacLen; + HMAC_Final(ctx, hmac.data(), &hmacLen); + + // Clean up HMAC context + HMAC_CTX_free(ctx); + + // Resize the HMAC vector to the actual length + hmac.resize(hmacLen); + + output = hmac; +#endif +#else + std::vector output_aux(32); + gnutls_hmac_hd_t hmac; + gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); + gnutls_hmac(hmac, input.data(), input.size()); + gnutls_hmac_output(hmac, output_aux.data()); + output = output_aux; + gnutls_hmac_deinit(hmac, output_aux.data()); + +#endif + return output; +} + + +std::vector osnma_msg_receiver::computeCMAC_AES(const std::vector& key, const std::vector& input) +{ + std::vector output(16); +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 +#else +#endif +#else + gnutls_cipher_hd_t cipher; + std::vector mac(16); + std::vector message = input; + gnutls_datum_t key_data = {const_cast(key.data()), static_cast(key.size())}; + gnutls_cipher_init(&cipher, GNUTLS_CIPHER_AES_128_CBC, &key_data, nullptr); + gnutls_cipher_set_iv(cipher, nullptr, 16); // Set IV to zero + gnutls_cipher_encrypt(cipher, message.data(), message.size()); // Encrypt the message with AES-128 + gnutls_cipher_tag(cipher, mac.data(), mac.size()); // Get the CMAC-AES tag + output = mac; + gnutls_cipher_deinit(cipher); +#endif + return output; +} + // bool signature(const std::vector& publicKey, const std::vector& digest, std::vector& signature) // { // bool success = false; diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index beb33f50b..0a182f216 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -71,6 +71,8 @@ private: std::vector computeSHA256(const std::vector& input); std::vector computeSHA3_256(const std::vector& input); + std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); + std::vector computeCMAC_AES(const std::vector& key, const std::vector& input); std::unique_ptr d_dsm_reader; From 3902b6154de81836b4f128b12dcd902fe1bf7e89 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 11:15:15 +0200 Subject: [PATCH 037/499] Add work on crypto functions --- src/core/libs/osnma_msg_receiver.cc | 66 ++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 15 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 75029e95c..27b2553b2 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -51,6 +51,7 @@ namespace wht = std; #include #define OPENSSL_ENGINE NULL #else +#include #include #endif #else @@ -665,30 +666,27 @@ std::vector osnma_msg_receiver::computeHMAC_SHA_256(const std::vector output(32); #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 - std::vector hmac(SHA256_DIGEST_LENGTH); // HMAC-SHA256 output size + std::vector hmac(EVP_MAX_MD_SIZE); - // Create HMAC context + // Create HMAC-SHA256 context EVP_MD_CTX* ctx = EVP_MD_CTX_new(); - HMAC_CTX_reset(ctx); + EVP_PKEY* pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, nullptr, key.data(), key.size()); - // Initialize HMAC context with the key and HMAC algorithm - HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); + // Initialize HMAC-SHA256 context + EVP_DigestSignInit(ctx, nullptr, EVP_sha256(), nullptr, pkey); - // Update HMAC context with the message - HMAC_Update(ctx, input.data(), input.size()); + // Compute HMAC-SHA256 + EVP_DigestSignUpdate(ctx, input.data(), input.size()); + size_t macLength; + EVP_DigestSignFinal(ctx, hmac.data(), &macLength); - // Finalize HMAC computation and obtain the result - unsigned int hmacLen; - HMAC_Final(ctx, hmac.data(), &hmacLen); - - // Clean up HMAC context + EVP_PKEY_free(pkey); EVP_MD_CTX_free(ctx); - // Resize the HMAC vector to the actual length - hmac.resize(hmacLen); + mac.resize(macLength); output = hmac; #else - std::vector hmac(SHA256_DIGEST_LENGTH); + std::vector hmac(32); // Create HMAC context HMAC_CTX* ctx = HMAC_CTX_new(); HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); @@ -727,7 +725,45 @@ std::vector osnma_msg_receiver::computeCMAC_AES(const std::vector output(16); #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 + std::vector mac(EVP_MAX_MD_SIZE); // CMAC-AES output size + + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + + // Initialize CMAC-AES context + EVP_CIPHER_CTX* cmacCtx = EVP_CIPHER_CTX_new(); + EVP_CMAC_CTX* cmac = EVP_CMAC_CTX_new(); + + EVP_CIPHER_CTX_reset(ctx); + EVP_CMAC_CTX_reset(cmac); + + // Set AES-128 CMAC cipher and key + EVP_CMAC_init(cmac, key.data(), key.size(), EVP_aes_128_cbc(), nullptr); + + // Compute CMAC-AES + EVP_CMAC_update(cmac, input.data(), input.size()); + size_t macLength; + EVP_CMAC_final(cmac, mac.data(), &macLength); + + EVP_CIPHER_CTX_free(ctx); + EVP_CMAC_CTX_free(cmac); + + mac.resize(macLength); + output = mac; #else + std::vector mac(CMAC_DIGEST_LENGTH); // CMAC-AES output size + + // Create CMAC context + CMAC_CTX* cmacCtx = CMAC_CTX_new(); + CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr); + + // Compute CMAC-AES + CMAC_Update(cmacCtx, input.data(), input.size()); + CMAC_Final(cmacCtx, mac.data(), nullptr); + + // Clean up CMAC context + CMAC_CTX_free(cmacCtx); + + output = mac; #endif #else gnutls_cipher_hd_t cipher; From a75c2acb31869d0c820fd5edd36b3ba0b470b4d7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 11:19:14 +0200 Subject: [PATCH 038/499] Fix typo --- src/core/libs/osnma_msg_receiver.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 27b2553b2..d284dcd85 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -683,7 +683,7 @@ std::vector osnma_msg_receiver::computeHMAC_SHA_256(const std::vector hmac(32); From d351049eb28d09d60f5439db62479a5e930c24c8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 12:42:21 +0200 Subject: [PATCH 039/499] Read .pem file with gnutls --- src/core/libs/osnma_msg_receiver.cc | 65 ++++++++++++++++++++++++++++- src/core/libs/osnma_msg_receiver.h | 1 + 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d284dcd85..8572ec03d 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -46,17 +47,18 @@ namespace wht = std; #endif #if USE_OPENSSL_FALLBACK +#include #include #if USE_OPENSSL_3 #include #define OPENSSL_ENGINE NULL #else -#include #include #endif #else #include #include +#include #endif osnma_msg_receiver_sptr osnma_msg_receiver_make() @@ -795,4 +797,63 @@ std::vector osnma_msg_receiver::computeCMAC_AES(const std::vector osnma_msg_receiver::readPublicKeyFromPEM(const std::string& filePath) +{ + std::vector publicKey; +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 +#else +#endif +#else + // Open the .pem file + std::ifstream file(filePath); + if (!file) + { + std::cerr << "Failed to open the file: " << filePath << std::endl; + return publicKey; + } + + // Read the contents of the .pem file into a string + std::string pemContents((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + + gnutls_x509_crt_t cert; + gnutls_x509_crt_init(&cert); + + // Import the certificate from the PEM file + gnutls_datum_t pemData; + pemData.data = reinterpret_cast(const_cast(pemContents.data())); + pemData.size = pemContents.size(); + int ret = gnutls_x509_crt_import(cert, &pemData, GNUTLS_X509_FMT_PEM); + if (ret < 0) + { + std::cerr << "Failed to import certificate from PEM file" << std::endl; + gnutls_x509_crt_deinit(cert); + return publicKey; + } + + // Export the public key data + size_t pubkey_data_size = 0; + ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, nullptr, &pubkey_data_size); + if (ret < 0) + { + std::cerr << "Failed to export public key data" << std::endl; + gnutls_x509_crt_deinit(cert); + return publicKey; + } + + publicKey.resize(pubkey_data_size); + ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, publicKey.data(), &pubkey_data_size); + if (ret < 0) + { + std::cerr << "Failed to export public key data" << std::endl; + gnutls_x509_crt_deinit(cert); + return publicKey; + } + + gnutls_x509_crt_deinit(cert); + +#endif + return publicKey; +} \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 0a182f216..149d20b43 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -73,6 +73,7 @@ private: std::vector computeSHA3_256(const std::vector& input); std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); std::vector computeCMAC_AES(const std::vector& key, const std::vector& input); + std::vector readPublicKeyFromPEM(const std::string& filePath); std::unique_ptr d_dsm_reader; From 972ead3cae637939007b4bda7d2b1b4d876ed7d4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 17:21:42 +0200 Subject: [PATCH 040/499] Introducing the crypto bro --- src/core/libs/CMakeLists.txt | 39 --- src/core/libs/osnma_msg_receiver.cc | 309 +---------------- src/core/libs/osnma_msg_receiver.h | 15 +- src/core/receiver/gnss_flowgraph.cc | 4 +- src/core/system_parameters/CMakeLists.txt | 38 ++ src/core/system_parameters/gnss_crypto.cc | 400 ++++++++++++++++++++++ src/core/system_parameters/gnss_crypto.h | 49 +++ 7 files changed, 507 insertions(+), 347 deletions(-) create mode 100644 src/core/system_parameters/gnss_crypto.cc create mode 100644 src/core/system_parameters/gnss_crypto.h diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index c5425d027..1c0c6e811 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -102,45 +102,6 @@ target_link_libraries(core_libs Pugixml::pugixml ) -if(OPENSSL_FOUND) - if(TARGET OpenSSL::SSL) - target_link_libraries(core_libs - PRIVATE - OpenSSL::SSL - ) - else() - target_link_libraries(core_libs - PRIVATE - ${OPENSSL_LIBRARIES} - ) - target_include_directories(core_libs - PRIVATE - ${OPENSSL_INCLUDE_DIR} - ) - endif() - if(OPENSSL_VERSION) - if(OPENSSL_VERSION VERSION_GREATER "3.0.0") - target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_3=1) - endif() - endif() -else() - target_link_libraries(core_libs - PRIVATE - ${GNUTLS_LIBRARIES} - ${GNUTLS_OPENSSL_LIBRARY} - ) - target_include_directories(core_libs - PRIVATE - ${GNUTLS_INCLUDE_DIR} - ) -endif() - - - -if(OPENSSL_FOUND) - target_compile_definitions(core_libs PRIVATE -DUSE_OPENSSL_FALLBACK=1) -endif() - if(USE_GENERIC_LAMBDAS AND NOT GNURADIO_USES_STD_POINTERS) target_link_libraries(core_libs PUBLIC Boost::headers) else() diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 8572ec03d..c8cd9e372 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -19,18 +19,15 @@ #include "osnma_msg_receiver.h" #include "Galileo_OSNMA.h" +#include "gnss_crypto.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include // for DLOG #include // for gr::io_signature::make -#include #include #include #include -#include #include -#include #include -#include #include // for typeid #if HAS_GENERIC_LAMBDA @@ -46,33 +43,21 @@ namespace wht = boost; namespace wht = std; #endif -#if USE_OPENSSL_FALLBACK -#include -#include -#if USE_OPENSSL_3 -#include -#define OPENSSL_ENGINE NULL -#else -#include -#endif -#else -#include -#include -#include -#endif -osnma_msg_receiver_sptr osnma_msg_receiver_make() +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath) { - return osnma_msg_receiver_sptr(new osnma_msg_receiver()); + return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath)); } -osnma_msg_receiver::osnma_msg_receiver() : gr::block("osnma_msg_receiver", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) +osnma_msg_receiver::osnma_msg_receiver( + const std::string& pemFilePath) : gr::block("osnma_msg_receiver", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); - // register OSNMA input message port from telemetry blocks + d_crypto = std::make_unique(pemFilePath); + // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block this->message_port_register_out(pmt::mp("OSNMA_to_PVT")); @@ -291,11 +276,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg std::vector hash; if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. { - hash = computeSHA256(MSG); + hash = d_crypto->computeSHA256(MSG); } else if (d_osnma_data.d_dsm_kroot_message.hf == 2) { - hash = computeSHA3_256(MSG); + hash = d_crypto->computeSHA3_256(MSG); } else { @@ -585,275 +570,3 @@ void osnma_msg_receiver::read_mack_key() void osnma_msg_receiver::read_mack_padding() { } - - -std::vector osnma_msg_receiver::computeSHA256(const std::vector& input) -{ - std::vector output(32); // SHA256 hash size -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 - // unsigned char mdVal[EVP_MAX_MD_SIZE]; - // unsigned char* md; - unsigned int mdLen; - EVP_MD_CTX* mdCtx = EVP_MD_CTX_new(); - if (!EVP_DigestInit_ex(mdCtx, EVP_sha256(), OPENSSL_ENGINE)) - { - LOG(WARNING) << "OSNMA SHA-256: Message digest initialization failed."; - EVP_MD_CTX_free(mdCtx); - return output; - } - if (!EVP_DigestUpdate(mdCtx, input.data(), input.size())) - { - LOG(WARNING) << "OSNMA SHA-256: Message digest update failed."; - EVP_MD_CTX_free(mdCtx); - return output; - } - if (!EVP_DigestFinal_ex(mdCtx, output.data(), &mdLen)) - { - LOG(WARNING) << "OSNMA SHA-256: Message digest finalization failed."; - EVP_MD_CTX_free(mdCtx); - return output; - } - EVP_MD_CTX_free(mdCtx); - // md = mdVal; -#else - SHA256_CTX sha256Context; - SHA256_Init(&sha256Context); - SHA256_Update(&sha256Context, input.data(), input.size()); - SHA256_Final(output.data(), &sha256Context); -#endif -#else - std::vector output_aux(32); - gnutls_hash_hd_t hashHandle; - gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); - gnutls_hash(hashHandle, input.data(), input.size()); - gnutls_hash_output(hashHandle, output_aux.data()); - output = output_aux; - gnutls_hash_deinit(hashHandle, output_aux.data()); -#endif - return output; -} - - -std::vector osnma_msg_receiver::computeSHA3_256(const std::vector& input) -{ - std::vector output(32); // SHA256 hash size -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 - EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); - const EVP_MD* md = EVP_sha3_256(); - - EVP_DigestInit_ex(mdctx, md, nullptr); - EVP_DigestUpdate(mdctx, input.data(), input.size()); - EVP_DigestFinal_ex(mdctx, output.data(), nullptr); - EVP_MD_CTX_free(mdctx); -#else - // SHA3-256 not implemented in OpenSSL < 3.0 -#endif -#else - std::vector output_aux(32); - gnutls_hash_hd_t hashHandle; - gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); - gnutls_hash(hashHandle, input.data(), input.size()); - gnutls_hash_output(hashHandle, output_aux.data()); - output = output_aux; - gnutls_hash_deinit(hashHandle, output_aux.data()); -#endif - return output; -} - - -std::vector osnma_msg_receiver::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) -{ - std::vector output(32); -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 - std::vector hmac(EVP_MAX_MD_SIZE); - - // Create HMAC-SHA256 context - EVP_MD_CTX* ctx = EVP_MD_CTX_new(); - EVP_PKEY* pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, nullptr, key.data(), key.size()); - - // Initialize HMAC-SHA256 context - EVP_DigestSignInit(ctx, nullptr, EVP_sha256(), nullptr, pkey); - - // Compute HMAC-SHA256 - EVP_DigestSignUpdate(ctx, input.data(), input.size()); - size_t macLength; - EVP_DigestSignFinal(ctx, hmac.data(), &macLength); - - EVP_PKEY_free(pkey); - EVP_MD_CTX_free(ctx); - - hmac.resize(macLength); - output = hmac; -#else - std::vector hmac(32); - // Create HMAC context - HMAC_CTX* ctx = HMAC_CTX_new(); - HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); - - // Update HMAC context with the message - HMAC_Update(ctx, input.data(), input.size()); - - // Finalize HMAC computation - unsigned int hmacLen; - HMAC_Final(ctx, hmac.data(), &hmacLen); - - // Clean up HMAC context - HMAC_CTX_free(ctx); - - // Resize the HMAC vector to the actual length - hmac.resize(hmacLen); - - output = hmac; -#endif -#else - std::vector output_aux(32); - gnutls_hmac_hd_t hmac; - gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); - gnutls_hmac(hmac, input.data(), input.size()); - gnutls_hmac_output(hmac, output_aux.data()); - output = output_aux; - gnutls_hmac_deinit(hmac, output_aux.data()); - -#endif - return output; -} - - -std::vector osnma_msg_receiver::computeCMAC_AES(const std::vector& key, const std::vector& input) -{ - std::vector output(16); -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 - std::vector mac(EVP_MAX_MD_SIZE); // CMAC-AES output size - - EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); - - // Initialize CMAC-AES context - EVP_CIPHER_CTX* cmacCtx = EVP_CIPHER_CTX_new(); - EVP_CMAC_CTX* cmac = EVP_CMAC_CTX_new(); - - EVP_CIPHER_CTX_reset(ctx); - EVP_CMAC_CTX_reset(cmac); - - // Set AES-128 CMAC cipher and key - EVP_CMAC_init(cmac, key.data(), key.size(), EVP_aes_128_cbc(), nullptr); - - // Compute CMAC-AES - EVP_CMAC_update(cmac, input.data(), input.size()); - size_t macLength; - EVP_CMAC_final(cmac, mac.data(), &macLength); - - EVP_CIPHER_CTX_free(ctx); - EVP_CMAC_CTX_free(cmac); - - mac.resize(macLength); - output = mac; -#else - std::vector mac(CMAC_DIGEST_LENGTH); // CMAC-AES output size - - // Create CMAC context - CMAC_CTX* cmacCtx = CMAC_CTX_new(); - CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr); - - // Compute CMAC-AES - CMAC_Update(cmacCtx, input.data(), input.size()); - CMAC_Final(cmacCtx, mac.data(), nullptr); - - // Clean up CMAC context - CMAC_CTX_free(cmacCtx); - - output = mac; -#endif -#else - gnutls_cipher_hd_t cipher; - std::vector mac(16); - std::vector message = input; - gnutls_datum_t key_data = {const_cast(key.data()), static_cast(key.size())}; - gnutls_cipher_init(&cipher, GNUTLS_CIPHER_AES_128_CBC, &key_data, nullptr); - gnutls_cipher_set_iv(cipher, nullptr, 16); // Set IV to zero - gnutls_cipher_encrypt(cipher, message.data(), message.size()); // Encrypt the message with AES-128 - gnutls_cipher_tag(cipher, mac.data(), mac.size()); // Get the CMAC-AES tag - output = mac; - gnutls_cipher_deinit(cipher); -#endif - return output; -} - -// bool signature(const std::vector& publicKey, const std::vector& digest, std::vector& signature) -// { -// bool success = false; -// #if USE_OPENSSL_FALLBACK -// #else -// gnutls_global_init(); -// int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data, digest.size(), signature.data(), signature.size()); -// success = (result == GNUTLS_E_SUCCESS); -// gnutls_global_deinit(); -// #endif -// return success; -// } -// bool verifyDigitalSignature(const unsigned char* signature, size_t signatureSize, const unsigned char* message, size_t messageSize, gnutls_pubkey_t publicKey) -// { -// int verificationStatus = gnutls_pubkey_verify_data(publicKey, GNUTLS_DIG_SHA256, 0, message, messageSize, signature, signatureSize); -// return verificationStatus == 0; - -std::vector osnma_msg_receiver::readPublicKeyFromPEM(const std::string& filePath) -{ - std::vector publicKey; -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 -#else -#endif -#else - // Open the .pem file - std::ifstream file(filePath); - if (!file) - { - std::cerr << "Failed to open the file: " << filePath << std::endl; - return publicKey; - } - - // Read the contents of the .pem file into a string - std::string pemContents((std::istreambuf_iterator(file)), std::istreambuf_iterator()); - - gnutls_x509_crt_t cert; - gnutls_x509_crt_init(&cert); - - // Import the certificate from the PEM file - gnutls_datum_t pemData; - pemData.data = reinterpret_cast(const_cast(pemContents.data())); - pemData.size = pemContents.size(); - int ret = gnutls_x509_crt_import(cert, &pemData, GNUTLS_X509_FMT_PEM); - if (ret < 0) - { - std::cerr << "Failed to import certificate from PEM file" << std::endl; - gnutls_x509_crt_deinit(cert); - return publicKey; - } - - // Export the public key data - size_t pubkey_data_size = 0; - ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, nullptr, &pubkey_data_size); - if (ret < 0) - { - std::cerr << "Failed to export public key data" << std::endl; - gnutls_x509_crt_deinit(cert); - return publicKey; - } - - publicKey.resize(pubkey_data_size); - ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, publicKey.data(), &pubkey_data_size); - if (ret < 0) - { - std::cerr << "Failed to export public key data" << std::endl; - gnutls_x509_crt_deinit(cert); - return publicKey; - } - - gnutls_x509_crt_deinit(cert); - -#endif - return publicKey; -} \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 149d20b43..831ca29ab 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -27,6 +27,7 @@ #include // for pmt::pmt_t #include // for std::array #include // for std::shared_ptr +#include #include /** \addtogroup Core @@ -35,11 +36,12 @@ * \{ */ class OSNMA_DSM_Reader; +class Gnss_Crypto; class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; -osnma_msg_receiver_sptr osnma_msg_receiver_make(); +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath); /*! * \brief GNU Radio block that receives asynchronous OSNMA messages @@ -53,8 +55,8 @@ public: ~osnma_msg_receiver() = default; //!< Default destructor private: - friend osnma_msg_receiver_sptr osnma_msg_receiver_make(); - osnma_msg_receiver(); + friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath); + osnma_msg_receiver(const std::string& pemFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); @@ -69,13 +71,8 @@ private: void read_mack_key(); void read_mack_padding(); - std::vector computeSHA256(const std::vector& input); - std::vector computeSHA3_256(const std::vector& input); - std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); - std::vector computeCMAC_AES(const std::vector& key, const std::vector& input); - std::vector readPublicKeyFromPEM(const std::string& filePath); - std::unique_ptr d_dsm_reader; + std::unique_ptr d_crypto; std::array, 16> d_dsm_message{}; std::array, 16> d_dsm_id_received{}; diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 4fde5eea3..7d17fa1b0 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -118,7 +118,9 @@ void GNSSFlowgraph::init() if (configuration_->property("Channels_1B.count", 0) > 0) { enable_osnma_rx_ = true; - osnma_rx_ = osnma_msg_receiver_make(); + const std::string pemfile_default("./OSNMA_PublicKey_20210920133026.pem"); + auto pemFilePath = configuration_->property("GNSS-SDR.OSNMA_pem", pemfile_default); + osnma_rx_ = osnma_msg_receiver_make(pemFilePath); } else { diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 3f2e2a167..a39e45c6c 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -7,6 +7,7 @@ set(SYSTEM_PARAMETERS_SOURCES gnss_almanac.cc + gnss_crypto.cc gnss_ephemeris.cc gnss_satellite.cc gnss_signal.cc @@ -34,6 +35,7 @@ set(SYSTEM_PARAMETERS_SOURCES set(SYSTEM_PARAMETERS_HEADERS gnss_almanac.h + gnss_crypto.h gnss_ephemeris.h gnss_satellite.h gnss_signal.h @@ -130,6 +132,42 @@ target_include_directories(core_system_parameters ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) +if(OPENSSL_FOUND) + if(TARGET OpenSSL::SSL) + target_link_libraries(core_system_parameters + PRIVATE + OpenSSL::SSL + ) + else() + target_link_libraries(core_system_parameters + PRIVATE + ${OPENSSL_LIBRARIES} + ) + target_include_directories(core_system_parameters + PRIVATE + ${OPENSSL_INCLUDE_DIR} + ) + endif() + if(OPENSSL_VERSION) + if(OPENSSL_VERSION VERSION_GREATER "3.0.0") + target_compile_definitions(core_system_parameters PRIVATE -DUSE_OPENSSL_3=1) + endif() + endif() +else() + target_link_libraries(core_system_parameters + PRIVATE + ${GNUTLS_LIBRARIES} + ${GNUTLS_OPENSSL_LIBRARY} + ) + target_include_directories(core_system_parameters + PRIVATE + ${GNUTLS_INCLUDE_DIR} + ) +endif() +if(OPENSSL_FOUND) + target_compile_definitions(core_system_parameters PRIVATE -DUSE_OPENSSL_FALLBACK=1) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(core_system_parameters diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc new file mode 100644 index 000000000..7f65f081b --- /dev/null +++ b/src/core/system_parameters/gnss_crypto.cc @@ -0,0 +1,400 @@ +/*! + * \file gnss_crypto.cc + * \brief Class for computing cryptografic functions + * \author Carles Fernandez, 2023. cfernandez(at)cttc.es + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "gnss_crypto.h" +#include +#include +#include +#include + +#if USE_OPENSSL_FALLBACK +#include +#include +#include +#if USE_OPENSSL_3 +#include +#define OPENSSL_ENGINE NULL +#else +#include +#include +#endif +#else +#include +#include +#include +#endif + +Gnss_Crypto::Gnss_Crypto(const std::string& filePath) +{ + d_PublicKey = readPublicKeyFromPEM(filePath); +} + + +std::vector Gnss_Crypto::computeSHA256(const std::vector& input) +{ + std::vector output(32); // SHA256 hash size +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + unsigned int mdLen; + EVP_MD_CTX* mdCtx = EVP_MD_CTX_new(); + if (!EVP_DigestInit_ex(mdCtx, EVP_sha256(), OPENSSL_ENGINE)) + { + // LOG(WARNING) << "OSNMA SHA-256: Message digest initialization failed."; + EVP_MD_CTX_free(mdCtx); + return output; + } + if (!EVP_DigestUpdate(mdCtx, input.data(), input.size())) + { + // LOG(WARNING) << "OSNMA SHA-256: Message digest update failed."; + EVP_MD_CTX_free(mdCtx); + return output; + } + if (!EVP_DigestFinal_ex(mdCtx, output.data(), &mdLen)) + { + // LOG(WARNING) << "OSNMA SHA-256: Message digest finalization failed."; + EVP_MD_CTX_free(mdCtx); + return output; + } + EVP_MD_CTX_free(mdCtx); +#else + SHA256_CTX sha256Context; + SHA256_Init(&sha256Context); + SHA256_Update(&sha256Context, input.data(), input.size()); + SHA256_Final(output.data(), &sha256Context); +#endif +#else + std::vector output_aux(32); + gnutls_hash_hd_t hashHandle; + gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); + gnutls_hash(hashHandle, input.data(), input.size()); + gnutls_hash_output(hashHandle, output_aux.data()); + output = output_aux; + gnutls_hash_deinit(hashHandle, output_aux.data()); +#endif + return output; +} + + +std::vector Gnss_Crypto::computeSHA3_256(const std::vector& input) +{ + std::vector output(32); // SHA256 hash size +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); + const EVP_MD* md = EVP_sha3_256(); + + EVP_DigestInit_ex(mdctx, md, nullptr); + EVP_DigestUpdate(mdctx, input.data(), input.size()); + EVP_DigestFinal_ex(mdctx, output.data(), nullptr); + EVP_MD_CTX_free(mdctx); +#else + // SHA3-256 not implemented in OpenSSL < 3.0 +#endif +#else + std::vector output_aux(32); + gnutls_hash_hd_t hashHandle; + gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); + gnutls_hash(hashHandle, input.data(), input.size()); + gnutls_hash_output(hashHandle, output_aux.data()); + output = output_aux; + gnutls_hash_deinit(hashHandle, output_aux.data()); +#endif + return output; +} + + +std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) +{ + std::vector output(32); +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + std::vector hmac(EVP_MAX_MD_SIZE); + + // Create HMAC-SHA256 context + EVP_MD_CTX* ctx = EVP_MD_CTX_new(); + EVP_PKEY* pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, nullptr, key.data(), key.size()); + + // Initialize HMAC-SHA256 context + EVP_DigestSignInit(ctx, nullptr, EVP_sha256(), nullptr, pkey); + + // Compute HMAC-SHA256 + EVP_DigestSignUpdate(ctx, input.data(), input.size()); + size_t macLength; + EVP_DigestSignFinal(ctx, hmac.data(), &macLength); + + EVP_PKEY_free(pkey); + EVP_MD_CTX_free(ctx); + + hmac.resize(macLength); + output = hmac; +#else + std::vector hmac(32); + // Create HMAC context + HMAC_CTX* ctx = HMAC_CTX_new(); + HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); + + // Update HMAC context with the message + HMAC_Update(ctx, input.data(), input.size()); + + // Finalize HMAC computation + unsigned int hmacLen; + HMAC_Final(ctx, hmac.data(), &hmacLen); + + // Clean up HMAC context + HMAC_CTX_free(ctx); + + // Resize the HMAC vector to the actual length + hmac.resize(hmacLen); + + output = hmac; +#endif +#else + std::vector output_aux(32); + gnutls_hmac_hd_t hmac; + gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); + gnutls_hmac(hmac, input.data(), input.size()); + gnutls_hmac_output(hmac, output_aux.data()); + output = output_aux; + gnutls_hmac_deinit(hmac, output_aux.data()); + +#endif + return output; +} + + +std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& key, const std::vector& input) +{ + std::vector output(16); +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + std::vector mac(EVP_MAX_MD_SIZE); // CMAC-AES output size + + EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); + EVP_MAC* cmac = EVP_MAC_fetch(NULL, "CMAC-AES", NULL); + + EVP_MAC_CTX* cmacCtx = EVP_MAC_CTX_new(cmac); + + OSSL_PARAM params[4]; + params[0] = OSSL_PARAM_construct_utf8_string("key", (char*)key.data(), key.size()); + params[1] = OSSL_PARAM_construct_octet_string("iv", NULL, 0); // Set IV to NULL + params[2] = OSSL_PARAM_construct_octet_string("aad", NULL, 0); // Set AAD to NULL + params[3] = OSSL_PARAM_construct_end(); + + // Set AES-128 CMAC cipher and key + EVP_MAC_init(cmacCtx, nullptr, 0, params); + + // Compute CMAC-AES + EVP_MAC_update(cmacCtx, input.data(), input.size()); + size_t macLength = mac.size(); + size_t outputLength = 16; + + EVP_MAC_final(cmacCtx, mac.data(), &macLength, outputLength); + + EVP_MAC_free(cmac); + EVP_MAC_CTX_free(cmacCtx); + EVP_CIPHER_CTX_free(ctx); + + mac.resize(macLength); + output = mac; +#else + std::vector mac(16); // CMAC-AES output size + + // Create CMAC context + CMAC_CTX* cmacCtx = CMAC_CTX_new(); + CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr); + + // Compute CMAC-AES + CMAC_Update(cmacCtx, input.data(), input.size()); + CMAC_Final(cmacCtx, mac.data(), nullptr); + + // Clean up CMAC context + CMAC_CTX_free(cmacCtx); + + output = mac; +#endif +#else + gnutls_cipher_hd_t cipher; + std::vector mac(16); + std::vector message = input; + gnutls_datum_t key_data = {const_cast(key.data()), static_cast(key.size())}; + gnutls_cipher_init(&cipher, GNUTLS_CIPHER_AES_128_CBC, &key_data, nullptr); + gnutls_cipher_set_iv(cipher, nullptr, 16); // Set IV to zero + gnutls_cipher_encrypt(cipher, message.data(), message.size()); // Encrypt the message with AES-128 + gnutls_cipher_tag(cipher, mac.data(), mac.size()); // Get the CMAC-AES tag + output = mac; + gnutls_cipher_deinit(cipher); +#endif + return output; +} + + +std::vector Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) +{ + std::vector publicKey; + // Open the .pem file + std::ifstream pemFile(filePath); + if (!pemFile) + { + std::cerr << "Failed to open the file: " << filePath << std::endl; + return publicKey; + } +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + // Read the contents of the file into a string + std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); + + // Create a BIO object from the string data + BIO* bio = BIO_new_mem_buf(pemContent.c_str(), pemContent.length()); + if (!bio) + { + // Handle BIO creation error + pemFile.close(); + // ... + } + + // Read the PEM data from the BIO + EVP_PKEY* evpKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); + if (!evpKey) + { + // Handle PEM reading error + BIO_free(bio); + pemFile.close(); + // ... + } + + // Create a memory BIO to write the public key data + BIO* memBio = BIO_new(BIO_s_mem()); + if (!memBio) + { + // Handle memory BIO creation error + EVP_PKEY_free(evpKey); + BIO_free(bio); + pemFile.close(); + // ... + } + + // Write the public key to the memory BIO + int result = PEM_write_bio_PUBKEY(memBio, evpKey); + if (result != 1) + { + // Handle public key writing error + BIO_free(memBio); + EVP_PKEY_free(evpKey); + BIO_free(bio); + pemFile.close(); + // ... + } + + // Get the pointer to the memory BIO data and its length + char* bioData; + long bioDataLength = BIO_get_mem_data(memBio, &bioData); + + // Copy the public key data to the vector + publicKey.assign(bioData, bioData + bioDataLength); + + // Free resources + BIO_free(memBio); + EVP_PKEY_free(evpKey); + BIO_free(bio); + pemFile.close(); +#else + // Read the PEM file contents into a string + std::string pemContents((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); + + // Create a BIO object to hold the PEM data + BIO* bio = BIO_new_mem_buf(pemContents.c_str(), -1); + + // Load the public key from the BIO + RSA* rsa = PEM_read_bio_RSA_PUBKEY(bio, nullptr, nullptr, nullptr); + BIO_free(bio); + + if (rsa == nullptr) + { + // Handle error reading public key + return {}; + } + + // Get the RSA modulus and convert it to a vector of uint8_t + const BIGNUM* rsaModulus = nullptr; + RSA_get0_key(rsa, &rsaModulus, nullptr, nullptr); + + BN_bn2bin(rsaModulus, publicKey.data()); + + // Clean up the RSA object + RSA_free(rsa); +#endif +#else + // Read the contents of the .pem file into a string + std::string pemContents((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); + + gnutls_x509_crt_t cert; + gnutls_x509_crt_init(&cert); + + // Import the certificate from the PEM file + gnutls_datum_t pemData; + pemData.data = reinterpret_cast(const_cast(pemContents.data())); + pemData.size = pemContents.size(); + int ret = gnutls_x509_crt_import(cert, &pemData, GNUTLS_X509_FMT_PEM); + if (ret < 0) + { + std::cerr << "Failed to import certificate from PEM file" << std::endl; + gnutls_x509_crt_deinit(cert); + return publicKey; + } + + // Export the public key data + size_t pubkey_data_size = 0; + ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, nullptr, &pubkey_data_size); + if (ret < 0) + { + std::cerr << "Failed to export public key data" << std::endl; + gnutls_x509_crt_deinit(cert); + return publicKey; + } + + publicKey.resize(pubkey_data_size); + ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, publicKey.data(), &pubkey_data_size); + if (ret < 0) + { + std::cerr << "Failed to export public key data" << std::endl; + gnutls_x509_crt_deinit(cert); + return publicKey; + } + + gnutls_x509_crt_deinit(cert); +#endif + return publicKey; +} + + + +// // bool signature(const std::vector& publicKey, const std::vector& digest, std::vector& signature) +// // { +// // bool success = false; +// // #if USE_OPENSSL_FALLBACK +// // #else +// // gnutls_global_init(); +// // int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data, digest.size(), signature.data(), signature.size()); +// // success = (result == GNUTLS_E_SUCCESS); +// // gnutls_global_deinit(); +// // #endif +// // return success; +// // } +// // bool verifyDigitalSignature(const unsigned char* signature, size_t signatureSize, const unsigned char* message, size_t messageSize, gnutls_pubkey_t publicKey) +// // { +// // int verificationStatus = gnutls_pubkey_verify_data(publicKey, GNUTLS_DIG_SHA256, 0, message, messageSize, signature, signatureSize); +// // return verificationStatus == 0; diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h new file mode 100644 index 000000000..5dc20f4c3 --- /dev/null +++ b/src/core/system_parameters/gnss_crypto.h @@ -0,0 +1,49 @@ +/*! + * \file gnss_crypto.h + * \brief Class for computing cryptografic functions + * \author Carles Fernandez, 2023. cfernandez(at)cttc.es + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_GNSS_CRYPTO_H +#define GNSS_SDR_GNSS_CRYPTO_H + +#include +#include +#include + + +/** \addtogroup Core + * \{ */ +/** \addtogroup System_Parameters + * \{ */ + + +class Gnss_Crypto +{ +public: + Gnss_Crypto() = default; + Gnss_Crypto(const std::string& filePath); + std::vector computeSHA256(const std::vector& input); + std::vector computeSHA3_256(const std::vector& input); + std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); + std::vector computeCMAC_AES(const std::vector& key, const std::vector& input); + std::vector readPublicKeyFromPEM(const std::string& filePath); + +private: + std::vector d_PublicKey; +}; + +/** \} */ +/** \} */ +#endif // GNSS_SDR_GNSS_CRYPTO_H \ No newline at end of file From 84cc4c79abf4a6f0137998a3b4278bf93b2ee037 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 17:31:10 +0200 Subject: [PATCH 041/499] Fix cpplint job --- src/core/libs/osnma_msg_receiver.h | 2 +- src/core/system_parameters/gnss_crypto.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 831ca29ab..4310a1bee 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -56,7 +56,7 @@ public: private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath); - osnma_msg_receiver(const std::string& pemFilePath); + explicit osnma_msg_receiver(const std::string& pemFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 5dc20f4c3..1eba17f7e 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -33,7 +33,7 @@ class Gnss_Crypto { public: Gnss_Crypto() = default; - Gnss_Crypto(const std::string& filePath); + explicit Gnss_Crypto(const std::string& filePath); std::vector computeSHA256(const std::vector& input); std::vector computeSHA3_256(const std::vector& input); std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); From ddbbcd8d970534d3f36a7ab1ef9479fd73dc4199 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 17:44:46 +0200 Subject: [PATCH 042/499] Fix clang-format --- src/core/system_parameters/gnss_crypto.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 7f65f081b..9f167de62 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -381,7 +381,6 @@ std::vector Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePa } - // // bool signature(const std::vector& publicKey, const std::vector& digest, std::vector& signature) // // { // // bool success = false; From 94d1df62c058f7370aadf2b11ed641a565fc54b4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 18:12:27 +0200 Subject: [PATCH 043/499] Remove unused file --- src/core/system_parameters/CMakeLists.txt | 1 - src/core/system_parameters/gnss_crypto.cc | 12 ++++++++++++ src/core/system_parameters/gnss_crypto.h | 2 ++ src/core/system_parameters/osnma_data.cc | 17 ----------------- 4 files changed, 14 insertions(+), 18 deletions(-) delete mode 100644 src/core/system_parameters/osnma_data.cc diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index a39e45c6c..f321ab52c 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -29,7 +29,6 @@ set(SYSTEM_PARAMETERS_SOURCES glonass_gnav_utc_model.cc glonass_gnav_navigation_message.cc reed_solomon.cc - osnma_data.cc osnma_dsm_reader.cc ) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 9f167de62..0faa6d096 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -44,6 +44,18 @@ Gnss_Crypto::Gnss_Crypto(const std::string& filePath) } +bool Gnss_Crypto::have_public_key() const +{ + return !d_PublicKey.empty(); +} + + +void Gnss_Crypto::set_public_key(const std::vector& publickey) +{ + d_PublicKey = publickey; +} + + std::vector Gnss_Crypto::computeSHA256(const std::vector& input) { std::vector output(32); // SHA256 hash size diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 1eba17f7e..b6151454c 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -34,6 +34,8 @@ class Gnss_Crypto public: Gnss_Crypto() = default; explicit Gnss_Crypto(const std::string& filePath); + bool have_public_key() const; + void set_public_key(const std::vector& publickey); std::vector computeSHA256(const std::vector& input); std::vector computeSHA3_256(const std::vector& input); std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc deleted file mode 100644 index dde58b44a..000000000 --- a/src/core/system_parameters/osnma_data.cc +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * \file osnma_data.cc - * \brief Class for Galileo OSNMA data storage - * \author Carles Fernandez-Prades, 2020-2023 cfernandez(at)cttc.es - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "osnma_data.h" From 274857a1a4e45c580ca5e6ae54c53b0f9e9b9b19 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Jun 2023 20:16:13 +0200 Subject: [PATCH 044/499] Use nullptr instead of null --- src/core/system_parameters/gnss_crypto.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 0faa6d096..89fdc9e01 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -27,7 +27,7 @@ #include #if USE_OPENSSL_3 #include -#define OPENSSL_ENGINE NULL +#define OPENSSL_ENGINE nullptr #else #include #include @@ -196,14 +196,14 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke std::vector mac(EVP_MAX_MD_SIZE); // CMAC-AES output size EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); - EVP_MAC* cmac = EVP_MAC_fetch(NULL, "CMAC-AES", NULL); + EVP_MAC* cmac = EVP_MAC_fetch(nullptr, "CMAC-AES", nullptr); EVP_MAC_CTX* cmacCtx = EVP_MAC_CTX_new(cmac); OSSL_PARAM params[4]; params[0] = OSSL_PARAM_construct_utf8_string("key", (char*)key.data(), key.size()); - params[1] = OSSL_PARAM_construct_octet_string("iv", NULL, 0); // Set IV to NULL - params[2] = OSSL_PARAM_construct_octet_string("aad", NULL, 0); // Set AAD to NULL + params[1] = OSSL_PARAM_construct_octet_string("iv", nullptr, 0); // Set IV to nullptr + params[2] = OSSL_PARAM_construct_octet_string("aad", nullptr, 0); // Set AAD to nullptr params[3] = OSSL_PARAM_construct_end(); // Set AES-128 CMAC cipher and key From a7e822166fd89d9383c4196769a9e7efe102fe9b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Jun 2023 16:14:00 +0200 Subject: [PATCH 045/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 47 ++++++++++++++----- src/core/libs/osnma_msg_receiver.h | 2 +- .../system_parameters/galileo_inav_message.cc | 8 ++++ .../system_parameters/galileo_inav_message.h | 2 + 4 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index c8cd9e372..8e9641a4c 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -85,6 +85,14 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); + std::cout << "Galileo OSNMA: Subframe received at " + << "WN=" + << nma_msg->WN_sf0 + << ", TOW=" + << nma_msg->TOW_sf0 + << ", from SVID=" + << nma_msg->PRN + << std::endl; process_osnma_message(nma_msg); } else @@ -133,6 +141,9 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID LOG(WARNING) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); LOG(WARNING) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); + std::cout << "Galileo OSNMA: Received block " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) + << " from DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) + << std::endl; } @@ -144,12 +155,6 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][SIZE_DSM_BLOCKS_BYTES * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; index++; } - std::cout << "dsm_message:"; - for (auto c : d_dsm_message[d_osnma_data.d_dsm_header.dsm_id]) - { - std::cout << " " << static_cast(c); - } - std::cout << std::endl; if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { // Get number of blocks in message @@ -187,6 +192,20 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; + std::cout << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; + for (auto id_received : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) + { + if (id_received == 0) + { + std::cout << "- "; + } + else + { + std::cout << "X "; + } + } + std::cout << "]" << std::endl; + // is message complete? -> Process DSM message if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cbegin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cend(), 0))) @@ -201,12 +220,12 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; - process_dsm_message(dsm_msg, osnma_msg->hkroot[0]); + process_dsm_message(dsm_msg, osnma_msg); } } -void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, uint8_t nma_header) +void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg) { if (d_osnma_data.d_dsm_header.dsm_id < 12) { @@ -254,7 +273,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((l_lk_bytes * 8.0) + l_ds_bits) / 104.0); if (l_dk_bits != check_l_dk) { - std::cout << "OSNMA: Failed length reading" << std::endl; + std::cout << "Galileo OSNMA: Failed length reading" << std::endl; } else { @@ -262,7 +281,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; MSG.reserve(size_m + l_ds_bytes + 1); - MSG.push_back(nma_header); + MSG.push_back(osnma_msg->hkroot[0]); for (uint16_t i = 1; i < size_m; i++) { MSG.push_back(dsm_msg[i]); @@ -297,7 +316,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { LOG(WARNING) << "OSNMA: DSM-KROOT message received ok."; - std::cout << "OSNMA: DSM-KROOT message validated" << std::endl; + std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) + << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) + << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) + << " validated" << std::endl; } // Validate signature } @@ -342,7 +365,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t check_l_dp = 104 * std::ceil(static_cast(1040.0 + l_npk * 8.0) / 104.0); if (l_dp != check_l_dp) { - std::cout << "OSNMA: Failed length reading" << std::endl; + std::cout << "Galileo OSNMA: Failed length reading" << std::endl; } else { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 4310a1bee..bf8a87b10 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -64,7 +64,7 @@ private: void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); void read_mack_block(const std::shared_ptr& osnma_msg); - void process_dsm_message(const std::vector& dsm_msg, uint8_t nma_header); + void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_info_and_tags(); diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 48d973d97..13c843194 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1422,6 +1422,14 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) OSNMA_msg Galileo_Inav_Message::get_osnma_msg() { nma_position_filled = std::array{}; + // Fill TOW and WN + nma_msg.WN_sf0 = WN_0; + int32_t TOW_sf0 = TOW_5 - 24; + if (TOW_sf0 < 0) + { + TOW_sf0 += 604800; + } + nma_msg.TOW_sf0 = static_cast(TOW_sf0); return nma_msg; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 043b05a14..1ed9a8ae9 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -47,6 +47,8 @@ public: std::array mack{}; std::array hkroot{}; uint32_t PRN{}; + uint32_t WN_sf0{}; + uint32_t TOW_sf0{}; }; /*! From 46442ee0fc9c9a57976e71c3e394d8d9350a167f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Jun 2023 16:30:26 +0200 Subject: [PATCH 046/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 8e9641a4c..4e3962ab0 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -193,15 +193,32 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; std::cout << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; - for (auto id_received : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) + if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) { - if (id_received == 0) + for (auto id_received : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) { - std::cout << "- "; + if (id_received == 0) + { + std::cout << "- "; + } + else + { + std::cout << "X "; + } } - else + } + else + { + for (uint8_t k = 0; k < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; k++) { - std::cout << "X "; + if (d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][k] == 0) + { + std::cout << "- "; + } + else + { + std::cout << "X "; + } } } std::cout << "]" << std::endl; From 9b560b6da2cd9a19e138ddbd20c9fc4fa5ede3af Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Jun 2023 17:45:22 +0200 Subject: [PATCH 047/499] Add work on OSNMA receiver --- .../galileo_telemetry_decoder_gs.cc | 19 --------------- src/core/libs/osnma_msg_receiver.cc | 13 ++++++---- .../system_parameters/osnma_dsm_reader.cc | 24 +++++++++++++++++++ src/core/system_parameters/osnma_dsm_reader.h | 2 ++ 4 files changed, 35 insertions(+), 23 deletions(-) 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 0868ab5e9..aaa3bc8f3 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 @@ -511,26 +511,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in if (d_band == '1' && d_inav_nav.have_new_nma() == true) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); - uint8_t nma_status = (tmp_obj->hkroot[0] & 0xC0) >> 6; this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - std::string nma_status_string; - if (nma_status == 0) - { - nma_status_string = std::string("(Reserved mode)"); - } - else if (nma_status == 1) - { - nma_status_string = std::string("(Test mode)"); - } - else if (nma_status == 2) - { - nma_status_string = std::string("(Operational mode)"); - } - else - { - nma_status_string = std::string("(Do not use mode)"); - } - std::cout << "Galileo OSNMA message " << nma_status_string << " received in channel " << d_channel << " from satellite " << d_satellite << std::endl; } } diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 4e3962ab0..6d8275763 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -20,6 +20,7 @@ #include "osnma_msg_receiver.h" #include "Galileo_OSNMA.h" #include "gnss_crypto.h" +#include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include // for DLOG #include // for gr::io_signature::make @@ -85,13 +86,14 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); - std::cout << "Galileo OSNMA: Subframe received at " + const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); + std::cout << "Galileo OSNMA: Subframe received starting at " << "WN=" << nma_msg->WN_sf0 << ", TOW=" << nma_msg->TOW_sf0 - << ", from SVID=" - << nma_msg->PRN + << ", from satellite " + << sat << std::endl; process_osnma_message(nma_msg); } @@ -336,8 +338,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << " validated" << std::endl; + std::cout << "Galileo OSNMA: NMAS is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + << " Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " + << "CPSK is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } // Validate signature } diff --git a/src/core/system_parameters/osnma_dsm_reader.cc b/src/core/system_parameters/osnma_dsm_reader.cc index baf873bbb..8a2a061d9 100644 --- a/src/core/system_parameters/osnma_dsm_reader.cc +++ b/src/core/system_parameters/osnma_dsm_reader.cc @@ -202,3 +202,27 @@ uint8_t OSNMA_DSM_Reader::get_npktid(const std::vector& dsm_msg) const { return (dsm_msg[129] & mask_dsm_npktid); } + + +std::string OSNMA_DSM_Reader::get_nmas_status(uint8_t nmas) const +{ + std::string status_; + const auto it = OSNMA_TABLE_1.find(nmas); + if (it != OSNMA_TABLE_1.cend()) + { + status_ = it->second; + } + return status_; +} + + +std::string OSNMA_DSM_Reader::get_cpks_status(uint8_t cpks) const +{ + std::string status_; + const auto it = OSNMA_TABLE_2.find(cpks); + if (it != OSNMA_TABLE_2.cend()) + { + status_ = it->second; + } + return status_; +} \ No newline at end of file diff --git a/src/core/system_parameters/osnma_dsm_reader.h b/src/core/system_parameters/osnma_dsm_reader.h index f90bd531b..3eeeb5bea 100644 --- a/src/core/system_parameters/osnma_dsm_reader.h +++ b/src/core/system_parameters/osnma_dsm_reader.h @@ -55,6 +55,8 @@ public: uint16_t get_lk_bits(uint8_t ks) const; std::vector get_kroot(const std::vector& dsm_msg, uint16_t bytes_lk) const; std::string get_hash_function(uint8_t hf) const; + std::string get_nmas_status(uint8_t nmas) const; + std::string get_cpks_status(uint8_t cpks) const; uint8_t get_mid(const std::vector& dsm_msg) const; uint8_t get_npkt(const std::vector& dsm_msg) const; From e343a48a6596a54a4e330d9e7d3417fae17bfc41 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Jun 2023 17:46:58 +0200 Subject: [PATCH 048/499] Add work on OSNMA receiver --- src/core/system_parameters/Galileo_OSNMA.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index bb3781c3f..be43d91f2 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -32,16 +32,24 @@ constexpr size_t SIZE_DSM_BLOCKS_BYTES = 13; -// OSNMA User ICD for the Test Phase, Issue 1.0, Table 2 +// OSNMA User ICD for the Test Phase, Issue 1.0, Table 1 +const std::unordered_map OSNMA_TABLE_1 = { + {0, std::string("Reserved")}, + {1, std::string("Test")}, + {2, std::string("Operational")}, + {3, std::string("Don't use")}}; // key: nmas, value: nmas status + + +// OSNMA User ICD for the Test Phase, Issue 1.0, Table 1 const std::unordered_map OSNMA_TABLE_2 = { {0, std::string("Reserved")}, {1, std::string("Nominal")}, {2, std::string("End of Chain (EOC)")}, {3, std::string("Chain Revoked (CREV)")}, - {4, std::string("New Public Key (NPK)")}, - {5, std::string("Public Key Revoked (PKREV)")}, - {6, std::string("Reserved")}, - {7, std::string("Reserved")}}; // key: cpks, value: Chain and Public Key Status + {4, std::string("Public Key Revoked (PKREV)")}, + {5, std::string("Chain Revoked (CREV)")}, + {6, std::string("New Merkle Tree (NMT)")}, + {7, std::string("Alert Message (AM)")}}; // key: cpks, value: cpks status // OSNMA User ICD for the Test Phase, Issue 1.0, Table 3 const std::unordered_map> OSNMA_TABLE_3 = { From c8347584f8834643cc1179b0ebad2ed6892d86fa Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Jun 2023 01:46:08 +0200 Subject: [PATCH 049/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 6 +- src/core/receiver/gnss_flowgraph.cc | 4 +- src/core/system_parameters/Galileo_OSNMA.h | 1 + src/core/system_parameters/gnss_crypto.cc | 340 ++++++++++++++------- src/core/system_parameters/gnss_crypto.h | 11 +- 5 files changed, 235 insertions(+), 127 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 6d8275763..b8da3b78b 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -340,9 +340,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << " validated" << std::endl; - std::cout << "Galileo OSNMA: NMAS is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " - << " Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " - << "CPSK is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; + std::cout << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " + << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } // Validate signature } diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 7d17fa1b0..3856876ca 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -27,6 +27,7 @@ #include "Galileo_E5a.h" #include "Galileo_E5b.h" #include "Galileo_E6.h" +#include "Galileo_OSNMA.h" #include "channel.h" #include "channel_fsm.h" #include "channel_interface.h" @@ -118,8 +119,7 @@ void GNSSFlowgraph::init() if (configuration_->property("Channels_1B.count", 0) > 0) { enable_osnma_rx_ = true; - const std::string pemfile_default("./OSNMA_PublicKey_20210920133026.pem"); - auto pemFilePath = configuration_->property("GNSS-SDR.OSNMA_pem", pemfile_default); + auto pemFilePath = configuration_->property("GNSS-SDR.OSNMA_pem", PEMFILE_DEFAULT); osnma_rx_ = osnma_msg_receiver_make(pemFilePath); } else diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index be43d91f2..2cb486248 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -160,6 +160,7 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-256"), 512}, {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} +const std::string PEMFILE_DEFAULT("./OSNMA_PublicKey_20210920133026.pem"); /** \} */ /** \} */ #endif // GNSS_SDR_GALILEO_OSNMA_H \ No newline at end of file diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 89fdc9e01..0a1eb6623 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -16,10 +16,12 @@ */ #include "gnss_crypto.h" +#include "Galileo_OSNMA.h" #include #include #include #include +#include #if USE_OPENSSL_FALLBACK #include @@ -29,7 +31,6 @@ #include #define OPENSSL_ENGINE nullptr #else -#include #include #endif #else @@ -40,7 +41,7 @@ Gnss_Crypto::Gnss_Crypto(const std::string& filePath) { - d_PublicKey = readPublicKeyFromPEM(filePath); + readPublicKeyFromPEM(filePath); } @@ -56,7 +57,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publickey) } -std::vector Gnss_Crypto::computeSHA256(const std::vector& input) +std::vector Gnss_Crypto::computeSHA256(const std::vector& input) const { std::vector output(32); // SHA256 hash size #if USE_OPENSSL_FALLBACK @@ -101,7 +102,7 @@ std::vector Gnss_Crypto::computeSHA256(const std::vector& inpu } -std::vector Gnss_Crypto::computeSHA3_256(const std::vector& input) +std::vector Gnss_Crypto::computeSHA3_256(const std::vector& input) const { std::vector output(32); // SHA256 hash size #if USE_OPENSSL_FALLBACK @@ -129,7 +130,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in } -std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) +std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const { std::vector output(32); #if USE_OPENSSL_FALLBACK @@ -171,7 +172,6 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector // Resize the HMAC vector to the actual length hmac.resize(hmacLen); - output = hmac; #endif #else @@ -182,13 +182,12 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector gnutls_hmac_output(hmac, output_aux.data()); output = output_aux; gnutls_hmac_deinit(hmac, output_aux.data()); - #endif return output; } -std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& key, const std::vector& input) +std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& key, const std::vector& input) const { std::vector output(16); #if USE_OPENSSL_FALLBACK @@ -254,158 +253,265 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } -std::vector Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) +void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) { - std::vector publicKey; // Open the .pem file std::ifstream pemFile(filePath); if (!pemFile) { - std::cerr << "Failed to open the file: " << filePath << std::endl; - return publicKey; + // PEM file not found + // If it not was the default, maybe it is a configuration error + if (filePath != PEMFILE_DEFAULT) + { + std::cerr << "File " << filePath << " not found" << std::endl; + } + return; } -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 - // Read the contents of the file into a string + std::vector publicKey; std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); - +#if USE_OPENSSL_FALLBACK // Create a BIO object from the string data BIO* bio = BIO_new_mem_buf(pemContent.c_str(), pemContent.length()); if (!bio) { - // Handle BIO creation error - pemFile.close(); - // ... + std::cerr << "OpenSSL: error creating a BIO object with data read from file " << filePath << ". Aborting import" << std::endl; + return; } - - // Read the PEM data from the BIO +#if USE_OPENSSL_3 + // Read the PEM data from the BIO object EVP_PKEY* evpKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); + BIO_free(bio); if (!evpKey) { - // Handle PEM reading error - BIO_free(bio); - pemFile.close(); - // ... + std::cerr << "OpenSSL: error reading the Public Key from file " << filePath << ". Aborting import" << std::endl; + return; } - // Create a memory BIO to write the public key data - BIO* memBio = BIO_new(BIO_s_mem()); - if (!memBio) + // Check if the public key is an EC key + if (EVP_PKEY_base_id(evpKey) != EVP_PKEY_EC) { - // Handle memory BIO creation error + std::cerr << "OpenSSL: Public key imported from file " << filePath << " is not an EC key. Aborting import" << std::endl; EVP_PKEY_free(evpKey); - BIO_free(bio); - pemFile.close(); - // ... + return; } - // Write the public key to the memory BIO - int result = PEM_write_bio_PUBKEY(memBio, evpKey); - if (result != 1) - { - // Handle public key writing error - BIO_free(memBio); - EVP_PKEY_free(evpKey); - BIO_free(bio); - pemFile.close(); - // ... - } - - // Get the pointer to the memory BIO data and its length - char* bioData; - long bioDataLength = BIO_get_mem_data(memBio, &bioData); - - // Copy the public key data to the vector - publicKey.assign(bioData, bioData + bioDataLength); - - // Free resources - BIO_free(memBio); + // Get the EC key from the EVP_PKEY object + EC_KEY* ecKey = EVP_PKEY_get1_EC_KEY(evpKey); EVP_PKEY_free(evpKey); - BIO_free(bio); - pemFile.close(); + + if (ecKey == nullptr) + { + std::cout << "OpenSSL: Failed to get the EC key from file " << filePath << ". Aborting import" << std::endl; + return; + } + + // Get the EC group from the EC key + const EC_GROUP* ecGroup = EC_KEY_get0_group(ecKey); + + if (ecGroup == nullptr) + { + std::cout << "OpenSSL: Failed to extract the EC group from file " << filePath << ". Aborting import" << std::endl; + EC_KEY_free(ecKey); + return; + } + + // Check if it is ECDSA P-256 + if (EC_GROUP_get_curve_name(ecGroup) != NID_X9_62_prime256v1) + { + std::cerr << "Invalid curve name in file " << filePath << ". Expected P-256. Aborting import" << std::endl; + EC_KEY_free(ecKey); + return; + } + // Convert the EC parameters to an octet string (raw binary) + // size_t octetSize = i2o_ECPublicKey(ecKey, nullptr); + // std::vector ecParameters(octetSize); + // unsigned char* p = ecParameters.data(); + // i2o_ECPublicKey(ecKey, &p); + std::vector ecParameters(EC_GROUP_get_degree(ecGroup) / 8); + EC_POINT_point2oct(ecGroup, EC_KEY_get0_public_key(ecKey), POINT_CONVERSION_UNCOMPRESSED, ecParameters.data(), ecParameters.size(), nullptr); + + // Get the EC public key from the EC key + const EC_POINT* ecPoint = EC_KEY_get0_public_key(ecKey); + + // Convert the EC public key to an octet string (raw binary) + size_t pointSize = EC_POINT_point2oct(ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, nullptr, 0, nullptr); + publicKey = std::vector(pointSize); + EC_POINT_point2oct(ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, publicKey.data(), pointSize, nullptr); + size_t octetSize = i2o_ECPublicKey(ecKey, nullptr); + std::vector publicKey2(octetSize); + unsigned char* p2 = publicKey2.data(); + i2o_ECPublicKey(ecKey, &p2); + // Clean up the EC key + EC_KEY_free(ecKey); + + std::cout << "EC parameters (size: " << ecParameters.size() << "):"; + for (auto k : ecParameters) + { + std::cout << " " << static_cast(k); + } + std::cout << std::endl; + std::cout << "Public Key (size: " << publicKey.size() << "):"; + for (auto k : publicKey) + { + std::cout << " " << static_cast(k); + } + std::cout << "Public Key2: (size: " << publicKey2.size() << "):"; + for (auto k : publicKey2) + { + std::cout << " " << static_cast(k); + } + std::cout << std::endl; #else - // Read the PEM file contents into a string - std::string pemContents((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); - - // Create a BIO object to hold the PEM data - BIO* bio = BIO_new_mem_buf(pemContents.c_str(), -1); - // Load the public key from the BIO - RSA* rsa = PEM_read_bio_RSA_PUBKEY(bio, nullptr, nullptr, nullptr); + EC_KEY* ecKeyPublic = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); BIO_free(bio); - - if (rsa == nullptr) + if (ecKeyPublic == nullptr) { - // Handle error reading public key - return {}; + std::cerr << "OpenSSL: error reading the Public Key from file " << filePath << ". Aborting import" << std::endl; + return; } - // Get the RSA modulus and convert it to a vector of uint8_t - const BIGNUM* rsaModulus = nullptr; - RSA_get0_key(rsa, &rsaModulus, nullptr, nullptr); + // // Get the EC group and EC point from the EC key + const EC_GROUP* ecGroup = EC_KEY_get0_group(ecKeyPublic); + const EC_POINT* ecPoint = EC_KEY_get0_public_key(ecKeyPublic); + // Convert the EC point to an octet string (raw binary) + const size_t octetSize = EC_POINT_point2oct( + ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, nullptr, 0, nullptr); + publicKey = std::vector(octetSize); + EC_POINT_point2oct( + ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, publicKey.data(), octetSize, nullptr); + EC_KEY_free(ecKeyPublic); - BN_bn2bin(rsaModulus, publicKey.data()); - - // Clean up the RSA object - RSA_free(rsa); + std::cout << "Public Key:"; + for (auto k : publicKey) + { + std::cout << " " << static_cast(k); + } + std::cout << std::endl; #endif #else - // Read the contents of the .pem file into a string - std::string pemContents((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); - - gnutls_x509_crt_t cert; - gnutls_x509_crt_init(&cert); - - // Import the certificate from the PEM file - gnutls_datum_t pemData; - pemData.data = reinterpret_cast(const_cast(pemContents.data())); - pemData.size = pemContents.size(); - int ret = gnutls_x509_crt_import(cert, &pemData, GNUTLS_X509_FMT_PEM); - if (ret < 0) + // Find the beginning and end of the EC PARAMETERS section + std::size_t beginPos = pemContent.find("-----BEGIN EC PARAMETERS-----"); + std::size_t endPos = pemContent.find("-----END EC PARAMETERS-----"); + if (beginPos == std::string::npos || endPos == std::string::npos) { - std::cerr << "Failed to import certificate from PEM file" << std::endl; - gnutls_x509_crt_deinit(cert); - return publicKey; + std::cerr << "No EC Parameters found in file " << filePath << ". Aborting import" << std::endl; + return; } - // Export the public key data - size_t pubkey_data_size = 0; - ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, nullptr, &pubkey_data_size); - if (ret < 0) - { - std::cerr << "Failed to export public key data" << std::endl; - gnutls_x509_crt_deinit(cert); - return publicKey; - } + // Extract the EC parameters data + std::string ecParamsBase64 = pemContent.substr(beginPos + 30, endPos - beginPos - 31); + std::vector ecParameters = base64Decode(ecParamsBase64); - publicKey.resize(pubkey_data_size); - ret = gnutls_x509_crt_export(cert, GNUTLS_X509_FMT_DER, publicKey.data(), &pubkey_data_size); - if (ret < 0) + std::cout << ecParamsBase64 << std::endl; + std::cout << "Size ecParamsBase64 : " << ecParamsBase64.size() << std::endl; + std::cout << "Size EC : " << ecParameters.size() << std::endl; + for (auto k : ecParameters) { - std::cerr << "Failed to export public key data" << std::endl; - gnutls_x509_crt_deinit(cert); - return publicKey; + std::cout << " " << static_cast(k); } + std::cout << std::endl; - gnutls_x509_crt_deinit(cert); + std::size_t beginPos2 = pemContent.find("-----BEGIN PUBLIC KEY-----"); + std::size_t endPos2 = pemContent.find("-----END PUBLIC KEY-----"); + if (beginPos2 == std::string::npos || endPos2 == std::string::npos) + { + std::cout << "No Public Key found in file " << filePath << ". Aborting import" << std::endl; + return; + } + auto PublickeyBase64 = pemContent.substr(beginPos2 + 27, endPos2 - beginPos2 - 28); + auto readpublickey_long = base64Decode(PublickeyBase64); + publicKey = std::vector(readpublickey_long.begin() + 26, readpublickey_long.end()); // ?? + + std::cout << "Public Key (size: " << publicKey.size() << "):" << std::endl; + for (auto k : publicKey) + { + std::cout << " " << static_cast(k); + } + std::cout << std::endl; #endif - return publicKey; + d_PublicKey = publicKey; + std::cout << "Public key successfully read from file " << filePath << std::endl; } -// // bool signature(const std::vector& publicKey, const std::vector& digest, std::vector& signature) -// // { -// // bool success = false; -// // #if USE_OPENSSL_FALLBACK -// // #else -// // gnutls_global_init(); -// // int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data, digest.size(), signature.data(), signature.size()); -// // success = (result == GNUTLS_E_SUCCESS); -// // gnutls_global_deinit(); -// // #endif -// // return success; -// // } +// bool signature(const std::vector& publicKey, const std::vector& digest, const std::vector& signature) +// { +// bool success = false; +// #if USE_OPENSSL_FALLBACK +// #else +// gnutls_global_init(); +// int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data(), digest.size(), signature.data(), signature.size()); +// success = (result == GNUTLS_E_SUCCESS); +// gnutls_global_deinit(); +// #endif +// return success; +// } // // bool verifyDigitalSignature(const unsigned char* signature, size_t signatureSize, const unsigned char* message, size_t messageSize, gnutls_pubkey_t publicKey) // // { // // int verificationStatus = gnutls_pubkey_verify_data(publicKey, GNUTLS_DIG_SHA256, 0, message, messageSize, signature, signatureSize); // // return verificationStatus == 0; + + +std::vector Gnss_Crypto::base64Decode(const std::string& encoded_string) +{ + const std::string base64_chars = + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789+/"; + int in_len = encoded_string.size(); + int i = 0; + int j = 0; + int in_ = 0; + uint8_t char_array_4[4]; + uint8_t char_array_3[3]; + std::vector decoded; + + while (in_len-- && (encoded_string[in_] != '=') && + (isalnum(encoded_string[in_]) || (encoded_string[in_] == '+') || (encoded_string[in_] == '/'))) + { + char_array_4[i++] = encoded_string[in_]; + in_++; + if (i == 4) + { + for (i = 0; i < 4; i++) + { + char_array_4[i] = base64_chars.find(char_array_4[i]); + } + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (i = 0; (i < 3); i++) + { + decoded.push_back(char_array_3[i]); + } + i = 0; + } + } + + if (i) + { + for (j = i; j < 4; j++) + { + char_array_4[j] = 0; + } + + for (j = 0; j < 4; j++) + { + char_array_4[j] = base64_chars.find(char_array_4[j]); + } + + char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); + char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); + char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; + + for (j = 0; (j < i - 1); j++) + { + decoded.push_back(char_array_3[j]); + } + } + + return decoded; +} \ No newline at end of file diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index b6151454c..8c4af9a5b 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -35,14 +35,15 @@ public: Gnss_Crypto() = default; explicit Gnss_Crypto(const std::string& filePath); bool have_public_key() const; + std::vector computeSHA256(const std::vector& input) const; + std::vector computeSHA3_256(const std::vector& input) const; + std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; + std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; void set_public_key(const std::vector& publickey); - std::vector computeSHA256(const std::vector& input); - std::vector computeSHA3_256(const std::vector& input); - std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input); - std::vector computeCMAC_AES(const std::vector& key, const std::vector& input); - std::vector readPublicKeyFromPEM(const std::string& filePath); + void readPublicKeyFromPEM(const std::string& filePath); private: + std::vector base64Decode(const std::string& encoded_string); std::vector d_PublicKey; }; From e75bdeb5f6e0b0130f54fb77605d8cb291851419 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Jun 2023 20:30:03 +0200 Subject: [PATCH 050/499] Add work on OSNMA receiver --- src/core/libs/osnma_msg_receiver.cc | 5 + src/core/system_parameters/CMakeLists.txt | 14 +- src/core/system_parameters/gnss_crypto.cc | 240 ++++++---------------- src/core/system_parameters/gnss_crypto.h | 18 +- 4 files changed, 93 insertions(+), 184 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index b8da3b78b..8f7b82051 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -397,6 +397,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; } // std::vector mi; // (NPKT + NPKID + NPK) + std::cout << "Galileo OSNMA: DSM-PKR with CID=" << static_cast(d_osnma_data.d_nma_header.cid) + << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) + << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 + << " received" << std::endl; } } else diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index f321ab52c..c8b4c2d57 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -134,37 +134,37 @@ target_include_directories(core_system_parameters if(OPENSSL_FOUND) if(TARGET OpenSSL::SSL) target_link_libraries(core_system_parameters - PRIVATE + PUBLIC OpenSSL::SSL ) else() target_link_libraries(core_system_parameters - PRIVATE + PUBLIC ${OPENSSL_LIBRARIES} ) target_include_directories(core_system_parameters - PRIVATE + PUBLIC ${OPENSSL_INCLUDE_DIR} ) endif() if(OPENSSL_VERSION) if(OPENSSL_VERSION VERSION_GREATER "3.0.0") - target_compile_definitions(core_system_parameters PRIVATE -DUSE_OPENSSL_3=1) + target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_3=1) endif() endif() else() target_link_libraries(core_system_parameters - PRIVATE + PUBLIC ${GNUTLS_LIBRARIES} ${GNUTLS_OPENSSL_LIBRARY} ) target_include_directories(core_system_parameters - PRIVATE + PUBLIC ${GNUTLS_INCLUDE_DIR} ) endif() if(OPENSSL_FOUND) - target_compile_definitions(core_system_parameters PRIVATE -DUSE_OPENSSL_FALLBACK=1) + target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_FALLBACK=1) endif() if(ENABLE_CLANG_TIDY) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 0a1eb6623..df72beff0 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -25,6 +25,7 @@ #if USE_OPENSSL_FALLBACK #include +#include #include #include #if USE_OPENSSL_3 @@ -34,27 +35,49 @@ #include #endif #else +#include #include -#include #include #endif + Gnss_Crypto::Gnss_Crypto(const std::string& filePath) { +#if USE_OPENSSL_FALLBACK +#else + gnutls_global_init(); +#endif readPublicKeyFromPEM(filePath); } +Gnss_Crypto::~Gnss_Crypto() +{ +#if USE_OPENSSL_FALLBACK + if (d_PublicKey != nullptr) + { + EC_KEY_free(d_PublicKey); + } +#else + if (d_PublicKey != nullptr) + { + gnutls_pubkey_deinit(*d_PublicKey); + } + + gnutls_global_deinit(); +#endif +} + + bool Gnss_Crypto::have_public_key() const { - return !d_PublicKey.empty(); + return (d_PublicKey != nullptr); } -void Gnss_Crypto::set_public_key(const std::vector& publickey) -{ - d_PublicKey = publickey; -} +// void Gnss_Crypto::set_public_key(const std::vector& publickey) +// { +// } std::vector Gnss_Crypto::computeSHA256(const std::vector& input) const @@ -296,22 +319,22 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) } // Get the EC key from the EVP_PKEY object - EC_KEY* ecKey = EVP_PKEY_get1_EC_KEY(evpKey); + d_PublicKey = EVP_PKEY_get1_EC_KEY(evpKey); EVP_PKEY_free(evpKey); - if (ecKey == nullptr) + if (d_PublicKey == nullptr) { std::cout << "OpenSSL: Failed to get the EC key from file " << filePath << ". Aborting import" << std::endl; return; } // Get the EC group from the EC key - const EC_GROUP* ecGroup = EC_KEY_get0_group(ecKey); + const EC_GROUP* ecGroup = EC_KEY_get0_group(d_PublicKey); if (ecGroup == nullptr) { std::cout << "OpenSSL: Failed to extract the EC group from file " << filePath << ". Aborting import" << std::endl; - EC_KEY_free(ecKey); + EC_KEY_free(d_PublicKey); return; } @@ -319,131 +342,68 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) if (EC_GROUP_get_curve_name(ecGroup) != NID_X9_62_prime256v1) { std::cerr << "Invalid curve name in file " << filePath << ". Expected P-256. Aborting import" << std::endl; - EC_KEY_free(ecKey); + EC_KEY_free(d_PublicKey); return; } - // Convert the EC parameters to an octet string (raw binary) - // size_t octetSize = i2o_ECPublicKey(ecKey, nullptr); - // std::vector ecParameters(octetSize); - // unsigned char* p = ecParameters.data(); - // i2o_ECPublicKey(ecKey, &p); - std::vector ecParameters(EC_GROUP_get_degree(ecGroup) / 8); - EC_POINT_point2oct(ecGroup, EC_KEY_get0_public_key(ecKey), POINT_CONVERSION_UNCOMPRESSED, ecParameters.data(), ecParameters.size(), nullptr); - - // Get the EC public key from the EC key - const EC_POINT* ecPoint = EC_KEY_get0_public_key(ecKey); - - // Convert the EC public key to an octet string (raw binary) - size_t pointSize = EC_POINT_point2oct(ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, nullptr, 0, nullptr); - publicKey = std::vector(pointSize); - EC_POINT_point2oct(ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, publicKey.data(), pointSize, nullptr); - size_t octetSize = i2o_ECPublicKey(ecKey, nullptr); - std::vector publicKey2(octetSize); - unsigned char* p2 = publicKey2.data(); - i2o_ECPublicKey(ecKey, &p2); - // Clean up the EC key - EC_KEY_free(ecKey); - - std::cout << "EC parameters (size: " << ecParameters.size() << "):"; - for (auto k : ecParameters) - { - std::cout << " " << static_cast(k); - } - std::cout << std::endl; - std::cout << "Public Key (size: " << publicKey.size() << "):"; - for (auto k : publicKey) - { - std::cout << " " << static_cast(k); - } - std::cout << "Public Key2: (size: " << publicKey2.size() << "):"; - for (auto k : publicKey2) - { - std::cout << " " << static_cast(k); - } - std::cout << std::endl; #else // Load the public key from the BIO - EC_KEY* ecKeyPublic = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); + d_PublicKey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); BIO_free(bio); - if (ecKeyPublic == nullptr) + if (d_PublicKey == nullptr) { std::cerr << "OpenSSL: error reading the Public Key from file " << filePath << ". Aborting import" << std::endl; return; } - - // // Get the EC group and EC point from the EC key - const EC_GROUP* ecGroup = EC_KEY_get0_group(ecKeyPublic); - const EC_POINT* ecPoint = EC_KEY_get0_public_key(ecKeyPublic); - // Convert the EC point to an octet string (raw binary) - const size_t octetSize = EC_POINT_point2oct( - ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, nullptr, 0, nullptr); - publicKey = std::vector(octetSize); - EC_POINT_point2oct( - ecGroup, ecPoint, POINT_CONVERSION_UNCOMPRESSED, publicKey.data(), octetSize, nullptr); - EC_KEY_free(ecKeyPublic); - - std::cout << "Public Key:"; - for (auto k : publicKey) - { - std::cout << " " << static_cast(k); - } - std::cout << std::endl; #endif #else - // Find the beginning and end of the EC PARAMETERS section - std::size_t beginPos = pemContent.find("-----BEGIN EC PARAMETERS-----"); - std::size_t endPos = pemContent.find("-----END EC PARAMETERS-----"); - if (beginPos == std::string::npos || endPos == std::string::npos) + gnutls_pubkey_t pubKey; + gnutls_pubkey_init(&pubKey); + d_PublicKey = &pubKey; + // Import the PEM data + gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(pemContent.data())), static_cast(pemContent.size())}; + int ret = gnutls_pubkey_import(*d_PublicKey, &pemDatum, GNUTLS_X509_FMT_PEM); + if (ret < 0) { - std::cerr << "No EC Parameters found in file " << filePath << ". Aborting import" << std::endl; + std::cerr << "GnuTLS: error reading the Public Key from file " + << filePath + << ". (Error: " << gnutls_strerror(ret) << "). Aborting import" << std::endl; + gnutls_pubkey_deinit(*d_PublicKey); return; } - - // Extract the EC parameters data - std::string ecParamsBase64 = pemContent.substr(beginPos + 30, endPos - beginPos - 31); - std::vector ecParameters = base64Decode(ecParamsBase64); - - std::cout << ecParamsBase64 << std::endl; - std::cout << "Size ecParamsBase64 : " << ecParamsBase64.size() << std::endl; - std::cout << "Size EC : " << ecParameters.size() << std::endl; - for (auto k : ecParameters) - { - std::cout << " " << static_cast(k); - } - std::cout << std::endl; - - std::size_t beginPos2 = pemContent.find("-----BEGIN PUBLIC KEY-----"); - std::size_t endPos2 = pemContent.find("-----END PUBLIC KEY-----"); - if (beginPos2 == std::string::npos || endPos2 == std::string::npos) - { - std::cout << "No Public Key found in file " << filePath << ". Aborting import" << std::endl; - return; - } - auto PublickeyBase64 = pemContent.substr(beginPos2 + 27, endPos2 - beginPos2 - 28); - auto readpublickey_long = base64Decode(PublickeyBase64); - publicKey = std::vector(readpublickey_long.begin() + 26, readpublickey_long.end()); // ?? - - std::cout << "Public Key (size: " << publicKey.size() << "):" << std::endl; - for (auto k : publicKey) - { - std::cout << " " << static_cast(k); - } - std::cout << std::endl; #endif - d_PublicKey = publicKey; std::cout << "Public key successfully read from file " << filePath << std::endl; } -// bool signature(const std::vector& publicKey, const std::vector& digest, const std::vector& signature) +// bool verify_signature(const std::vector& message, const std::vector& signature) // { // bool success = false; // #if USE_OPENSSL_FALLBACK +/** Verifies that the given signature is valid ECDSA signature + * of the supplied hash value using the specified public key. + * \param type this parameter is ignored + * \param dgst pointer to the hash value + * \param dgstlen length of the hash value + * \param sig pointer to the DER encoded signature + * \param siglen length of the DER encoded signature + * \param eckey EC_KEY object containing a public EC key + * \return 1 if the signature is valid, 0 if the signature is invalid + * and -1 on error + */ +// int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, const unsigned char *sig, int siglen, EC_KEY *eckey);) +// int verification = ECDSA_verify(0, digest, SHA256_DIGEST_LENGTH, signature, signature_len, key_pair_obj); // #else // gnutls_global_init(); // int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data(), digest.size(), signature.data(), signature.size()); // success = (result == GNUTLS_E_SUCCESS); // gnutls_global_deinit(); +// pubkey: Holds the public key +// algo: The signature algorithm used +// flags: Zero or an OR list of gnutls_certificate_verify_flags +// data: holds the signed data +// signature: contains the signature +// This function will verify the given signed data, using the parameters from the certificate. +// gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * data, const gnutls_datum_t * signature) // #endif // return success; // } @@ -451,67 +411,3 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) // // { // // int verificationStatus = gnutls_pubkey_verify_data(publicKey, GNUTLS_DIG_SHA256, 0, message, messageSize, signature, signatureSize); // // return verificationStatus == 0; - - -std::vector Gnss_Crypto::base64Decode(const std::string& encoded_string) -{ - const std::string base64_chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "0123456789+/"; - int in_len = encoded_string.size(); - int i = 0; - int j = 0; - int in_ = 0; - uint8_t char_array_4[4]; - uint8_t char_array_3[3]; - std::vector decoded; - - while (in_len-- && (encoded_string[in_] != '=') && - (isalnum(encoded_string[in_]) || (encoded_string[in_] == '+') || (encoded_string[in_] == '/'))) - { - char_array_4[i++] = encoded_string[in_]; - in_++; - if (i == 4) - { - for (i = 0; i < 4; i++) - { - char_array_4[i] = base64_chars.find(char_array_4[i]); - } - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (i = 0; (i < 3); i++) - { - decoded.push_back(char_array_3[i]); - } - i = 0; - } - } - - if (i) - { - for (j = i; j < 4; j++) - { - char_array_4[j] = 0; - } - - for (j = 0; j < 4; j++) - { - char_array_4[j] = base64_chars.find(char_array_4[j]); - } - - char_array_3[0] = (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4); - char_array_3[1] = ((char_array_4[1] & 0xf) << 4) + ((char_array_4[2] & 0x3c) >> 2); - char_array_3[2] = ((char_array_4[2] & 0x3) << 6) + char_array_4[3]; - - for (j = 0; (j < i - 1); j++) - { - decoded.push_back(char_array_3[j]); - } - } - - return decoded; -} \ No newline at end of file diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 8c4af9a5b..4e160ac2c 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -21,30 +21,38 @@ #include #include #include - +#if USE_OPENSSL_FALLBACK +#include +#else +#include +#endif /** \addtogroup Core * \{ */ /** \addtogroup System_Parameters * \{ */ - class Gnss_Crypto { public: Gnss_Crypto() = default; + ~Gnss_Crypto(); explicit Gnss_Crypto(const std::string& filePath); bool have_public_key() const; std::vector computeSHA256(const std::vector& input) const; std::vector computeSHA3_256(const std::vector& input) const; std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; - void set_public_key(const std::vector& publickey); + void readPublicKeyFromPEM(const std::string& filePath); + // void set_public_key(const std::vector& publickey); private: - std::vector base64Decode(const std::string& encoded_string); - std::vector d_PublicKey; +#if USE_OPENSSL_FALLBACK + EC_KEY* d_PublicKey = nullptr; +#else + gnutls_pubkey_t* d_PublicKey; +#endif }; /** \} */ From bece57d226edd27ffc2bea6cf046d8f150a7a6f7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 12 Jun 2023 10:02:52 +0200 Subject: [PATCH 051/499] Add work on OSNMA receiver --- src/core/system_parameters/gnss_crypto.cc | 156 ++++++++++------------ src/core/system_parameters/gnss_crypto.h | 5 + 2 files changed, 74 insertions(+), 87 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index df72beff0..e8ea0b719 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -43,10 +43,6 @@ Gnss_Crypto::Gnss_Crypto(const std::string& filePath) { -#if USE_OPENSSL_FALLBACK -#else - gnutls_global_init(); -#endif readPublicKeyFromPEM(filePath); } @@ -54,10 +50,13 @@ Gnss_Crypto::Gnss_Crypto(const std::string& filePath) Gnss_Crypto::~Gnss_Crypto() { #if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 +#else if (d_PublicKey != nullptr) { EC_KEY_free(d_PublicKey); } +#endif #else if (d_PublicKey != nullptr) { @@ -300,52 +299,6 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) std::cerr << "OpenSSL: error creating a BIO object with data read from file " << filePath << ". Aborting import" << std::endl; return; } -#if USE_OPENSSL_3 - // Read the PEM data from the BIO object - EVP_PKEY* evpKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); - BIO_free(bio); - if (!evpKey) - { - std::cerr << "OpenSSL: error reading the Public Key from file " << filePath << ". Aborting import" << std::endl; - return; - } - - // Check if the public key is an EC key - if (EVP_PKEY_base_id(evpKey) != EVP_PKEY_EC) - { - std::cerr << "OpenSSL: Public key imported from file " << filePath << " is not an EC key. Aborting import" << std::endl; - EVP_PKEY_free(evpKey); - return; - } - - // Get the EC key from the EVP_PKEY object - d_PublicKey = EVP_PKEY_get1_EC_KEY(evpKey); - EVP_PKEY_free(evpKey); - - if (d_PublicKey == nullptr) - { - std::cout << "OpenSSL: Failed to get the EC key from file " << filePath << ". Aborting import" << std::endl; - return; - } - - // Get the EC group from the EC key - const EC_GROUP* ecGroup = EC_KEY_get0_group(d_PublicKey); - - if (ecGroup == nullptr) - { - std::cout << "OpenSSL: Failed to extract the EC group from file " << filePath << ". Aborting import" << std::endl; - EC_KEY_free(d_PublicKey); - return; - } - - // Check if it is ECDSA P-256 - if (EC_GROUP_get_curve_name(ecGroup) != NID_X9_62_prime256v1) - { - std::cerr << "Invalid curve name in file " << filePath << ". Expected P-256. Aborting import" << std::endl; - EC_KEY_free(d_PublicKey); - return; - } -#else // Load the public key from the BIO d_PublicKey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); BIO_free(bio); @@ -354,8 +307,8 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) std::cerr << "OpenSSL: error reading the Public Key from file " << filePath << ". Aborting import" << std::endl; return; } -#endif #else + gnutls_global_init(); gnutls_pubkey_t pubKey; gnutls_pubkey_init(&pubKey); d_PublicKey = &pubKey; @@ -370,44 +323,73 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) gnutls_pubkey_deinit(*d_PublicKey); return; } + gnutls_pubkey_deinit(pubKey); #endif std::cout << "Public key successfully read from file " << filePath << std::endl; } -// bool verify_signature(const std::vector& message, const std::vector& signature) -// { -// bool success = false; -// #if USE_OPENSSL_FALLBACK -/** Verifies that the given signature is valid ECDSA signature - * of the supplied hash value using the specified public key. - * \param type this parameter is ignored - * \param dgst pointer to the hash value - * \param dgstlen length of the hash value - * \param sig pointer to the DER encoded signature - * \param siglen length of the DER encoded signature - * \param eckey EC_KEY object containing a public EC key - * \return 1 if the signature is valid, 0 if the signature is invalid - * and -1 on error - */ -// int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen, const unsigned char *sig, int siglen, EC_KEY *eckey);) -// int verification = ECDSA_verify(0, digest, SHA256_DIGEST_LENGTH, signature, signature_len, key_pair_obj); -// #else -// gnutls_global_init(); -// int result = gnutls_pubkey_verify_data(publicKey.data(), GNUTLS_SIGN_ECDSA_SHA256, digest.data(), digest.size(), signature.data(), signature.size()); -// success = (result == GNUTLS_E_SUCCESS); -// gnutls_global_deinit(); -// pubkey: Holds the public key -// algo: The signature algorithm used -// flags: Zero or an OR list of gnutls_certificate_verify_flags -// data: holds the signed data -// signature: contains the signature -// This function will verify the given signed data, using the parameters from the certificate. -// gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * data, const gnutls_datum_t * signature) -// #endif -// return success; -// } -// // bool verifyDigitalSignature(const unsigned char* signature, size_t signatureSize, const unsigned char* message, size_t messageSize, gnutls_pubkey_t publicKey) -// // { -// // int verificationStatus = gnutls_pubkey_verify_data(publicKey, GNUTLS_DIG_SHA256, 0, message, messageSize, signature, signatureSize); -// // return verificationStatus == 0; +bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) +{ + bool success = false; +#if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + EVP_PKEY_CTX* ctx; + ctx = EVP_PKEY_CTX_new(d_PublicKey, NULL /* no engine */); + bool do_operation = true; + if (!ctx) + { + do_operation = false; + } + if (EVP_PKEY_verify_init(ctx) <= 0) + { + do_operation = false; + } + if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) + { + do_operation = false; + } + int verification = 0; + if (do_operation) + { + verification = EVP_PKEY_verify(ctx, signature.data(), signature.size(), message.data(), message.size()); + } + if (verification == 1) + { + success = true; + } +#else + auto digest = this->computeSHA256(message); + int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, signature.data(), static_cast(signature.size()), d_PublicKey); + if (verification == 1) + { + success = true; + } + else if (verification == 0) + { + std::cerr << "OpenSSL: invalid signature found when verifying message" << std::endl; + } + +#endif +#else + // Verify the dummy hash using the public key + gnutls_datum_t dummyHash = {nullptr, 0}; + int ret2 = gnutls_pubkey_verify_hash2(*d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &dummyHash, &dummyHash); + if (ret2 != GNUTLS_E_SUCCESS) + { + std::cout << "GnuTLS: The Public Key is invalid" << std::endl; + } + gnutls_datum_t signature_{}; + signature_.data = const_cast(signature.data()); + signature_.size = signature.size(); + gnutls_datum_t data_{}; + data_.data = const_cast(message.data()); + data_.size = message.size(); + int ret = gnutls_pubkey_verify_data2(*d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &data_, &signature_); + if (ret == GNUTLS_E_SUCCESS) + { + success = true; + } +#endif + return success; +} \ No newline at end of file diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 4e160ac2c..5a89d1fef 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -43,13 +43,18 @@ public: std::vector computeSHA3_256(const std::vector& input) const; std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; + bool verify_signature(const std::vector& message, const std::vector& signature); void readPublicKeyFromPEM(const std::string& filePath); // void set_public_key(const std::vector& publickey); private: #if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 + EVP_PKEY* d_PublicKey; +#else EC_KEY* d_PublicKey = nullptr; +#endif #else gnutls_pubkey_t* d_PublicKey; #endif From 45196a5251fc848a365d4c121aedd527b60edaf5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 12 Jun 2023 10:15:48 +0200 Subject: [PATCH 052/499] Fixes for OpenSSL 3.0 --- src/core/system_parameters/gnss_crypto.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index e8ea0b719..e82f27b22 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -300,7 +300,11 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) return; } // Load the public key from the BIO +#if USE_OPENSSL_3 + d_PublicKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); +#else d_PublicKey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); +#endif BIO_free(bio); if (d_PublicKey == nullptr) { From 2debff63077f2bb90a4c69cc10e9b4d933f4d3d7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 12 Jun 2023 12:52:00 +0200 Subject: [PATCH 053/499] Fix segfault with gnutls --- src/core/system_parameters/gnss_crypto.cc | 43 +++++++++++++---------- src/core/system_parameters/gnss_crypto.h | 2 +- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index e82f27b22..8667eb7fd 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -43,6 +43,10 @@ Gnss_Crypto::Gnss_Crypto(const std::string& filePath) { +#if USE_OPENSSL_FALLBACK +#else + // gnutls_global_init(); +#endif readPublicKeyFromPEM(filePath); } @@ -57,20 +61,17 @@ Gnss_Crypto::~Gnss_Crypto() EC_KEY_free(d_PublicKey); } #endif -#else - if (d_PublicKey != nullptr) - { - gnutls_pubkey_deinit(*d_PublicKey); - } - - gnutls_global_deinit(); #endif } bool Gnss_Crypto::have_public_key() const { +#if USE_OPENSSL_FALLBACK return (d_PublicKey != nullptr); +#else + return (d_PublicKey != gnutls_pubkey_t{}); +#endif } @@ -299,7 +300,6 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) std::cerr << "OpenSSL: error creating a BIO object with data read from file " << filePath << ". Aborting import" << std::endl; return; } - // Load the public key from the BIO #if USE_OPENSSL_3 d_PublicKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); #else @@ -312,22 +312,23 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) return; } #else - gnutls_global_init(); - gnutls_pubkey_t pubKey; - gnutls_pubkey_init(&pubKey); - d_PublicKey = &pubKey; // Import the PEM data gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(pemContent.data())), static_cast(pemContent.size())}; - int ret = gnutls_pubkey_import(*d_PublicKey, &pemDatum, GNUTLS_X509_FMT_PEM); - if (ret < 0) + gnutls_pubkey_t pubkey; + gnutls_pubkey_init(&pubkey); + + int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); + if (ret != GNUTLS_E_SUCCESS) { + gnutls_pubkey_deinit(pubkey); std::cerr << "GnuTLS: error reading the Public Key from file " << filePath - << ". (Error: " << gnutls_strerror(ret) << "). Aborting import" << std::endl; - gnutls_pubkey_deinit(*d_PublicKey); + << ". Aborting import" << std::endl; return; } - gnutls_pubkey_deinit(pubKey); + gnutls_pubkey_init(&d_PublicKey); + d_PublicKey = pubkey; + gnutls_pubkey_deinit(pubkey); #endif std::cout << "Public key successfully read from file " << filePath << std::endl; } @@ -335,6 +336,10 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) { + if (!have_public_key()) + { + return false; + } bool success = false; #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 @@ -378,7 +383,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #else // Verify the dummy hash using the public key gnutls_datum_t dummyHash = {nullptr, 0}; - int ret2 = gnutls_pubkey_verify_hash2(*d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &dummyHash, &dummyHash); + int ret2 = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &dummyHash, &dummyHash); if (ret2 != GNUTLS_E_SUCCESS) { std::cout << "GnuTLS: The Public Key is invalid" << std::endl; @@ -389,7 +394,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st gnutls_datum_t data_{}; data_.data = const_cast(message.data()); data_.size = message.size(); - int ret = gnutls_pubkey_verify_data2(*d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &data_, &signature_); + int ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &data_, &signature_); if (ret == GNUTLS_E_SUCCESS) { success = true; diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 5a89d1fef..44103b28b 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -56,7 +56,7 @@ private: EC_KEY* d_PublicKey = nullptr; #endif #else - gnutls_pubkey_t* d_PublicKey; + gnutls_pubkey_t d_PublicKey{}; #endif }; From 7ca6c42f7bee1bbe7cc5076eaa0ee3c8320504ab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 12 Jun 2023 16:04:05 +0200 Subject: [PATCH 054/499] Add work on OSNMA receiver --- src/core/system_parameters/gnss_crypto.cc | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 8667eb7fd..316289953 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -344,7 +344,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; - ctx = EVP_PKEY_CTX_new(d_PublicKey, NULL /* no engine */); + ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr /* no engine */); bool do_operation = true; if (!ctx) { @@ -367,6 +367,10 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { success = true; } + else + { + std::cerr << "OpenSSL: message authentication failed" << std::endl; + } #else auto digest = this->computeSHA256(message); int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, signature.data(), static_cast(signature.size()), d_PublicKey); @@ -378,16 +382,13 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { std::cerr << "OpenSSL: invalid signature found when verifying message" << std::endl; } + else + { + std::cerr << "OpenSSL: message authentication failed" << std::endl; + } #endif #else - // Verify the dummy hash using the public key - gnutls_datum_t dummyHash = {nullptr, 0}; - int ret2 = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &dummyHash, &dummyHash); - if (ret2 != GNUTLS_E_SUCCESS) - { - std::cout << "GnuTLS: The Public Key is invalid" << std::endl; - } gnutls_datum_t signature_{}; signature_.data = const_cast(signature.data()); signature_.size = signature.size(); @@ -395,10 +396,14 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st data_.data = const_cast(message.data()); data_.size = message.size(); int ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &data_, &signature_); - if (ret == GNUTLS_E_SUCCESS) + if (ret >= 0) { success = true; } + else + { + std::cerr << "GnuTLS: message authentication failed" << std::endl; + } #endif return success; } \ No newline at end of file From 9479f145521bbae872723ed6fdb7d4bace73c145 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 13 Jun 2023 13:36:30 +0200 Subject: [PATCH 055/499] Read MACK key --- src/core/libs/osnma_msg_receiver.cc | 89 ++++++++++++++++++++----- src/core/libs/osnma_msg_receiver.h | 6 +- src/core/system_parameters/osnma_data.h | 1 - 3 files changed, 74 insertions(+), 22 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 8f7b82051..6028506c5 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -305,7 +305,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { MSG.push_back(dsm_msg[i]); } - + std::vector message = MSG; for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); @@ -334,12 +334,20 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // check DS signature if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { + bool authenticated = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); LOG(WARNING) << "OSNMA: DSM-KROOT message received ok."; std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 - << " validated" << std::endl; + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; + if (authenticated) + { + std::cout << " authenticated" << std::endl; + } + else + { + std::cout << " validated" << std::endl; + } std::cout << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; @@ -428,9 +436,8 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma if (d_osnma_data.d_dsm_kroot_message.ts != 0) { read_mack_header(); - read_mack_info_and_tags(); - read_mack_key(); - read_mack_padding(); + read_mack_body(); + d_old_mack_message = d_osnma_data.d_mack_message; } } @@ -496,7 +503,7 @@ void osnma_msg_receiver::read_mack_header() } -void osnma_msg_receiver::read_mack_info_and_tags() +void osnma_msg_receiver::read_mack_body() { uint8_t lt_bits = 0; const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); @@ -518,7 +525,7 @@ void osnma_msg_receiver::read_mack_info_and_tags() { return; } - uint16_t nt = std::floor((480.0 + float(lk_bits)) / (float(lt_bits) + 16.0)); + uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); for (uint16_t k = 0; k < (nt - 1); k++) { @@ -537,6 +544,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += d_mack_message[6 + step]; ADKD += ((d_mack_message[7 + step] & 0xF0) >> 4); cop += (d_mack_message[7 + step] & 0x0F); + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = d_mack_message[8 + step + j]; + } + } } else { @@ -547,6 +562,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += (d_mack_message[6 + step] & 0xF0) >> 4; ADKD += (d_mack_message[6 + step] & 0x0F); cop += (d_mack_message[7 + step] & 0xF0) >> 4; + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = ((d_mack_message[7 + step + j] & 0x0F) << 4) + ((d_mack_message[8 + step + j] & 0xF0) >> 4); + } + } } } else if (lt_bits == 24) @@ -557,6 +580,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += d_mack_message[8 + k * 5]; ADKD += ((d_mack_message[9 + k * 5] & 0xF0) >> 4); cop += (d_mack_message[9 + k * 5] & 0x0F); + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = d_mack_message[10 + k * 5 + j]; + } + } } else if (lt_bits == 28) { @@ -570,6 +601,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += d_mack_message[9 + step]; ADKD += ((d_mack_message[10 + step] & 0xF0) >> 4); cop += (d_mack_message[10 + step] & 0x0F); + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = d_mack_message[11 + step + j]; + } + } } else { @@ -581,6 +620,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += ((d_mack_message[9 + step] & 0xF0) >> 4); ADKD += (d_mack_message[9 + step] & 0x0F); cop += ((d_mack_message[10 + step] & 0xF0) >> 4); + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = ((d_mack_message[10 + step + j] & 0x0F) << 4) + ((d_mack_message[11 + step + j] & 0xF0) >> 4); + } + } } } else if (lt_bits == 32) @@ -592,6 +639,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += d_mack_message[10 + k * 6]; ADKD += ((d_mack_message[11 + k * 6] & 0xF0) >> 4); cop += (d_mack_message[11 + k * 6] & 0x0F); + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = d_mack_message[12 + k * 6 + j]; + } + } } else if (lt_bits == 40) { @@ -603,6 +658,14 @@ void osnma_msg_receiver::read_mack_info_and_tags() PRN_d += d_mack_message[12 + k * 7]; ADKD += ((d_mack_message[13 + k * 7] & 0xF0) >> 4); cop += (d_mack_message[13 + k * 7] & 0x0F); + if (k == (nt - 2)) + { + d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); + for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) + { + d_osnma_data.d_mack_message.key[j] = d_mack_message[14 + k * 7 + j]; + } + } } d_osnma_data.d_mack_message.tag_and_info[k].tag = tag; d_osnma_data.d_mack_message.tag_and_info[k].tag_info.PRN_d = PRN_d; @@ -610,13 +673,3 @@ void osnma_msg_receiver::read_mack_info_and_tags() d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; } } - - -void osnma_msg_receiver::read_mack_key() -{ -} - - -void osnma_msg_receiver::read_mack_padding() -{ -} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index bf8a87b10..328e3d8d9 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -67,9 +67,9 @@ private: void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); void read_mack_header(); - void read_mack_info_and_tags(); - void read_mack_key(); - void read_mack_padding(); + void read_mack_body(); + + MACK_message d_old_mack_message; std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 315848a70..890eeb3a5 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -116,7 +116,6 @@ public: MACK_header header; std::vector tag_and_info; std::vector key; - std::vector padding; }; /*! From 5ebc544ff671d59a4a7c2bed49c6391ede4859d5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 13 Jun 2023 14:30:53 +0200 Subject: [PATCH 056/499] Add table 16 --- src/core/system_parameters/Galileo_OSNMA.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 2cb486248..4a5d2b28c 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -161,6 +161,24 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} const std::string PEMFILE_DEFAULT("./OSNMA_PublicKey_20210920133026.pem"); + + +class Mack_lookup +{ +public: + Mack_lookup() = default; + uint8_t msg{}; + uint8_t nt{}; + std::vector sequence1; + std::vector sequence2; +}; + +const std::unordered_map OSNMA_TABLE_16 = { + {27, {2, 6, {"00S", "00E", "00E", "00E", "12S", "00E"}, {"00S ", "00E", "00E", "04S", "12S", "00E"}}}, + {28, {2, 10, {"00S", "00E", "00E", "00E", "00S", "00E", "00E", "12S", "00E", "00E"}, {"00S", "00E", "00E", "00S", "00E", "00E", "04S", "12S", "00E", "00E"}}}, + {31, {2, 5, {"00S", "00E", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "04S"}}}, + {33, {2, 6, {"00S", "00E", "04S", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "00E", "12E"}}}}; + /** \} */ /** \} */ #endif // GNSS_SDR_GALILEO_OSNMA_H \ No newline at end of file From 30b0230680a753b62515980fcef2d8c1a8d488ce Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 13 Jun 2023 16:41:15 +0200 Subject: [PATCH 057/499] Add work on MACSEQ validation --- src/core/libs/osnma_msg_receiver.cc | 44 +++++++++++++++++++++++++++-- src/core/libs/osnma_msg_receiver.h | 13 ++++----- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 6028506c5..4926c51dc 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -58,6 +58,7 @@ osnma_msg_receiver::osnma_msg_receiver( { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath); + d_old_mack_message.set_capacity(10); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -352,7 +353,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } - // Validate signature } } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) @@ -437,7 +437,47 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma { read_mack_header(); read_mack_body(); - d_old_mack_message = d_osnma_data.d_mack_message; + d_old_mack_message.push_back(d_osnma_data.d_mack_message); + + // MACSEQ validation + uint32_t GST_SF = osnma_msg->TOW_sf0; + + // Are there flexible tags? + std::vector m(5); + m[0] = static_cast(osnma_msg->PRN); // PRN_A + m[1] = ((GST_SF & 0xF000) >> 24); + m[2] = ((GST_SF & 0x0F00) >> 16); + m[3] = ((GST_SF & 0x00F0) >> 8); + m[4] = (GST_SF & 0x000F); + + std::vector applicable_key; + // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full + // otherwise pick d_old_mack_message.back() + applicable_key = d_old_mack_message.back().key; + std::vector mac; + if (d_osnma_data.d_dsm_kroot_message.mf == 0) + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + uint16_t mac_msb = 0; + if (!mac.empty()) + { + mac_msb = (mac[0] << 8) + mac[1]; + } + uint16_t computed_macseq = (mac_msb & 0x0FFF); + int num_tags_added = 0; + if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) + { + std::cout << "OSNMA: MACSEQ authenticated for PRN_A " + << osnma_msg->PRN << " with WN=" + << osnma_msg->WN_sf0 << ", TOW=" + << osnma_msg->TOW_sf0 << ". Tags added: " + << num_tags_added << std::endl; + } } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 328e3d8d9..dbe6f5493 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -23,10 +23,11 @@ #include "gnss_block_interface.h" // for gnss_shared_ptr #include "gnss_sdr_make_unique.h" // for std::make:unique in C++11 #include "osnma_data.h" // for OSNMA_data -#include // for gr::block -#include // for pmt::pmt_t -#include // for std::array -#include // for std::shared_ptr +#include +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::array +#include // for std::shared_ptr #include #include @@ -65,12 +66,10 @@ private: void read_dsm_block(const std::shared_ptr& osnma_msg); void read_mack_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); - void read_mack_header(); void read_mack_body(); - MACK_message d_old_mack_message; - + boost::circular_buffer d_old_mack_message; std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; From 59b783d8399acea08922c79b9139fb02a6e4a1c8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 14 Jun 2023 15:32:22 +0200 Subject: [PATCH 058/499] Bug fixes --- src/core/libs/osnma_msg_receiver.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 4926c51dc..d82eb3f68 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -427,9 +427,9 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma uint32_t index = 0; for (uint32_t value : osnma_msg->mack) { - d_mack_message[index] = static_cast((value & 0xFF000000) >> 6); - d_mack_message[index + 1] = static_cast((value & 0x00FF0000) >> 4); - d_mack_message[index + 2] = static_cast((value & 0x0000FF00) >> 2); + d_mack_message[index] = static_cast((value & 0xFF000000) >> 24); + d_mack_message[index + 1] = static_cast((value & 0x00FF0000) >> 16); + d_mack_message[index + 2] = static_cast((value & 0x0000FF00) >> 8); d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } @@ -508,7 +508,7 @@ void osnma_msg_receiver::read_mack_header() else if (lt_bits == 24) { first_lt_bits += static_cast(d_mack_message[2]); - macseq += (static_cast(d_mack_message[3]) << 8); + macseq += (static_cast(d_mack_message[3]) << 4); macseq += (static_cast(d_mack_message[4] & 0xF0) >> 4); cop += (d_mack_message[4] & 0x0F); } @@ -524,7 +524,7 @@ void osnma_msg_receiver::read_mack_header() { first_lt_bits += (static_cast(d_mack_message[2]) << 8); first_lt_bits += static_cast(d_mack_message[3]); - macseq += (static_cast(d_mack_message[4]) << 8); + macseq += (static_cast(d_mack_message[4]) << 4); macseq += (static_cast(d_mack_message[5] & 0xF0) >> 4); cop += (d_mack_message[5] & 0x0F); } @@ -533,13 +533,13 @@ void osnma_msg_receiver::read_mack_header() first_lt_bits += (static_cast(d_mack_message[2]) << 16); first_lt_bits += (static_cast(d_mack_message[3]) << 8); first_lt_bits += static_cast(d_mack_message[4]); - macseq += (static_cast(d_mack_message[5]) << 8); + macseq += (static_cast(d_mack_message[5]) << 4); macseq += (static_cast(d_mack_message[6] & 0xF0) >> 4); cop += (d_mack_message[6] & 0x0F); } d_osnma_data.d_mack_message.header.tag0 = first_lt_bits; d_osnma_data.d_mack_message.header.macseq = macseq; - d_osnma_data.d_mack_message.header.macseq = cop; + d_osnma_data.d_mack_message.header.cop = cop; } From 020d711f5af4c0949d92028c4bc7b14669dd29da Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 15 Jun 2023 09:31:26 +0200 Subject: [PATCH 059/499] Fix leakage --- src/core/system_parameters/gnss_crypto.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 316289953..923483ce6 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -290,7 +290,6 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) } return; } - std::vector publicKey; std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); #if USE_OPENSSL_FALLBACK // Create a BIO object from the string data @@ -326,7 +325,6 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) << ". Aborting import" << std::endl; return; } - gnutls_pubkey_init(&d_PublicKey); d_PublicKey = pubkey; gnutls_pubkey_deinit(pubkey); #endif @@ -346,6 +344,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st EVP_PKEY_CTX* ctx; ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr /* no engine */); bool do_operation = true; + if (!ctx) { do_operation = false; @@ -363,6 +362,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { verification = EVP_PKEY_verify(ctx, signature.data(), signature.size(), message.data(), message.size()); } + EVP_PKEY_CTX_free(ctx); if (verification == 1) { success = true; From 6fcf6d79b349a8ff67ef3aa8208fe10ef6a4681b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Jun 2023 09:57:24 +0200 Subject: [PATCH 060/499] Add the Merkle Tree --- src/core/libs/osnma_msg_receiver.cc | 13 +- src/core/libs/osnma_msg_receiver.h | 6 +- src/core/receiver/gnss_flowgraph.cc | 3 +- src/core/system_parameters/CMakeLists.txt | 1 + src/core/system_parameters/Galileo_OSNMA.h | 2 +- src/core/system_parameters/gnss_crypto.cc | 180 +++++++++++++++++++-- src/core/system_parameters/gnss_crypto.h | 11 +- 7 files changed, 190 insertions(+), 26 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d82eb3f68..3a6b81999 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -45,19 +45,20 @@ namespace wht = std; #endif -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath) +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath) { - return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath)); + return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath)); } osnma_msg_receiver::osnma_msg_receiver( - const std::string& pemFilePath) : gr::block("osnma_msg_receiver", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) + const std::string& pemFilePath, + const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); - d_crypto = std::make_unique(pemFilePath); + d_crypto = std::make_unique(pemFilePath, merkleFilePath); d_old_mack_message.set_capacity(10); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index dbe6f5493..c2a2a7d90 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -42,7 +42,7 @@ class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath); +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); /*! * \brief GNU Radio block that receives asynchronous OSNMA messages @@ -56,8 +56,8 @@ public: ~osnma_msg_receiver() = default; //!< Default destructor private: - friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath); - explicit osnma_msg_receiver(const std::string& pemFilePath); + friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); + osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 3856876ca..2d1e3676f 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -120,7 +120,8 @@ void GNSSFlowgraph::init() { enable_osnma_rx_ = true; auto pemFilePath = configuration_->property("GNSS-SDR.OSNMA_pem", PEMFILE_DEFAULT); - osnma_rx_ = osnma_msg_receiver_make(pemFilePath); + auto merKleTreePath = configuration_->property("GNSS-SDR.OSNMA_MerkleTree", MERKLEFILE_DEFAULT); + osnma_rx_ = osnma_msg_receiver_make(pemFilePath, merKleTreePath); } else { diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index c8b4c2d57..9db20a317 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -123,6 +123,7 @@ target_link_libraries(core_system_parameters PRIVATE Gflags::gflags Glog::glog + Pugixml::pugixml ) # for gnss_sdr_make_unique.h diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 4a5d2b28c..5be8dfcce 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -161,7 +161,7 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} const std::string PEMFILE_DEFAULT("./OSNMA_PublicKey_20210920133026.pem"); - +const std::string MERKLEFILE_DEFAULT("./OSNMA_MerkleTree_20210920133026.xml"); class Mack_lookup { diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 923483ce6..eaab09bb5 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -17,6 +17,7 @@ #include "gnss_crypto.h" #include "Galileo_OSNMA.h" +#include #include #include #include @@ -41,13 +42,14 @@ #endif -Gnss_Crypto::Gnss_Crypto(const std::string& filePath) +Gnss_Crypto::Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath) { #if USE_OPENSSL_FALLBACK #else // gnutls_global_init(); #endif - readPublicKeyFromPEM(filePath); + readPublicKeyFromPEM(pemFilePath); + read_merkle_xml(merkleTreePath); } @@ -75,6 +77,121 @@ bool Gnss_Crypto::have_public_key() const } +std::string Gnss_Crypto::convert_to_utf8_str(const std::vector& input) const +{ + const char hex[] = "0123456789ABCDEF"; + std::string str(input.size() * 2, '0'); + for (size_t i = 0; i < input.size(); i++) + { + str[(i * 2) + 0] = hex[((input[i] & 0xF0) >> 4)]; + str[(i * 2) + 1] = hex[((input[i] & 0x0F))]; + } + return str; +} + + +std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) const +{ + std::vector result; + + // Iterate over the input string in pairs + for (size_t i = 0; i < input.length(); i += 2) + { + // Extract two hexadecimal characters from the input string + std::string hexByte = input.substr(i, 2); + + // Convert the hexadecimal string to an integer value + uint8_t value = static_cast(std::stoul(hexByte, nullptr, 16)); + + // Append the value to the result vector + result.push_back(value); + } + + return result; +} + + +void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) +{ + pugi::xml_document doc; + pugi::xml_parse_result result = doc.load_file(merkleFilePath.c_str()); + if (!result) + { + // XML file not found + // If it was not the default, maybe it is a configuration error + if (merkleFilePath != MERKLEFILE_DEFAULT) + { + std::cerr << "File " << merkleFilePath << " not found" << std::endl; + } + return; + } + try + { + pugi::xml_node root = doc.child("signalData"); + pugi::xml_node header = root.child("header"); + pugi::xml_node body = root.child("body"); + + // Accessing data from the header + pugi::xml_node galHeader = header.child("GAL-header"); + pugi::xml_node source = galHeader.child("source").child("GAL-EXT-GOC-SC-GLAd"); + pugi::xml_node destination = galHeader.child("destination").child("GAL-EXT-GOC-SC-GLAd"); + std::string issueDate = galHeader.child("issueDate").text().get(); + std::string signalVersion = galHeader.child("signalVersion").text().get(); + std::string dataVersion = galHeader.child("dataVersion").text().get(); + + std::cout << " Source: " << source.child_value("mission") << " - " << source.child_value("segment") << " - " << source.child_value("element") << std::endl; + std::cout << " Destination: " << destination.child_value("mission") << " - " << destination.child_value("segment") << " - " << destination.child_value("element") << std::endl; + std::cout << " Issue Date: " << issueDate << std::endl; + std::cout << " Signal Version: " << signalVersion << std::endl; + std::cout << " Data Version: " << dataVersion << std::endl; + + // Accessing data from the body + pugi::xml_node merkleTree = body.child("MerkleTree"); + + int n = std::stoi(merkleTree.child_value("N")); + std::string hashFunction = merkleTree.child_value("HashFunction"); + + std::cout << " N: " << n << std::endl; + std::cout << " Hash Function: " << hashFunction << std::endl; + + for (pugi::xml_node publicKey : merkleTree.children("PublicKey")) + { + int i = std::stoi(publicKey.child_value("i")); + std::string pkid = publicKey.child_value("PKID"); + int lengthInBits = std::stoi(publicKey.child_value("lengthInBits")); + std::string point = publicKey.child_value("point"); + std::string pkType = publicKey.child_value("PKType"); + + std::cout << " Public Key: " << i << std::endl; + std::cout << " PKID: " << pkid << std::endl; + std::cout << " Length in Bits: " << lengthInBits << std::endl; + std::cout << " Point: " << point << std::endl; + std::cout << " PK Type: " << pkType << std::endl; + } + for (pugi::xml_node treeNode : merkleTree.children("TreeNode")) + { + int j = std::stoi(treeNode.child_value("j")); + int i = std::stoi(treeNode.child_value("i")); + int lengthInBits = std::stoi(treeNode.child_value("lengthInBits")); + std::cout << " Node length (bits): " << lengthInBits << std::endl; + std::string x_ji = treeNode.child_value("x_ji"); + std::cout << " Size string (bytes): " << x_ji.size() << std::endl; + std::cout << " m_" << j << "_" << i << " = " << x_ji << std::endl; + std::vector myVector2 = convert_from_hex_str(x_ji); + std::cout << "After the conversion is " << convert_to_utf8_str(myVector2) << std::endl; + std::vector myVector(x_ji.begin(), x_ji.end()); // No + std::cout << " Length Tree node (bytes): " << myVector.size() << std::endl; + } + } + catch (const std::exception& e) + { + std::cerr << "Exception raised reading the " << merkleFilePath << " file: " << e.what() << '\n'; + return; + } + std::cout << "Merkle Tree successfully read from file " << merkleFilePath << std::endl; +} + + // void Gnss_Crypto::set_public_key(const std::vector& publickey) // { // } @@ -276,17 +393,17 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } -void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) +void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) { // Open the .pem file - std::ifstream pemFile(filePath); + std::ifstream pemFile(pemFilePath); if (!pemFile) { // PEM file not found - // If it not was the default, maybe it is a configuration error - if (filePath != PEMFILE_DEFAULT) + // If it was not the default, maybe it is a configuration error + if (pemFilePath != PEMFILE_DEFAULT) { - std::cerr << "File " << filePath << " not found" << std::endl; + std::cerr << "File " << pemFilePath << " not found" << std::endl; } return; } @@ -296,7 +413,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) BIO* bio = BIO_new_mem_buf(pemContent.c_str(), pemContent.length()); if (!bio) { - std::cerr << "OpenSSL: error creating a BIO object with data read from file " << filePath << ". Aborting import" << std::endl; + std::cerr << "OpenSSL: error creating a BIO object with data read from file " << pemFilePath << ". Aborting import" << std::endl; return; } #if USE_OPENSSL_3 @@ -307,7 +424,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) BIO_free(bio); if (d_PublicKey == nullptr) { - std::cerr << "OpenSSL: error reading the Public Key from file " << filePath << ". Aborting import" << std::endl; + std::cerr << "OpenSSL: error reading the Public Key from file " << pemFilePath << ". Aborting import" << std::endl; return; } #else @@ -321,14 +438,14 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& filePath) { gnutls_pubkey_deinit(pubkey); std::cerr << "GnuTLS: error reading the Public Key from file " - << filePath + << pemFilePath << ". Aborting import" << std::endl; return; } d_PublicKey = pubkey; gnutls_pubkey_deinit(pubkey); #endif - std::cout << "Public key successfully read from file " << filePath << std::endl; + std::cout << "Public key successfully read from file " << pemFilePath << std::endl; } @@ -389,6 +506,11 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #endif #else + unsigned int bit_size; + if (gnutls_pubkey_get_pk_algorithm(d_PublicKey, &bit_size) != GNUTLS_PK_ECDSA) + { + std::cout << "GnuTLS: the Public Key does not contain a ECDSA key. Aborting signature verification" << std::endl; + } gnutls_datum_t signature_{}; signature_.data = const_cast(signature.data()); signature_.size = signature.size(); @@ -406,4 +528,38 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } #endif return success; -} \ No newline at end of file +} + + +std::vector Gnss_Crypto::getMerkleRoot(const std::vector>& merkle) +{ + if (merkle.empty()) + { + return {}; + } + else if (merkle.size() == 1) + { + return this->computeSHA3_256(merkle[0]); + } + + std::vector> new_merkle = merkle; + + while (new_merkle.size() > 1) + { + if (new_merkle.size() % 2 == 1) + new_merkle.push_back(merkle.back()); + + std::vector> result; + + for (size_t i = 0; i < new_merkle.size(); i += 2) + { + std::vector var1 = this->computeSHA3_256(new_merkle[i]); + std::vector var2 = this->computeSHA3_256(new_merkle[i + 1]); + var1.insert(var1.end(), var2.begin(), var2.end()); + std::vector hash = this->computeSHA3_256(var1); + result.push_back(hash); + } + new_merkle = result; + } + return new_merkle[0]; +} diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 44103b28b..c6acc728f 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -37,15 +37,20 @@ class Gnss_Crypto public: Gnss_Crypto() = default; ~Gnss_Crypto(); - explicit Gnss_Crypto(const std::string& filePath); + Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath); bool have_public_key() const; + std::string convert_to_utf8_str(const std::vector& input) const; + std::vector convert_from_hex_str(const std::string& input) const; std::vector computeSHA256(const std::vector& input) const; std::vector computeSHA3_256(const std::vector& input) const; std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; - bool verify_signature(const std::vector& message, const std::vector& signature); - void readPublicKeyFromPEM(const std::string& filePath); + bool verify_signature(const std::vector& message, const std::vector& signature); + void readPublicKeyFromPEM(const std::string& pemFilePath); + void read_merkle_xml(const std::string& merkleFilePath); + std::vector getMerkleRoot(const std::vector>& merkle); + // void set_public_key(const std::vector& publickey); private: From e32a65b3a3def22bdf8f1e1a351194c872d8bf9c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Jun 2023 11:07:44 +0200 Subject: [PATCH 061/499] Fix building in macOS --- src/core/system_parameters/Galileo_OSNMA.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 5be8dfcce..2cf1104af 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -167,6 +167,13 @@ class Mack_lookup { public: Mack_lookup() = default; + Mack_lookup(uint8_t msg_, + uint8_t nt_, + const std::vector& s1_, + const std::vector& s2_) : msg(msg_), + nt(nt_), + sequence1(s1_), + sequence2(s2_){}; uint8_t msg{}; uint8_t nt{}; std::vector sequence1; From 2a41ed82783fe3620abbc5557bf803ab4caddf2f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Jun 2023 14:56:53 +0200 Subject: [PATCH 062/499] Store roots from Merkle Tree file, pick up defaults if not found --- src/core/system_parameters/gnss_crypto.cc | 49 +++++++++++++++++++---- src/core/system_parameters/gnss_crypto.h | 6 +++ 2 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index eaab09bb5..0492b1d23 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -101,7 +101,7 @@ std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) std::string hexByte = input.substr(i, 2); // Convert the hexadecimal string to an integer value - uint8_t value = static_cast(std::stoul(hexByte, nullptr, 16)); + auto value = static_cast(std::stoul(hexByte, nullptr, 16)); // Append the value to the result vector result.push_back(value); @@ -118,11 +118,18 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) if (!result) { // XML file not found - // If it was not the default, maybe it is a configuration error + // If it was not the default, maybe it is a configuration error, warn user if (merkleFilePath != MERKLEFILE_DEFAULT) { std::cerr << "File " << merkleFilePath << " not found" << std::endl; } + // fill default values + d_x_4_0 = convert_from_hex_str("C5B2A3BD24E819EF82B17ACE83C0E7F41D34AC9B488CB7CE4D765FDE7DCA0297"); + d_x_3_1 = convert_from_hex_str("C8314BA8084E0CA101E595E88F170012F1F5CE71EEEFAB27334283E15935E8E6"); + d_x_2_1 = convert_from_hex_str("6FB21E4DDF3F8E517A5C5B1C6D843F9236707FF11D96F9BA954BFEAA3A44E56B"); + d_x_1_1 = convert_from_hex_str("86E53A50D345FBDAD49835F3363EE4A7262DB738CBDFC399229AE2803679300D"); + d_x_0_0 = convert_from_hex_str("40CAA1D70F7B1D370219674A25721311170A49DE4E4A0CE4FE328674E01CF750"); + d_x_0_1 = convert_from_hex_str("AA1A8B68E5DB293106B5BC8806F9790E8ACF8DC2D28A6EF6C1AC7233A9813D3F"); return; } try @@ -177,15 +184,41 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) std::string x_ji = treeNode.child_value("x_ji"); std::cout << " Size string (bytes): " << x_ji.size() << std::endl; std::cout << " m_" << j << "_" << i << " = " << x_ji << std::endl; - std::vector myVector2 = convert_from_hex_str(x_ji); - std::cout << "After the conversion is " << convert_to_utf8_str(myVector2) << std::endl; - std::vector myVector(x_ji.begin(), x_ji.end()); // No - std::cout << " Length Tree node (bytes): " << myVector.size() << std::endl; + if (j == 4 && i == 0) + { + d_x_4_0 = convert_from_hex_str(x_ji); + } + if (j == 3 && i == 1) + { + d_x_3_1 = convert_from_hex_str(x_ji); + } + if (j == 2 && i == 1) + { + d_x_2_1 = convert_from_hex_str(x_ji); + } + if (j == 1 && i == 1) + { + d_x_1_1 = convert_from_hex_str(x_ji); + } + if (j == 0 && i == 0) + { + d_x_0_0 = convert_from_hex_str(x_ji); + } + if (j == 0 && i == 1) + { + d_x_0_0 = convert_from_hex_str(x_ji); + } } } catch (const std::exception& e) { std::cerr << "Exception raised reading the " << merkleFilePath << " file: " << e.what() << '\n'; + d_x_4_0 = convert_from_hex_str("C5B2A3BD24E819EF82B17ACE83C0E7F41D34AC9B488CB7CE4D765FDE7DCA0297"); + d_x_3_1 = convert_from_hex_str("C8314BA8084E0CA101E595E88F170012F1F5CE71EEEFAB27334283E15935E8E6"); + d_x_2_1 = convert_from_hex_str("6FB21E4DDF3F8E517A5C5B1C6D843F9236707FF11D96F9BA954BFEAA3A44E56B"); + d_x_1_1 = convert_from_hex_str("86E53A50D345FBDAD49835F3363EE4A7262DB738CBDFC399229AE2803679300D"); + d_x_0_0 = convert_from_hex_str("40CAA1D70F7B1D370219674A25721311170A49DE4E4A0CE4FE328674E01CF750"); + d_x_0_1 = convert_from_hex_str("AA1A8B68E5DB293106B5BC8806F9790E8ACF8DC2D28A6EF6C1AC7233A9813D3F"); return; } std::cout << "Merkle Tree successfully read from file " << merkleFilePath << std::endl; @@ -547,7 +580,9 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector 1) { if (new_merkle.size() % 2 == 1) - new_merkle.push_back(merkle.back()); + { + new_merkle.push_back(merkle.back()); + } std::vector> result; diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index c6acc728f..83137f15e 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -63,6 +63,12 @@ private: #else gnutls_pubkey_t d_PublicKey{}; #endif + std::vector d_x_4_0; + std::vector d_x_3_1; + std::vector d_x_2_1; + std::vector d_x_1_1; + std::vector d_x_0_0; + std::vector d_x_0_1; }; /** \} */ From 2649406538d58cd8952a3c5a9980895475ca7dee Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Jun 2023 08:20:45 +0200 Subject: [PATCH 063/499] Make clang-tidy happy --- src/core/system_parameters/gnss_crypto.cc | 2 +- src/core/system_parameters/gnss_crypto.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 0492b1d23..eab8ab23e 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -564,7 +564,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } -std::vector Gnss_Crypto::getMerkleRoot(const std::vector>& merkle) +std::vector Gnss_Crypto::getMerkleRoot(const std::vector>& merkle) const { if (merkle.empty()) { diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 83137f15e..c544020a9 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -49,7 +49,7 @@ public: bool verify_signature(const std::vector& message, const std::vector& signature); void readPublicKeyFromPEM(const std::string& pemFilePath); void read_merkle_xml(const std::string& merkleFilePath); - std::vector getMerkleRoot(const std::vector>& merkle); + std::vector getMerkleRoot(const std::vector>& merkle) const; // void set_public_key(const std::vector& publickey); From 28474b824f364756baa573bc0d74e8d93bcf8a86 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 3 Jul 2023 21:28:33 +0200 Subject: [PATCH 064/499] Reorder code --- src/core/libs/osnma_msg_receiver.cc | 88 +++++++++++++++-------------- src/core/libs/osnma_msg_receiver.h | 3 +- 2 files changed, 49 insertions(+), 42 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 3a6b81999..39ac24843 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -438,47 +438,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma { read_mack_header(); read_mack_body(); - d_old_mack_message.push_back(d_osnma_data.d_mack_message); - - // MACSEQ validation - uint32_t GST_SF = osnma_msg->TOW_sf0; - - // Are there flexible tags? - std::vector m(5); - m[0] = static_cast(osnma_msg->PRN); // PRN_A - m[1] = ((GST_SF & 0xF000) >> 24); - m[2] = ((GST_SF & 0x0F00) >> 16); - m[3] = ((GST_SF & 0x00F0) >> 8); - m[4] = (GST_SF & 0x000F); - - std::vector applicable_key; - // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full - // otherwise pick d_old_mack_message.back() - applicable_key = d_old_mack_message.back().key; - std::vector mac; - if (d_osnma_data.d_dsm_kroot_message.mf == 0) - { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); - } - else if (d_osnma_data.d_dsm_kroot_message.mf == 1) - { - mac = d_crypto->computeCMAC_AES(applicable_key, m); - } - uint16_t mac_msb = 0; - if (!mac.empty()) - { - mac_msb = (mac[0] << 8) + mac[1]; - } - uint16_t computed_macseq = (mac_msb & 0x0FFF); - int num_tags_added = 0; - if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) - { - std::cout << "OSNMA: MACSEQ authenticated for PRN_A " - << osnma_msg->PRN << " with WN=" - << osnma_msg->WN_sf0 << ", TOW=" - << osnma_msg->TOW_sf0 << ". Tags added: " - << num_tags_added << std::endl; - } + process_mack_message(osnma_msg); } } @@ -714,3 +674,49 @@ void osnma_msg_receiver::read_mack_body() d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; } } + + +void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) +{ + d_old_mack_message.push_back(d_osnma_data.d_mack_message); + + // MACSEQ validation + uint32_t GST_SF = osnma_msg->TOW_sf0; + + // Are there flexible tags? + std::vector m(5); + m[0] = static_cast(osnma_msg->PRN); // PRN_A + m[1] = ((GST_SF & 0xF000) >> 24); + m[2] = ((GST_SF & 0x0F00) >> 16); + m[3] = ((GST_SF & 0x00F0) >> 8); + m[4] = (GST_SF & 0x000F); + + std::vector applicable_key; + // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full + // otherwise pick d_old_mack_message.back() + applicable_key = d_old_mack_message.back().key; + std::vector mac; + if (d_osnma_data.d_dsm_kroot_message.mf == 0) + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + uint16_t mac_msb = 0; + if (!mac.empty()) + { + mac_msb = (mac[0] << 8) + mac[1]; + } + uint16_t computed_macseq = (mac_msb & 0x0FFF); + int num_tags_added = 0; + if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) + { + std::cout << "OSNMA: MACSEQ authenticated for PRN_A " + << osnma_msg->PRN << " with WN=" + << osnma_msg->WN_sf0 << ", TOW=" + << osnma_msg->TOW_sf0 << ". Tags added: " + << num_tags_added << std::endl; + } +} \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index c2a2a7d90..b07f4177b 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -64,10 +64,11 @@ private: void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); - void read_mack_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); + void read_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); + void process_mack_message(const std::shared_ptr& osnma_msg); boost::circular_buffer d_old_mack_message; std::unique_ptr d_dsm_reader; From 15840f6ae5b6bd1f1ad98d1014a7582751d1e097 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 26 Oct 2023 14:45:01 +0200 Subject: [PATCH 065/499] Fix merging --- .../gnuradio_blocks/galileo_telemetry_decoder_gs.cc | 4 ---- 1 file changed, 4 deletions(-) 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 9467f3994..1f7678ced 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 @@ -105,13 +105,9 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs( d_enable_reed_solomon_inav(false), d_valid_timetag(false), d_E6_TOW_set(false), -<<<<<<< HEAD d_there_are_e1_channels(conf.there_are_e1_channels), - d_there_are_e6_channels(conf.there_are_e6_channels) -======= d_there_are_e6_channels(conf.there_are_e6_channels), d_use_ced(conf.use_ced) ->>>>>>> 62a8547e62605a6b9fa6b1e128beceb046bde2dc { // prevent telemetry symbols accumulation in output buffers this->set_max_noutput_items(1); From ba357ebd9c39d90fa59639d217712685b108d4bf Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 3 Dec 2023 15:50:16 +0100 Subject: [PATCH 066/499] Comments and questions | verify_dsm_pkr() structure --- src/core/libs/osnma_msg_receiver.cc | 54 +++++++++++++++++-------- src/core/libs/osnma_msg_receiver.h | 8 +++- src/core/system_parameters/osnma_data.h | 2 +- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 39ac24843..8f157414f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -110,9 +110,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } // Send the resulting decoded NMA data (if available) to PVT - if (d_new_data == true) + if (d_new_data == true) // TODO where is it set to true? { - auto osnma_data_ptr = std::make_shared(d_osnma_data); + auto osnma_data_ptr = std::make_shared(d_osnma_data); // C: why create new object and pass it empty to Pvt? this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); d_new_data = false; // d_osnma_data = OSNMA_data(); @@ -302,12 +302,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; MSG.reserve(size_m + l_ds_bytes + 1); - MSG.push_back(osnma_msg->hkroot[0]); + MSG.push_back(osnma_msg->hkroot[0]); // C: NMA header for (uint16_t i = 1; i < size_m; i++) { MSG.push_back(dsm_msg[i]); } - std::vector message = MSG; + std::vector message = MSG; // C: MSG == M || DS from ICD. Eq. 7 for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); @@ -344,16 +344,20 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; if (authenticated) { - std::cout << " authenticated" << std::endl; + std::cout << " authenticated" << std::endl; // C: proceed with Tesla chain key verification. } else { - std::cout << " validated" << std::endl; + std::cout << " validated" << std::endl; // C: Kroot not verified => retrieve it again } std::cout << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } + else + { + std::cout << "Galileo OSNMA: Error computing padding bits." << std::endl; + } } } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) @@ -411,6 +415,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << " received" << std::endl; + // C: NPK verification against Merkle tree root. + std::vector m_0; + d_public_key_verified = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message, m_0); } } else @@ -434,7 +441,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } - if (d_osnma_data.d_dsm_kroot_message.ts != 0) + if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 { read_mack_header(); read_mack_body(); @@ -444,7 +451,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma void osnma_msg_receiver::read_mack_header() -{ +{ // C: still to review computations. uint8_t lt_bits = 0; const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it != OSNMA_TABLE_11.cend()) @@ -453,7 +460,7 @@ void osnma_msg_receiver::read_mack_header() } if (lt_bits == 0) { - return; + return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. } uint16_t macseq = 0; uint8_t cop = 0; @@ -526,8 +533,8 @@ void osnma_msg_receiver::read_mack_body() { return; } - uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); - d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); + uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); // C: compute number of tags + d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); // C: nt - 1? for (uint16_t k = 0; k < (nt - 1); k++) { uint64_t tag = 0; @@ -680,11 +687,14 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { d_old_mack_message.push_back(d_osnma_data.d_mack_message); - // MACSEQ validation + // MACSEQ validation - case no FLX Tags uint32_t GST_SF = osnma_msg->TOW_sf0; + // C: TODO check ADKD-MACLT for match, also identify which tags are FLX + // C: TODO if Tag_x FLX => MACSEQ, otherwise ___ ? // Are there flexible tags? - std::vector m(5); + + std::vector m(5); // C: ICD - Eq. 23 m[0] = static_cast(osnma_msg->PRN); // PRN_A m[1] = ((GST_SF & 0xF000) >> 24); m[2] = ((GST_SF & 0x0F00) >> 16); @@ -696,11 +706,11 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // otherwise pick d_old_mack_message.back() applicable_key = d_old_mack_message.back().key; std::vector mac; - if (d_osnma_data.d_dsm_kroot_message.mf == 0) + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); } - else if (d_osnma_data.d_dsm_kroot_message.mf == 1) + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { mac = d_crypto->computeCMAC_AES(applicable_key, m); } @@ -719,4 +729,16 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& << osnma_msg->TOW_sf0 << ". Tags added: " << num_tags_added << std::endl; } -} \ No newline at end of file + + // C: TODO - for each tag in tag_and_info[] && until l_t_verified <= L_t_min + // C: TODO - tag = trunc(l_t, mac(applicable_key,m)) + // C: TODO - where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) +} + +bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message, std::vector m0) +{ + // TODO concatenate message + // TODO create function for recursively apply hash + + return false; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index b07f4177b..89522bc69 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -65,6 +65,7 @@ private: void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); + bool verify_dsm_pkr(DSM_PKR_message message, std::vector input_message); void read_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); @@ -74,13 +75,16 @@ private: std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; - std::array, 16> d_dsm_message{}; + std::array, 16> d_dsm_message{}; // C: each dsm[0-15] has 2048 bits std::array, 16> d_dsm_id_received{}; std::array d_number_of_blocks{}; - std::array d_mack_message{}; + std::array d_mack_message{}; // C: 480 b OSNMA_data d_osnma_data{}; bool d_new_data{false}; + bool d_public_key_verified{false}; + bool d_kroot_verified{false}; + }; diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 890eeb3a5..5f82bb5a8 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -68,7 +68,7 @@ class MACK_tag_and_info { public: MACK_tag_and_info() = default; - uint64_t tag; + uint64_t tag; // C: 20-40 bits MACK_tag_info tag_info; }; From d01ea978c69205300c8afa51d4e778f2d187e5ff Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 3 Dec 2023 17:45:15 +0100 Subject: [PATCH 067/499] [TAS-108] first implementation of verify_dsm_pkr() * osnma_msg_receiver : leafs computation without loop and root comparison * gnss_crypto : getMerkleRoot() to return d_x_4_0 --- src/core/libs/osnma_msg_receiver.cc | 48 +++++++++++++++++++++--- src/core/libs/osnma_msg_receiver.h | 2 +- src/core/system_parameters/gnss_crypto.h | 4 ++ 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 8f157414f..cf7e3adc9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -416,8 +416,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << " received" << std::endl; // C: NPK verification against Merkle tree root. - std::vector m_0; - d_public_key_verified = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message, m_0); + d_public_key_verified = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); } } else @@ -735,10 +734,49 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // C: TODO - where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) } -bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message, std::vector m0) +bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) { - // TODO concatenate message + // TODO create leafe base message m_i // TODO create function for recursively apply hash - return false; + // build base leaf m_i +// auto leaf = message.mid; + std::vector m_i; + m_i.reserve(2 + message.npk.size()); + m_i[0] = message.npkt; + m_i[1] = message.npktid; + for (uint8_t i = 2; i < m_i.size(); i++) + { + m_i.push_back(message.npk[i]); + } + + // compute intermediate leafs' values + std::vector x_0,x_1,x_2,x_3,x_4; +// uint8_t k = 0; + x_0 = d_crypto->computeSHA256(m_i); + x_0.insert(x_0.end(),message.itn.begin(),&message.itn[31]); + x_1 = d_crypto->computeSHA256(x_0); + x_1.insert(x_1.end(),&message.itn[32],&message.itn[63]); + x_2 = d_crypto->computeSHA256(x_1); + x_2.insert(x_2.end(),&message.itn[64],&message.itn[95]); + x_3 = d_crypto->computeSHA256(x_2); + x_3.insert(x_3.end(),&message.itn[96],&message.itn[127]); + // root leaf computation + x_4 = d_crypto->computeSHA256(x_3); + + // C: d_crypto->getMerkleRoot([m_0:m_15]) I realised I could have done this... + // C: ... but why computing all the possible results? I have only one leaf in each osnma message... + // verify that computed root matches merkle root + + if(x_4 == d_crypto->getMerkleRoot()) + { + std::cout << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; + return true; + // C: NPK verification against Merkle tree root. + } + else + { + std::cout << "Galileo OSNMA: DSM-PKR verification unsuccessful !" << std::endl; + return false; + } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 89522bc69..2c9cedcc7 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -65,7 +65,7 @@ private: void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); - bool verify_dsm_pkr(DSM_PKR_message message, std::vector input_message); + bool verify_dsm_pkr(DSM_PKR_message message); void read_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index c544020a9..50047c440 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -50,6 +50,10 @@ public: void readPublicKeyFromPEM(const std::string& pemFilePath); void read_merkle_xml(const std::string& merkleFilePath); std::vector getMerkleRoot(const std::vector>& merkle) const; + std::vector getMerkleRoot() const + { + return d_x_4_0; + } // void set_public_key(const std::vector& publickey); From 51061f18ebbd365d7c53d403516bab6914d470b5 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 5 Dec 2023 20:16:03 +0100 Subject: [PATCH 068/499] [TAS-106] process_mack_message: tags ADKD-MCLT check (first draft) --- src/core/libs/osnma_msg_receiver.cc | 51 ++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index cf7e3adc9..80f67a5ef 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -533,7 +533,7 @@ void osnma_msg_receiver::read_mack_body() return; } uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); // C: compute number of tags - d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); // C: nt - 1? + d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); for (uint16_t k = 0; k < (nt - 1); k++) { uint64_t tag = 0; @@ -684,7 +684,7 @@ void osnma_msg_receiver::read_mack_body() void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { - d_old_mack_message.push_back(d_osnma_data.d_mack_message); + d_old_mack_message.push_back(d_osnma_data.d_mack_message); // C: old mack message is needed for // MACSEQ validation - case no FLX Tags uint32_t GST_SF = osnma_msg->TOW_sf0; @@ -692,8 +692,47 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // C: TODO check ADKD-MACLT for match, also identify which tags are FLX // C: TODO if Tag_x FLX => MACSEQ, otherwise ___ ? // Are there flexible tags? + // d_osnma_data.d_dsm_kroot_message.maclt + // d_osnma_data.d_mack_message.tag_and_info[k].tag - std::vector m(5); // C: ICD - Eq. 23 + // retrieve data to verify MACK tags + uint8_t msg {0}; + uint8_t nt {0}; + std::vector sq1{}; + std::vector sq2{}; + const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); + if (it != OSNMA_TABLE_16.cend()) + { + auto msg = it->second.msg; + auto nt = it->second.nt; + auto sq1 = it->second.sequence1; + auto sq2 = it->second.sequence2; + } + if (msg == 0) + { + return; + } + // compare ADKD of Mack tags with MACLT defined ADKDs + // TODO - "When it is equal to 2, the sequence starts with the MACK message transmitted in the first 30 seconds of a GST minute." + if(d_osnma_data.d_mack_message.tag_and_info.size() != sq1.size()) // TODO - which sequence is retrieved in this Mack? + { + std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; + return; + } + bool allOk = true; + std::string selfAutenticated {}; + for (uint8_t i = 0; i < d_osnma_data.d_mack_message.tag_and_info.size(); i++) + { + if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(sq1[i])) // C: undefined if format is not "00S" + { + allOk = false; + break; + } + selfAutenticated = sq1[i][sq1[i].size()-1]; + } + + + std::vector m(5); // C: ICD - Eq. 22 m[0] = static_cast(osnma_msg->PRN); // PRN_A m[1] = ((GST_SF & 0xF000) >> 24); m[2] = ((GST_SF & 0x0F00) >> 16); @@ -730,8 +769,10 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& } // C: TODO - for each tag in tag_and_info[] && until l_t_verified <= L_t_min - // C: TODO - tag = trunc(l_t, mac(applicable_key,m)) - // C: TODO - where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) + // C: d_osnma_data.d_dsm_kroot_message.ts gives l_t of each tag for this mack + // C: tag = trunc(l_t, mac(applicable_key,m)) + // C: where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) + // C: si l_t_verified >= L_t_min d_new_data = true } bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) From 1356a3e87bd35ca0b7ae6701d1966731a471d056 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 7 Dec 2023 05:34:52 +0100 Subject: [PATCH 069/499] [TAS-110] verify_tesla_key-> implement retrieval tesla key --- src/core/libs/osnma_msg_receiver.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 80f67a5ef..ad361dd9f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -512,6 +512,7 @@ void osnma_msg_receiver::read_mack_header() void osnma_msg_receiver::read_mack_body() { + uint8_t lt_bits = 0; const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it != OSNMA_TABLE_11.cend()) @@ -534,7 +535,7 @@ void osnma_msg_receiver::read_mack_body() } uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); // C: compute number of tags d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); - for (uint16_t k = 0; k < (nt - 1); k++) + for (uint16_t k = 0; k < (nt - 1); k++) // C: retrieve Tag&Info { uint64_t tag = 0; uint8_t PRN_d = 0; @@ -679,6 +680,20 @@ void osnma_msg_receiver::read_mack_body() d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = ADKD; d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; } + // TODO - [TAS-110] + // retrieve TESLA key: index i is [479-MH(l_t)-(nt-1)*(16+l_t), i+l_k] + // compute I (GST_SFi,GST_Kroot) + // perform recursive hash calls until base case: i = 10...1 + + // retrieve tesla key + uint8_t start_index_bytes = ( 480 - (lt_bits + 16) - (nt - 1) * ( lt_bits + 16 ) - 1 ) / 8; // includes -1 to start at [i-1] + uint8_t last_index_bytes = ( start_index_bytes * 8 + lk_bits ) / 8; + uint8_t key_index_bytes = 0; + for (uint8_t i = start_index_bytes; i < last_index_bytes ; i++, key_index_bytes++) + { + d_osnma_data.d_mack_message.key[key_index_bytes] = d_mack_message[i]; + } + } From 33f6bacd9b0d21d5be6cb96632d3b555b5d677cb Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 12 Dec 2023 22:07:30 +0100 Subject: [PATCH 070/499] [TAS-110] tesla key verification first implementation * read_mack_block => computation of d_GST_Sf and d_GST_0 * read_mack_header => verify_tesla_key logic --- src/core/libs/osnma_msg_receiver.cc | 81 +++++++++++++++++++++++-- src/core/libs/osnma_msg_receiver.h | 3 +- src/core/system_parameters/osnma_data.h | 2 +- 3 files changed, 79 insertions(+), 7 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index ad361dd9f..62a0be6fa 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -440,6 +440,9 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } + // compute time of subrame and kroot time of applicability, used in read_mack_body and process_mack_message + d_GST_Sf = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - find a better placement + d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k; if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 { read_mack_header(); @@ -694,6 +697,75 @@ void osnma_msg_receiver::read_mack_body() d_osnma_data.d_mack_message.key[key_index_bytes] = d_mack_message[i]; } + // compute number of hashes required + uint8_t num_of_hashes_needed = (d_GST_Sf - d_GST_0) / 30 + 1; + uint32_t GST_SFi = d_GST_Sf; + std::vector K_II = d_osnma_data.d_mack_message.key; + std::vector K_I; // result of the recursive hash operations + uint8_t size_hash_f = d_osnma_data.d_dsm_kroot_message.ks / 8; + // compute the current tesla key + for (uint8_t i = 1; i < num_of_hashes_needed ; i++) + { + // build message digest m = (K_I+1 || GST_SFi || alpha) + std::vector msg(sizeof(K_II) + sizeof(d_GST_Sf) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::copy(K_II.begin(),K_II.end(),msg.begin()); + + msg.push_back((d_GST_Sf & 0xF000) >> 24); + msg.push_back((d_GST_Sf & 0x0F00) >> 16); + msg.push_back((d_GST_Sf & 0x00F0) >> 8); + msg.push_back(d_GST_Sf & 0x000F); + + for (uint8_t k = 5; k >= 0;k--) + { + // TODO: static extracts the MSB in case from larger to shorter int? + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. + } + + // compute hash + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + { + hash = d_crypto->computeSHA256(msg); + } + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + { + hash = d_crypto->computeSHA3_256(msg); + } + else + { + hash = std::vector(32); + } + // truncate hash + K_I.reserve(size_hash_f); // TODO - case hash function has 512 bits + for (uint16_t i = 0; i < size_hash_f; i++) + { + K_I.push_back(hash[i]); + } + + // set parameters + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation + } + // compare computed current key against received key + bool result_comparison; + if(K_I.size() != d_osnma_data.d_mack_message.key.size()) + { + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + } + if (K_II == d_osnma_data.d_mack_message.key) + { + result_comparison = true; + std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + // TODO - propagate result + // TODO - save current tesla key as latest one? + } + else + + { + result_comparison = false; + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + } } @@ -702,7 +774,6 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& d_old_mack_message.push_back(d_osnma_data.d_mack_message); // C: old mack message is needed for // MACSEQ validation - case no FLX Tags - uint32_t GST_SF = osnma_msg->TOW_sf0; // C: TODO check ADKD-MACLT for match, also identify which tags are FLX // C: TODO if Tag_x FLX => MACSEQ, otherwise ___ ? @@ -749,10 +820,10 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& std::vector m(5); // C: ICD - Eq. 22 m[0] = static_cast(osnma_msg->PRN); // PRN_A - m[1] = ((GST_SF & 0xF000) >> 24); - m[2] = ((GST_SF & 0x0F00) >> 16); - m[3] = ((GST_SF & 0x00F0) >> 8); - m[4] = (GST_SF & 0x000F); + m[1] = ((d_GST_Sf & 0xF000) >> 24); + m[2] = ((d_GST_Sf & 0x0F00) >> 16); + m[3] = ((d_GST_Sf & 0x00F0) >> 8); + m[4] = (d_GST_Sf & 0x000F); std::vector applicable_key; // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 2c9cedcc7..6922ae5aa 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -84,7 +84,8 @@ private: bool d_new_data{false}; bool d_public_key_verified{false}; bool d_kroot_verified{false}; - + uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification + uint32_t d_GST_0 {}; }; diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 5f82bb5a8..ffd459fab 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -102,7 +102,7 @@ public: uint8_t reserved1{}; uint8_t hf{}; uint8_t mf{}; - uint8_t ks{}; + uint8_t ks{}; // key size, in bits uint8_t ts{}; uint8_t maclt{}; uint8_t reserved{}; From 7f3202be8e96105a64ddc3af5a884832586f855e Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 17 Dec 2023 14:15:00 +0100 Subject: [PATCH 071/499] WIP --- src/core/libs/osnma_msg_receiver.cc | 21 +++++++++++++++------ src/core/libs/osnma_msg_receiver.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 62a0be6fa..f7ab9e334 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -150,7 +150,9 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) << std::endl; } - +/* + * accumulates dsm messages until completeness, then calls process_dsm_message + * */ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) { size_t index = 0; @@ -245,7 +247,13 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } } - +/* + * case DSM-Kroot: + * - computes the padding + * - if successful, tries to verify the digital signature + * case DSM-PKR: + * - calls verify_dsm_pkr to verify the public key + * */ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg) { if (d_osnma_data.d_dsm_header.dsm_id < 12) @@ -441,8 +449,9 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma index = index + 4; } // compute time of subrame and kroot time of applicability, used in read_mack_body and process_mack_message - d_GST_Sf = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - find a better placement + d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - find a better placement d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k; + d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // TODO - find a better placement if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 { read_mack_header(); @@ -703,11 +712,11 @@ void osnma_msg_receiver::read_mack_body() std::vector K_II = d_osnma_data.d_mack_message.key; std::vector K_I; // result of the recursive hash operations uint8_t size_hash_f = d_osnma_data.d_dsm_kroot_message.ks / 8; - // compute the current tesla key + // compute the current tesla key , GST_SFi and K_II change in each iteration for (uint8_t i = 1; i < num_of_hashes_needed ; i++) { // build message digest m = (K_I+1 || GST_SFi || alpha) - std::vector msg(sizeof(K_II) + sizeof(d_GST_Sf) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); std::copy(K_II.begin(),K_II.end(),msg.begin()); msg.push_back((d_GST_Sf & 0xF000) >> 24); @@ -772,7 +781,7 @@ void osnma_msg_receiver::read_mack_body() void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { d_old_mack_message.push_back(d_osnma_data.d_mack_message); // C: old mack message is needed for - + // MACSEQ validation - case no FLX Tags // C: TODO check ADKD-MACLT for match, also identify which tags are FLX diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 6922ae5aa..0ba9169ff 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -86,6 +86,7 @@ private: bool d_kroot_verified{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification uint32_t d_GST_0 {}; + uint32_t d_GST_SIS {}; }; From 656684e39630066c7ab2f1dae1391b2f340e3e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Sun, 17 Dec 2023 21:01:01 +0100 Subject: [PATCH 072/499] DSM-PKR getter setter structure --- src/core/libs/osnma_msg_receiver.cc | 17 +++++++++++++---- src/core/system_parameters/gnss_crypto.cc | 23 +++++++++++++++++++++++ src/core/system_parameters/gnss_crypto.h | 3 ++- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f7ab9e334..c08b669d3 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -341,7 +341,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { p_dk_truncated.push_back(hash[i]); } - // check DS signature + // Check that the padding bits received match the computed values if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { bool authenticated = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); @@ -371,7 +371,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { LOG(WARNING) << "OSNMA: DSM-PKR message received."; - // DSM-PKR message + // Save DSM-PKR message d_osnma_data.d_dsm_pkr_message.nb_dp = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_pkr_message.mid = d_dsm_reader->get_mid(dsm_msg); for (int k = 0; k > 128; k++) @@ -424,7 +424,17 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << " received" << std::endl; // C: NPK verification against Merkle tree root. - d_public_key_verified = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); + if (!d_public_key_verified) + { + bool verification = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); + if (verification) + { + d_public_key_verified = true; + d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); + } + + } + } } else @@ -872,7 +882,6 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) { - // TODO create leafe base message m_i // TODO create function for recursively apply hash // build base leaf m_i diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index eab8ab23e..eb9d38ca0 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -598,3 +598,26 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector& publicKey) +{ +#if USE_OPENSSL_FALLBACK + // TODO - convert to OSSL PubKey format +#else +// GNU-TLS + // TODO - convert to gnutls_pubkey_st +#endif + +} + +std::vector Gnss_Crypto::get_public_key() +{ +#if USE_OPENSSL_FALLBACK + // TODO +#else +// GNU-TLS + // TODO +#endif + return {}; +} diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 50047c440..6f405cc24 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -55,7 +55,8 @@ public: return d_x_4_0; } - // void set_public_key(const std::vector& publickey); + void set_public_key(const std::vector& publickey); + static std::vector get_public_key(); private: #if USE_OPENSSL_FALLBACK From fdbd99ce6b1928e8d0a828c5756c84a7aa9be88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Sat, 6 Jan 2024 16:47:29 +0100 Subject: [PATCH 073/499] [TAS-109] ADKD-MCLT check - changed GST mask, implement FLX tags --- src/core/libs/osnma_msg_receiver.cc | 101 ++++++++++++------ .../system_parameters/galileo_inav_message.cc | 3 + .../system_parameters/galileo_inav_message.h | 2 + src/core/system_parameters/osnma_data.h | 1 + 4 files changed, 73 insertions(+), 34 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index c08b669d3..819f5d6a9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -249,7 +249,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ /* * case DSM-Kroot: - * - computes the padding + * - computes the padding and compares with received message * - if successful, tries to verify the digital signature * case DSM-PKR: * - calls verify_dsm_pkr to verify the public key @@ -459,9 +459,10 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma index = index + 4; } // compute time of subrame and kroot time of applicability, used in read_mack_body and process_mack_message - d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - find a better placement + // TODO - find a better placement + d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k; - d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // TODO - find a better placement + d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // Eq. 3 R.G. if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 { read_mack_header(); @@ -472,7 +473,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma void osnma_msg_receiver::read_mack_header() -{ // C: still to review computations. +{ // C: TODO - still to review computations. uint8_t lt_bits = 0; const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it != OSNMA_TABLE_11.cend()) @@ -729,10 +730,10 @@ void osnma_msg_receiver::read_mack_body() std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); std::copy(K_II.begin(),K_II.end(),msg.begin()); - msg.push_back((d_GST_Sf & 0xF000) >> 24); - msg.push_back((d_GST_Sf & 0x0F00) >> 16); - msg.push_back((d_GST_Sf & 0x00F0) >> 8); - msg.push_back(d_GST_Sf & 0x000F); + msg.push_back((d_GST_Sf & 0xFF000000) >> 24); + msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); + msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); + msg.push_back(d_GST_Sf & 0x000000FF); for (uint8_t k = 5; k >= 0;k--) { @@ -767,7 +768,7 @@ void osnma_msg_receiver::read_mack_body() K_I.clear(); // empty the actual one for a new computation } // compare computed current key against received key - bool result_comparison; + bool result_comparison; // TODO - not needed? if(K_I.size() != d_osnma_data.d_mack_message.key.size()) { std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; @@ -778,6 +779,9 @@ void osnma_msg_receiver::read_mack_body() std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; // TODO - propagate result // TODO - save current tesla key as latest one? + // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + + } else @@ -795,8 +799,8 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // MACSEQ validation - case no FLX Tags // C: TODO check ADKD-MACLT for match, also identify which tags are FLX - // C: TODO if Tag_x FLX => MACSEQ, otherwise ___ ? - // Are there flexible tags? + + // d_osnma_data.d_dsm_kroot_message.maclt // d_osnma_data.d_mack_message.tag_and_info[k].tag @@ -808,42 +812,69 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); if (it != OSNMA_TABLE_16.cend()) { - auto msg = it->second.msg; - auto nt = it->second.nt; - auto sq1 = it->second.sequence1; - auto sq2 = it->second.sequence2; + uint8_t msg = it->second.msg; + uint8_t nt = it->second.nt; + std::vector sq1 = it->second.sequence1; + std::vector sq2 = it->second.sequence2; } if (msg == 0) { return; } + std::vector sequence; + if (d_GST_Sf % 60 == 0) + { + sequence = sq1; + } + else if (d_GST_Sf % 60 == 30) + { + sequence = sq2; + } + else + { + std::cout << "Galileo OSNMA: Mismatch in the GST verification => should end in 30 or 60 seconds but it dit not." << std::endl; + } // compare ADKD of Mack tags with MACLT defined ADKDs - // TODO - "When it is equal to 2, the sequence starts with the MACK message transmitted in the first 30 seconds of a GST minute." - if(d_osnma_data.d_mack_message.tag_and_info.size() != sq1.size()) // TODO - which sequence is retrieved in this Mack? + if(d_osnma_data.d_mack_message.tag_and_info.size() != sq1.size()) { std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; return; } - bool allOk = true; - std::string selfAutenticated {}; + bool allOk = true; // one being invalid spoils the entire MACK + std::vector flxTags {}; + std::string tempADKD; for (uint8_t i = 0; i < d_osnma_data.d_mack_message.tag_and_info.size(); i++) { - if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(sq1[i])) // C: undefined if format is not "00S" + // TODO - logic for asserting if if sq[i] == "FLX" (string) or "00X" (int built with first two digits) + tempADKD = sequence[i]; + if(tempADKD == "FLX") + { + flxTags.push_back(i); // C: just need to save the index in the sequence + } + else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(sequence[i])) { allOk = false; - break; + std::cout << "Galileo OSNMA: Unsuccessful verification of received ADKD against MAC Look-up table. " << std::endl; + return; // C: suffices one incorrect to abort and not process the rest of the tags } - selfAutenticated = sq1[i][sq1[i].size()-1]; } + // MACSEQ verification - std::vector m(5); // C: ICD - Eq. 22 + // Case no tags defined as FLX in the MACLT + std::vector m(5 + flxTags.size()); // C: ICD - Eq. 22 m[0] = static_cast(osnma_msg->PRN); // PRN_A - m[1] = ((d_GST_Sf & 0xF000) >> 24); - m[2] = ((d_GST_Sf & 0x0F00) >> 16); - m[3] = ((d_GST_Sf & 0x00F0) >> 8); - m[4] = (d_GST_Sf & 0x000F); + m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); + m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); + m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); + m[4] = static_cast(d_GST_Sf & 0x000000FF); + // Case tags flexible + for (uint8_t i = 0; i < flxTags.size() ; i++) + { + m[i+5] = d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[i+6] = d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; + } std::vector applicable_key; // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full // otherwise pick d_old_mack_message.back() @@ -857,27 +888,29 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { mac = d_crypto->computeCMAC_AES(applicable_key, m); } + + // Truncate the twelve MSBits and compare with received MACSEQ uint16_t mac_msb = 0; if (!mac.empty()) { mac_msb = (mac[0] << 8) + mac[1]; } - uint16_t computed_macseq = (mac_msb & 0x0FFF); + uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; // TODO - double check, it was 0x0FFF which presuposes little endian... int num_tags_added = 0; if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) { + + // C: TODO - for each tag in tag_and_info[] && until l_t_verified <= L_t_min or tags of MACK are finished + // C: d_osnma_data.d_dsm_kroot_message.ts gives l_t of each tag for this mack + // C: tag = trunc(l_t, mac(applicable_key,m)) + // C: where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) + // C: si l_t_verified >= L_t_min d_new_data = true std::cout << "OSNMA: MACSEQ authenticated for PRN_A " << osnma_msg->PRN << " with WN=" << osnma_msg->WN_sf0 << ", TOW=" << osnma_msg->TOW_sf0 << ". Tags added: " << num_tags_added << std::endl; } - - // C: TODO - for each tag in tag_and_info[] && until l_t_verified <= L_t_min - // C: d_osnma_data.d_dsm_kroot_message.ts gives l_t of each tag for this mack - // C: tag = trunc(l_t, mac(applicable_key,m)) - // C: where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) - // C: si l_t_verified >= L_t_min d_new_data = true } bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 8166b0e9f..57d950e44 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1430,6 +1430,9 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() TOW_sf0 += 604800; } nma_msg.TOW_sf0 = static_cast(TOW_sf0); + // TODO - draft for retrieving NavData for use during Tag verification. + nma_msg.t0e_1 = static_cast(t0e_1); + nma_msg.IOD_nav = static_cast(IOD_nav_1); return nma_msg; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 1ed9a8ae9..91b332ca3 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -49,6 +49,8 @@ public: uint32_t PRN{}; uint32_t WN_sf0{}; uint32_t TOW_sf0{}; + uint32_t t0e_1{}; + uint32_t IOD_nav{}; }; /*! diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index ffd459fab..a19666d5b 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -70,6 +70,7 @@ public: MACK_tag_and_info() = default; uint64_t tag; // C: 20-40 bits MACK_tag_info tag_info; + // TODO - std::vector with complete Tag }; class DSM_PKR_message From f7d7f5a78474949a6f3c494266260d4844ed9436 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Mon, 8 Jan 2024 19:11:13 +0100 Subject: [PATCH 074/499] [TAS-116] tag verification for ADKD=0 --- src/core/libs/osnma_msg_receiver.cc | 103 ++++++++++++++++-- src/core/libs/osnma_msg_receiver.h | 1 + .../system_parameters/galileo_inav_message.h | 3 + 3 files changed, 97 insertions(+), 10 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 819f5d6a9..6bc8d487f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -460,7 +460,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma } // compute time of subrame and kroot time of applicability, used in read_mack_body and process_mack_message // TODO - find a better placement - d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; + d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k; d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // Eq. 3 R.G. if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 @@ -888,7 +888,6 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { mac = d_crypto->computeCMAC_AES(applicable_key, m); } - // Truncate the twelve MSBits and compare with received MACSEQ uint16_t mac_msb = 0; if (!mac.empty()) @@ -899,17 +898,101 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& int num_tags_added = 0; if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) { - - // C: TODO - for each tag in tag_and_info[] && until l_t_verified <= L_t_min or tags of MACK are finished - // C: d_osnma_data.d_dsm_kroot_message.ts gives l_t of each tag for this mack - // C: tag = trunc(l_t, mac(applicable_key,m)) - // C: where m = (PRNd || PRNa || GSTsf || CTR || NMAS || NavData || P) - // C: si l_t_verified >= L_t_min d_new_data = true std::cout << "OSNMA: MACSEQ authenticated for PRN_A " << osnma_msg->PRN << " with WN=" << osnma_msg->WN_sf0 << ", TOW=" - << osnma_msg->TOW_sf0 << ". Tags added: " - << num_tags_added << std::endl; + << osnma_msg->TOW_sf0 << ". Verifying tags. " + << std::endl; + + uint8_t l_t_verified = 0; // tag bits verified + uint8_t i = 0; + // TODO - configuration file must define which tags shall be verified + // e.g. NavDataVerification: A == ALL, T == Timing Parameters, ECS == Ephemeris,Clock and Status. + std::string navDataToVerify = "EphemerisClockAndStatus"; // ADKD 0 + // Timing Parameters ADKD 4 + // EphemerisClockAndStatus ADKD 12 10+ Delay + m.clear(); + uint8_t lt_bits = 0; + const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it2 != OSNMA_TABLE_11.cend()) + { + lt_bits = it2->second; + } + if (lt_bits == 0) + { + return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. + } + while (i < d_osnma_data.d_mack_message.tag_and_info.size() && l_t_verified < d_Lt_min) + { + // compute m + m.push_back(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.PRN_d); + m.push_back(osnma_msg->PRN); + m.push_back(static_cast((d_GST_Sf & 0xFF000000) >> 24)); + m.push_back(static_cast((d_GST_Sf & 0x00FF0000) >> 16)); + m.push_back(static_cast((d_GST_Sf & 0x0000FF00) >> 8)); + m.push_back(static_cast(d_GST_Sf & 0x000000FF)); + m.push_back(i+1); // CTRauto + m.push_back(d_osnma_data.d_nma_header.nmas); + // TODO - other ADKD need different data. + // TODO - store buffer the NavData of 11 last subframes, ADKD 0 and 12 => NavData belongs to SF-1 + m.insert(m.end(),osnma_msg->EphemerisClockAndStatusData.begin(),osnma_msg->EphemerisClockAndStatusData.end()) ; + i = 0; + while (i<10/*TODO - number of padding zeroes to be computed*/) + { + m.push_back(0); + i++; + } + + // compute mac + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + + // compute tag = trunc(l_t, mac(K,m)) Eq. 23 ICD + uint64_t computed_mac = static_cast(mac[0]) << (lt_bits - 8); + computed_mac += (static_cast(mac[1]) << (lt_bits - 16)); + if (lt_bits == 20) + { + computed_mac += (static_cast(mac[1] & 0xF0) >> 4); + } + else if (lt_bits == 24) + { + computed_mac += static_cast(mac[2]); + } + else if (lt_bits == 28) + { + computed_mac += (static_cast(mac[2]) << 4); + computed_mac += (static_cast(mac[3] & 0xF0) >> 4); + } + else if (lt_bits == 32) + { + computed_mac += (static_cast(mac[2]) << 8); + computed_mac += static_cast(mac[3]); + } + else if (lt_bits == 40) + { + computed_mac += (static_cast(mac[2]) << 16); + computed_mac += (static_cast(mac[3]) << 8); + computed_mac += static_cast(mac[4]); + } + + // Compare computed tag with received one truncated + if (d_osnma_data.d_mack_message.tag_and_info[i].tag == computed_mac) + { + std::cout << "Galileo OSNMA: Tag verification successful " << std::endl; + l_t_verified += lt_bits; + } + else + { + std::cout << "Galileo OSNMA: Tag verification failed " << std::endl; + } + + } } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 0ba9169ff..655f0dae5 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -85,6 +85,7 @@ private: bool d_public_key_verified{false}; bool d_kroot_verified{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification + uint8_t d_Lt_min {}; // minimum equivalent tag length uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; }; diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 91b332ca3..d6139c7e0 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -49,6 +49,9 @@ public: uint32_t PRN{}; uint32_t WN_sf0{}; uint32_t TOW_sf0{}; + // TODO - NavData to be retrieved correctly + std::vector EphemerisClockAndStatusData {}; + std::vector TimingData {}; uint32_t t0e_1{}; uint32_t IOD_nav{}; }; From 13cc59c5fa8130c8949e3622811358ada9ed4a2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Thu, 18 Jan 2024 14:00:36 +0100 Subject: [PATCH 075/499] [TAS-117] implement first test --- src/core/libs/osnma_msg_receiver.cc | 17 +---------- .../osnma/osnma_sha2_test.cpp | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 6bc8d487f..895a310aa 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -535,7 +535,6 @@ void osnma_msg_receiver::read_mack_header() void osnma_msg_receiver::read_mack_body() { - uint8_t lt_bits = 0; const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it != OSNMA_TABLE_11.cend()) @@ -703,10 +702,6 @@ void osnma_msg_receiver::read_mack_body() d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = ADKD; d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; } - // TODO - [TAS-110] - // retrieve TESLA key: index i is [479-MH(l_t)-(nt-1)*(16+l_t), i+l_k] - // compute I (GST_SFi,GST_Kroot) - // perform recursive hash calls until base case: i = 10...1 // retrieve tesla key uint8_t start_index_bytes = ( 480 - (lt_bits + 16) - (nt - 1) * ( lt_bits + 16 ) - 1 ) / 8; // includes -1 to start at [i-1] @@ -798,12 +793,6 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // MACSEQ validation - case no FLX Tags - // C: TODO check ADKD-MACLT for match, also identify which tags are FLX - - - // d_osnma_data.d_dsm_kroot_message.maclt - // d_osnma_data.d_mack_message.tag_and_info[k].tag - // retrieve data to verify MACK tags uint8_t msg {0}; uint8_t nt {0}; @@ -840,21 +829,17 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; return; } - bool allOk = true; // one being invalid spoils the entire MACK std::vector flxTags {}; std::string tempADKD; for (uint8_t i = 0; i < d_osnma_data.d_mack_message.tag_and_info.size(); i++) { - // TODO - logic for asserting if if sq[i] == "FLX" (string) or "00X" (int built with first two digits) tempADKD = sequence[i]; if(tempADKD == "FLX") { flxTags.push_back(i); // C: just need to save the index in the sequence } else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(sequence[i])) - { - allOk = false; - std::cout << "Galileo OSNMA: Unsuccessful verification of received ADKD against MAC Look-up table. " << std::endl; + { std::cout << "Galileo OSNMA: Unsuccessful verification of received ADKD against MAC Look-up table. " << std::endl; return; // C: suffices one incorrect to abort and not process the rest of the tags } } diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp new file mode 100644 index 000000000..4e04a837f --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp @@ -0,0 +1,29 @@ +// +// Created by cghio on 17.01.24. +// +#include "gtest/gtest.h" +#include "gnss_crypto.h" +//#include "std" +#ifndef GNSS_SDR_GNSS_CRYPTO_SHA2_TEST_H +#define GNSS_SDR_GNSS_CRYPTO_SHA2_TEST_H + +class OsnmaCryptoTest : public :: testing ::Test{ +}; + +TEST_F(OsnmaCryptoTest, basicTest) +{ + std::unique_ptr d_crypto; + + auto str = "Hello World!"; + std::vector input (str, str + strlen(str)); + + auto expectedOutputStr = "86933b0b147ac4c010266b99004158fa17937db89a03dd7bb2ca5ef7f43c325a"; + std::vector expectedOutput(expectedOutputStr, expectedOutputStr + strlen(expectedOutputStr)); + + std::vector computedOutput = d_crypto->computeSHA256(input); + + ASSERT_TRUE(computedOutput == expectedOutput); + +} + +#endif // GNSS_SDR_GNSS_CRYPTO_SHA2_TEST_H From 50fbc3e9e5834ee299c60c507ad0652268b7f499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Sat, 20 Jan 2024 10:21:22 +0100 Subject: [PATCH 076/499] [TAS-111] time synch check: first draft --- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 3 ++ src/core/libs/osnma_msg_receiver.cc | 48 +++++++++++++++---- src/core/libs/osnma_msg_receiver.h | 2 + 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index ec7db2067..298634dd1 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -188,6 +188,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, this->message_port_register_out(pmt::mp("pvt_to_trk")); // Send PVT status to gnss_flowgraph this->message_port_register_out(pmt::mp("status")); + // Send PVT time to OSNMA + this->message_port_register_out(pmt::mp("pvt_to_osnma")); // GPS Ephemeris data message port in this->message_port_register_in(pmt::mp("telemetry")); @@ -2139,6 +2141,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item // #### solve PVT and store the corrected observable set if (d_internal_pvt_solver->get_PVT(d_gnss_observables_map, d_observable_interval_ms / 1000.0)) { + this->message_port_pub(pmt::mp("pvt_to_osnma"), pmt::make_any(convert_to_time_t(d_internal_pvt_solver->get_position_UTC_time()))); d_pvt_errors_counter = 0; // Reset consecutive PVT error counter const double Rx_clock_offset_s = d_internal_pvt_solver->get_time_offset_s(); diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 895a310aa..68dec02e5 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -22,6 +22,7 @@ #include "gnss_crypto.h" #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader +#include "pvt_interface.h" #include // for DLOG #include // for gr::io_signature::make #include @@ -62,9 +63,6 @@ osnma_msg_receiver::osnma_msg_receiver( d_old_mack_message.set_capacity(10); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); - // register OSNMA output message port to PVT block - this->message_port_register_out(pmt::mp("OSNMA_to_PVT")); - this->set_msg_handler(pmt::mp("OSNMA_from_TLM"), #if HAS_GENERIC_LAMBDA [this](auto&& PH1) { msg_handler_osnma(PH1); }); @@ -75,9 +73,33 @@ osnma_msg_receiver::osnma_msg_receiver( boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, _1)); #endif #endif + // register OSNMA input message port from PVT block + this->message_port_register_in(pmt::mp("pvt_to_osnma")); + this->set_msg_handler(pmt::mp("pvt_to_osnma"), +#if HAS_GENERIC_LAMBDA + [this](auto&& PH1) { msg_handler_pvt_to_osnma(PH1); }); +#else +#if USE_BOOST_BIND_PLACEHOLDERS + boost::bind(&osnma_msg_receiver::msg_handler_pvt_to_osnma, this, boost::placeholders::_1)); +#else + boost::bind(&osnma_msg_receiver::msg_handler_pvt_to_osnma, this, _1)); +#endif +#endif + // register OSNMA output message port to PVT block + this->message_port_register_out(pmt::mp("OSNMA_to_PVT")); } - +void osnma_msg_receiver::msg_handler_pvt_to_osnma(const pmt::pmt_t& msg) +{ + try + { + d_receiver_time = wht::any_cast(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block + } + catch (const pmt::exception& e) + { + LOG(WARNING) << "osnma_msg_receiver pmt exception: " << e.what(); + } +} void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { // requires mutex with msg_handler_osnma function called by the scheduler @@ -97,7 +119,18 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) << ", from satellite " << sat << std::endl; - process_osnma_message(nma_msg); + + // compare local time with OSNMA subframe time + d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... + double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time + if(abs(d_GST_SIS - d_receiver_time) <= T_L) + { + process_osnma_message(nma_msg); + } + else + { + LOG(WARNING) << "OSNMA: Subframe received with time difference greater than " << T_L << " seconds"; + } } else { @@ -432,7 +465,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_public_key_verified = true; d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); } - } } @@ -446,7 +478,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } - +// reads Mack message void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma_msg) { uint32_t index = 0; @@ -789,6 +821,7 @@ void osnma_msg_receiver::read_mack_body() void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { + // TODO - is it filled at this point always? d_old_mack_message.push_back(d_osnma_data.d_mack_message); // C: old mack message is needed for // MACSEQ validation - case no FLX Tags @@ -1018,7 +1051,6 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) { std::cout << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; return true; - // C: NPK verification against Merkle tree root. } else { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 655f0dae5..b79719093 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -60,6 +60,7 @@ private: osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); + void msg_handler_pvt_to_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); @@ -88,6 +89,7 @@ private: uint8_t d_Lt_min {}; // minimum equivalent tag length uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; + std::time_t d_receiver_time {}; }; From 08bd1992af7730a7b66f46c75a0c33881ed54983 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Mon, 22 Jan 2024 17:55:52 +0100 Subject: [PATCH 077/499] [TAS-125] NavData retrieval. * set osnma flags to true when new data * send them to osnma block if filled. --- .../galileo_telemetry_decoder_gs.cc | 10 +++++++++- .../gnuradio_blocks/galileo_telemetry_decoder_gs.h | 3 +++ src/core/system_parameters/galileo_inav_message.cc | 10 ++++++---- src/core/system_parameters/galileo_inav_message.h | 14 +++++++++----- 4 files changed, 27 insertions(+), 10 deletions(-) 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 80a94aab0..991fb6895 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 @@ -465,6 +465,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set + + d_flag_osnma_ephemeris = true; } else { @@ -514,6 +516,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; } + + d_flag_osnma_iono_and_time = true; } if (d_inav_nav.have_new_utc_model() == true) @@ -549,6 +553,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_delta_t = tmp_obj->A_0G + tmp_obj->A_1G * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G), 64.0))); DLOG(INFO) << "delta_t=" << d_delta_t << "[s]"; + + d_flag_osnma_utc_model = true; } if (d_inav_nav.have_new_almanac() == true) @@ -584,7 +590,9 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); } - if (d_band == '1' && d_inav_nav.have_new_nma() == true) + // get osnma message if the needed nav data is available + auto adkd_4_12_nav_data_available = d_flag_osnma_iono_and_time && d_flag_osnma_ephemeris; + if (d_band == '1' && d_inav_nav.have_new_nma() == true && adkd_4_12_nav_data_available == true && d_flag_osnma_utc_model == true) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); 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 a6391a2e0..bad8c8fc5 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 @@ -155,6 +155,9 @@ private: bool d_there_are_e1_channels; bool d_there_are_e6_channels; bool d_use_ced; + bool d_flag_osnma_ephemeris; // flag to indicate if the ephemeris is complete for OSNMA processing + bool d_flag_osnma_utc_model; // flag to indicate if the GST conversion parameters are complete for OSNMA processing + bool d_flag_osnma_iono_and_time; // flag to indicate if the iono correction and time is complete for OSNMA processing }; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 565009dc7..7a500d788 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1387,15 +1387,17 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 24; + int32_t TOW_sf0 = TOW_5 - 24; // TODO - why not TOW_0? if (TOW_sf0 < 0) { TOW_sf0 += 604800; } nma_msg.TOW_sf0 = static_cast(TOW_sf0); - // TODO - draft for retrieving NavData for use during Tag verification. - nma_msg.t0e_1 = static_cast(t0e_1); - nma_msg.IOD_nav = static_cast(IOD_nav_1); +// nma_msg.TOW_sf0 = static_cast(TOW_0); + // get ephemeris, clock and iono correction datn and GST-UTC and GST-GPS converstion parameters (may be incomplete) + nma_msg.EphemerisData = get_ephemeris(); + nma_msg.IonoData = get_iono(); + nma_msg.UtcModelData = get_utc_model(); return nma_msg; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index d6139c7e0..13db80706 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -39,7 +39,9 @@ class ReedSolomon; // Forward declaration of the ReedSolomon class * \{ */ /** \addtogroup System_Parameters * \{ */ - +/*! + * \brief This class fills the OSNMA_msg structure with the data received from the telemetry blocks. + */ class OSNMA_msg { public: @@ -47,13 +49,15 @@ public: std::array mack{}; std::array hkroot{}; uint32_t PRN{}; - uint32_t WN_sf0{}; + uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already uint32_t TOW_sf0{}; - // TODO - NavData to be retrieved correctly std::vector EphemerisClockAndStatusData {}; std::vector TimingData {}; - uint32_t t0e_1{}; - uint32_t IOD_nav{}; + Galileo_Ephemeris EphemerisData {}; + Galileo_Iono IonoData {}; + Galileo_Utc_Model UtcModelData {}; + + }; /*! From dedb9a59505270acfa7a8f82abfa87c579521075 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 24 Jan 2024 23:22:32 +0100 Subject: [PATCH 078/499] The action continues at the next branch --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8257ffdc3..99e567462 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ option(ENABLE_ORC "Use (if available) the Optimized Inner Loop Runtime Compiler ################################################################################ # GNSS-SDR version information ################################################################################ -set(THIS_IS_A_RELEASE ON) # only related to version name, no further implications. +set(THIS_IS_A_RELEASE OFF) # only related to version name, no further implications. if(NOT ${THIS_IS_A_RELEASE}) find_package(Git) set_package_properties(Git PROPERTIES From 620249f9f2aab0e9741787d0bc64c2daea9723a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Thu, 25 Jan 2024 17:11:28 +0100 Subject: [PATCH 079/499] [TAS-126] [TAS-125] NavData storage of last 10 SFs / NavData retrieval: store needed NavData within osnma_data::NavData for the last 10 subframes * In osnma_msg_receiver: d_old_navdata_buffer to store last 10 NavData. * In osnma_msg_receiver::process_mack_message: pass needed data to the newly created structure osnma_data::NavData, generate needed vectors for tag verification. * In osnma_data.h/cc: Create NavData structure, Create osnma_data.cc source file, add to CMakeLists source file. --- src/core/libs/osnma_msg_receiver.cc | 13 +- src/core/libs/osnma_msg_receiver.h | 1 + src/core/system_parameters/CMakeLists.txt | 1 + .../system_parameters/galileo_inav_message.cc | 1 + src/core/system_parameters/osnma_data.cc | 185 ++++++++++++++++++ src/core/system_parameters/osnma_data.h | 22 +++ 6 files changed, 219 insertions(+), 4 deletions(-) create mode 100644 src/core/system_parameters/osnma_data.cc diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 68dec02e5..66099e054 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -145,7 +145,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // Send the resulting decoded NMA data (if available) to PVT if (d_new_data == true) // TODO where is it set to true? { - auto osnma_data_ptr = std::make_shared(d_osnma_data); // C: why create new object and pass it empty to Pvt? + auto osnma_data_ptr = std::make_shared(d_osnma_data); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); d_new_data = false; // d_osnma_data = OSNMA_data(); @@ -821,9 +821,14 @@ void osnma_msg_receiver::read_mack_body() void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { - // TODO - is it filled at this point always? - d_old_mack_message.push_back(d_osnma_data.d_mack_message); // C: old mack message is needed for - + d_old_mack_message.push_back(d_osnma_data.d_mack_message); // last 10 MACKs are needed to be stored as per ICD + // populate d_nav_data with three classes of osnma_msg + d_osnma_data.d_nav_data.EphemerisData = osnma_msg->EphemerisData; + d_osnma_data.d_nav_data.IonoData = osnma_msg->IonoData; + d_osnma_data.d_nav_data.UtcData = osnma_msg->UtcModelData; + d_osnma_data.d_nav_data.generate_eph_iono_vector2(); + d_osnma_data.d_nav_data.generate_utc_vector(); + d_old_navdata_buffer.push_back(d_osnma_data.d_nav_data); // last 10 NavData messages are needed to be stored as per ICD // MACSEQ validation - case no FLX Tags // retrieve data to verify MACK tags diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index b79719093..6b694f32d 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -73,6 +73,7 @@ private: void process_mack_message(const std::shared_ptr& osnma_msg); boost::circular_buffer d_old_mack_message; + boost::circular_buffer d_old_navdata_buffer; // buffer that holds last 10 received navdata messages std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 9db20a317..dc78ae094 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -30,6 +30,7 @@ set(SYSTEM_PARAMETERS_SOURCES glonass_gnav_navigation_message.cc reed_solomon.cc osnma_dsm_reader.cc + osnma_data.cc ) set(SYSTEM_PARAMETERS_HEADERS diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 7a500d788..869ba3c35 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1384,6 +1384,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) OSNMA_msg Galileo_Inav_Message::get_osnma_msg() { + // TODO - why PRN of word 4 is done separately? nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc new file mode 100644 index 000000000..db4b5c553 --- /dev/null +++ b/src/core/system_parameters/osnma_data.cc @@ -0,0 +1,185 @@ +/*! +* \file osnma_data.cc +* \brief Class for Galileo OSNMA data storage +* \author Carles Fernandez-Prades, 2020-2023 cfernandez(at)cttc.es +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- +*/ + +#include "osnma_data.h" +#include + +void NavData::generate_eph_iono_vector() +{ + ephemeris_iono_vector.clear(); + ephemeris_iono_vector.push_back(static_cast((EphemerisData.IOD_nav & 0b0000'0000'0000'0000'0000'0011'1111'1100) >> 2)); + ephemeris_iono_vector.push_back(static_cast((EphemerisData.IOD_nav & 0b0000'0000'0000'0000'0000'0000'0000'0011) << 6 + | (EphemerisData.toe & 0b0000'0000'0000'0000'0011'1111'1111'1111) >> 8)); + ephemeris_iono_vector.push_back(static_cast(EphemerisData.toe)); + uint64_t binary_representation; + memcpy(&binary_representation, &EphemerisData.M_0, sizeof(EphemerisData.M_0)); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 8))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 16))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 24))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 32))); + memcpy(&binary_representation, &EphemerisData.ecc, sizeof(EphemerisData.ecc)); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 8))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 16))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 24))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 32))); + memcpy(&binary_representation, &EphemerisData.sqrtA, sizeof(EphemerisData.sqrtA)); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 8))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 16))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 24))); + ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 32))); + + // TODO: Implement the function to generate the rest of pages +} + +void NavData::generate_eph_iono_vector2() +{ + std::vector eph_iono_vector; + uint64_t bit_buffer = 0; // variable to store the bits to be extracted, it can contain bits from different variables + int bit_count = 0; // Number of bits in the buffer, i.e. to be extracted + + // create structure to hold the variables to store into the vector along with their bit size + std::vector> variables = { + // data from word type 1 + {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, + {static_cast(&EphemerisData.toe), sizeof(EphemerisData.toe) * 8}, + {static_cast(&EphemerisData.M_0), sizeof(EphemerisData.M_0) * 8}, + {static_cast(&EphemerisData.ecc), sizeof(EphemerisData.ecc) * 8}, + {static_cast(&EphemerisData.sqrtA), sizeof(EphemerisData.sqrtA) * 8}, + // data from word type 2 + {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, + {static_cast(&EphemerisData.OMEGA_0), sizeof(EphemerisData.OMEGA_0) * 8}, + {static_cast(&EphemerisData.i_0), sizeof(EphemerisData.i_0) * 8}, + {static_cast(&EphemerisData.omega), sizeof(EphemerisData.omega) * 8}, + {static_cast(&EphemerisData.idot), sizeof(EphemerisData.idot) * 8}, + {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, + // data from word type 3 + {static_cast(&EphemerisData.OMEGAdot), sizeof(EphemerisData.OMEGAdot) * 8}, + {static_cast(&EphemerisData.delta_n), sizeof(EphemerisData.delta_n) * 8}, + {static_cast(&EphemerisData.Cuc), sizeof(EphemerisData.Cuc) * 8}, + {static_cast(&EphemerisData.Cus), sizeof(EphemerisData.Cus) * 8}, + {static_cast(&EphemerisData.Crc), sizeof(EphemerisData.Crc) * 8}, + {static_cast(&EphemerisData.Crs), sizeof(EphemerisData.Crs) * 8}, + {static_cast(&EphemerisData.SISA), sizeof(EphemerisData.SISA) * 8}, + // data from word type 4 + {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, + {static_cast(&EphemerisData.PRN), sizeof(EphemerisData.PRN) * 8}, + {static_cast(&EphemerisData.Cic), sizeof(EphemerisData.Cic) * 8}, + {static_cast(&EphemerisData.Cis), sizeof(EphemerisData.Cis) * 8}, + {static_cast(&EphemerisData.toe), sizeof(EphemerisData.toe) * 8}, + {static_cast(&EphemerisData.af0), sizeof(EphemerisData.af0) * 8}, + {static_cast(&EphemerisData.af1), sizeof(EphemerisData.af1) * 8}, + {static_cast(&EphemerisData.af2), sizeof(EphemerisData.af2) * 8}, + // data from word type 5 + {static_cast(&IonoData.ai0), sizeof(IonoData.ai0) * 8}, + {static_cast(&IonoData.ai1), sizeof(IonoData.ai1) * 8}, + {static_cast(&IonoData.ai2), sizeof(IonoData.ai2) * 8}, + {static_cast(&IonoData.Region1_flag), sizeof(IonoData.Region1_flag) * 8}, + {static_cast(&IonoData.Region2_flag), sizeof(IonoData.Region2_flag) * 8}, + {static_cast(&IonoData.Region3_flag), sizeof(IonoData.Region3_flag) * 8}, + {static_cast(&IonoData.Region4_flag), sizeof(IonoData.Region4_flag) * 8}, + {static_cast(&IonoData.Region5_flag), sizeof(IonoData.Region5_flag) * 8}, + {static_cast(&EphemerisData.BGD_E1E5a), sizeof(EphemerisData.BGD_E1E5a) * 8}, + {static_cast(&EphemerisData.BGD_E1E5b), sizeof(EphemerisData.BGD_E1E5b) * 8}, + {static_cast(&EphemerisData.E5b_HS), sizeof(EphemerisData.E5b_HS) * 8}, + {static_cast(&EphemerisData.E1B_HS), sizeof(EphemerisData.E1B_HS) * 8}, + {static_cast(&EphemerisData.E5b_DVS), sizeof(EphemerisData.E5b_DVS) * 8}, + {static_cast(&EphemerisData.E1B_DVS), sizeof(EphemerisData.E1B_DVS) * 8}, + }; + + for (auto& var : variables) + { + // extract the bits from the variable + uint64_t binary_representation; + memcpy(&binary_representation, var.first, var.second / 8); + + // Append the bits to the buffer and update the bit count + bit_buffer = (bit_buffer << var.second) | binary_representation; + bit_count += var.second; + // While there are 8 or more bits in the buffer + while (bit_count >= 8) + { + // Extract the 8 bits starting from last bit position and add them to the vector + uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; + eph_iono_vector.push_back(extracted_bits); + + // Remove the extracted bits from the buffer + bit_count -= 8; + bit_buffer = bit_buffer & ~(0xFF << bit_count); + } + + } + + // If there are any bits left in the buffer, add them to the vector + if (bit_count > 0) + { + eph_iono_vector.push_back(static_cast(bit_buffer)); + } +} + +void NavData::generate_utc_vector() +{ + utc_vector.clear(); + uint64_t bit_buffer = 0; + int bit_count = 0; + + std::vector> variables = { + {static_cast(&UtcData.A0), sizeof(UtcData.A0) * 8}, + {static_cast(&UtcData.A1), sizeof(UtcData.A1) * 8}, + {static_cast(&UtcData.Delta_tLS), sizeof(UtcData.Delta_tLS) * 8}, + {static_cast(&UtcData.tot), sizeof(UtcData.tot) * 8}, + {static_cast(&UtcData.WNot), sizeof(UtcData.WNot) * 8}, + {static_cast(&UtcData.WN_LSF), sizeof(UtcData.WN_LSF) * 8}, + {static_cast(&UtcData.DN), sizeof(UtcData.DN) * 8}, + {static_cast(&UtcData.Delta_tLSF), sizeof(UtcData.Delta_tLSF) * 8}, + {static_cast(&UtcData.A_0G), sizeof(UtcData.A_0G) * 8}, + {static_cast(&UtcData.A_1G), sizeof(UtcData.A_1G) * 8}, + {static_cast(&UtcData.t_0G), sizeof(UtcData.t_0G) * 8}, + {static_cast(&UtcData.WN_0G), sizeof(UtcData.WN_0G) * 8}, + }; + + for (auto& var : variables) + { + uint64_t binary_representation; + memcpy(&binary_representation, var.first, var.second / 8); + + bit_buffer = (bit_buffer << var.second) | binary_representation; + bit_count += var.second; + + while (bit_count >= 8) + { + uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; + utc_vector.push_back(extracted_bits); + + bit_count -= 8; + bit_buffer = bit_buffer & ~(0xFF << bit_count); + } + } + + if (bit_count > 0) + { + utc_vector.push_back(static_cast(bit_buffer)); + } +} + +std::vector NavData::get_eph_iono_vector() +{ + return ephemeris_iono_vector; +} + +std::vector NavData::get_utc_vector() +{ + return utc_vector; +} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index a19666d5b..941e7c8bc 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -18,6 +18,9 @@ #ifndef GNSS_SDR_OSNMA_DATA_H #define GNSS_SDR_OSNMA_DATA_H +#include "galileo_ephemeris.h" +#include "galileo_iono.h" +#include "galileo_utc_model.h" #include #include #include @@ -119,6 +122,24 @@ public: std::vector key; }; +class NavData +{ +public: + NavData() = default; + Galileo_Ephemeris EphemerisData; + Galileo_Iono IonoData; + Galileo_Utc_Model UtcData; + void generate_eph_iono_vector(); // TODO check with Carles procedure and compare with v2 + void generate_eph_iono_vector2(); + void generate_utc_vector(); // TODO + std::vector get_eph_iono_vector(); // TODO + std::vector get_utc_vector(); // TODO +private: + std::vector ephemeris_iono_vector; + std::vector utc_vector; + +}; + /*! * \brief This class handles ONSMA data * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo_OSNMA_User_ICD_for_Test_Phase_v1.0.pdf @@ -132,6 +153,7 @@ public: DSM_PKR_message d_dsm_pkr_message; DSM_KROOT_message d_dsm_kroot_message; MACK_message d_mack_message; + NavData d_nav_data; }; From ec180d852574e10c621f9bf498d3ef70d26342ce Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Jan 2024 10:28:10 +0100 Subject: [PATCH 080/499] Fix clang-format job --- src/tests/system-tests/position_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index ecf90f365..5802aa9ca 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -312,7 +312,7 @@ int PositionSystemTest::configure_receiver() // Set PVT config->set_property("PVT.implementation", "RTKLIB_PVT"); - config->set_property("PVT.enable_pvt_kf", "true"), + config->set_property("PVT.enable_pvt_kf", "true"); config->set_property("PVT.positioning_mode", "PPP_Static"); config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms)); config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms)); From 90b2f804d82d1cffb1f7fd31cfe46f7ec64a919e Mon Sep 17 00:00:00 2001 From: kalmancito Date: Mon, 29 Jan 2024 11:44:59 +0100 Subject: [PATCH 081/499] [manag] tidy conf files --- .../Beidou}/gnss-sdr_BDS_B1I_byte.conf | 254 +++--- .../gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf | 424 +++++----- .../Beidou}/gnss-sdr_BDS_B3I_byte.conf | 246 +++--- .../Beidou}/gnss-sdr_BDS_B3I_ibyte.conf | 264 +++--- .../Beidou}/gnss-sdr_BDS_B3I_short.conf | 162 ++-- .../GPS}/gnss-sdr-L1-gaussian.conf | 134 +-- .../GPS}/gnss-sdr_GPS_L1_CA_ibyte.conf | 188 ++--- .../GPS}/gnss-sdr_GPS_L1_SPIR.conf | 274 +++---- .../GPS}/gnss-sdr_GPS_L1_acq_QuickSync.conf | 216 ++--- .../GPS}/gnss-sdr_GPS_L1_gr_complex.conf | 196 ++--- .../GPS}/gnss-sdr_GPS_L1_ishort.conf | 204 ++--- ...nnel_GPS_L1_Flexiband_bin_file_III_1a.conf | 368 ++++----- ...nnel_GPS_L1_Flexiband_realtime_III_1a.conf | 378 ++++----- ...nnel_GPS_L1_Flexiband_realtime_III_1b.conf | 376 ++++----- ...annel_GPS_L1_Flexiband_realtime_II_3b.conf | 390 ++++----- ...hannel_GPS_L1_Flexiband_realtime_I_1b.conf | 366 ++++----- ...l_GPS_L1_L2_Flexiband_realtime_III_1b.conf | 610 +++++++------- ...Galileo_E1B_Flexiband_bin_file_III_1b.conf | 556 ++++++------- ...el_GPS_L2_M_Flexiband_bin_file_III_1b.conf | 726 ++++++++--------- ...S_L2_M_Flexiband_bin_file_III_1b_real.conf | 516 ++++++------ .../gnss-sdr_Galileo_E1_acq_QuickSync.conf | 200 ++--- .../Galileo}/gnss-sdr_Galileo_E1_ishort.conf | 218 ++--- .../Galileo}/gnss-sdr_Galileo_E1_nsr.conf | 254 +++--- .../Galileo}/gnss-sdr_Galileo_E5a.conf | 242 +++--- .../gnss-sdr_Galileo_E5a_IFEN_CTTC.conf | 314 +++---- ...r_galileo_E1_extended_correlator_byte.conf | 282 +++---- ...galileo_E1_extended_correlator_labsat.conf | 338 ++++---- ...nss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf | 284 +++---- .../gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf | 286 +++---- .../gnss-sdr_GLONASS_L1_CA_ibyte.conf | 164 ++-- .../gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf | 172 ++-- .../Glonass}/gnss-sdr_GLONASS_L1_ibyte.conf | 202 ++--- ...nss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf | 286 +++---- .../gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf | 288 +++---- .../gnss-sdr_GLONASS_L2_CA_ibyte.conf | 152 ++-- .../gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf | 172 ++-- .../MultiCons}/gnss-sdr_Hybrid_byte.conf | 320 ++++---- .../MultiCons}/gnss-sdr_Hybrid_byte_sim.conf | 290 +++---- .../gnss-sdr_Hybrid_gr_complex.conf | 262 +++--- .../MultiCons}/gnss-sdr_Hybrid_ishort.conf | 322 ++++---- .../MultiCons}/gnss-sdr_labsat_kf.conf | 370 ++++----- ..._all_in_one_Flexiband_bin_file_III_1b.conf | 770 +++++++++--------- .../gnss-sdr_multisource_Hybrid_ishort.conf | 338 ++++---- .../gnss-sdr_multisource_Hybrid_nsr.conf | 462 +++++------ conf/{ => Nsr_input}/gnss-sdr_GPS_L1_nsr.conf | 328 ++++---- .../gnss-sdr_GPS_L1_nsr_gauss.conf | 414 +++++----- conf/{ => Nsr_input}/gnss-sdr_Hybrid_nsr.conf | 352 ++++---- conf/{ => Other}/front-end-cal.conf | 23 +- conf/{ => Other}/gnss-sdr_GPS_L1_2ch_udp.conf | 206 ++--- conf/{ => Other}/gnss-sdr_GPS_L1_FPGA.conf | 144 ++-- conf/{ => Other}/gnss-sdr_GPS_L1_fifo.conf | 112 +-- .../gnss-sdr_GPS_L1_gr_complex_gpu.conf | 170 ++-- conf/{ => Other}/gnss-sdr_GPS_L1_monitor.conf | 178 ++-- .../gnss-sdr_GPS_L1_nsr_twobit_packed.conf | 308 +++---- ...-sdr_GPS_L1_pulse_blanking_gr_complex.conf | 222 ++--- .../gnss-sdr_GPS_L1_two_bits_cpx.conf | 276 +++---- .../gnss-sdr_GPS_L1_udp_with_monitor.conf | 162 ++-- ...gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf | 230 +++--- .../gnss-sdr_GPS_L1_LimeSDR.conf | 258 +++--- .../gnss-sdr_GPS_L1_USRP_X300_realtime.conf | 314 +++---- .../gnss-sdr_GPS_L1_USRP_realtime.conf | 236 +++--- .../gnss-sdr_GPS_L1_bladeRF.conf | 218 ++--- .../gnss-sdr_GPS_L1_fmcomms2_realtime.conf | 268 +++--- .../gnss-sdr_GPS_L1_plutosdr_realtime.conf | 290 +++---- .../gnss-sdr_GPS_L1_rtl_tcp_realtime.conf | 302 +++---- .../gnss-sdr_GPS_L1_rtlsdr_realtime.conf | 306 +++---- .../gnss-sdr_GPS_L2C_USRP1_realtime.conf | 312 +++---- .../gnss-sdr_GPS_L2C_USRP_X300_realtime.conf | 324 ++++---- ...nss-sdr_Galileo_E1_USRP_X300_realtime.conf | 186 ++--- ...ultichannel_GPS_L1_USRP_X300_realtime.conf | 322 ++++---- conf/gnss-sdr.conf | 290 +++---- 71 files changed, 10296 insertions(+), 10291 deletions(-) rename conf/{ => File_input/Beidou}/gnss-sdr_BDS_B1I_byte.conf (97%) rename conf/{ => File_input/Beidou}/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf (97%) rename conf/{ => File_input/Beidou}/gnss-sdr_BDS_B3I_byte.conf (97%) rename conf/{ => File_input/Beidou}/gnss-sdr_BDS_B3I_ibyte.conf (96%) rename conf/{ => File_input/Beidou}/gnss-sdr_BDS_B3I_short.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr-L1-gaussian.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_GPS_L1_CA_ibyte.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_GPS_L1_SPIR.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_GPS_L1_acq_QuickSync.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_GPS_L1_gr_complex.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_GPS_L1_ishort.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf (96%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf (97%) rename conf/{ => File_input/GPS}/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf (96%) rename conf/{ => File_input/Galileo}/gnss-sdr_Galileo_E1_acq_QuickSync.conf (97%) rename conf/{ => File_input/Galileo}/gnss-sdr_Galileo_E1_ishort.conf (97%) rename conf/{ => File_input/Galileo}/gnss-sdr_Galileo_E1_nsr.conf (97%) rename conf/{ => File_input/Galileo}/gnss-sdr_Galileo_E5a.conf (97%) rename conf/{ => File_input/Galileo}/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf (97%) rename conf/{ => File_input/Galileo}/gnss-sdr_galileo_E1_extended_correlator_byte.conf (96%) rename conf/{ => File_input/Galileo}/gnss-sdr_galileo_E1_extended_correlator_labsat.conf (96%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf (97%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf (96%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L1_CA_ibyte.conf (97%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf (97%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L1_ibyte.conf (97%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf (97%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf (96%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L2_CA_ibyte.conf (97%) rename conf/{ => File_input/Glonass}/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf (97%) rename conf/{ => File_input/MultiCons}/gnss-sdr_Hybrid_byte.conf (96%) rename conf/{ => File_input/MultiCons}/gnss-sdr_Hybrid_byte_sim.conf (96%) rename conf/{ => File_input/MultiCons}/gnss-sdr_Hybrid_gr_complex.conf (96%) rename conf/{ => File_input/MultiCons}/gnss-sdr_Hybrid_ishort.conf (97%) rename conf/{ => File_input/MultiCons}/gnss-sdr_labsat_kf.conf (97%) rename conf/{ => File_input/MultiCons}/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf (96%) rename conf/{ => File_input/MultiCons}/gnss-sdr_multisource_Hybrid_ishort.conf (96%) rename conf/{ => File_input/MultiCons}/gnss-sdr_multisource_Hybrid_nsr.conf (96%) rename conf/{ => Nsr_input}/gnss-sdr_GPS_L1_nsr.conf (97%) rename conf/{ => Nsr_input}/gnss-sdr_GPS_L1_nsr_gauss.conf (97%) rename conf/{ => Nsr_input}/gnss-sdr_Hybrid_nsr.conf (96%) rename conf/{ => Other}/front-end-cal.conf (94%) rename conf/{ => Other}/gnss-sdr_GPS_L1_2ch_udp.conf (96%) rename conf/{ => Other}/gnss-sdr_GPS_L1_FPGA.conf (96%) rename conf/{ => Other}/gnss-sdr_GPS_L1_fifo.conf (97%) rename conf/{ => Other}/gnss-sdr_GPS_L1_gr_complex_gpu.conf (97%) rename conf/{ => Other}/gnss-sdr_GPS_L1_monitor.conf (96%) rename conf/{ => Other}/gnss-sdr_GPS_L1_nsr_twobit_packed.conf (97%) rename conf/{ => Other}/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf (97%) rename conf/{ => Other}/gnss-sdr_GPS_L1_two_bits_cpx.conf (97%) rename conf/{ => Other}/gnss-sdr_GPS_L1_udp_with_monitor.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf (96%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_LimeSDR.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_USRP_X300_realtime.conf (96%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_USRP_realtime.conf (96%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_bladeRF.conf (96%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_fmcomms2_realtime.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_plutosdr_realtime.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L1_rtlsdr_realtime.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L2C_USRP1_realtime.conf (96%) rename conf/{ => RealTime_input}/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf (96%) rename conf/{ => RealTime_input}/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf (97%) rename conf/{ => RealTime_input}/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf (96%) diff --git a/conf/gnss-sdr_BDS_B1I_byte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf similarity index 97% rename from conf/gnss-sdr_BDS_B1I_byte.conf rename to conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf index a21547d24..873653eea 100644 --- a/conf/gnss-sdr_BDS_B1I_byte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf @@ -1,127 +1,127 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=25000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/BDS3_datasets/BdsB1IStr01.dat -SignalSource.item_type=byte -SignalSource.sampling_frequency=25000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Byte_To_Short -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=short -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=25000000 -InputFilter.IF=6250000 -InputFilter.dump = false -InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat -Resampler.implementation=Pass_Through -Resampler.sample_freq_in=25000000 -Resampler.sample_freq_out=25000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_B1.count=10 -Channels.in_acquisition=1 -Channel.signal=B1 - -Channel0.satellite = 6; -Channel1.satellite = 8; -Channel2.satellite = 9; -Channel3.satellite = 13; -Channel4.satellite = 17; -Channel5.satellite = 1; -Channel6.satellite = 2; -Channel7.satellite = 3; -Channel8.satellite = 4; -Channel9.satellite = 5; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition -Acquisition_B1.item_type=gr_complex -Acquisition_B1.coherent_integration_time_ms=1 -Acquisition_B1.pfa=0.01 -;Acquisition_B1.pfa=0.0000001; -Acquisition_B1.doppler_max=10000 -Acquisition_B1.doppler_step=100 -Acquisition_B1.dump=true -Acquisition_B1.dump_filename=./bds_acq -Acquisition_B1.blocking=false; -Acquisition_B1.bit_transition_flag = false; - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking -Tracking_B1.item_type=gr_complex -Tracking_B1.pll_bw_hz=25.0; -Tracking_B1.dll_bw_hz=2.50; -Tracking_B1.dump=false; -Tracking_B1.dump_filename=./epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder -TelemetryDecoder_B1.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true -PVT.rinex_version=3 -PVT.rinex_output_enabled=true -PVT.gpx_output_enabled=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=25000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/BDS3_datasets/BdsB1IStr01.dat +SignalSource.item_type=byte +SignalSource.sampling_frequency=25000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Byte_To_Short +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=short +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=25000000 +InputFilter.IF=6250000 +InputFilter.dump = false +InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat +Resampler.implementation=Pass_Through +Resampler.sample_freq_in=25000000 +Resampler.sample_freq_out=25000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_B1.count=10 +Channels.in_acquisition=1 +Channel.signal=B1 + +Channel0.satellite = 6; +Channel1.satellite = 8; +Channel2.satellite = 9; +Channel3.satellite = 13; +Channel4.satellite = 17; +Channel5.satellite = 1; +Channel6.satellite = 2; +Channel7.satellite = 3; +Channel8.satellite = 4; +Channel9.satellite = 5; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition +Acquisition_B1.item_type=gr_complex +Acquisition_B1.coherent_integration_time_ms=1 +Acquisition_B1.pfa=0.01 +;Acquisition_B1.pfa=0.0000001; +Acquisition_B1.doppler_max=10000 +Acquisition_B1.doppler_step=100 +Acquisition_B1.dump=true +Acquisition_B1.dump_filename=./bds_acq +Acquisition_B1.blocking=false; +Acquisition_B1.bit_transition_flag = false; + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking +Tracking_B1.item_type=gr_complex +Tracking_B1.pll_bw_hz=25.0; +Tracking_B1.dll_bw_hz=2.50; +Tracking_B1.dump=false; +Tracking_B1.dump_filename=./epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder +TelemetryDecoder_B1.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true +PVT.rinex_version=3 +PVT.rinex_output_enabled=true +PVT.gpx_output_enabled=true diff --git a/conf/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf similarity index 97% rename from conf/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf rename to conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf index f6df123ee..c17409232 100644 --- a/conf/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf @@ -1,212 +1,212 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=30000000 -GNSS-SDR.num_sources=2 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -;# Signal Source config for GPS, Galileo signals -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/BDS3_datasets/long/20180713_211400_3.dat -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=10000000 -SignalSource0.samples=0 -SignalSource0.repeat=false -SignalSource0.dump=false -SignalSource0.enable_throttle_control=false - -;# Signal Source config for BDS signals -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=30000000 -SignalSource1.samples=0 -SignalSource1.repeat=false -SignalSource1.dump=false -SignalSource1.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -;# Signal Conditioner config for GPS, Galileo signals -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=10000000 -InputFilter0.IF=420000 -Resampler0.implementation=Direct_Resampler -Resampler0.sample_freq_in=10000000 -Resampler0.sample_freq_out=30000000 -Resampler0.item_type=gr_complex - -;# Signal Conditioner config for BDS signals -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.70 -InputFilter1.band2_begin=0.80 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=10000000 -InputFilter1.IF=1020000 -Resampler1.implementation=Pass_Through -Resampler1.sample_freq_in=30000000 -Resampler1.sample_freq_out=30000000 -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=7 -Channels_B3.count=4 -Channels.in_acquisition=11 - -;# Preparing collection for GPS satellites -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel0.signal=1C -Channel0.satellite = 2 -Channel1.signal=1C -Channel1.satellite = 5 -Channel2.signal=1C -Channel2.satellite = 25 -Channel3.signal=1C -Channel3.satellite = 31 -Channel4.signal=1C -Channel4.satellite = 24 -Channel5.signal=1C -Channel5.satellite = 6 -Channel6.signal=1C -Channel6.satellite = 29 - -;# Preparing collection for BDS satellites -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 -Channel10.RF_channel_ID=1 - -Channel7.signal=B3 -Channel7.satellite = 29 -Channel8.signal=B3 -Channel8.satellite = 19 -Channel9.signal=B3 -Channel9.satellite = 20 -Channel10.signal=B3 -Channel10.satellite = 30 - - -;######### ACQUISITION GLOBAL CONFIG ############ -;# Acquisition config for BDS signals -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=1 -Acquisition_B3.pfa=0.01 -Acquisition_B3.doppler_max=15000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=false -Acquisition_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_acq -Acquisition_B3.blocking=false; -Acquisition_B3.use_CFAR_algorithm=true; -Acquisition_B3.bit_transition_flag = false; - -;# Acquisition config for GPS signals -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=15000 -Acquisition_1C.doppler_step=50 -Acquisition_1C.dump=true -Acquisition_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_acq -Acquisition_1C.blocking=false; -Acquisition_1C.use_CFAR_algorithm=true; -Acquisition_1C.bit_transition_flag = false; - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking -Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.50; -Tracking_B3.dump=true; -Tracking_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_trk_ch_ - -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=25.0; -Tracking_1C.dll_bw_hz=2.50; -Tracking_1C.dump=true; -Tracking_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_trk_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false - -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump=true -PVT.dump_filename = /home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/pvt_l1 -PVT.kml_output_enabled = false; -PVT.xml_output_enabled = false; -PVT.gpx_output_enabled = false; -PVT.rinex_output_enabled = false; -PVT.rtcm_output_enabled = false; -PVT.nmea_output_enabled = false; -PVT.geojson_output_enabled = false; +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=30000000 +GNSS-SDR.num_sources=2 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +;# Signal Source config for GPS, Galileo signals +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/BDS3_datasets/long/20180713_211400_3.dat +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=10000000 +SignalSource0.samples=0 +SignalSource0.repeat=false +SignalSource0.dump=false +SignalSource0.enable_throttle_control=false + +;# Signal Source config for BDS signals +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=30000000 +SignalSource1.samples=0 +SignalSource1.repeat=false +SignalSource1.dump=false +SignalSource1.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +;# Signal Conditioner config for GPS, Galileo signals +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=10000000 +InputFilter0.IF=420000 +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=10000000 +Resampler0.sample_freq_out=30000000 +Resampler0.item_type=gr_complex + +;# Signal Conditioner config for BDS signals +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.70 +InputFilter1.band2_begin=0.80 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=10000000 +InputFilter1.IF=1020000 +Resampler1.implementation=Pass_Through +Resampler1.sample_freq_in=30000000 +Resampler1.sample_freq_out=30000000 +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=7 +Channels_B3.count=4 +Channels.in_acquisition=11 + +;# Preparing collection for GPS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel0.signal=1C +Channel0.satellite = 2 +Channel1.signal=1C +Channel1.satellite = 5 +Channel2.signal=1C +Channel2.satellite = 25 +Channel3.signal=1C +Channel3.satellite = 31 +Channel4.signal=1C +Channel4.satellite = 24 +Channel5.signal=1C +Channel5.satellite = 6 +Channel6.signal=1C +Channel6.satellite = 29 + +;# Preparing collection for BDS satellites +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 +Channel10.RF_channel_ID=1 + +Channel7.signal=B3 +Channel7.satellite = 29 +Channel8.signal=B3 +Channel8.satellite = 19 +Channel9.signal=B3 +Channel9.satellite = 20 +Channel10.signal=B3 +Channel10.satellite = 30 + + +;######### ACQUISITION GLOBAL CONFIG ############ +;# Acquisition config for BDS signals +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms=1 +Acquisition_B3.pfa=0.01 +Acquisition_B3.doppler_max=15000 +Acquisition_B3.doppler_step=50 +Acquisition_B3.dump=false +Acquisition_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_acq +Acquisition_B3.blocking=false; +Acquisition_B3.use_CFAR_algorithm=true; +Acquisition_B3.bit_transition_flag = false; + +;# Acquisition config for GPS signals +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=15000 +Acquisition_1C.doppler_step=50 +Acquisition_1C.dump=true +Acquisition_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_acq +Acquisition_1C.blocking=false; +Acquisition_1C.use_CFAR_algorithm=true; +Acquisition_1C.bit_transition_flag = false; + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking +Tracking_B3.item_type=gr_complex +Tracking_B3.pll_bw_hz=25.0; +Tracking_B3.dll_bw_hz=2.50; +Tracking_B3.dump=true; +Tracking_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_trk_ch_ + +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=25.0; +Tracking_1C.dll_bw_hz=2.50; +Tracking_1C.dump=true; +Tracking_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_trk_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=false + +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump=true +PVT.dump_filename = /home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/pvt_l1 +PVT.kml_output_enabled = false; +PVT.xml_output_enabled = false; +PVT.gpx_output_enabled = false; +PVT.rinex_output_enabled = false; +PVT.rtcm_output_enabled = false; +PVT.nmea_output_enabled = false; +PVT.geojson_output_enabled = false; diff --git a/conf/gnss-sdr_BDS_B3I_byte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf similarity index 97% rename from conf/gnss-sdr_BDS_B3I_byte.conf rename to conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf index 8de1c685e..3c4baa708 100644 --- a/conf/gnss-sdr_BDS_B3I_byte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf @@ -1,123 +1,123 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=50000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/BDS3_datasets/BdsB3IStr01.dat -SignalSource.item_type=byte -SignalSource.sampling_frequency=50000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.enable_throttle_control=false -;SignalSource.samples=200000 - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Byte_To_Short -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=short -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=50000000 -InputFilter.IF=12500000 -InputFilter.dump = false -InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat -Resampler.implementation=Pass_Through -Resampler.sample_freq_in=50000000 -Resampler.sample_freq_out=50000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_B3.count=10 -Channels.in_acquisition=1 -Channel.signal=B3 - -Channel0.satellite = 6; -Channel1.satellite = 23; -Channel2.satellite = 16; -Channel3.satellite = 18; -Channel4.satellite = 7; -Channel5.satellite = 1; -Channel6.satellite = 2; -Channel7.satellite = 3; -Channel8.satellite = 4; -Channel9.satellite = 5; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=3 -Acquisition_B3.max_dwells = 2 -Acquisition_B3.pfa=0.01 -Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=100 -Acquisition_B3.dump=false -Acquisition_B3.dump_filename=./bds_acq - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking -Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=40.0; -Tracking_B3.dll_bw_hz=4.0; -Tracking_B3.pll_bw_narrow_hz=20.0; -Tracking_B3.dll_bw_narrow_hz=3.0; -Tracking_B3.dump=false; -Tracking_B3.dump_filename=./epl_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=50000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/BDS3_datasets/BdsB3IStr01.dat +SignalSource.item_type=byte +SignalSource.sampling_frequency=50000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.enable_throttle_control=false +;SignalSource.samples=200000 + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Byte_To_Short +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=short +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=50000000 +InputFilter.IF=12500000 +InputFilter.dump = false +InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat +Resampler.implementation=Pass_Through +Resampler.sample_freq_in=50000000 +Resampler.sample_freq_out=50000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_B3.count=10 +Channels.in_acquisition=1 +Channel.signal=B3 + +Channel0.satellite = 6; +Channel1.satellite = 23; +Channel2.satellite = 16; +Channel3.satellite = 18; +Channel4.satellite = 7; +Channel5.satellite = 1; +Channel6.satellite = 2; +Channel7.satellite = 3; +Channel8.satellite = 4; +Channel9.satellite = 5; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms=3 +Acquisition_B3.max_dwells = 2 +Acquisition_B3.pfa=0.01 +Acquisition_B3.doppler_max=10000 +Acquisition_B3.doppler_step=100 +Acquisition_B3.dump=false +Acquisition_B3.dump_filename=./bds_acq + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking +Tracking_B3.item_type=gr_complex +Tracking_B3.pll_bw_hz=40.0; +Tracking_B3.dll_bw_hz=4.0; +Tracking_B3.pll_bw_narrow_hz=20.0; +Tracking_B3.dll_bw_narrow_hz=3.0; +Tracking_B3.dump=false; +Tracking_B3.dump_filename=./epl_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/gnss-sdr_BDS_B3I_ibyte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf similarity index 96% rename from conf/gnss-sdr_BDS_B3I_ibyte.conf rename to conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf index b8d1e9cb5..651afa570 100644 --- a/conf/gnss-sdr_BDS_B3I_ibyte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf @@ -1,132 +1,132 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=30000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=30000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=30000000 -InputFilter.IF=1020000 -Resampler.implementation=Pass_Through -Resampler.sample_freq_in=30000000 -Resampler.sample_freq_out=30000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_B3.count=4 -Channels.in_acquisition=1 -Channel.signal=B3 - -Channel0.satellite = 29; -Channel1.satellite = 19; -Channel2.satellite = 20; -Channel3.satellite = 30; - - -;Channel0.satellite = 6; -;Channel1.satellite = 7; -;Channel2.satellite = 9; -;Channel3.satellite = 16; -;Channel4.satellite = 18; -;Channel5.satellite = 1; -;Channel6.satellite = 2; -;Channel7.satellite = 3; -;Channel8.satellite = 4; -;Channel9.satellite = 5; -;Channel10.satellite = 23; -;Channel11.satellite = 25; -;Channel12.satellite = 32; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=1 -Acquisition_B3.max_dwells = 1 -Acquisition_B3.pfa=0.01 -;Acquisition_B3.pfa=0.0000001; -Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=false -Acquisition_B3.dump_filename=./bds_acq -Acquisition_B3.blocking=false; -Acquisition_B3.bit_transition_flag = false; - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking -Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.50; -Tracking_B3.dump=false; -Tracking_B3.dump_filename=./epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=30000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=30000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=30000000 +InputFilter.IF=1020000 +Resampler.implementation=Pass_Through +Resampler.sample_freq_in=30000000 +Resampler.sample_freq_out=30000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_B3.count=4 +Channels.in_acquisition=1 +Channel.signal=B3 + +Channel0.satellite = 29; +Channel1.satellite = 19; +Channel2.satellite = 20; +Channel3.satellite = 30; + + +;Channel0.satellite = 6; +;Channel1.satellite = 7; +;Channel2.satellite = 9; +;Channel3.satellite = 16; +;Channel4.satellite = 18; +;Channel5.satellite = 1; +;Channel6.satellite = 2; +;Channel7.satellite = 3; +;Channel8.satellite = 4; +;Channel9.satellite = 5; +;Channel10.satellite = 23; +;Channel11.satellite = 25; +;Channel12.satellite = 32; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms=1 +Acquisition_B3.max_dwells = 1 +Acquisition_B3.pfa=0.01 +;Acquisition_B3.pfa=0.0000001; +Acquisition_B3.doppler_max=10000 +Acquisition_B3.doppler_step=50 +Acquisition_B3.dump=false +Acquisition_B3.dump_filename=./bds_acq +Acquisition_B3.blocking=false; +Acquisition_B3.bit_transition_flag = false; + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking +Tracking_B3.item_type=gr_complex +Tracking_B3.pll_bw_hz=25.0; +Tracking_B3.dll_bw_hz=2.50; +Tracking_B3.dump=false; +Tracking_B3.dump_filename=./epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/gnss-sdr_BDS_B3I_short.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf similarity index 97% rename from conf/gnss-sdr_BDS_B3I_short.conf rename to conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf index a88c36092..399d5d433 100644 --- a/conf/gnss-sdr_BDS_B3I_short.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf @@ -1,81 +1,81 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) -; 5C is the channel identifier for BeiDou B2a, both the data signal and the pilot signal - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=30000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -;SignalSource.filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/USRP_BDS_B2a_201805171115_fs_25e6_if0e3_ishort_200ms.bin -SignalSource.filename=/archive/USRP_BDS_B3I_201805171118_fs_25e6_if0e3_ishort.bin -SignalSource.item_type=ishort -SignalSource.sampling_frequency=30000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -InputFilter.implementation=Pass_Through -DataTypeAdapter.implementation=Ishort_To_Complex -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=30000000 -Resampler.sample_freq_out=30000000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=B3 -Channels.in_acquisition=1 -Channels_B3.count=5; - -Channel0.satellite = 27; -Channel1.satellite = 22; -Channel2.satellite = 21; -Channel3.satellite = 28; -Channel4.satellite = 30; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms = 1 -Acquisition_B3.max_dwells = 1 -Acquisition_B3.pfa=0.01 -Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=true -Acquisition_B3.dump_channel = 0; -Acquisition_B3.dump_filename=/archive/bds_b3i_acq -Acquisition_B3.blocking=false; -Acquisition_B3.bit_transition_flag = false; - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation= BEIDOU_B3I_DLL_PLL_Tracking; -Tracking_B3.item_type=gr_complex -Tracking_B3.early_late_space_chips=0.5 -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.0; -Tracking_B3.dump=true; -Tracking_B3.dump_filename=/archive/bds_b3i_trk_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=true -TelemetryDecoder_B3.dump_filename=/archive/bds_b3i_tel_dec.dat - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/bds_b3i_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) +; 5C is the channel identifier for BeiDou B2a, both the data signal and the pilot signal + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=30000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +;SignalSource.filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/USRP_BDS_B2a_201805171115_fs_25e6_if0e3_ishort_200ms.bin +SignalSource.filename=/archive/USRP_BDS_B3I_201805171118_fs_25e6_if0e3_ishort.bin +SignalSource.item_type=ishort +SignalSource.sampling_frequency=30000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +InputFilter.implementation=Pass_Through +DataTypeAdapter.implementation=Ishort_To_Complex +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=30000000 +Resampler.sample_freq_out=30000000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=B3 +Channels.in_acquisition=1 +Channels_B3.count=5; + +Channel0.satellite = 27; +Channel1.satellite = 22; +Channel2.satellite = 21; +Channel3.satellite = 28; +Channel4.satellite = 30; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms = 1 +Acquisition_B3.max_dwells = 1 +Acquisition_B3.pfa=0.01 +Acquisition_B3.doppler_max=10000 +Acquisition_B3.doppler_step=50 +Acquisition_B3.dump=true +Acquisition_B3.dump_channel = 0; +Acquisition_B3.dump_filename=/archive/bds_b3i_acq +Acquisition_B3.blocking=false; +Acquisition_B3.bit_transition_flag = false; + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation= BEIDOU_B3I_DLL_PLL_Tracking; +Tracking_B3.item_type=gr_complex +Tracking_B3.early_late_space_chips=0.5 +Tracking_B3.pll_bw_hz=25.0; +Tracking_B3.dll_bw_hz=2.0; +Tracking_B3.dump=true; +Tracking_B3.dump_filename=/archive/bds_b3i_trk_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=true +TelemetryDecoder_B3.dump_filename=/archive/bds_b3i_tel_dec.dat + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/bds_b3i_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 diff --git a/conf/gnss-sdr-L1-gaussian.conf b/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf similarity index 97% rename from conf/gnss-sdr-L1-gaussian.conf rename to conf/File_input/GPS/gnss-sdr-L1-gaussian.conf index a208366e5..17f62a765 100644 --- a/conf/gnss-sdr-L1-gaussian.conf +++ b/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf @@ -1,67 +1,67 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 -GNSS-SDR.internal_fs_hz=2000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/glamountain/gnss-sdr/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.samples=0 - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ishort_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=2000000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=../data/kalman/acq_dump - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/kalman/epl_tracking_ch_ -Tracking_1C.bce_run = true; -Tracking_1C.p_transient = 0; -Tracking_1C.s_transient = 100; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=GPS_L1_CA_Observables - -;######### PVT CONFIG ############ -PVT.implementation=GPS_L1_CA_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 +GNSS-SDR.internal_fs_hz=2000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/home/glamountain/gnss-sdr/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.samples=0 + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ishort_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=../data/kalman/acq_dump + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/kalman/epl_tracking_ch_ +Tracking_1C.bce_run = true; +Tracking_1C.p_transient = 0; +Tracking_1C.s_transient = 100; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=GPS_L1_CA_Observables + +;######### PVT CONFIG ############ +PVT.implementation=GPS_L1_CA_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 diff --git a/conf/gnss-sdr_GPS_L1_CA_ibyte.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_CA_ibyte.conf rename to conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf index 6afe08ced..d698d540f 100644 --- a/conf/gnss-sdr_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf @@ -1,94 +1,94 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -;SignalSource.samples=66250000 -SignalSource.samples=0 -SignalSource.dump=false; - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=6625000 -InputFilter.IF=60000 -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=6625000 -Resampler.sample_freq_out=6625000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1C -Channels.in_acquisition=1 -Channels_1C.count=6 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false; -Acquisition_1C.dump_filename=/archive/gps_acquisition.dat -;Acquisition_1C.coherent_integration_time_ms=10 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.pll_bw_hz=25.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=/archive/gps_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/gps_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=3 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +;SignalSource.samples=66250000 +SignalSource.samples=0 +SignalSource.dump=false; + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=6625000 +InputFilter.IF=60000 +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=6625000 +Resampler.sample_freq_out=6625000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1C +Channels.in_acquisition=1 +Channels_1C.count=6 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=25.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/gps_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=3 diff --git a/conf/gnss-sdr_GPS_L1_SPIR.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_SPIR.conf rename to conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf index d83bd63d3..02ff66fb5 100644 --- a/conf/gnss-sdr_GPS_L1_SPIR.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf @@ -1,137 +1,137 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Spir_File_Signal_Source -SignalSource.filename=/dtalogger/signals/spir/data/20Secs/20Secs_L1.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=int -SignalSource.sampling_frequency=80000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=80000000 -InputFilter.IF=10164 -InputFilter.decimation_factor=20 - - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=80000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=0 -Channels.in_acquisition=1 - -Channel.signal=1C - - -;######### CHANNEL 0 CONFIG ############ -;Channel0.satellite=20 - -;######### CHANNEL 1 CONFIG ############ -;Channel1.satellite=12 - -;######### CHANNEL 2 CONFIG ############ -;Channel2.satellite=11 - -;######### CHANNEL 3 CONFIG ############ -;Channel3.satellite=19 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.005 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=5 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation algorithm -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=500 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Spir_File_Signal_Source +SignalSource.filename=/dtalogger/signals/spir/data/20Secs/20Secs_L1.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=int +SignalSource.sampling_frequency=80000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=80000000 +InputFilter.IF=10164 +InputFilter.decimation_factor=20 + + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=80000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=0 +Channels.in_acquisition=1 + +Channel.signal=1C + + +;######### CHANNEL 0 CONFIG ############ +;Channel0.satellite=20 + +;######### CHANNEL 1 CONFIG ############ +;Channel1.satellite=12 + +;######### CHANNEL 2 CONFIG ############ +;Channel2.satellite=11 + +;######### CHANNEL 3 CONFIG ############ +;Channel3.satellite=19 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.005 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=5 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation algorithm +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=500 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_acq_QuickSync.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_acq_QuickSync.conf rename to conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf index 356dde132..c64b15c84 100644 --- a/conf/gnss-sdr_GPS_L1_acq_QuickSync.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf @@ -1,108 +1,108 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/data_type_adapter.dat - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=5 -Channels.in_acquisition=1 - - -;######### ACQUISITION GLOBAL CONFIG ############_1C -Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent-integration_time_ms=4 -Acquisition_1C.dump=true -;Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### ACQUISITION CHANNELS CONFIG ###### -Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition -Acquisition_1C.threshold=0.4 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=50.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/data_type_adapter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 + + +;######### ACQUISITION GLOBAL CONFIG ############_1C +Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent-integration_time_ms=4 +Acquisition_1C.dump=true +;Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### ACQUISITION CHANNELS CONFIG ###### +Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition +Acquisition_1C.threshold=0.4 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=50.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_gr_complex.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_gr_complex.conf rename to conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf index 84179dbed..cda1b5420 100644 --- a/conf/gnss-sdr_GPS_L1_gr_complex.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf @@ -1,98 +1,98 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf - - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat - -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=5 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=true -Tracking_1C.dump_filename=epl_tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_c - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=1 -PVT.display_rate_ms=100 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf + + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat + +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=true +Tracking_1C.dump_filename=epl_tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_c + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=1 +PVT.display_rate_ms=100 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_ishort.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_ishort.conf rename to conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf index 1d76c2a2f..60317c7cc 100644 --- a/conf/gnss-sdr_GPS_L1_ishort.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf @@ -1,102 +1,102 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=2000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -;Acquisition_1C.pfa=0.000001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat -Acquisition_1C.blocking=false; - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=./epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +;Acquisition_1C.pfa=0.000001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat +Acquisition_1C.blocking=false; + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=./epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf similarity index 97% rename from conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf index d7a72f476..e58863107 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf @@ -1,184 +1,184 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=0; -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 - -Channels.in_acquisition=1 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=10 -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.pll_bw_narrow_hz=35; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=0; +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 + +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=10 +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.pll_bw_narrow_hz=35; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf index 48727d42f..c63314288 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf @@ -1,189 +1,189 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1a.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 - -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1a.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 + +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf index 478cc875d..0c15ff8a5 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf @@ -1,188 +1,188 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -;#frontend channels AGC -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +;#frontend channels AGC +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf index 3ba4ba52d..5e54db37f 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf @@ -1,195 +1,195 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_II-3b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=40000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=16 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_II-3b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=40000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=16 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf index 73624bc73..ab1d04fc4 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf @@ -1,183 +1,183 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_I-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=40000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -;Channel4.RF_channel_ID=0 -;Channel5.RF_channel_ID=0 -;Channel6.RF_channel_ID=0 -;Channel7.RF_channel_ID=0 - -;#signal: -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_I-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=40000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +;Channel4.RF_channel_ID=0 +;Channel5.RF_channel_ID=0 +;Channel6.RF_channel_ID=0 +;Channel7.RF_channel_ID=0 + +;#signal: +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf index 9e77cb6ae..d74b51f15 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf @@ -1,305 +1,305 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=2 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=100000 -InputFilter1.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_2S.count=8 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel0.signal=1C - -Channel1.RF_channel_ID=0 -Channel1.signal=1C - -Channel2.RF_channel_ID=0 -Channel2.signal=1C - -Channel3.RF_channel_ID=0 -Channel3.signal=1C - -Channel4.RF_channel_ID=0 -Channel4.signal=1C - -Channel5.RF_channel_ID=0 -Channel5.signal=1C - -Channel6.RF_channel_ID=0 -Channel6.signal=1C - -Channel7.RF_channel_ID=0 -Channel7.signal=1C - - -Channel8.RF_channel_ID=1 -Channel8.signal=2S - -Channel9.RF_channel_ID=1 -Channel9.signal=2S - -Channel10.RF_channel_ID=1 -Channel10.signal=2S - -Channel11.RF_channel_ID=1 -Channel11.signal=2S - -Channel12.RF_channel_ID=1 -Channel12.signal=2S - -Channel13.RF_channel_ID=1 -Channel13.signal=2S - -Channel14.RF_channel_ID=1 -Channel14.signal=2S - -Channel15.RF_channel_ID=1 -Channel15.signal=2S - -Channel8.RF_channel_ID=1 -Channel8.signal=2S - -Channel9.RF_channel_ID=1 -Channel9.signal=2S - -Channel10.RF_channel_ID=1 -Channel10.signal=2S - -Channel11.RF_channel_ID=1 -Channel11.signal=2S - -Channel12.RF_channel_ID=1 -Channel12.signal=2S - -Channel13.RF_channel_ID=1 -Channel13.signal=2S - -Channel14.RF_channel_ID=1 -Channel14.signal=2S - -Channel15.RF_channel_ID=1 -Channel15.signal=2S - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=true -Tracking_1C.dump_filename=./tracking_ch_ - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=30 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.3; -Tracking_2S.order=3; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS L1 CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GPS L2 CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.flag_averaging=true -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=2 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=100000 +InputFilter1.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_2S.count=8 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel0.signal=1C + +Channel1.RF_channel_ID=0 +Channel1.signal=1C + +Channel2.RF_channel_ID=0 +Channel2.signal=1C + +Channel3.RF_channel_ID=0 +Channel3.signal=1C + +Channel4.RF_channel_ID=0 +Channel4.signal=1C + +Channel5.RF_channel_ID=0 +Channel5.signal=1C + +Channel6.RF_channel_ID=0 +Channel6.signal=1C + +Channel7.RF_channel_ID=0 +Channel7.signal=1C + + +Channel8.RF_channel_ID=1 +Channel8.signal=2S + +Channel9.RF_channel_ID=1 +Channel9.signal=2S + +Channel10.RF_channel_ID=1 +Channel10.signal=2S + +Channel11.RF_channel_ID=1 +Channel11.signal=2S + +Channel12.RF_channel_ID=1 +Channel12.signal=2S + +Channel13.RF_channel_ID=1 +Channel13.signal=2S + +Channel14.RF_channel_ID=1 +Channel14.signal=2S + +Channel15.RF_channel_ID=1 +Channel15.signal=2S + +Channel8.RF_channel_ID=1 +Channel8.signal=2S + +Channel9.RF_channel_ID=1 +Channel9.signal=2S + +Channel10.RF_channel_ID=1 +Channel10.signal=2S + +Channel11.RF_channel_ID=1 +Channel11.signal=2S + +Channel12.RF_channel_ID=1 +Channel12.signal=2S + +Channel13.RF_channel_ID=1 +Channel13.signal=2S + +Channel14.RF_channel_ID=1 +Channel14.signal=2S + +Channel15.RF_channel_ID=1 +Channel15.signal=2S + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=true +Tracking_1C.dump_filename=./tracking_ch_ + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=30 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.3; +Tracking_2S.order=3; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS L1 CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GPS L2 CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.flag_averaging=true +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf index f2a47b807..c5737900d 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf @@ -1,278 +1,278 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=2 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=0 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=0 -InputFilter1.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############. -Channels_1C.count=2 -Channels_1B.count=4 -Channels_2S.count=4 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=1 -Channel3.RF_channel_ID=1 -Channel4.RF_channel_ID=1 -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=1.5; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=30 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.3; -Tracking_2S.order=3; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=../data/epl_tracking_ch_ - - -;# GALILEO E1B -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000005 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=./veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS L1 CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GPS L2 CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - -;######### TELEMETRY DECODER GALILEO E1B CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=2 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=0 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=0 +InputFilter1.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############. +Channels_1C.count=2 +Channels_1B.count=4 +Channels_2S.count=4 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=1 +Channel3.RF_channel_ID=1 +Channel4.RF_channel_ID=1 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=1.5; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=30 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.3; +Tracking_2S.order=3; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=../data/epl_tracking_ch_ + + +;# GALILEO E1B +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000005 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=./veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS L1 CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GPS L2 CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + +;######### TELEMETRY DECODER GALILEO E1B CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf similarity index 97% rename from conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf index c6ca7e8e0..73fc542af 100644 --- a/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf @@ -1,363 +1,363 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=0 -InputFilter0.decimation_factor=4 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=0 -InputFilter1.decimation_factor=4 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - - -;###################################################### -;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Freq_Xlating_Fir_Filter -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter_ch2.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex -InputFilter2.taps_item_type=float -InputFilter2.number_of_taps=5 -InputFilter2.number_of_bands=2 -InputFilter2.band1_begin=0.0 -InputFilter2.band1_end=0.45 -InputFilter2.band2_begin=0.55 -InputFilter2.band2_end=1.0 -InputFilter2.ampl1_begin=1.0 -InputFilter2.ampl1_end=1.0 -InputFilter2.ampl2_begin=0.0 -InputFilter2.ampl2_end=0.0 -InputFilter2.band1_error=1.0 -InputFilter2.band2_error=1.0 -InputFilter2.filter_type=bandpass -InputFilter2.grid_density=16 -InputFilter2.sampling_frequency=40000000 -InputFilter2.IF=0 -InputFilter2.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler2.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=10 -Channels_2S.count=0 -Channels_5X.count=0 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 -;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a - -;# CHANNEL CONNECTION - -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=0 -Channel11.RF_channel_ID=0 -Channel12.RF_channel_ID=0 -Channel13.RF_channel_ID=0 -Channel14.RF_channel_ID=0 -Channel15.RF_channel_ID=0 -Channel16.RF_channel_ID=0 -Channel17.RF_channel_ID=0 -Channel18.RF_channel_ID=0 -Channel19.RF_channel_ID=0 -Channel20.RF_channel_ID=0 -Channel21.RF_channel_ID=0 -Channel22.RF_channel_ID=0 -Channel23.RF_channel_ID=0 -Channel24.RF_channel_ID=0 -Channel25.RF_channel_ID=0 -Channel26.RF_channel_ID=0 -Channel27.RF_channel_ID=0 -Channel28.RF_channel_ID=0 -Channel29.RF_channel_ID=0 -Channel30.RF_channel_ID=2 -Channel31.RF_channel_ID=2 -Channel32.RF_channel_ID=2 -Channel33.RF_channel_ID=2 -Channel34.RF_channel_ID=2 -Channel35.RF_channel_ID=2 -Channel36.RF_channel_ID=2 -Channel37.RF_channel_ID=2 -Channel38.RF_channel_ID=2 -Channel39.RF_channel_ID=2 - -;######### ACQUISITION CONFIG ###### - -;# GPS L1 CA -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;# Galileo E1 -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;# GALILEO E5a -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.threshold=0.009 -Acquisition_5X.doppler_max=5000 -Acquisition_5X.doppler_step=125 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.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 -Acquisition_5X.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. -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;######### TRACKING CONFIG ############ -;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### GALILEO E1 TRK CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=false -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### GALILEO E5 TRK CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.pll_bw_hz_init=20.0; **Only for E5a** PLL loop filter bandwidth during initialization [Hz] -Tracking_5X.dll_bw_hz_init=20.0; **Only for E5a** DLL loop filter bandwidth during initialization [Hz] -Tracking_5X.ti_ms=1; **Only for E5a** loop filter integration time after initialization (secondary code delay search)[ms] -Tracking_5X.pll_bw_hz=20.0; -Tracking_5X.dll_bw_hz=20.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=0 +InputFilter0.decimation_factor=4 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=0 +InputFilter1.decimation_factor=4 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + + +;###################################################### +;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Freq_Xlating_Fir_Filter +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter_ch2.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex +InputFilter2.taps_item_type=float +InputFilter2.number_of_taps=5 +InputFilter2.number_of_bands=2 +InputFilter2.band1_begin=0.0 +InputFilter2.band1_end=0.45 +InputFilter2.band2_begin=0.55 +InputFilter2.band2_end=1.0 +InputFilter2.ampl1_begin=1.0 +InputFilter2.ampl1_end=1.0 +InputFilter2.ampl2_begin=0.0 +InputFilter2.ampl2_end=0.0 +InputFilter2.band1_error=1.0 +InputFilter2.band2_error=1.0 +InputFilter2.filter_type=bandpass +InputFilter2.grid_density=16 +InputFilter2.sampling_frequency=40000000 +InputFilter2.IF=0 +InputFilter2.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler2.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=10 +Channels_2S.count=0 +Channels_5X.count=0 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 +;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a + +;# CHANNEL CONNECTION + +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=0 +Channel11.RF_channel_ID=0 +Channel12.RF_channel_ID=0 +Channel13.RF_channel_ID=0 +Channel14.RF_channel_ID=0 +Channel15.RF_channel_ID=0 +Channel16.RF_channel_ID=0 +Channel17.RF_channel_ID=0 +Channel18.RF_channel_ID=0 +Channel19.RF_channel_ID=0 +Channel20.RF_channel_ID=0 +Channel21.RF_channel_ID=0 +Channel22.RF_channel_ID=0 +Channel23.RF_channel_ID=0 +Channel24.RF_channel_ID=0 +Channel25.RF_channel_ID=0 +Channel26.RF_channel_ID=0 +Channel27.RF_channel_ID=0 +Channel28.RF_channel_ID=0 +Channel29.RF_channel_ID=0 +Channel30.RF_channel_ID=2 +Channel31.RF_channel_ID=2 +Channel32.RF_channel_ID=2 +Channel33.RF_channel_ID=2 +Channel34.RF_channel_ID=2 +Channel35.RF_channel_ID=2 +Channel36.RF_channel_ID=2 +Channel37.RF_channel_ID=2 +Channel38.RF_channel_ID=2 +Channel39.RF_channel_ID=2 + +;######### ACQUISITION CONFIG ###### + +;# GPS L1 CA +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;# Galileo E1 +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;# GALILEO E5a +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.threshold=0.009 +Acquisition_5X.doppler_max=5000 +Acquisition_5X.doppler_step=125 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.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 +Acquisition_5X.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. +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;######### TRACKING CONFIG ############ +;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### GALILEO E1 TRK CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=false +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### GALILEO E5 TRK CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.pll_bw_hz_init=20.0; **Only for E5a** PLL loop filter bandwidth during initialization [Hz] +Tracking_5X.dll_bw_hz_init=20.0; **Only for E5a** DLL loop filter bandwidth during initialization [Hz] +Tracking_5X.ti_ms=1; **Only for E5a** loop filter integration time after initialization (secondary code delay search)[ms] +Tracking_5X.pll_bw_hz=20.0; +Tracking_5X.dll_bw_hz=20.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf rename to conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf index 0abf4188c..cbc7def7f 100644 --- a/conf/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf @@ -1,258 +1,258 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/home/javier/signals/20140923_20-24-17_L125_roof_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=2 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.IF=0 -InputFilter0.decimation_factor=4 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=0 -InputFilter1.decimation_factor=4 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_2S.count=4 - -;#GPS.prns=7,8 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 -;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 -Channel16.RF_channel_ID=1 -Channel17.RF_channel_ID=1 -Channel18.RF_channel_ID=1 -Channel19.RF_channel_ID=1 - - -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;######### TRACKING CONFIG ############ -;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=false -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/home/javier/signals/20140923_20-24-17_L125_roof_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=2 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.IF=0 +InputFilter0.decimation_factor=4 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=0 +InputFilter1.decimation_factor=4 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_2S.count=4 + +;#GPS.prns=7,8 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 +;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 +Channel16.RF_channel_ID=1 +Channel17.RF_channel_ID=1 +Channel18.RF_channel_ID=1 +Channel19.RF_channel_ID=1 + + +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;######### TRACKING CONFIG ############ +;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=false +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf similarity index 97% rename from conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf rename to conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf index 3f3a9831e..1f58776f7 100644 --- a/conf/gnss-sdr_Galileo_E1_acq_QuickSync.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf @@ -1,100 +1,100 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/data_type_adapter.dat - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1B.count=4 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.threshold=0.05 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.coherent_integration_time_ms=8 -Acquisition_1B.cboc=false -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.dump=false -PVT.dump_filename=./PVT -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false; -PVT.flag_rtcm_tty_port=false; -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/data_type_adapter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=4 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.threshold=0.05 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.coherent_integration_time_ms=8 +Acquisition_1B.cboc=false +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.dump=false +PVT.dump_filename=./PVT +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false; +PVT.flag_rtcm_tty_port=false; +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_Galileo_E1_ishort.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf similarity index 97% rename from conf/gnss-sdr_Galileo_E1_ishort.conf rename to conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf index 257bd9091..ce6ceac98 100644 --- a/conf/gnss-sdr_Galileo_E1_ishort.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf @@ -1,109 +1,109 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=true - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1B.count=8 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.00001 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.cboc=false -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat -Acquisition_1B.blocking=false - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.dump=true -Tracking_1B.dump_filename=./veml_tracking_ch_ -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=3.0; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.track_pilot=true -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true; -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MSM_rate_ms=1000 -PVT.flag_rtcm_tty_port=false; -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=true + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=8 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.00001 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.cboc=false +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat +Acquisition_1B.blocking=false + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.dump=true +Tracking_1B.dump_filename=./veml_tracking_ch_ +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=3.0; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.track_pilot=true +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true; +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MSM_rate_ms=1000 +PVT.flag_rtcm_tty_port=false; +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Galileo_E1_nsr.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf similarity index 97% rename from conf/gnss-sdr_Galileo_E1_nsr.conf rename to conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf index 883927c8e..d4372a04f 100644 --- a/conf/gnss-sdr_Galileo_E1_nsr.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf @@ -1,127 +1,127 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;GNSS-SDR.internal_fs_sps=6826700 -GNSS-SDR.internal_fs_sps=2560000 -;GNSS-SDR.internal_fs_sps=4096000 -;GNSS-SDR.internal_fs_sps=5120000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 ; 0 means the entire file -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -InputFilter.IF=5499998.47412109 -InputFilter.decimation_factor=8 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1B.count=8 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.cboc=false ; This option allows you to choose between acquiring with CBOC signal [true] or sinboc(1,1) signal [false]. Use only if GNSS-SDR.internal_fs_sps is greater than or equal to 6138000 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump=true -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;GNSS-SDR.internal_fs_sps=6826700 +GNSS-SDR.internal_fs_sps=2560000 +;GNSS-SDR.internal_fs_sps=4096000 +;GNSS-SDR.internal_fs_sps=5120000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Nsr_File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 ; 0 means the entire file +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +InputFilter.IF=5499998.47412109 +InputFilter.decimation_factor=8 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=8 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.pfa=0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.cboc=false ; This option allows you to choose between acquiring with CBOC signal [true] or sinboc(1,1) signal [false]. Use only if GNSS-SDR.internal_fs_sps is greater than or equal to 6138000 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump=true +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_Galileo_E5a.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf similarity index 97% rename from conf/gnss-sdr_Galileo_E5a.conf rename to conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf index 7ac27534e..b9534b4b0 100644 --- a/conf/gnss-sdr_Galileo_E5a.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf @@ -1,121 +1,121 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=32000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -;GNSS-SDR.SUPL_gps_enabled=false -;GNSS-SDR.SUPL_read_gps_assistance_xml=false -;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -;GNSS-SDR.SUPL_gps_ephemeris_port=7275 -;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -;GNSS-SDR.SUPL_gps_acquisition_port=7275 -;GNSS-SDR.SUPL_MCC=244 -;GNSS-SDR.SUPL_MNC=5 -;GNSS-SDR.SUPL_LAC=0x59e2 -;GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/32MS_complex.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=32000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_5X.count=1 -Channels.in_acquisition=1 - -;######### SPECIFIC CHANNELS CONFIG ###### -;#The following options are specific to each channel and overwrite the generic options - -;######### CHANNEL 0 CONFIG ############ -;Channel0.satellite=19 - -;######### CHANNEL 1 CONFIG ############ -;Channel1.satellite=12 - -;######### CHANNEL 2 CONFIG ############ -;Channel2.satellite=11 - -;######### CHANNEL 3 CONFIG ############ - -;Channel3.system=Galileo -;Channel3.signal=5Q -;Channel3.satellite=20 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.pfa=0.01 -Acquisition_5X.pfa=0.0003 -Acquisition_5X.doppler_max=10000 -Acquisition_5X.doppler_step=250 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.CAF_window_hz=0 -Acquisition_5X.Zero_padding=0 -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.pll_bw_hz=20.0; -Tracking_5X.dll_bw_hz=20.0; -Tracking_5X.pll_bw_narrow_hz=2.0; -Tracking_5X.dll_bw_narrow_hz=5.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=32000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +;GNSS-SDR.SUPL_gps_enabled=false +;GNSS-SDR.SUPL_read_gps_assistance_xml=false +;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +;GNSS-SDR.SUPL_gps_ephemeris_port=7275 +;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +;GNSS-SDR.SUPL_gps_acquisition_port=7275 +;GNSS-SDR.SUPL_MCC=244 +;GNSS-SDR.SUPL_MNC=5 +;GNSS-SDR.SUPL_LAC=0x59e2 +;GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/32MS_complex.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=32000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_5X.count=1 +Channels.in_acquisition=1 + +;######### SPECIFIC CHANNELS CONFIG ###### +;#The following options are specific to each channel and overwrite the generic options + +;######### CHANNEL 0 CONFIG ############ +;Channel0.satellite=19 + +;######### CHANNEL 1 CONFIG ############ +;Channel1.satellite=12 + +;######### CHANNEL 2 CONFIG ############ +;Channel2.satellite=11 + +;######### CHANNEL 3 CONFIG ############ + +;Channel3.system=Galileo +;Channel3.signal=5Q +;Channel3.satellite=20 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.pfa=0.01 +Acquisition_5X.pfa=0.0003 +Acquisition_5X.doppler_max=10000 +Acquisition_5X.doppler_step=250 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.CAF_window_hz=0 +Acquisition_5X.Zero_padding=0 +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.pll_bw_hz=20.0; +Tracking_5X.dll_bw_hz=20.0; +Tracking_5X.pll_bw_narrow_hz=2.0; +Tracking_5X.dll_bw_narrow_hz=5.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf similarity index 97% rename from conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf rename to conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf index 9c2ea55cc..7aba98ac1 100644 --- a/conf/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf @@ -1,157 +1,157 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=50000000 - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -;GNSS-SDR.SUPL_gps_enabled=false -;GNSS-SDR.SUPL_read_gps_assistance_xml=false -;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -;GNSS-SDR.SUPL_gps_ephemeris_port=7275 -;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -;GNSS-SDR.SUPL_gps_acquisition_port=7275 -;GNSS-SDR.SUPL_MCC=244 -;GNSS-SDR.SUPL_MNC=5 -;GNSS-SDR.SUPL_LAC=0x59e2 -;GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/Galileo_E5ab_IFEN_CTTC_run1.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=50000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=50000000 -InputFilter.IF=-15345000 -InputFilter.decimation_factor=1 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_5X.count=8 -Channels.in_acquisition=1 -Channel.signal=5X - -;######### SPECIFIC CHANNELS CONFIG ###### -;#The following options are specific to each channel and overwrite the generic options - -;######### CHANNEL 0 CONFIG ############ -Channel0.signal=5X -;Channel0.satellite=19 -;Channel0.repeat_satellite=true - -;######### CHANNEL 1 CONFIG ############ -Channel1.signal=5X -;Channel1.satellite=12 - -;######### CHANNEL 2 CONFIG ############ -Channel2.signal=5X -;Channel2.satellite=11 - -;######### CHANNEL 3 CONFIG ############ -Channel3.signal=5X -;Channel3.satellite=20 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.threshold=0.002 -Acquisition_5X.doppler_max=10000 -Acquisition_5X.doppler_step=250 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.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 -Acquisition_5X.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. -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.pll_bw_hz=20.0; -Tracking_5X.dll_bw_hz=20.0; -Tracking_5X.pll_bw_narrow_hz=20.0; -Tracking_5X.dll_bw_narrow_hz=20.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=OFF ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.dump=false -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=50000000 + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +;GNSS-SDR.SUPL_gps_enabled=false +;GNSS-SDR.SUPL_read_gps_assistance_xml=false +;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +;GNSS-SDR.SUPL_gps_ephemeris_port=7275 +;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +;GNSS-SDR.SUPL_gps_acquisition_port=7275 +;GNSS-SDR.SUPL_MCC=244 +;GNSS-SDR.SUPL_MNC=5 +;GNSS-SDR.SUPL_LAC=0x59e2 +;GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/Galileo_E5ab_IFEN_CTTC_run1.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=50000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=50000000 +InputFilter.IF=-15345000 +InputFilter.decimation_factor=1 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_5X.count=8 +Channels.in_acquisition=1 +Channel.signal=5X + +;######### SPECIFIC CHANNELS CONFIG ###### +;#The following options are specific to each channel and overwrite the generic options + +;######### CHANNEL 0 CONFIG ############ +Channel0.signal=5X +;Channel0.satellite=19 +;Channel0.repeat_satellite=true + +;######### CHANNEL 1 CONFIG ############ +Channel1.signal=5X +;Channel1.satellite=12 + +;######### CHANNEL 2 CONFIG ############ +Channel2.signal=5X +;Channel2.satellite=11 + +;######### CHANNEL 3 CONFIG ############ +Channel3.signal=5X +;Channel3.satellite=20 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.threshold=0.002 +Acquisition_5X.doppler_max=10000 +Acquisition_5X.doppler_step=250 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.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 +Acquisition_5X.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. +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.pll_bw_hz=20.0; +Tracking_5X.dll_bw_hz=20.0; +Tracking_5X.pll_bw_narrow_hz=20.0; +Tracking_5X.dll_bw_narrow_hz=20.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=OFF ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.dump=false +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf similarity index 96% rename from conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf rename to conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf index a0715fba8..e53d49252 100644 --- a/conf/gnss-sdr_galileo_E1_extended_correlator_byte.conf +++ b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf @@ -1,141 +1,141 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=20000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ibyte_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=8 - -Channels.in_acquisition=1 - -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.scoherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.acquire_pilot=true -Acquisition_1B.threshold=2.5 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.bit_transition_flag=true -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=../data/acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=30.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.track_pilot=true -Tracking_1B.pll_bw_hz=4.0; -Tracking_1B.dll_bw_hz=0.5; -Tracking_1B.pll_bw_narrow_hz=2.0; -Tracking_1B.dll_bw_narrow_hz=0.25; -Tracking_1B.extend_correlation_symbols=4; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.early_late_space_narrow_chips=0.06; -Tracking_1B.very_early_late_space_narrow_chips=0.25; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=20000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ibyte_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=8 + +Channels.in_acquisition=1 + +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.scoherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.acquire_pilot=true +Acquisition_1B.threshold=2.5 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.bit_transition_flag=true +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=../data/acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=30.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.track_pilot=true +Tracking_1B.pll_bw_hz=4.0; +Tracking_1B.dll_bw_hz=0.5; +Tracking_1B.pll_bw_narrow_hz=2.0; +Tracking_1B.dll_bw_narrow_hz=0.25; +Tracking_1B.extend_correlation_symbols=4; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.early_late_space_narrow_chips=0.06; +Tracking_1B.very_early_late_space_narrow_chips=0.25; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_galileo_E1_extended_correlator_labsat.conf b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf similarity index 96% rename from conf/gnss-sdr_galileo_E1_extended_correlator_labsat.conf rename to conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf index 91387a875..9213ef302 100644 --- a/conf/gnss-sdr_galileo_E1_extended_correlator_labsat.conf +++ b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf @@ -1,169 +1,169 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=5456000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Labsat_Signal_Source -SignalSource.selected_channel=1 -;#filename: path to file with the captured GNSS signal samples to be processed -;# Labsat sile source automatically increments the file name when the signal is split in several files -;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on -;# in this example, the first file complete path will be ../signals/GPS_025_0000.LS3 -SignalSource.filename=../signals/GPS_025 ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=16368000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=16368000 -InputFilter.IF=0 -InputFilter.decimation_factor=3 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=6 -Channels.in_acquisition=1 - -Channel0.signal=1B -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.acquire_pilot=true -Acquisition_1B.threshold=2.5 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.bit_transition_flag=true -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=../data/acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.track_pilot=true -Tracking_1B.pll_bw_hz=7.5; -Tracking_1B.dll_bw_hz=0.5; -Tracking_1B.pll_bw_narrow_hz=2.5; -Tracking_1B.dll_bw_narrow_hz=0.25; -Tracking_1B.extend_correlation_symbols=4; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.early_late_space_narrow_chips=0.15; -Tracking_1B.very_early_late_space_narrow_chips=0.30; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=5456000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Labsat_Signal_Source +SignalSource.selected_channel=1 +;#filename: path to file with the captured GNSS signal samples to be processed +;# Labsat sile source automatically increments the file name when the signal is split in several files +;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on +;# in this example, the first file complete path will be ../signals/GPS_025_0000.LS3 +SignalSource.filename=../signals/GPS_025 ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=16368000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=16368000 +InputFilter.IF=0 +InputFilter.decimation_factor=3 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=6 +Channels.in_acquisition=1 + +Channel0.signal=1B +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.acquire_pilot=true +Acquisition_1B.threshold=2.5 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.bit_transition_flag=true +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=../data/acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.track_pilot=true +Tracking_1B.pll_bw_hz=7.5; +Tracking_1B.dll_bw_hz=0.5; +Tracking_1B.pll_bw_narrow_hz=2.5; +Tracking_1B.dll_bw_narrow_hz=0.25; +Tracking_1B.extend_correlation_symbols=4; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.early_late_space_narrow_chips=0.15; +Tracking_1B.very_early_late_space_narrow_chips=0.30; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf index 021b12ae8..372449d4c 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf @@ -1,142 +1,142 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=../data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=../data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Direct_Resampler -Resampler0.sample_freq_in=6625000 -Resampler0.sample_freq_out=6625000 -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=1 -Channels_1G.count=5 -Channels_1C.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.0 -Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false; -Acquisition_1C.dump_filename=/archive/gps_acquisition.dat -;Acquisition_1C.coherent_integration_time_ms=10 - -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.00001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=10 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=/archive/gps_tracking_ch_ - -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=25.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=../data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=../data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=6625000 +Resampler0.sample_freq_out=6625000 +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_1G.count=5 +Channels_1C.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.0 +Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.00001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf similarity index 96% rename from conf/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf index 8d37347c8..8681ca8ba 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf @@ -1,143 +1,143 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Pass_Through -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=5 -Channels_2S.count=5 -Channels_1G.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel0.signal=2S -Channel1.RF_channel_ID=0 -Channel1.signal=2S -Channel2.RF_channel_ID=0 -Channel2.signal=2S -Channel3.RF_channel_ID=0 -Channel3.signal=2S -Channel4.RF_channel_ID=0 -Channel4.signal=2S -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.threshold=0.0 -Acquisition_2S.pfa=0.00001 -Acquisition_2S.doppler_max=10000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 - -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.00001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.early_late_space_chips=0.5 -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.250; -Tracking_2S.order=2; -Tracking_2S.dump=false; -Tracking_2S.dump_filename=/archive/gps_tracking_ch_ - -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=25.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=3 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Pass_Through +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=5 +Channels_2S.count=5 +Channels_1G.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel0.signal=2S +Channel1.RF_channel_ID=0 +Channel1.signal=2S +Channel2.RF_channel_ID=0 +Channel2.signal=2S +Channel3.RF_channel_ID=0 +Channel3.signal=2S +Channel4.RF_channel_ID=0 +Channel4.signal=2S +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.threshold=0.0 +Acquisition_2S.pfa=0.00001 +Acquisition_2S.doppler_max=10000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 + +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.00001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.early_late_space_chips=0.5 +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.250; +Tracking_2S.order=2; +Tracking_2S.dump=false; +Tracking_2S.dump_filename=/archive/gps_tracking_ch_ + +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=3 diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf index 46efcc5df..fda369294 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -1,82 +1,82 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1G -Channels.in_acquisition=1 -Channels_1G.count=5 - -Channel0.satellite=24 ; k= -Channel1.satellite=1 ; k=1 -Channel2.satellite=2 ; k=-4 -Channel3.satellite=20 ; k=-5 -Channel4.satellite=21 ; k=4 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.0001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=true; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=1 -;Acquisition_1G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=25.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.dump=true; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=1 +Channels_1G.count=5 + +Channel0.satellite=24 ; k= +Channel1.satellite=1 ; k=1 +Channel2.satellite=2 ; k=-4 +Channel3.satellite=20 ; k=-5 +Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=true; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=true; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf index bc48c28a7..faa67b8ca 100644 --- a/conf/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf @@ -1,86 +1,86 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1G -Channels.in_acquisition=2 -Channels_1G.count=8 - -;Channel0.satellite=24 ; k=2 -;Channel1.satellite=1 ; k=1 -;Channel2.satellite=2 ; k=-4 -;Channel3.satellite=20 ; k=-5 -;Channel4.satellite=21 ; k=4 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.0001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=1 -;Acquisition_1G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=40.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.pll_bw_narrow_hz = 25.0; -Tracking_1G.dll_bw_narrow_hz = 2.0; -Tracking_1G.extend_correlation_ms = 1; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=2 +Channels_1G.count=8 + +;Channel0.satellite=24 ; k=2 +;Channel1.satellite=1 ; k=1 +;Channel2.satellite=2 ; k=-4 +;Channel3.satellite=20 ; k=-5 +;Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=40.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.pll_bw_narrow_hz = 25.0; +Tracking_1G.dll_bw_narrow_hz = 2.0; +Tracking_1G.extend_correlation_ms = 1; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_GLONASS_L1_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L1_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf index 8f8baecfc..4ab21d0b3 100644 --- a/conf/gnss-sdr_GLONASS_L1_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf @@ -1,101 +1,101 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Hz]. -GNSS-SDR.internal_fs_sps=6625000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/dmiralles/Documents/GSOC/GSOC2017/gnss-sdr/data/dmirallesNT1065_L2_20160831_fs6625e6_60e3_schar_1H.bin -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.freq=1602000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.sample_type=iq -SignalSource.seconds_to_skip=0 -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -;InputFilter.input_item_type=gr_complex -;InputFilter.output_item_type=gr_complex -InputFilter.item_type=gr_complex -;Resampler.implementation=Pass_Through -;Resampler.item_type=gr_complex -Resampler.implementation=Pass_Through -;Resampler.sample_freq_in=4000000 -;Resampler.sample_freq_out=2000000 -;Resampler.item_type=gr_complex -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1R.count=8 ;Assuming here that identifier `1r=R` defines GLONASS SP signals -Channels.in_acquisition=1 -Channel.signal=1R -;Channel.item_type=cshort - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1R.dump=false -Acquisition_1R.dump_filename=./acq_dump.dat -Acquisition_1R.item_type=cshort -Acquisition_1R.sampled_ms=1 -Acquisition_1R.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1R.pfa=0.01 -;Acquisition_1C.pfa=0.000001 -Acquisition_1R.doppler_max=10000 -Acquisition_1R.doppler_step=250 -Acquisition_1R.tong_init_val=2 -Acquisition_1R.tong_max_val=10 -Acquisition_1R.tong_max_dwells=20 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1R.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking -Tracking_1R.item_type=cshort -Tracking_1R.dump=false -Tracking_1R.dump_filename=../data/epl_tracking_ch_ -Tracking_1R.pll_bw_hz=40.0; -Tracking_1R.dll_bw_hz=4.0; -Tracking_1R.order=3; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1R.implementation=GLONASS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1R.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Hz]. +GNSS-SDR.internal_fs_sps=6625000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/home/dmiralles/Documents/GSOC/GSOC2017/gnss-sdr/data/dmirallesNT1065_L2_20160831_fs6625e6_60e3_schar_1H.bin +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.freq=1602000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.sample_type=iq +SignalSource.seconds_to_skip=0 +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +;InputFilter.input_item_type=gr_complex +;InputFilter.output_item_type=gr_complex +InputFilter.item_type=gr_complex +;Resampler.implementation=Pass_Through +;Resampler.item_type=gr_complex +Resampler.implementation=Pass_Through +;Resampler.sample_freq_in=4000000 +;Resampler.sample_freq_out=2000000 +;Resampler.item_type=gr_complex +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1R.count=8 ;Assuming here that identifier `1r=R` defines GLONASS SP signals +Channels.in_acquisition=1 +Channel.signal=1R +;Channel.item_type=cshort + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1R.dump=false +Acquisition_1R.dump_filename=./acq_dump.dat +Acquisition_1R.item_type=cshort +Acquisition_1R.sampled_ms=1 +Acquisition_1R.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1R.pfa=0.01 +;Acquisition_1C.pfa=0.000001 +Acquisition_1R.doppler_max=10000 +Acquisition_1R.doppler_step=250 +Acquisition_1R.tong_init_val=2 +Acquisition_1R.tong_max_val=10 +Acquisition_1R.tong_max_dwells=20 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1R.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1R.item_type=cshort +Tracking_1R.dump=false +Tracking_1R.dump_filename=../data/epl_tracking_ch_ +Tracking_1R.pll_bw_hz=40.0; +Tracking_1R.dll_bw_hz=4.0; +Tracking_1R.order=3; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1R.implementation=GLONASS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1R.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf index abdbea4b2..663f6451e 100644 --- a/conf/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf @@ -1,143 +1,143 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Direct_Resampler -Resampler0.sample_freq_in=6625000 -Resampler0.sample_freq_out=6625000 -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=1 -Channels_2G.count=5 -Channels_1C.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.0 -Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false; -Acquisition_1C.dump_filename=/archive/gps_acquisition.dat -;Acquisition_1C.coherent_integration_time_ms=10 - -Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition -Acquisition_2G.item_type=gr_complex -Acquisition_2G.threshold=0.0 -Acquisition_2G.pfa=0.00001 -Acquisition_2G.doppler_max=10000 -Acquisition_2G.doppler_step=250 -Acquisition_2G.dump=false; -Acquisition_2G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_2G.coherent_integration_time_ms=10 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=/archive/gps_tracking_ch_ - -Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking -Tracking_2G.item_type=gr_complex -Tracking_2G.early_late_space_chips=0.5 -Tracking_2G.pll_bw_hz=25.0; -Tracking_2G.dll_bw_hz=2.0; -Tracking_2G.dump=false; -Tracking_2G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=6625000 +Resampler0.sample_freq_out=6625000 +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_2G.count=5 +Channels_1C.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.0 +Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition +Acquisition_2G.item_type=gr_complex +Acquisition_2G.threshold=0.0 +Acquisition_2G.pfa=0.00001 +Acquisition_2G.doppler_max=10000 +Acquisition_2G.doppler_step=250 +Acquisition_2G.dump=false; +Acquisition_2G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_2G.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking +Tracking_2G.item_type=gr_complex +Tracking_2G.early_late_space_chips=0.5 +Tracking_2G.pll_bw_hz=25.0; +Tracking_2G.dll_bw_hz=2.0; +Tracking_2G.dump=false; +Tracking_2G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf similarity index 96% rename from conf/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf index 79585a6ae..faa27538d 100644 --- a/conf/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf @@ -1,144 +1,144 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/archive/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Pass_Through -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=5 -Channels_2S.count=5 -Channels_2G.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel0.signal=2S -Channel1.RF_channel_ID=0 -Channel1.signal=2S -Channel2.RF_channel_ID=0 -Channel2.signal=2S -Channel3.RF_channel_ID=0 -Channel3.signal=2S -Channel4.RF_channel_ID=0 -Channel4.signal=2S -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.threshold=0.0 -Acquisition_2S.pfa=0.00001 -Acquisition_2S.doppler_max=10000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 - -Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition -Acquisition_2G.item_type=gr_complex -Acquisition_2G.threshold=0.0 -Acquisition_2G.pfa=0.00001 -Acquisition_2G.doppler_max=10000 -Acquisition_2G.doppler_step=250 -Acquisition_2G.dump=false; -Acquisition_2G.dump_filename=/archive/glo_acquisition.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.early_late_space_chips=0.5 -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.250; -Tracking_2S.order=2; -Tracking_2S.dump=false; -Tracking_2S.dump_filename=/archive/gps_tracking_ch_ - -Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking -Tracking_2G.item_type=gr_complex -Tracking_2G.early_late_space_chips=0.5 -Tracking_2G.pll_bw_hz=25.0; -Tracking_2G.dll_bw_hz=3.0; -Tracking_2G.dump=false; -Tracking_2G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=3 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Pass_Through +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=5 +Channels_2S.count=5 +Channels_2G.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel0.signal=2S +Channel1.RF_channel_ID=0 +Channel1.signal=2S +Channel2.RF_channel_ID=0 +Channel2.signal=2S +Channel3.RF_channel_ID=0 +Channel3.signal=2S +Channel4.RF_channel_ID=0 +Channel4.signal=2S +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.threshold=0.0 +Acquisition_2S.pfa=0.00001 +Acquisition_2S.doppler_max=10000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 + +Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition +Acquisition_2G.item_type=gr_complex +Acquisition_2G.threshold=0.0 +Acquisition_2G.pfa=0.00001 +Acquisition_2G.doppler_max=10000 +Acquisition_2G.doppler_step=250 +Acquisition_2G.dump=false; +Acquisition_2G.dump_filename=/archive/glo_acquisition.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.early_late_space_chips=0.5 +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.250; +Tracking_2S.order=2; +Tracking_2S.dump=false; +Tracking_2S.dump_filename=/archive/gps_tracking_ch_ + +Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking +Tracking_2G.item_type=gr_complex +Tracking_2G.early_late_space_chips=0.5 +Tracking_2G.pll_bw_hz=25.0; +Tracking_2G.dll_bw_hz=3.0; +Tracking_2G.dump=false; +Tracking_2G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=3 diff --git a/conf/gnss-sdr_GLONASS_L2_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L2_CA_ibyte.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf index 9ac3595eb..8ded2ca7e 100644 --- a/conf/gnss-sdr_GLONASS_L2_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf @@ -1,76 +1,76 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160831_fs6625e6_60e3_schar_1m.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=2G -Channels.in_acquisition=1 -Channels_2G.count=5 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition -Acquisition_2G.item_type=gr_complex -Acquisition_2G.threshold=0.0 -Acquisition_2G.pfa=0.0001 -Acquisition_2G.doppler_max=10000 -Acquisition_2G.doppler_step=250 -Acquisition_2G.dump=true; -Acquisition_2G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_2G.coherent_integration_time_ms=1 -;Acquisition_2G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking -Tracking_2G.item_type=gr_complex -Tracking_2G.early_late_space_chips=0.5 -Tracking_2G.pll_bw_hz=20.0; -Tracking_2G.dll_bw_hz=2.0; -Tracking_2G.dump=true; -Tracking_2G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160831_fs6625e6_60e3_schar_1m.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=2G +Channels.in_acquisition=1 +Channels_2G.count=5 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition +Acquisition_2G.item_type=gr_complex +Acquisition_2G.threshold=0.0 +Acquisition_2G.pfa=0.0001 +Acquisition_2G.doppler_max=10000 +Acquisition_2G.doppler_step=250 +Acquisition_2G.dump=true; +Acquisition_2G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_2G.coherent_integration_time_ms=1 +;Acquisition_2G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking +Tracking_2G.item_type=gr_complex +Tracking_2G.early_late_space_chips=0.5 +Tracking_2G.pll_bw_hz=20.0; +Tracking_2G.dll_bw_hz=2.0; +Tracking_2G.dump=true; +Tracking_2G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf similarity index 97% rename from conf/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf rename to conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf index bc48c28a7..faa67b8ca 100644 --- a/conf/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf @@ -1,86 +1,86 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1G -Channels.in_acquisition=2 -Channels_1G.count=8 - -;Channel0.satellite=24 ; k=2 -;Channel1.satellite=1 ; k=1 -;Channel2.satellite=2 ; k=-4 -;Channel3.satellite=20 ; k=-5 -;Channel4.satellite=21 ; k=4 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.0001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=1 -;Acquisition_1G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=40.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.pll_bw_narrow_hz = 25.0; -Tracking_1G.dll_bw_narrow_hz = 2.0; -Tracking_1G.extend_correlation_ms = 1; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=2 +Channels_1G.count=8 + +;Channel0.satellite=24 ; k=2 +;Channel1.satellite=1 ; k=1 +;Channel2.satellite=2 ; k=-4 +;Channel3.satellite=20 ; k=-5 +;Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=40.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.pll_bw_narrow_hz = 25.0; +Tracking_1G.dll_bw_narrow_hz = 2.0; +Tracking_1G.extend_correlation_ms = 1; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_Hybrid_byte.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf similarity index 96% rename from conf/gnss-sdr_Hybrid_byte.conf rename to conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf index 3daee47ce..a9f5495ba 100644 --- a/conf/gnss-sdr_Hybrid_byte.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf @@ -1,160 +1,160 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=20000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/javier/Extreme 500/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ibyte_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=20000000 -Resampler.sample_freq_out=20000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=10 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B -Channel16.signal=1B -Channel17.signal=1B -Channel18.signal=1B -Channel19.signal=1B - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=3.5 -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.5 -Acquisition_1B.blocking=true -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=1 -Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=30; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.5; -Tracking_1C.order=2; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=3.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10; -PVT.display_rate_ms=500; -PVT.elevation_mask=15; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=20000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/javier/Extreme 500/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ibyte_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=20000000 +Resampler.sample_freq_out=20000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=10 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B +Channel16.signal=1B +Channel17.signal=1B +Channel18.signal=1B +Channel19.signal=1B + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=3.5 +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.blocking=true +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=1 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.order=2; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=3.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10; +PVT.display_rate_ms=500; +PVT.elevation_mask=15; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Hybrid_byte_sim.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf similarity index 96% rename from conf/gnss-sdr_Hybrid_byte_sim.conf rename to conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf index b92bdc4a9..9ad05a378 100644 --- a/conf/gnss-sdr_Hybrid_byte_sim.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf @@ -1,145 +1,145 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2600000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/Users/carlesfernandez/git/cttc/build/signal_out.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ibyte_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type = gr_complex; - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=11 -Channels_1B.count=0 -Channels.in_acquisition=1 - -;#signal: -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C -Channel8.signal=1C -Channel9.signal=1C -Channel10.signal=1C -Channel11.signal=1C -Channel12.signal=1C -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=6000 -Acquisition_1C.doppler_step=100 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.dll_bw_hz=1.5; -Tracking_1C.order=3; - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2600000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/Users/carlesfernandez/git/cttc/build/signal_out.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ibyte_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type = gr_complex; + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=11 +Channels_1B.count=0 +Channels.in_acquisition=1 + +;#signal: +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C +Channel8.signal=1C +Channel9.signal=1C +Channel10.signal=1C +Channel11.signal=1C +Channel12.signal=1C +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=6000 +Acquisition_1C.doppler_step=100 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=1.5; +Tracking_1C.order=3; + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Hybrid_gr_complex.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf similarity index 96% rename from conf/gnss-sdr_Hybrid_gr_complex.conf rename to conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf index b375cec21..ad5cf520e 100644 --- a/conf/gnss-sdr_Hybrid_gr_complex.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf @@ -1,131 +1,131 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4092000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/sim/GPS_sim1.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=4092000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=1 -Channels_1B.count=0 -Channels.in_acquisition=1 - -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=100 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=10 -Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=25; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.fll_bw_hz=10.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10; -PVT.display_rate_ms=500; -PVT.dump=false -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4092000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/sim/GPS_sim1.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=4092000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=1 +Channels_1B.count=0 +Channels.in_acquisition=1 + +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=100 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=10 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=25; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.fll_bw_hz=10.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10; +PVT.display_rate_ms=500; +PVT.dump=false +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Hybrid_ishort.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf similarity index 97% rename from conf/gnss-sdr_Hybrid_ishort.conf rename to conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf index 3931754e0..1950ff6d0 100644 --- a/conf/gnss-sdr_Hybrid_ishort.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf @@ -1,161 +1,161 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=5 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "5X" GALILEO E5a I+Q -Channel0.signal=1B -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008; 0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.cboc=false; -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=50.0; -Tracking_1C.dll_bw_hz=5.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of Galileo ephemeris messages. 0 mutes this message -PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of GPS ephemeris messages. 0 mutes this message -PVT.rtcm_MT1097_rate_ms=1000 ; Period (in ms) of Galileo observables. 0 mutes this message -PVT.rtcm_MT1077_rate_ms=1000 ; Period (in ms) of GPS observables. 0 mutes this message -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=5 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "5X" GALILEO E5a I+Q +Channel0.signal=1B +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000008; 0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.cboc=false; +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=50.0; +Tracking_1C.dll_bw_hz=5.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of Galileo ephemeris messages. 0 mutes this message +PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of GPS ephemeris messages. 0 mutes this message +PVT.rtcm_MT1097_rate_ms=1000 ; Period (in ms) of Galileo observables. 0 mutes this message +PVT.rtcm_MT1077_rate_ms=1000 ; Period (in ms) of GPS observables. 0 mutes this message +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_labsat_kf.conf b/conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf similarity index 97% rename from conf/gnss-sdr_labsat_kf.conf rename to conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf index 31787abab..0e906aca7 100644 --- a/conf/gnss-sdr_labsat_kf.conf +++ b/conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf @@ -1,185 +1,185 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=5456000 -GNSS-SDR.use_acquisition_resampler=true - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Labsat_Signal_Source -SignalSource.selected_channel=1 -;#filename: path to file with the captured GNSS signal samples to be processed -;# Labsat sile source automatically increments the file name when the signal is split in several files -;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on -;# in this example, the first file complete path will be ../signals/GPS_025_ -SignalSource.filename=/home/javier/signals/satgen_30mins/output/output -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=16368000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=./out.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=/media/javier/WDNASNTFS/output_5.456Msps_gr_complex.dat - -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -InputFilter.filter_type=lowpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=16368000 -InputFilter.IF=0 -InputFilter.decimation_factor=3 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels_1B.count=0 -Channels_L5.count=0 -Channels_5X.count=0 - -Channels.in_acquisition=1 - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=3.0 -Acquisition_1C.use_CFAR_algorithm=false -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=125 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.8 -Acquisition_1B.use_CFAR_algorithm=false -Acquisition_1B.blocking=false -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_KF_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=true -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.extend_correlation_symbols=20; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.early_late_space_narrow_chips=0.15 - -;Tracking_1C.code_disc_sd_chips=0.2; // Initial R -;Tracking_1C.carrier_disc_sd_rads=0.3; // Initial R - -;Tracking_1C.init_code_phase_sd_chips=0.5; // Initial P_0_0 -;Tracking_1C.init_carrier_phase_sd_rad=0.7; -;Tracking_1C.init_carrier_freq_sd_hz=5; -;Tracking_1C.init_carrier_freq_rate_sd_hz_s=1; - -;Tracking_1C.code_phase_sd_chips=0.15; // Initial Q -;Tracking_1C.carrier_phase_sd_rad=0.25; -;Tracking_1C.carrier_freq_sd_hz=0.6; -;Tracking_1C.carrier_freq_rate_sd_hz_s=0.01; - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=0.75; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.5; -Tracking_1B.early_late_space_narrow_chips=0.10; -Tracking_1B.very_early_late_space_narrow_chips=0.5; -Tracking_1B.pll_bw_narrow_hz=2.5 -Tracking_1B.dll_bw_narrow_hz=0.2 -Tracking_1B.extend_correlation_symbols=5 -Tracking_1B.track_pilot=true -Tracking_1B.enable_fll_pull_in=true; -;Tracking_1B.pull_in_time_s=60 -Tracking_1B.enable_fll_steady_state=false -Tracking_1B.fll_bw_hz=10 -Tracking_1B.dump=false -Tracking_1B.dump_filename=tracking_ch_ - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat -Observables.enable_carrier_smoothing=false -Observables.smoothing_factor=200 - - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.enable_rx_clock_correction=false -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=1000; -PVT.rinexobs_rate_ms=1000; -PVT.display_rate_ms=1000; -PVT.elevation_mask=15; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT -PVT.enable_monitor=false -PVT.monitor_udp_port=1337 -PVT.monitor_client_addresses=127.0.0.1 - -;######### MONITOR CONFIG ############ -Monitor.enable_monitor=false -Monitor.decimation_factor=1 -Monitor.client_addresses=127.0.0.1 -Monitor.udp_port=1234 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=5456000 +GNSS-SDR.use_acquisition_resampler=true + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Labsat_Signal_Source +SignalSource.selected_channel=1 +;#filename: path to file with the captured GNSS signal samples to be processed +;# Labsat sile source automatically increments the file name when the signal is split in several files +;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on +;# in this example, the first file complete path will be ../signals/GPS_025_ +SignalSource.filename=/home/javier/signals/satgen_30mins/output/output +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=16368000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./out.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=/media/javier/WDNASNTFS/output_5.456Msps_gr_complex.dat + +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +InputFilter.filter_type=lowpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=16368000 +InputFilter.IF=0 +InputFilter.decimation_factor=3 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels_1B.count=0 +Channels_L5.count=0 +Channels_5X.count=0 + +Channels.in_acquisition=1 + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=3.0 +Acquisition_1C.use_CFAR_algorithm=false +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=125 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.8 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_KF_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=true +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.extend_correlation_symbols=20; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.15 + +;Tracking_1C.code_disc_sd_chips=0.2; // Initial R +;Tracking_1C.carrier_disc_sd_rads=0.3; // Initial R + +;Tracking_1C.init_code_phase_sd_chips=0.5; // Initial P_0_0 +;Tracking_1C.init_carrier_phase_sd_rad=0.7; +;Tracking_1C.init_carrier_freq_sd_hz=5; +;Tracking_1C.init_carrier_freq_rate_sd_hz_s=1; + +;Tracking_1C.code_phase_sd_chips=0.15; // Initial Q +;Tracking_1C.carrier_phase_sd_rad=0.25; +;Tracking_1C.carrier_freq_sd_hz=0.6; +;Tracking_1C.carrier_freq_rate_sd_hz_s=0.01; + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.early_late_space_narrow_chips=0.10; +Tracking_1B.very_early_late_space_narrow_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=2.5 +Tracking_1B.dll_bw_narrow_hz=0.2 +Tracking_1B.extend_correlation_symbols=5 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +;Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat +Observables.enable_carrier_smoothing=false +Observables.smoothing_factor=200 + + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.enable_rx_clock_correction=false +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=1000; +PVT.rinexobs_rate_ms=1000; +PVT.display_rate_ms=1000; +PVT.elevation_mask=15; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT +PVT.enable_monitor=false +PVT.monitor_udp_port=1337 +PVT.monitor_client_addresses=127.0.0.1 + +;######### MONITOR CONFIG ############ +Monitor.enable_monitor=false +Monitor.decimation_factor=1 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1234 diff --git a/conf/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf similarity index 96% rename from conf/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf rename to conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf index a9ec9e564..d9ebe3069 100644 --- a/conf/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf @@ -1,385 +1,385 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 -GNSS-SDR.Galileo_banned_prns=14,18 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=3 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.IF=0 -InputFilter0.decimation_factor=4 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.IF=0 -InputFilter1.decimation_factor=4 - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - - -;###################################################### -;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Freq_Xlating_Fir_Filter -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter_ch2.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex -InputFilter2.taps_item_type=float -InputFilter2.number_of_taps=5 -InputFilter2.number_of_bands=2 -InputFilter2.band1_begin=0.0 -InputFilter2.band1_end=0.45 -InputFilter2.band2_begin=0.55 -InputFilter2.band2_end=1.0 -InputFilter2.ampl1_begin=1.0 -InputFilter2.ampl1_end=1.0 -InputFilter2.ampl2_begin=0.0 -InputFilter2.ampl2_end=0.0 -InputFilter2.band1_error=1.0 -InputFilter2.band2_error=1.0 -InputFilter2.filter_type=bandpass -InputFilter2.grid_density=16 -InputFilter2.IF=0 -InputFilter2.decimation_factor=8 - - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=10 -Channels_2S.count=10 -Channels_5X.count=2 -Channels_L5.count=2 - -;#GPS.prns=7,8 -;Channels.in_acquisition=2 - -;# CHANNEL CONNECTION - -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 -Channel16.RF_channel_ID=1 -Channel17.RF_channel_ID=1 -Channel18.RF_channel_ID=1 -Channel19.RF_channel_ID=1 -Channel20.RF_channel_ID=0 -Channel21.RF_channel_ID=0 -Channel22.RF_channel_ID=0 -Channel23.RF_channel_ID=0 -Channel24.RF_channel_ID=0 -Channel25.RF_channel_ID=0 -Channel26.RF_channel_ID=0 -Channel27.RF_channel_ID=0 -Channel28.RF_channel_ID=0 -Channel29.RF_channel_ID=0 -Channel30.RF_channel_ID=2 -Channel31.RF_channel_ID=2 -Channel32.RF_channel_ID=2 -Channel33.RF_channel_ID=2 -Channel34.RF_channel_ID=2 -Channel35.RF_channel_ID=2 -Channel36.RF_channel_ID=2 -Channel37.RF_channel_ID=2 -Channel38.RF_channel_ID=2 -Channel39.RF_channel_ID=2 -Channel40.RF_channel_ID=2 -Channel41.RF_channel_ID=2 -Channel42.RF_channel_ID=2 - -;Channel20.satellite=7 - - -;# GPS L1 CA -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;# Galileo E1 -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump_filename=./acq_dump.dat - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;# GALILEO E5a -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.threshold=0.009 -Acquisition_5X.doppler_max=5000 -Acquisition_5X.doppler_step=125 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.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 -Acquisition_5X.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. -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;# GPS L5 -Acquisition_L5.implementation=GPS_L5i_PCPS_Acquisition -Acquisition_L5.item_type=gr_complex -Acquisition_L5.pfa=0.01 -;Acquisition_L5.pfa=0.001 -Acquisition_L5.doppler_max=5000 -Acquisition_L5.doppler_min=-5000 -Acquisition_L5.doppler_step=125 -Acquisition_L5.max_dwells=1 -Acquisition_L5.dump=false -Acquisition_L5.dump_filename=./acq_dump.dat - - - -;######### TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - -;######### GALILEO E1 TRK CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=false -Tracking_2S.dump_filename=./tracking_ch_ - -;######### GALILEO E5 TRK CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.track_pilot=true -Tracking_5X.pll_bw_hz=15.0; -Tracking_5X.dll_bw_hz=2.0; -Tracking_5X.pll_bw_narrow_hz=5.0; -Tracking_5X.dll_bw_narrow_hz=1.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - -;######### GALILEO E5 TRK CONFIG ############ -Tracking_L5.implementation=GPS_L5_DLL_PLL_Tracking -Tracking_L5.item_type=gr_complex -Tracking_L5.track_pilot=true -Tracking_L5.pll_bw_hz=15.0; -Tracking_L5.dll_bw_hz=2.0; -Tracking_L5.pll_bw_narrow_hz=4.0; -Tracking_L5.dll_bw_narrow_hz=1.0; -Tracking_L5.order=2; -Tracking_L5.early_late_space_chips=0.5; -Tracking_L5.dump=false -Tracking_L5.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - -TelemetryDecoder_L5.implementation=GPS_L5_Telemetry_Decoder -TelemetryDecoder_L5.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 +GNSS-SDR.Galileo_banned_prns=14,18 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=3 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.IF=0 +InputFilter0.decimation_factor=4 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.IF=0 +InputFilter1.decimation_factor=4 + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + + +;###################################################### +;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Freq_Xlating_Fir_Filter +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter_ch2.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex +InputFilter2.taps_item_type=float +InputFilter2.number_of_taps=5 +InputFilter2.number_of_bands=2 +InputFilter2.band1_begin=0.0 +InputFilter2.band1_end=0.45 +InputFilter2.band2_begin=0.55 +InputFilter2.band2_end=1.0 +InputFilter2.ampl1_begin=1.0 +InputFilter2.ampl1_end=1.0 +InputFilter2.ampl2_begin=0.0 +InputFilter2.ampl2_end=0.0 +InputFilter2.band1_error=1.0 +InputFilter2.band2_error=1.0 +InputFilter2.filter_type=bandpass +InputFilter2.grid_density=16 +InputFilter2.IF=0 +InputFilter2.decimation_factor=8 + + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=10 +Channels_2S.count=10 +Channels_5X.count=2 +Channels_L5.count=2 + +;#GPS.prns=7,8 +;Channels.in_acquisition=2 + +;# CHANNEL CONNECTION + +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 +Channel16.RF_channel_ID=1 +Channel17.RF_channel_ID=1 +Channel18.RF_channel_ID=1 +Channel19.RF_channel_ID=1 +Channel20.RF_channel_ID=0 +Channel21.RF_channel_ID=0 +Channel22.RF_channel_ID=0 +Channel23.RF_channel_ID=0 +Channel24.RF_channel_ID=0 +Channel25.RF_channel_ID=0 +Channel26.RF_channel_ID=0 +Channel27.RF_channel_ID=0 +Channel28.RF_channel_ID=0 +Channel29.RF_channel_ID=0 +Channel30.RF_channel_ID=2 +Channel31.RF_channel_ID=2 +Channel32.RF_channel_ID=2 +Channel33.RF_channel_ID=2 +Channel34.RF_channel_ID=2 +Channel35.RF_channel_ID=2 +Channel36.RF_channel_ID=2 +Channel37.RF_channel_ID=2 +Channel38.RF_channel_ID=2 +Channel39.RF_channel_ID=2 +Channel40.RF_channel_ID=2 +Channel41.RF_channel_ID=2 +Channel42.RF_channel_ID=2 + +;Channel20.satellite=7 + + +;# GPS L1 CA +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;# Galileo E1 +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump_filename=./acq_dump.dat + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;# GALILEO E5a +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.threshold=0.009 +Acquisition_5X.doppler_max=5000 +Acquisition_5X.doppler_step=125 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.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 +Acquisition_5X.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. +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;# GPS L5 +Acquisition_L5.implementation=GPS_L5i_PCPS_Acquisition +Acquisition_L5.item_type=gr_complex +Acquisition_L5.pfa=0.01 +;Acquisition_L5.pfa=0.001 +Acquisition_L5.doppler_max=5000 +Acquisition_L5.doppler_min=-5000 +Acquisition_L5.doppler_step=125 +Acquisition_L5.max_dwells=1 +Acquisition_L5.dump=false +Acquisition_L5.dump_filename=./acq_dump.dat + + + +;######### TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + +;######### GALILEO E1 TRK CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=false +Tracking_2S.dump_filename=./tracking_ch_ + +;######### GALILEO E5 TRK CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.track_pilot=true +Tracking_5X.pll_bw_hz=15.0; +Tracking_5X.dll_bw_hz=2.0; +Tracking_5X.pll_bw_narrow_hz=5.0; +Tracking_5X.dll_bw_narrow_hz=1.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + +;######### GALILEO E5 TRK CONFIG ############ +Tracking_L5.implementation=GPS_L5_DLL_PLL_Tracking +Tracking_L5.item_type=gr_complex +Tracking_L5.track_pilot=true +Tracking_L5.pll_bw_hz=15.0; +Tracking_L5.dll_bw_hz=2.0; +Tracking_L5.pll_bw_narrow_hz=4.0; +Tracking_L5.dll_bw_narrow_hz=1.0; +Tracking_L5.order=2; +Tracking_L5.early_late_space_chips=0.5; +Tracking_L5.dump=false +Tracking_L5.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + +TelemetryDecoder_L5.implementation=GPS_L5_Telemetry_Decoder +TelemetryDecoder_L5.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multisource_Hybrid_ishort.conf b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf similarity index 96% rename from conf/gnss-sdr_multisource_Hybrid_ishort.conf rename to conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf index 5838a3b88..5839e4483 100644 --- a/conf/gnss-sdr_multisource_Hybrid_ishort.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf @@ -1,169 +1,169 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - -GNSS-SDR.num_sources=2 - -SignalSource.enable_throttle_control=false -SignalSource.repeat=false - - -;######### SIGNAL_SOURCE 0 CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ishort -SignalSource0.sampling_frequency=4000000 -SignalSource0.samples=0 - - -;######### SIGNAL_SOURCE 1 CONFIG ############ -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ishort -SignalSource1.sampling_frequency=4000000 -SignalSource1.freq=1575420000 -SignalSource1.samples=0 - - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Ishort_To_Complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Pass_Through -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex - - - -;######### RESAMPLER 1 CONFIG ############ -Resampler1.implementation=Pass_Through -Resampler1.dump=false -Resampler1.dump_filename=../data/resampler.dat -Resampler1.item_type=gr_complex -Resampler1.sample_freq_in=4000000 -Resampler1.sample_freq_out=4000000 - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Ishort_To_Complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false - - -;######### RESAMPLER 1 CONFIG ############ -Resampler1.implementation=Pass_Through -Resampler1.dump=false -Resampler1.dump_filename=../data/resampler.dat. -Resampler1.item_type=gr_complex -Resampler1.sample_freq_in=4000000 -Resampler1.sample_freq_out=4000000 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=2 -Channels_1B.count=2 -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=1 -Channel3.RF_channel_ID=1 -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump_filename=./PVT -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + +GNSS-SDR.num_sources=2 + +SignalSource.enable_throttle_control=false +SignalSource.repeat=false + + +;######### SIGNAL_SOURCE 0 CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ishort +SignalSource0.sampling_frequency=4000000 +SignalSource0.samples=0 + + +;######### SIGNAL_SOURCE 1 CONFIG ############ +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ishort +SignalSource1.sampling_frequency=4000000 +SignalSource1.freq=1575420000 +SignalSource1.samples=0 + + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Ishort_To_Complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Pass_Through +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex + + + +;######### RESAMPLER 1 CONFIG ############ +Resampler1.implementation=Pass_Through +Resampler1.dump=false +Resampler1.dump_filename=../data/resampler.dat +Resampler1.item_type=gr_complex +Resampler1.sample_freq_in=4000000 +Resampler1.sample_freq_out=4000000 + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Ishort_To_Complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false + + +;######### RESAMPLER 1 CONFIG ############ +Resampler1.implementation=Pass_Through +Resampler1.dump=false +Resampler1.dump_filename=../data/resampler.dat. +Resampler1.item_type=gr_complex +Resampler1.sample_freq_in=4000000 +Resampler1.sample_freq_out=4000000 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=2 +Channels_1B.count=2 +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=1 +Channel3.RF_channel_ID=1 +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump_filename=./PVT +PVT.dump=false diff --git a/conf/gnss-sdr_multisource_Hybrid_nsr.conf b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf similarity index 96% rename from conf/gnss-sdr_multisource_Hybrid_nsr.conf rename to conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf index c5c5e9134..a6a1a0ea2 100644 --- a/conf/gnss-sdr_multisource_Hybrid_nsr.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf @@ -1,231 +1,231 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -GNSS-SDR.num_sources=2 - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;GNSS-SDR.internal_fs_sps=6826700 -GNSS-SDR.internal_fs_sps=2560000 -;GNSS-SDR.internal_fs_sps=4096000 -;GNSS-SDR.internal_fs_sps=5120000 - -SignalSource.enable_throttle_control=false -SignalSource.repeat=false - - -;######### SIGNAL_SOURCE 0 CONFIG ############ -SignalSource0.implementation=Nsr_File_Signal_Source -SignalSource0.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource0.item_type=byte -SignalSource0.sampling_frequency=20480000 -SignalSource0.samples=0 - - -;######### SIGNAL_SOURCE 1 CONFIG ############ -SignalSource1.implementation=Nsr_File_Signal_Source -SignalSource1.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream -SignalSource1.item_type=byte -SignalSource1.sampling_frequency=20480000 -SignalSource1.samples=0 - - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=float - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=float -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20480000 -InputFilter0.IF=5499998.47412109 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=float - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=float -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20480000 -InputFilter1.IF=5499998.47412109 -InputFilter1.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=8 -Channels.in_acquisition=1 - -;# SOURCE CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 - -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.scoherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +GNSS-SDR.num_sources=2 + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;GNSS-SDR.internal_fs_sps=6826700 +GNSS-SDR.internal_fs_sps=2560000 +;GNSS-SDR.internal_fs_sps=4096000 +;GNSS-SDR.internal_fs_sps=5120000 + +SignalSource.enable_throttle_control=false +SignalSource.repeat=false + + +;######### SIGNAL_SOURCE 0 CONFIG ############ +SignalSource0.implementation=Nsr_File_Signal_Source +SignalSource0.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource0.item_type=byte +SignalSource0.sampling_frequency=20480000 +SignalSource0.samples=0 + + +;######### SIGNAL_SOURCE 1 CONFIG ############ +SignalSource1.implementation=Nsr_File_Signal_Source +SignalSource1.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream +SignalSource1.item_type=byte +SignalSource1.sampling_frequency=20480000 +SignalSource1.samples=0 + + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=float + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=float +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20480000 +InputFilter0.IF=5499998.47412109 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=float + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=float +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20480000 +InputFilter1.IF=5499998.47412109 +InputFilter1.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_1B.count=8 +Channels.in_acquisition=1 + +;# SOURCE CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.scoherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_nsr.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_nsr.conf rename to conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf index d0682aa30..bde11e2a2 100644 --- a/conf/gnss-sdr_GPS_L1_nsr.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf @@ -1,164 +1,164 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Sample configuration file for IFEN SX-NSR software receiver front-end -; https://www.ifen.com/products/sx3-gnss-software-receiver/ -; This sample configuration is able to process directly .sream binary files -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2560000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/home/javier/Descargas/RoofTop_FE0_Band1.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -#InputFilter.IF=5499998.47412109 -InputFilter.IF=5679999.2370605494 -InputFilter.decimation_factor=8 - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_2S.count=8 -Channels.in_acquisition=1 - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.scoherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.coherent_integration_time_ms=20 -Acquisition_2S.pfa=0.01 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_step=100 -Acquisition_2S.bit_transition_flag=false -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.4; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Sample configuration file for IFEN SX-NSR software receiver front-end +; https://www.ifen.com/products/sx3-gnss-software-receiver/ +; This sample configuration is able to process directly .sream binary files +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2560000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Nsr_File_Signal_Source +SignalSource.filename=/home/javier/Descargas/RoofTop_FE0_Band1.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +#InputFilter.IF=5499998.47412109 +InputFilter.IF=5679999.2370605494 +InputFilter.decimation_factor=8 + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_2S.count=8 +Channels.in_acquisition=1 + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.scoherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.coherent_integration_time_ms=20 +Acquisition_2S.pfa=0.01 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_step=100 +Acquisition_2S.bit_transition_flag=false +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.4; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/gnss-sdr_GPS_L1_nsr_gauss.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_nsr_gauss.conf rename to conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf index a127a5870..5b9358268 100644 --- a/conf/gnss-sdr_GPS_L1_nsr_gauss.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf @@ -1,207 +1,207 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;GNSS-SDR.internal_fs_sps=6826700 -GNSS-SDR.internal_fs_sps=2560000 -;GNSS-SDR.internal_fs_sps=4096000 -;GNSS-SDR.internal_fs_sps=5120000 - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation: Use [File_Signal_Source] [Nsr_File_Signal_Source] or [UHD_Signal_Source] -SignalSource.implementation=Nsr_File_Signal_Source - -;#filename: path to file with the captured GNSS signal samples to be processed -SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE - -;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. -SignalSource.item_type=byte - -;#sampling_frequency: Original Signal sampling frequency in [Hz] -SignalSource.sampling_frequency=20480000 - -;#freq: RF front-end center frequency in [Hz] -SignalSource.freq=1575420000 - -;#samples: Number of samples to be processed. Notice that 0 indicates the entire file. -SignalSource.samples=0 - -;#repeat: Repeat the processing file. Disable this option in this version -SignalSource.repeat=false - -;#dump: Dump the Signal source data to a file. Disable this option in this version -SignalSource.dump=false - -SignalSource.dump_filename=../data/signal_source.dat - - -;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. -; it helps to not overload the CPU, but the processing time will be longer. -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -;## It holds blocks to change data type, filter and resample input data. - -;#implementation: Use [Pass_Through] or [Signal_Conditioner] -;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks -;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -;## Changes the type of input data. -;#implementation: [Pass_Through] disables this block -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -;## Filter the input data. Can be combined with frequency translation for IF signals - -;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter] -;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation -;# that shifts IF down to zero Hz. - -InputFilter.implementation=Freq_Xlating_Fir_Filter - -;#dump: Dump the filtered data to a file. -InputFilter.dump=false - -;#dump_filename: Log path and filename. -InputFilter.dump_filename=../data/input_filter.dat - -;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. -;#These options are based on parameters of gnuradio's function: gr_remez. -;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse -;#reponse given a set of band edges, the desired reponse on those bands, -;#and the weight given to the error in those bands. - -;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. -InputFilter.input_item_type=float - -;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version. -InputFilter.output_item_type=gr_complex - -;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version. -InputFilter.taps_item_type=float - -;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time -InputFilter.number_of_taps=5 - -;#number_of _bands: Number of frequency bands in the filter. -InputFilter.number_of_bands=2 - -;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]. -;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2) -;#The number of band_begin and band_end elements must match the number of bands - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]. -;#The number of ampl_begin and ampl_end elements must match the number of bands - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -;#band_error: weighting applied to each band (usually 1). -;#The number of band_error elements must match the number of bands -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -;#filter_type: one of "bandpass", "hilbert" or "differentiator" -InputFilter.filter_type=bandpass - -;#grid_density: determines how accurately the filter will be constructed. -;The minimum value is 16; higher values are slower to compute the filter. -InputFilter.grid_density=16 - -;# Original sampling frequency stored in the signal file -InputFilter.sampling_frequency=20480000 - -;#The following options are used only in Freq_Xlating_Fir_Filter implementation. -;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz - -InputFilter.IF=5499998.47412109 - -;# Decimation factor after the frequency tranaslating block -InputFilter.decimation_factor=8 - - -;######### RESAMPLER CONFIG ############ -;## Resamples the input data. - -;#implementation: Use [Pass_Through] or [Direct_Resampler] -;#[Pass_Through] disables this block -;#[Direct_Resampler] enables a resampler that implements a nearest neighbourhood interpolation -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -;#count: Number of available GPS satellite channels. -Channels_1C.count=8 -Channels.in_acquisition=1 -#Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat -Acquisition_1C.item_type=gr_complex -Acquisition_1C.if=0 -Acquisition_1C.sampled_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=100 - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.if=0 -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ -Tracking_1C.pll_bw_hz=15.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false -TelemetryDecoder_1C.decimation_factor=1; - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables - -;#dump: Enable or disable the Observables internal binary data file logging [true] or [false] -Observables.dump=false - -;#dump_filename: Log path and filename. -Observables.dump_filename=./observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;GNSS-SDR.internal_fs_sps=6826700 +GNSS-SDR.internal_fs_sps=2560000 +;GNSS-SDR.internal_fs_sps=4096000 +;GNSS-SDR.internal_fs_sps=5120000 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation: Use [File_Signal_Source] [Nsr_File_Signal_Source] or [UHD_Signal_Source] +SignalSource.implementation=Nsr_File_Signal_Source + +;#filename: path to file with the captured GNSS signal samples to be processed +SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE + +;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. +SignalSource.item_type=byte + +;#sampling_frequency: Original Signal sampling frequency in [Hz] +SignalSource.sampling_frequency=20480000 + +;#freq: RF front-end center frequency in [Hz] +SignalSource.freq=1575420000 + +;#samples: Number of samples to be processed. Notice that 0 indicates the entire file. +SignalSource.samples=0 + +;#repeat: Repeat the processing file. Disable this option in this version +SignalSource.repeat=false + +;#dump: Dump the Signal source data to a file. Disable this option in this version +SignalSource.dump=false + +SignalSource.dump_filename=../data/signal_source.dat + + +;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. +; it helps to not overload the CPU, but the processing time will be longer. +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +;## It holds blocks to change data type, filter and resample input data. + +;#implementation: Use [Pass_Through] or [Signal_Conditioner] +;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks +;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +;## Changes the type of input data. +;#implementation: [Pass_Through] disables this block +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +;## Filter the input data. Can be combined with frequency translation for IF signals + +;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter] +;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation +;# that shifts IF down to zero Hz. + +InputFilter.implementation=Freq_Xlating_Fir_Filter + +;#dump: Dump the filtered data to a file. +InputFilter.dump=false + +;#dump_filename: Log path and filename. +InputFilter.dump_filename=../data/input_filter.dat + +;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. +;#These options are based on parameters of gnuradio's function: gr_remez. +;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse +;#reponse given a set of band edges, the desired reponse on those bands, +;#and the weight given to the error in those bands. + +;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. +InputFilter.input_item_type=float + +;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version. +InputFilter.output_item_type=gr_complex + +;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version. +InputFilter.taps_item_type=float + +;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time +InputFilter.number_of_taps=5 + +;#number_of _bands: Number of frequency bands in the filter. +InputFilter.number_of_bands=2 + +;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]. +;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2) +;#The number of band_begin and band_end elements must match the number of bands + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]. +;#The number of ampl_begin and ampl_end elements must match the number of bands + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +;#band_error: weighting applied to each band (usually 1). +;#The number of band_error elements must match the number of bands +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +;#filter_type: one of "bandpass", "hilbert" or "differentiator" +InputFilter.filter_type=bandpass + +;#grid_density: determines how accurately the filter will be constructed. +;The minimum value is 16; higher values are slower to compute the filter. +InputFilter.grid_density=16 + +;# Original sampling frequency stored in the signal file +InputFilter.sampling_frequency=20480000 + +;#The following options are used only in Freq_Xlating_Fir_Filter implementation. +;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz + +InputFilter.IF=5499998.47412109 + +;# Decimation factor after the frequency tranaslating block +InputFilter.decimation_factor=8 + + +;######### RESAMPLER CONFIG ############ +;## Resamples the input data. + +;#implementation: Use [Pass_Through] or [Direct_Resampler] +;#[Pass_Through] disables this block +;#[Direct_Resampler] enables a resampler that implements a nearest neighbourhood interpolation +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +;#count: Number of available GPS satellite channels. +Channels_1C.count=8 +Channels.in_acquisition=1 +#Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat +Acquisition_1C.item_type=gr_complex +Acquisition_1C.if=0 +Acquisition_1C.sampled_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=100 + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.if=0 +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.pll_bw_hz=15.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false +TelemetryDecoder_1C.decimation_factor=1; + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables + +;#dump: Enable or disable the Observables internal binary data file logging [true] or [false] +Observables.dump=false + +;#dump_filename: Log path and filename. +Observables.dump_filename=./observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/gnss-sdr_Hybrid_nsr.conf b/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf similarity index 96% rename from conf/gnss-sdr_Hybrid_nsr.conf rename to conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf index 91bbc1c69..7f5d30494 100644 --- a/conf/gnss-sdr_Hybrid_nsr.conf +++ b/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf @@ -1,176 +1,176 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2560000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -InputFilter.IF=5499998.47412109 -InputFilter.decimation_factor=8 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=10 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C -Channel8.signal=1C -Channel9.signal=1C -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B -Channel16.signal=1B -Channel17signal=1B -Channel18.signal=1B -Channel19.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=2.5 -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.5 -Acquisition_1B.blocking=true -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=250 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=1 -Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=30; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.5; -Tracking_1C.order=2; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10; -PVT.display_rate_ms=500; -PVT.elevation_mask=20; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2560000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Nsr_File_Signal_Source +SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +InputFilter.IF=5499998.47412109 +InputFilter.decimation_factor=8 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=10 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C +Channel8.signal=1C +Channel9.signal=1C +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B +Channel16.signal=1B +Channel17signal=1B +Channel18.signal=1B +Channel19.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=2.5 +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.blocking=true +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=250 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=1 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.order=2; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10; +PVT.display_rate_ms=500; +PVT.elevation_mask=20; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/front-end-cal.conf b/conf/Other/front-end-cal.conf similarity index 94% rename from conf/front-end-cal.conf rename to conf/Other/front-end-cal.conf index af2a06a2f..39510a009 100644 --- a/conf/front-end-cal.conf +++ b/conf/Other/front-end-cal.conf @@ -17,19 +17,23 @@ ;GNSS-SDR.init_altitude_m=329.11968943169342 ; Barcelona CTTC -GNSS-SDR.init_latitude_deg=41.27719585553101 -GNSS-SDR.init_longitude_deg=1.988782985790802 -GNSS-SDR.init_altitude_m=10 +;GNSS-SDR.init_latitude_deg=41.27719585553101 +;GNSS-SDR.init_longitude_deg=1.988782985790802 +;GNSS-SDR.init_altitude_m=10 ; Mozoncillo ;GNSS-SDR.init_latitude_deg=41.14534824586196 ;GNSS-SDR.init_longitude_deg=-4.187125019737464 ;GNSS-SDR.init_altitude_m=900 +; ICEBAR - Jukkasjarvi +GNSS-SDR.init_latitude_deg=67.849722 +GNSS-SDR.init_longitude_deg=20.594444 +GNSS-SDR.init_altitude_m=325 ;######### GLOBAL OPTIONS ################## ;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 +GNSS-SDR.internal_fs_sps=2048000 ;######### SUPL RRLP GPS assistance configuration ##### ; Check https://www.mcc-mnc.com/ @@ -40,10 +44,10 @@ GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com GNSS-SDR.SUPL_gps_ephemeris_port=7275 GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=217 -GNSS-SDR.SUPL_MNC=7 -GNSS-SDR.SUPL_LAC=861 -GNSS-SDR.SUPL_CI=40184 +GNSS-SDR.SUPL_MCC=240 +GNSS-SDR.SUPL_MNC=08 +GNSS-SDR.SUPL_LAC=46003 +GNSS-SDR.SUPL_CI=425950 ;######### SIGNAL_SOURCE CONFIG ############ SignalSource.implementation=Osmosdr_Signal_Source @@ -52,7 +56,7 @@ SignalSource.freq=1575420000 ;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. SignalSource.item_type=gr_complex ;#sampling_frequency: Original Signal sampling frequency in samples per second -SignalSource.sampling_frequency=2000000 +SignalSource.sampling_frequency=2048000 ;#gain: Front-end Gain in [dB] SignalSource.gain=40 SignalSource.rf_gain=40 @@ -200,3 +204,4 @@ Acquisition.max_dwells=15 Acquisition.dump=false ;#filename: Log path and filename Acquisition.dump_filename=./acq_dump.dat + diff --git a/conf/gnss-sdr_GPS_L1_2ch_udp.conf b/conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_2ch_udp.conf rename to conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf index c25dc85f9..281ef2f81 100644 --- a/conf/gnss-sdr_GPS_L1_2ch_udp.conf +++ b/conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf @@ -1,103 +1,103 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. -GNSS-SDR.internal_fs_sps=13250000 ;//66.25/5 -;GNSS-SDR.internal_fs_sps=6625000 ;//66.25/10 -;GNSS-SDR.internal_fs_sps=3312500 ;//66.25/20 -;GNSS-SDR.internal_fs_sps=2650000 ;//66.25/25 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Custom_UDP_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.origin_address=0.0.0.0 -SignalSource.capture_device=eth0 -SignalSource.port=1234 -SignalSource.payload_bytes=1472 -;SignalSource.sample_type=cbyte -SignalSource.sample_type=c4bits -SignalSource.IQ_swap=false -SignalSource.RF_channels=1 -SignalSource.channels_in_udp=2 -SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through -;SignalConditioner0.implementation=Pass_Through -;SignalConditioner1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 - -;# CHANNEL CONNECTION -Channel.signal=1C -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - -;Channel0.signal=1C -;Channel1.RF_channel_ID=1 -;Channel1.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=2.5 -Acquisition_1C.blocking=false -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. +GNSS-SDR.internal_fs_sps=13250000 ;//66.25/5 +;GNSS-SDR.internal_fs_sps=6625000 ;//66.25/10 +;GNSS-SDR.internal_fs_sps=3312500 ;//66.25/20 +;GNSS-SDR.internal_fs_sps=2650000 ;//66.25/25 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Custom_UDP_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.origin_address=0.0.0.0 +SignalSource.capture_device=eth0 +SignalSource.port=1234 +SignalSource.payload_bytes=1472 +;SignalSource.sample_type=cbyte +SignalSource.sample_type=c4bits +SignalSource.IQ_swap=false +SignalSource.RF_channels=1 +SignalSource.channels_in_udp=2 +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through +;SignalConditioner0.implementation=Pass_Through +;SignalConditioner1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel.signal=1C +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + +;Channel0.signal=1C +;Channel1.RF_channel_ID=1 +;Channel1.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=2.5 +Acquisition_1C.blocking=false +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_FPGA.conf b/conf/Other/gnss-sdr_GPS_L1_FPGA.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_FPGA.conf rename to conf/Other/gnss-sdr_GPS_L1_FPGA.conf index c873f60cc..271b27811 100644 --- a/conf/gnss-sdr_GPS_L1_FPGA.conf +++ b/conf/Other/gnss-sdr_GPS_L1_FPGA.conf @@ -1,72 +1,72 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=12500000 -GNSS-SDR.enable_FPGA=true - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Ad9361_Fpga_Signal_Source -SignalSource.sampling_frequency=12500000 -SignalSource.freq=1575420000 -SignalSource.switch_position=2 -SignalSource.gain_mode_rx1=slow_attack - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=1 -Channels_1C.count=12 - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fpga -Acquisition_1C.threshold=2.0 -Acquisition_1C.doppler_max=50000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.make_two_steps=true -Acquisition_1C.second_nbins=3 -Acquisition_1C.doppler_step2=250 -Acquisition_1C.max_num_acqs=100 - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_Fpga -Tracking_1C.extend_correlation_symbols=20 -Tracking_1C.pll_bw_hz=35; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.pll_bw_narrow_hz=5.0; -Tracking_1C.dll_bw_narrow_hz=0.50; -Tracking_1C.fll_bw_hz=10 -Tracking_1C.enable_fll_pull_in=true; -Tracking_1C.enable_fll_steady_state=false -Tracking_1C.high_dyn=true -Tracking_1C.dump=false -Tracking_1C.dump_filename=tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.iono_model=OFF -PVT.trop_model=OFF -PVT.raim_fde=1 -PVT.output_rate_ms=20; -PVT.display_rate_ms=500; -PVT.elevation_mask=0; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=12500000 +GNSS-SDR.enable_FPGA=true + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Ad9361_Fpga_Signal_Source +SignalSource.sampling_frequency=12500000 +SignalSource.freq=1575420000 +SignalSource.switch_position=2 +SignalSource.gain_mode_rx1=slow_attack + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_1C.count=12 + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fpga +Acquisition_1C.threshold=2.0 +Acquisition_1C.doppler_max=50000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.make_two_steps=true +Acquisition_1C.second_nbins=3 +Acquisition_1C.doppler_step2=250 +Acquisition_1C.max_num_acqs=100 + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_Fpga +Tracking_1C.extend_correlation_symbols=20 +Tracking_1C.pll_bw_hz=35; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.50; +Tracking_1C.fll_bw_hz=10 +Tracking_1C.enable_fll_pull_in=true; +Tracking_1C.enable_fll_steady_state=false +Tracking_1C.high_dyn=true +Tracking_1C.dump=false +Tracking_1C.dump_filename=tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.iono_model=OFF +PVT.trop_model=OFF +PVT.raim_fde=1 +PVT.output_rate_ms=20; +PVT.display_rate_ms=500; +PVT.elevation_mask=0; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_fifo.conf b/conf/Other/gnss-sdr_GPS_L1_fifo.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_fifo.conf rename to conf/Other/gnss-sdr_GPS_L1_fifo.conf index a339ffb35..a8bf9d4fb 100644 --- a/conf/gnss-sdr_GPS_L1_fifo.conf +++ b/conf/Other/gnss-sdr_GPS_L1_fifo.conf @@ -1,56 +1,56 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=25000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Fifo_Signal_Source -SignalSource.filename=fifo.fifo ; example usage: mkfifo fifo.fifo && cat path_to.bin >> fifo.fifo -SignalSource.sample_type=ishort; ; sample representation in fifo stream - will always output gr_complex -SignalSource.dump=false -;SignalSource.dump_filename=dump - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.iono_model=Broadcast -PVT.trop_model=Saastamoinen -PVT.output_path=./files +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=25000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fifo_Signal_Source +SignalSource.filename=fifo.fifo ; example usage: mkfifo fifo.fifo && cat path_to.bin >> fifo.fifo +SignalSource.sample_type=ishort; ; sample representation in fifo stream - will always output gr_complex +SignalSource.dump=false +;SignalSource.dump_filename=dump + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.iono_model=Broadcast +PVT.trop_model=Saastamoinen +PVT.output_path=./files diff --git a/conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf b/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf rename to conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf index c1b99441b..67466b929 100644 --- a/conf/gnss-sdr_GPS_L1_gr_complex_gpu.conf +++ b/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf @@ -1,85 +1,85 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/Agilent/New York/4msps.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.samples=250000000 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.005 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_GPU -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/Agilent/New York/4msps.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.samples=250000000 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.005 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_GPU +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_monitor.conf b/conf/Other/gnss-sdr_GPS_L1_monitor.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_monitor.conf rename to conf/Other/gnss-sdr_GPS_L1_monitor.conf index a24a4fc9b..fddce6450 100644 --- a/conf/gnss-sdr_GPS_L1_monitor.conf +++ b/conf/Other/gnss-sdr_GPS_L1_monitor.conf @@ -1,89 +1,89 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/tmp/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.samples=0 -SignalSource.enable_throttle_control=true - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=2000000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=3 -Channels.in_acquisition=1 -Channel.signal=1C -Channel0.satellite=1 -Channel1.satellite=11 -Channel2.satellite=17 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.008 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.enable_monitor=true -PVT.monitor_client_addresses=127.0.0.1 -PVT.monitor_udp_port=1234 - -;######### MONITOR CONFIG ############ -Monitor.enable_monitor=true -Monitor.decimation_factor=1 -Monitor.client_addresses=127.0.0.1 -Monitor.udp_port=1233 - -;######### ACQUISITION MONITOR CONFIG ############ -AcquisitionMonitor.enable_monitor=true -AcquisitionMonitor.decimation_factor=1 -AcquisitionMonitor.client_addresses=127.0.0.1 -AcquisitionMonitor.udp_port=1231 - -;######### TRACKING MONITOR CONFIG ############ -TrackingMonitor.enable_monitor=true -TrackingMonitor.decimation_factor=1 -TrackingMonitor.client_addresses=127.0.0.1 -TrackingMonitor.udp_port=1232 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=2000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/tmp/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.samples=0 +SignalSource.enable_throttle_control=true + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=3 +Channels.in_acquisition=1 +Channel.signal=1C +Channel0.satellite=1 +Channel1.satellite=11 +Channel2.satellite=17 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.008 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.enable_monitor=true +PVT.monitor_client_addresses=127.0.0.1 +PVT.monitor_udp_port=1234 + +;######### MONITOR CONFIG ############ +Monitor.enable_monitor=true +Monitor.decimation_factor=1 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1233 + +;######### ACQUISITION MONITOR CONFIG ############ +AcquisitionMonitor.enable_monitor=true +AcquisitionMonitor.decimation_factor=1 +AcquisitionMonitor.client_addresses=127.0.0.1 +AcquisitionMonitor.udp_port=1231 + +;######### TRACKING MONITOR CONFIG ############ +TrackingMonitor.enable_monitor=true +TrackingMonitor.decimation_factor=1 +TrackingMonitor.client_addresses=127.0.0.1 +TrackingMonitor.udp_port=1232 diff --git a/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf rename to conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf index 01209aefb..30d080c51 100644 --- a/conf/gnss-sdr_GPS_L1_nsr_twobit_packed.conf +++ b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf @@ -1,154 +1,154 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Sample configuration file for IFEN SX-NSR software receiver front-end -; https://www.ifen.com/products/sx3-gnss-software-receiver/ -; This sample configuration is able to process directly .sream binary files -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2560000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Two_Bit_Packed_File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -; big_endian_items : not needed for byte inputs -; If the input were 'short' then this can either be big endian or little -; endian. If it is big endian then the second byte should be output -; first in each short. -; SignalSource.big_endian_items=false -; big_endian_bytes: true if the most signficiant two bits in the byte -; are the first two to be output. -SignalSource.big_endian_bytes=false -; sample_type: one of 'real' 'iq' or 'qi' -; Data is either real or complex. -; if the data is complex there are two conventions for sample ordering: -; 1) Real first : 'iq' -; 2) Imaginary first: 'qi' -; This setting specifies which of the three cases holds for this data file -SignalSource.sample_type=real -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -InputFilter.IF=5499998.47412109 -InputFilter.decimation_factor=8 - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.sampled_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Sample configuration file for IFEN SX-NSR software receiver front-end +; https://www.ifen.com/products/sx3-gnss-software-receiver/ +; This sample configuration is able to process directly .sream binary files +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2560000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Two_Bit_Packed_File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +; big_endian_items : not needed for byte inputs +; If the input were 'short' then this can either be big endian or little +; endian. If it is big endian then the second byte should be output +; first in each short. +; SignalSource.big_endian_items=false +; big_endian_bytes: true if the most signficiant two bits in the byte +; are the first two to be output. +SignalSource.big_endian_bytes=false +; sample_type: one of 'real' 'iq' or 'qi' +; Data is either real or complex. +; if the data is complex there are two conventions for sample ordering: +; 1) Real first : 'iq' +; 2) Imaginary first: 'qi' +; This setting specifies which of the three cases holds for this data file +SignalSource.sample_type=real +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +InputFilter.IF=5499998.47412109 +InputFilter.decimation_factor=8 + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.sampled_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf b/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf rename to conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf index b0d592f84..d9c8918c5 100644 --- a/conf/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf +++ b/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf @@ -1,111 +1,111 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SUPL RRLP GPS assistance configuration ##### -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/javier/signals/signal_source_int.dat -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=dump.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pulse_Blanking_Filter -InputFilter.Pfa=0.001 -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=8 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=10 -Tracking_1C.pll_bw_hz=35; -Tracking_1C.pll_bw_narrow_hz=30; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.5; -Tracking_1C.fll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=1 -PVT.display_rate_ms=100 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SUPL RRLP GPS assistance configuration ##### +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/home/javier/signals/signal_source_int.dat +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=dump.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pulse_Blanking_Filter +InputFilter.Pfa=0.001 +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=8 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=10 +Tracking_1C.pll_bw_hz=35; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.fll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=1 +PVT.display_rate_ms=100 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_two_bits_cpx.conf b/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_two_bits_cpx.conf rename to conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf index 67c4d60e1..93efcedc1 100644 --- a/conf/gnss-sdr_GPS_L1_two_bits_cpx.conf +++ b/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf @@ -1,138 +1,138 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=3200000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Two_Bit_Cpx_File_Signal_Source -SignalSource.filename=/datalogger/captures/ajith/test1_two_cpx_live.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=19200000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=19200000 -InputFilter.IF=4024000 -InputFilter.decimation_factor=6 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=1.5; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=./tracking_ch - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=3200000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Two_Bit_Cpx_File_Signal_Source +SignalSource.filename=/datalogger/captures/ajith/test1_two_cpx_live.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=19200000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=19200000 +InputFilter.IF=4024000 +InputFilter.decimation_factor=6 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=1.5; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=./tracking_ch + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_udp_with_monitor.conf b/conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_udp_with_monitor.conf rename to conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf index 9b7b18b94..5e7067ed7 100644 --- a/conf/gnss-sdr_GPS_L1_udp_with_monitor.conf +++ b/conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf @@ -1,82 +1,82 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps] -GNSS-SDR.internal_fs_sps=4000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Custom_UDP_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.origin_address=127.0.0.1 -SignalSource.capture_device=lo -SignalSource.port=1230 -;SignalSource.payload_bytes=1472 # Not used! Size is retrieved from UDP Packet -SignalSource.sample_type=cfloat -SignalSource.IQ_swap=true -SignalSource.RF_channels=1 -SignalSource.channels_in_udp=1 -SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=3 -Channels.in_acquisition=1 -Channel.signal=1C -Channel0.satellite=1 -Channel1.satellite=11 -Channel2.satellite=17 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.008 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.enable_monitor=true -PVT.monitor_client_addresses=127.0.0.1 -PVT.monitor_udp_port=1234 - -;######### MONITOR CONFIG ############ -Monitor.enable_monitor=true -Monitor.decimation_factor=1 -Monitor.client_addresses=127.0.0.1 -Monitor.udp_port=1233 - -;######### ACQUISITION MONITOR CONFIG ############ -AcquisitionMonitor.enable_monitor=true -AcquisitionMonitor.decimation_factor=1 -AcquisitionMonitor.client_addresses=127.0.0.1 -AcquisitionMonitor.udp_port=1231 - -;######### TRACKING MONITOR CONFIG ############ -TrackingMonitor.enable_monitor=true -TrackingMonitor.decimation_factor=1 -TrackingMonitor.client_addresses=127.0.0.1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps] +GNSS-SDR.internal_fs_sps=4000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Custom_UDP_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.origin_address=127.0.0.1 +SignalSource.capture_device=lo +SignalSource.port=1230 +;SignalSource.payload_bytes=1472 # Not used! Size is retrieved from UDP Packet +SignalSource.sample_type=cfloat +SignalSource.IQ_swap=true +SignalSource.RF_channels=1 +SignalSource.channels_in_udp=1 +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=3 +Channels.in_acquisition=1 +Channel.signal=1C +Channel0.satellite=1 +Channel1.satellite=11 +Channel2.satellite=17 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.008 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.enable_monitor=true +PVT.monitor_client_addresses=127.0.0.1 +PVT.monitor_udp_port=1234 + +;######### MONITOR CONFIG ############ +Monitor.enable_monitor=true +Monitor.decimation_factor=1 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1233 + +;######### ACQUISITION MONITOR CONFIG ############ +AcquisitionMonitor.enable_monitor=true +AcquisitionMonitor.decimation_factor=1 +AcquisitionMonitor.client_addresses=127.0.0.1 +AcquisitionMonitor.udp_port=1231 + +;######### TRACKING MONITOR CONFIG ############ +TrackingMonitor.enable_monitor=true +TrackingMonitor.decimation_factor=1 +TrackingMonitor.client_addresses=127.0.0.1 TrackingMonitor.udp_port=1232 \ No newline at end of file diff --git a/conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf index 3fc5c22d2..9635f93c7 100644 --- a/conf/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf @@ -1,115 +1,115 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. -GNSS-SDR.internal_fs_sps=7000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Fmcomms2_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=192.168.0.4 -SignalSource.sampling_frequency=7000000 -SignalSource.freq=1575420000 -SignalSource.bandwidth=4000000 -SignalSource.RF_channels=2 -SignalSource.rx1_enable=true -SignalSource.rx2_enable=true -SignalSource.gain_mode_rx1=slow_attack -SignalSource.gain_mode_rx2=slow_attack -SignalSource.rf_port_select=A_BALANCED -SignalSource.gain_rx1=64 -SignalSource.gain_rx2=64 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_dds_lo=false -SignalSource.freq_rf_tx_hz=1260000000 -SignalSource.freq_dds_tx_hz=1000 -SignalSource.scale_dds_dbfs=0.0 -SignalSource.phase_dds_deg=0.0 -SignalSource.tx_attenuation_db=0.0 - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Pass_Through -SignalConditioner1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel0.signal=1C -Channel1.RF_channel_ID=0 -Channel1.signal=1C -Channel2.RF_channel_ID=0 -Channel2.signal=1C -Channel3.RF_channel_ID=0 -Channel3.signal=1C -Channel4.RF_channel_ID=1 -Channel4.signal=1C -Channel5.RF_channel_ID=1 -Channel5.signal=1C -Channel6.RF_channel_ID=1 -Channel6.signal=1C -Channel7.RF_channel_ID=1 -Channel7.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=2.5 -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. +GNSS-SDR.internal_fs_sps=7000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fmcomms2_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.0.4 +SignalSource.sampling_frequency=7000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=4000000 +SignalSource.RF_channels=2 +SignalSource.rx1_enable=true +SignalSource.rx2_enable=true +SignalSource.gain_mode_rx1=slow_attack +SignalSource.gain_mode_rx2=slow_attack +SignalSource.rf_port_select=A_BALANCED +SignalSource.gain_rx1=64 +SignalSource.gain_rx2=64 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_dds_lo=false +SignalSource.freq_rf_tx_hz=1260000000 +SignalSource.freq_dds_tx_hz=1000 +SignalSource.scale_dds_dbfs=0.0 +SignalSource.phase_dds_deg=0.0 +SignalSource.tx_attenuation_db=0.0 + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Pass_Through +SignalConditioner1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel0.signal=1C +Channel1.RF_channel_ID=0 +Channel1.signal=1C +Channel2.RF_channel_ID=0 +Channel2.signal=1C +Channel3.RF_channel_ID=0 +Channel3.signal=1C +Channel4.RF_channel_ID=1 +Channel4.signal=1C +Channel5.RF_channel_ID=1 +Channel5.signal=1C +Channel6.RF_channel_ID=1 +Channel6.signal=1C +Channel7.RF_channel_ID=1 +Channel7.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=2.5 +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_LimeSDR.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_LimeSDR.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf index c2a6b5019..7a1fea65e 100644 --- a/conf/gnss-sdr_GPS_L1_LimeSDR.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf @@ -1,129 +1,129 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=5000000 -GNSS-SDR.use_acquisition_resampler=true - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Limesdr_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=5000000 -SignalSource.freq=1575420000 -SignalSource.gain=50 ; 0-73 dB no AGC in LimeSDR -; SignalSource.analog_bw ; if not set, defaults to sample_rate/2 -; SignalSource.digital_bw ; if not set, defaults to 0 (disabled filter) -; SignalSource.limesdr_serial ; if not set, its automatic -SignalSource.antenna=2 ; None(0), LNAH(1), LNAL(2), LNAW(3), AUTO(255) -SignalSource.ext_clock_MHz=0 ; 0 -> internal clock -SignalSource.limechannel_mode=0 ; A(0), B(1) or (A+B) MIMO(2) -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=./captured_signal.dat - -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Pass_Through -InputFilter.implementation=Pulse_Blanking_Filter ; <- Required in some locations -InputFilter.pfa=0.001 -InputFilter.segments_est=2500 -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=7 -Channels_1B.count=0 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### GPS L1 ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### GALILEO E1 ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.pfa=0.01 -Acquisition_1B.blocking=false -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### GPS L1 TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.pll_bw_narrow_hz=5.0; -Tracking_1C.dll_bw_narrow_hz=0.75; -Tracking_1C.extend_correlation_symbols=1; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.early_late_space_narrow_chips=0.5 - -;######### GALILEO E1 TRACKING CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=0.75; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.5; -Tracking_1B.pll_bw_narrow_hz=5.0 -Tracking_1B.dll_bw_narrow_hz=0.5 -Tracking_1B.extend_correlation_symbols=1 -Tracking_1B.track_pilot=true -Tracking_1B.enable_fll_pull_in=true; -; Tracking_1B.pull_in_time_s=60 -Tracking_1B.enable_fll_steady_state=false -Tracking_1B.fll_bw_hz=10 -Tracking_1B.dump=false -Tracking_1B.dump_filename=tracking_ch_ - - -;######### TELEMETRY DECODER GPS L1 CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### TELEMETRY DECODER Galileo E1 CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.enable_rx_clock_correction=false -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.rinexobs_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=5000000 +GNSS-SDR.use_acquisition_resampler=true + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Limesdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=5000000 +SignalSource.freq=1575420000 +SignalSource.gain=50 ; 0-73 dB no AGC in LimeSDR +; SignalSource.analog_bw ; if not set, defaults to sample_rate/2 +; SignalSource.digital_bw ; if not set, defaults to 0 (disabled filter) +; SignalSource.limesdr_serial ; if not set, its automatic +SignalSource.antenna=2 ; None(0), LNAH(1), LNAL(2), LNAW(3), AUTO(255) +SignalSource.ext_clock_MHz=0 ; 0 -> internal clock +SignalSource.limechannel_mode=0 ; A(0), B(1) or (A+B) MIMO(2) +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./captured_signal.dat + +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Pass_Through +InputFilter.implementation=Pulse_Blanking_Filter ; <- Required in some locations +InputFilter.pfa=0.001 +InputFilter.segments_est=2500 +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=7 +Channels_1B.count=0 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### GPS L1 ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### GALILEO E1 ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.pfa=0.01 +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### GPS L1 TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.75; +Tracking_1C.extend_correlation_symbols=1; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.5 + +;######### GALILEO E1 TRACKING CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=5.0 +Tracking_1B.dll_bw_narrow_hz=0.5 +Tracking_1B.extend_correlation_symbols=1 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +; Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + + +;######### TELEMETRY DECODER GPS L1 CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER Galileo E1 CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.enable_rx_clock_correction=false +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.rinexobs_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf index f0ab33656..cf1840aeb 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf @@ -1,157 +1,157 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP X300 as a RF front-end for GPS L1 signals. -; Set SignalSource.device_address to the IP address of your device -; and run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=cshort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=cshort - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Fir_Filter -InputFilter.input_item_type=cshort -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=11 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.48 -InputFilter.band2_begin=0.52 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=4000000 -InputFilter.IF=0 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=0 -Channels.in_acquisition=1 -Channel.signal=1C - -;Channel0.signal=1C -;Channel1.signal=1C -;Channel2.signal=1C -;Channel3.signal=1C -;Channel4.signal=1C -;Channel5.signal=1C -;Channel6.signal=1C -;Channel7.signal=1C -;Channel8.signal=1C -;Channel9.signal=1C -;Channel10.signal=1C -;Channel11.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=8000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=30.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP X300 as a RF front-end for GPS L1 signals. +; Set SignalSource.device_address to the IP address of your device +; and run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=cshort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.gain=40 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=cshort + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Fir_Filter +InputFilter.input_item_type=cshort +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=11 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.48 +InputFilter.band2_begin=0.52 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=4000000 +InputFilter.IF=0 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_1B.count=0 +Channels.in_acquisition=1 +Channel.signal=1C + +;Channel0.signal=1C +;Channel1.signal=1C +;Channel2.signal=1C +;Channel3.signal=1C +;Channel4.signal=1C +;Channel5.signal=1C +;Channel6.signal=1C +;Channel7.signal=1C +;Channel8.signal=1C +;Channel9.signal=1C +;Channel10.signal=1C +;Channel11.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=8000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=30.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_USRP_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_USRP_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf index 04afb9a6c..c89fb7f3a 100644 --- a/conf/gnss-sdr_GPS_L1_USRP_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf @@ -1,118 +1,118 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP 1 as a RF front-end for GPS L1 signals. -; Run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -;SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -SignalSource.gain=60 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels_1B.count=0 -Channels.in_acquisition=1 - - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=30.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation: -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP 1 as a RF front-end for GPS L1 signals. +; Run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +;SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.gain=60 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels_1B.count=0 +Channels.in_acquisition=1 + + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=30.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation: +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_bladeRF.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf similarity index 96% rename from conf/gnss-sdr_GPS_L1_bladeRF.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf index e751730de..8a726ea8a 100644 --- a/conf/gnss-sdr_GPS_L1_bladeRF.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf @@ -1,109 +1,109 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Osmosdr_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -;# RF Gain: LNA Gain {0, 3, 6} -SignalSource.gain=6 -;# IF Gain: N/A -SignalSource.rf_gain=40 -;# BB Gain: RX VGA1 + VGA2 [5, 60] -SignalSource.if_gain=48 -SignalSource.AGC_enabled=false -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.osmosdr_args=bladerf=0 ; This line enables the bladeRF -SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.decimation_factor=1 -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.85 -InputFilter.band2_begin=0.9 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - -;######### PVT CONFIG ############ -;PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.iono_model=Broadcast -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=2000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +;# RF Gain: LNA Gain {0, 3, 6} +SignalSource.gain=6 +;# IF Gain: N/A +SignalSource.rf_gain=40 +;# BB Gain: RX VGA1 + VGA2 [5, 60] +SignalSource.if_gain=48 +SignalSource.AGC_enabled=false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.osmosdr_args=bladerf=0 ; This line enables the bladeRF +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.decimation_factor=1 +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.85 +InputFilter.band2_begin=0.9 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + +;######### PVT CONFIG ############ +;PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.iono_model=Broadcast +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf index df763f64e..63a02ee23 100644 --- a/conf/gnss-sdr_GPS_L1_fmcomms2_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -1,134 +1,134 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Fmcomms2_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=10.42.0.196 -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -SignalSource.bandwidth=2000000 -SignalSource.rx1_enable=true -SignalSource.gain_mode_rx1=manual -SignalSource.rf_port_select=A_BALANCED -SignalSource.gain_rx1=64 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=2000000 -InputFilter.IF=0; IF deviation due to front-end LO inaccuracies [Hz] - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=5 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fmcomms2_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=10.42.0.196 +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=2000000 +SignalSource.rx1_enable=true +SignalSource.gain_mode_rx1=manual +SignalSource.rf_port_select=A_BALANCED +SignalSource.gain_rx1=64 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=2000000 +InputFilter.IF=0; IF deviation due to front-end LO inaccuracies [Hz] + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf index e140810d2..2ec584332 100644 --- a/conf/gnss-sdr_GPS_L1_plutosdr_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf @@ -1,145 +1,145 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps]. -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -GNSS-SDR.internal_fs_sps=4000000 -GNSS-SDR.use_acquisition_resampler=true - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Plutosdr_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=192.168.2.1 -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.bandwidth=2000000 -SignalSource.gain_mode=slow_attack -SignalSource.gain=30 -SignalSource.samples=0 -SignalSource.buffer_size=65000 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=./capture.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=0 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.use_CFAR_algorithm=false; -Acquisition_1C.threshold=2.6 -Acquisition_1C.doppler_max=50000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.5 -Acquisition_1B.use_CFAR_algorithm=false -Acquisition_1B.blocking=false -Acquisition_1B.doppler_max=6000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.enable_fll_pull_in=true; -Tracking_1C.fll_bw_hz=10 -Tracking_1C.pll_bw_narrow_hz=5.0; -Tracking_1C.dll_bw_narrow_hz=0.75; -Tracking_1C.extend_correlation_symbols=1; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.early_late_space_narrow_chips=0.5 - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=0.75; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.5; -Tracking_1B.pll_bw_narrow_hz=5.0 -Tracking_1B.dll_bw_narrow_hz=0.5 -Tracking_1B.extend_correlation_symbols=1 -Tracking_1B.track_pilot=true -Tracking_1B.enable_fll_pull_in=true; -;Tracking_1B.pull_in_time_s=60 -Tracking_1B.enable_fll_steady_state=false -Tracking_1B.fll_bw_hz=10 -Tracking_1B.dump=false -Tracking_1B.dump_filename=tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.enable_rx_clock_correction=false -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.rinexobs_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +GNSS-SDR.internal_fs_sps=4000000 +GNSS-SDR.use_acquisition_resampler=true + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Plutosdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.2.1 +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=2000000 +SignalSource.gain_mode=slow_attack +SignalSource.gain=30 +SignalSource.samples=0 +SignalSource.buffer_size=65000 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./capture.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_1B.count=0 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.use_CFAR_algorithm=false; +Acquisition_1C.threshold=2.6 +Acquisition_1C.doppler_max=50000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=6000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.enable_fll_pull_in=true; +Tracking_1C.fll_bw_hz=10 +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.75; +Tracking_1C.extend_correlation_symbols=1; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.5 + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=5.0 +Tracking_1B.dll_bw_narrow_hz=0.5 +Tracking_1B.extend_correlation_symbols=1 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +;Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.enable_rx_clock_correction=false +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.rinexobs_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf index 370931cca..8d856d183 100644 --- a/conf/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -1,151 +1,151 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -GNSS-SDR.internal_fs_sps=1200000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation -SignalSource.implementation=RtlTcp_Signal_Source -SignalSource.sampling_frequency=1200000 -SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.rf_gain=40 -SignalSource.if_gain=30 -SignalSource.AGC_enabled = false -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.address=127.0.0.1 -SignalSource.port=1234 -SignalSource.swap_iq=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 - -;#The following options are used only in Freq_Xlating_Fir_Filter implementation. -;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -InputFilter.sampling_frequency=1200000 -InputFilter.IF=80558 - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 -Channels.in_acquisition=1 -Channel.signal=1C - - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation: -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +GNSS-SDR.internal_fs_sps=1200000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation +SignalSource.implementation=RtlTcp_Signal_Source +SignalSource.sampling_frequency=1200000 +SignalSource.freq=1575420000 +SignalSource.gain=40 +SignalSource.rf_gain=40 +SignalSource.if_gain=30 +SignalSource.AGC_enabled = false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.address=127.0.0.1 +SignalSource.port=1234 +SignalSource.swap_iq=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 + +;#The following options are used only in Freq_Xlating_Fir_Filter implementation. +;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +InputFilter.sampling_frequency=1200000 +InputFilter.IF=80558 + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 +Channels.in_acquisition=1 +Channel.signal=1C + + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation: +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf similarity index 97% rename from conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf index 8994bb3f3..0319813c0 100644 --- a/conf/gnss-sdr_GPS_L1_rtlsdr_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf @@ -1,153 +1,153 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -GNSS-SDR.internal_fs_sps=1999898 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Osmosdr_Signal_Source -SignalSource.item_type=gr_complex -; FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.rf_gain=40 -SignalSource.if_gain=30 -SignalSource.AGC_enabled = false -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - -;# Please note that the new RTL-SDR Blog V3 dongles ship a < 1 PPM -;# temperature compensated oscillator (TCXO), which is well suited for GNSS -;# signal processing, and a 4.5 V powered bias-tee to feed an active antenna. -;# Whether the bias-tee is turned off before reception depends on which version -;# of gr-osmosdr was used when compiling GNSS-SDR. With an old version -;# (for example, v0.1.4-8), the utility rtl_biast may be used to switch the -;# bias-tee, and then call gnss-sdr. -;# See https://github.com/rtlsdrblog/rtl_biast -;# After reception the bias-tee is switched off automatically by the program. -;# With newer versions of gr-osmosdr (>= 0.1.4-13), the bias-tee can be -;# activated by uncommenting the following line: -;SignalSource.osmosdr_args=rtl,bias=1 - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -InputFilter.sampling_frequency=1999898 -InputFilter.IF=80558 ; IF deviation due to front-end LO inaccuracies [Hz] - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +GNSS-SDR.internal_fs_sps=1999898 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.item_type=gr_complex +; FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.gain=40 +SignalSource.rf_gain=40 +SignalSource.if_gain=30 +SignalSource.AGC_enabled = false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + +;# Please note that the new RTL-SDR Blog V3 dongles ship a < 1 PPM +;# temperature compensated oscillator (TCXO), which is well suited for GNSS +;# signal processing, and a 4.5 V powered bias-tee to feed an active antenna. +;# Whether the bias-tee is turned off before reception depends on which version +;# of gr-osmosdr was used when compiling GNSS-SDR. With an old version +;# (for example, v0.1.4-8), the utility rtl_biast may be used to switch the +;# bias-tee, and then call gnss-sdr. +;# See https://github.com/rtlsdrblog/rtl_biast +;# After reception the bias-tee is switched off automatically by the program. +;# With newer versions of gr-osmosdr (>= 0.1.4-13), the bias-tee can be +;# activated by uncommenting the following line: +;SignalSource.osmosdr_args=rtl,bias=1 + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +InputFilter.sampling_frequency=1999898 +InputFilter.IF=80558 ; IF deviation due to front-end LO inaccuracies [Hz] + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf similarity index 96% rename from conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf index cffb6f9b0..85edb5451 100644 --- a/conf/gnss-sdr_GPS_L2C_USRP1_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf @@ -1,156 +1,156 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP1 as a RF front-end for GPS L2C signals -; Run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP1_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1227600000 -SignalSource.gain=60 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20000000 -InputFilter.IF=-1600000 -InputFilter.decimation_factor=1 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex -Resampler.sample_freq_in=2000000 -Resampler.sample_freq_out=2000000 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_2S.count=1 -Channels.in_acquisition=1 - -Channel.signal=2S - -Channel0.signal=2S -Channel1.signal=2S -Channel2.signal=2S -Channel3.signal=2S -Channel4.signal=2S -Channel5.signal=2S -Channel6.signal=2S -Channel7.signal=2S -;Channel8.signal=2S -;Channel9.signal=2S -;Channel10.signal=2S -;Channel11.signal=2S - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.013 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=10000 -Acquisition_2S.doppler_step=100 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.3; -Tracking_2S.order=3; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############. -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP1 as a RF front-end for GPS L2C signals +; Run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP1_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1227600000 +SignalSource.gain=60 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20000000 +InputFilter.IF=-1600000 +InputFilter.decimation_factor=1 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex +Resampler.sample_freq_in=2000000 +Resampler.sample_freq_out=2000000 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_2S.count=1 +Channels.in_acquisition=1 + +Channel.signal=2S + +Channel0.signal=2S +Channel1.signal=2S +Channel2.signal=2S +Channel3.signal=2S +Channel4.signal=2S +Channel5.signal=2S +Channel6.signal=2S +Channel7.signal=2S +;Channel8.signal=2S +;Channel9.signal=2S +;Channel10.signal=2S +;Channel11.signal=2S + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.013 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=10000 +Acquisition_2S.doppler_step=100 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.3; +Tracking_2S.order=3; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############. +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf similarity index 96% rename from conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf rename to conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf index a221b7169..f27bc5ed0 100644 --- a/conf/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf @@ -1,162 +1,162 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP X300 as a RF front-end for GPS L2C signals -; Set SignalSource.device_address to the IP address of your device -; and run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.device_address=192.168.50.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=cshort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1227600000 -;### Options: internal, external, or MIMO -SignalSource.clock_source=internal -SignalSource.gain=35 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=cshort - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Fir_Filter -InputFilter.input_item_type=cshort -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=11 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.48 -InputFilter.band2_begin=0.52 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=4000000 -InputFilter.IF=0 - -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_2S.count=1 -Channels.in_acquisition=1 - -Channel.signal=2S - -Channel0.signal=2S -Channel1.signal=2S -Channel2.signal=2S -Channel3.signal=2S -Channel4.signal=2S -Channel5.signal=2S -Channel6.signal=2S -Channel7.signal=2S -;Channel8.signal=2S -;Channel9.signal=2S -;Channel10.signal=2S -;Channel11.signal=2S - -;######### ACQUISITION GLOBAL CONFIG ############ - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.015 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=true - - -;######### OBSERVABLES CONFIG ############. -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP X300 as a RF front-end for GPS L2C signals +; Set SignalSource.device_address to the IP address of your device +; and run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.device_address=192.168.50.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=cshort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1227600000 +;### Options: internal, external, or MIMO +SignalSource.clock_source=internal +SignalSource.gain=35 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=cshort + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Fir_Filter +InputFilter.input_item_type=cshort +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=11 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.48 +InputFilter.band2_begin=0.52 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=4000000 +InputFilter.IF=0 + +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_2S.count=1 +Channels.in_acquisition=1 + +Channel.signal=2S + +Channel0.signal=2S +Channel1.signal=2S +Channel2.signal=2S +Channel3.signal=2S +Channel4.signal=2S +Channel5.signal=2S +Channel6.signal=2S +Channel7.signal=2S +;Channel8.signal=2S +;Channel9.signal=2S +;Channel10.signal=2S +;Channel11.signal=2S + +;######### ACQUISITION GLOBAL CONFIG ############ + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.015 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=true + + +;######### OBSERVABLES CONFIG ############. +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf similarity index 97% rename from conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf rename to conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf index b49801d10..4b0624fdc 100644 --- a/conf/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf @@ -1,93 +1,93 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP X300 as a RF front-end for Galileo E1 signals. -; Set SignalSource.device_address to the IP address of your device -; and run: -; gnss-sdr --config_file=/path/to/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 -GNSS-SDR.Galileo_banned_prns=14,18 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.gain=50 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ###### -Channels_1B.count=4 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=1 -Acquisition_1B.pfa=0.000008 -Acquisition_1B.doppler_max=6000 -Acquisition_1B.doppler_step=250 -Acquisition_1B.cboc=false -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP X300 as a RF front-end for Galileo E1 signals. +; Set SignalSource.device_address to the IP address of your device +; and run: +; gnss-sdr --config_file=/path/to/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 +GNSS-SDR.Galileo_banned_prns=14,18 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.gain=50 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ###### +Channels_1B.count=4 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=1 +Acquisition_1B.pfa=0.000008 +Acquisition_1B.doppler_max=6000 +Acquisition_1B.doppler_step=250 +Acquisition_1B.cboc=false +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf similarity index 96% rename from conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf rename to conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf index 61f18e09f..bf6e8043d 100644 --- a/conf/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf @@ -1,161 +1,161 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_1C_enabled=false -GNSS-SDR.SUPL_read_1C_assistance_xml=true -GNSS-SDR.SUPL_1C_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_1C_ephemeris_port=7275 -GNSS-SDR.SUPL_1C_acquisition_server=supl.google.com -GNSS-SDR.SUPL_1C_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation -SignalSource.implementation=UHD_Signal_Source -SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=gr_complex -SignalSource.RF_channels=2 -SignalSource.sampling_frequency=4000000 -SignalSource.subdevice=A:0 B:0 - -;######### RF Channels specific settings ###### -;## RF CHANNEL 0 ## -SignalSource.freq0=1575420000 -SignalSource.gain0=50 -SignalSource.samples0=0 - -;## RF CHANNEL 1 ## -SignalSource.freq1=1575420000 -SignalSource.gain1=50 -SignalSource.samples1=0 - - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Pass_Through -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=1 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=1 - - -;#signal: -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=8000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_1C_enabled=false +GNSS-SDR.SUPL_read_1C_assistance_xml=true +GNSS-SDR.SUPL_1C_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_1C_ephemeris_port=7275 +GNSS-SDR.SUPL_1C_acquisition_server=supl.google.com +GNSS-SDR.SUPL_1C_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation +SignalSource.implementation=UHD_Signal_Source +SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=gr_complex +SignalSource.RF_channels=2 +SignalSource.sampling_frequency=4000000 +SignalSource.subdevice=A:0 B:0 + +;######### RF Channels specific settings ###### +;## RF CHANNEL 0 ## +SignalSource.freq0=1575420000 +SignalSource.gain0=50 +SignalSource.samples0=0 + +;## RF CHANNEL 1 ## +SignalSource.freq1=1575420000 +SignalSource.gain1=50 +SignalSource.samples1=0 + + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Pass_Through +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=1 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=1 + + +;#signal: +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=8000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr.conf b/conf/gnss-sdr.conf index 3f4b61766..9c2b654d6 100644 --- a/conf/gnss-sdr.conf +++ b/conf/gnss-sdr.conf @@ -1,145 +1,145 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Default configuration file -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through ; or Fir_Filter - -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.44 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=4000000 -InputFilter.IF=0 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels_1B.count=0 -Channels.in_acquisition=1 - - -;######### SPECIFIC CHANNELS CONFIG ###### - -;######### CHANNEL 0 CONFIG ############ -;Channel0.signal=1C -;Channel0.satellite=11 - -;######### CHANNEL 1 CONFIG ############ -;Channel1.signal=1C -;Channel1.satellite=18 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=5 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.AR_GPS=PPP-AR ; options: OFF, Continuous, Instantaneous, Fix-and-Hold, PPP-AR -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Default configuration file +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through ; or Fir_Filter + +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.44 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=4000000 +InputFilter.IF=0 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels_1B.count=0 +Channels.in_acquisition=1 + + +;######### SPECIFIC CHANNELS CONFIG ###### + +;######### CHANNEL 0 CONFIG ############ +;Channel0.signal=1C +;Channel0.satellite=11 + +;######### CHANNEL 1 CONFIG ############ +;Channel1.signal=1C +;Channel1.satellite=18 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=5 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.AR_GPS=PPP-AR ; options: OFF, Continuous, Instantaneous, Fix-and-Hold, PPP-AR +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT From ffd925c1fcd834f0d1dd74a5811d5a75dd57dcab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 29 Jan 2024 15:32:48 +0100 Subject: [PATCH 082/499] Update changelog --- docs/CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 20d3ae65d..0a1b7fee4 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -12,6 +12,18 @@ SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades Date: Mon, 29 Jan 2024 17:05:47 +0100 Subject: [PATCH 083/499] [TAS-111] time synch check --- src/core/libs/osnma_msg_receiver.cc | 12 +++++++++--- src/core/libs/osnma_msg_receiver.h | 3 ++- src/core/system_parameters/galileo_utc_model.cc | 5 +++++ src/core/system_parameters/galileo_utc_model.h | 1 + src/core/system_parameters/osnma_data.cc | 2 +- 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 66099e054..1f96afb61 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -23,6 +23,7 @@ #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "pvt_interface.h" +#include "galileo_utc_model.h" // for Galileo_Utc_Model #include // for DLOG #include // for gr::io_signature::make #include @@ -54,9 +55,11 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, osnma_msg_receiver::osnma_msg_receiver( const std::string& pemFilePath, - const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", + const std::string& merkleFilePath, + const Galileo_Utc_Model &utc_model) : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) + gr::io_signature::make(0, 0, 0)), + galileo_utc_model(utc_model) { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); @@ -93,7 +96,9 @@ void osnma_msg_receiver::msg_handler_pvt_to_osnma(const pmt::pmt_t& msg) { try { - d_receiver_time = wht::any_cast(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block + // receive the UTC time + auto utc_time_from_pvt = wht::any_cast(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block + } catch (const pmt::exception& e) { @@ -122,6 +127,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... + auto utc = galileo_utc_model.GST_to_UTC_time(d_GST_SIS, static_cast(nma_msg->WN_sf0)); double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time if(abs(d_GST_SIS - d_receiver_time) <= T_L) { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 6b694f32d..27c07ae56 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -57,7 +57,7 @@ public: private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); - osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); + osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath, const Galileo_Utc_Model &galileo_utc_model); void msg_handler_osnma(const pmt::pmt_t& msg); void msg_handler_pvt_to_osnma(const pmt::pmt_t& msg); @@ -83,6 +83,7 @@ private: std::array d_mack_message{}; // C: 480 b OSNMA_data d_osnma_data{}; + Galileo_Utc_Model galileo_utc_model; bool d_new_data{false}; bool d_public_key_verified{false}; bool d_kroot_verified{false}; diff --git a/src/core/system_parameters/galileo_utc_model.cc b/src/core/system_parameters/galileo_utc_model.cc index 4f3a41df8..d14aa8c42 100644 --- a/src/core/system_parameters/galileo_utc_model.cc +++ b/src/core/system_parameters/galileo_utc_model.cc @@ -72,3 +72,8 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const t_Utc = secondsOfWeekBeforeToday + t_Utc_daytime; return t_Utc; } + +double Galileo_Utc_Model::UTC_time_to_GST(double t_Utc, int32_t WN) const +{ + // TODO +} \ No newline at end of file diff --git a/src/core/system_parameters/galileo_utc_model.h b/src/core/system_parameters/galileo_utc_model.h index adb941daa..6024a41d0 100644 --- a/src/core/system_parameters/galileo_utc_model.h +++ b/src/core/system_parameters/galileo_utc_model.h @@ -43,6 +43,7 @@ public: // double TOW; double GST_to_UTC_time(double t_e, int32_t WN) const; //!< GST-UTC Conversion Algorithm and Parameters + double UTC_time_to_GST(double t_Utc, int32_t WN) const; // Word type 6: GST-UTC conversion parameters double A0{}; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index db4b5c553..110b85241 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -102,7 +102,7 @@ void NavData::generate_eph_iono_vector2() for (auto& var : variables) { // extract the bits from the variable - uint64_t binary_representation; + uint64_t binary_representation; // FIXME types have more bits than the specification size, e.g. 32 bits vs 10 bits memcpy(&binary_representation, var.first, var.second / 8); // Append the bits to the buffer and update the bit count From 51b4209535bdfc592e062896093871d65bb8b8b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cesare=20G=2E=20Mart=C3=ADnez?= Date: Mon, 29 Jan 2024 17:05:47 +0100 Subject: [PATCH 084/499] [TAS-111] Refactor Galileo_Utc_Model and time synchronization in osnma_msg_receiver In osnma_msg_receiver, the time synchronization between OSNMA subframes and local time has been updated. To facilitate this, the Galileo_Utc_Model has been refactored to be used statically, instead of being passed through the osnma_msg_receiver constructor. Additional changes include: adjusting variable declarations, adding an initialization method, altering the function GST_to_UTC_time to be static, and removing an unused instantiation of the model in osnma_msg_receiver. --- src/core/libs/osnma_msg_receiver.cc | 8 ++++-- src/core/libs/osnma_msg_receiver.h | 3 +- .../system_parameters/galileo_utc_model.cc | 14 +++++++++- .../system_parameters/galileo_utc_model.h | 28 +++++++++++++------ 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1f96afb61..1131ffbc3 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -127,9 +127,11 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... - auto utc = galileo_utc_model.GST_to_UTC_time(d_GST_SIS, static_cast(nma_msg->WN_sf0)); - double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time - if(abs(d_GST_SIS - d_receiver_time) <= T_L) + // instantiate galileo_utc_model and call init function, then call GST_to_UTC_time + Galileo_Utc_Model::init(nma_msg->utc_data); + double_t utc = Galileo_Utc_Model::GST_to_UTC_time(static_cast(d_GST_SIS), static_cast(nma_msg->WN_sf0)); + double_t T_L = 15.0; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time + if(abs(utc - d_receiver_time) <= T_L) { process_osnma_message(nma_msg); } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 27c07ae56..efaadd6a2 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -72,6 +72,7 @@ private: void read_mack_body(); void process_mack_message(const std::shared_ptr& osnma_msg); +// Galileo_Utc_Model galileo_utc_model; boost::circular_buffer d_old_mack_message; boost::circular_buffer d_old_navdata_buffer; // buffer that holds last 10 received navdata messages std::unique_ptr d_dsm_reader; @@ -91,7 +92,7 @@ private: uint8_t d_Lt_min {}; // minimum equivalent tag length uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; - std::time_t d_receiver_time {}; + std::time_t d_receiver_time {}; // PVT time computed by the local receiver }; diff --git a/src/core/system_parameters/galileo_utc_model.cc b/src/core/system_parameters/galileo_utc_model.cc index d14aa8c42..74ea2ba43 100644 --- a/src/core/system_parameters/galileo_utc_model.cc +++ b/src/core/system_parameters/galileo_utc_model.cc @@ -17,8 +17,19 @@ #include "galileo_utc_model.h" #include +void Galileo_Utc_Model::init(const Galileo_Utc_Model& data) +{ + A0 = data.A0; + A1 = data.A1; + Delta_tLS = data.Delta_tLS; + Delta_tLSF = data.Delta_tLSF; + DN = data.DN; + tot = data.tot; + WNot = data.WNot; + WN_LSF = data.WN_LSF; -double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const +} +double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) { double t_Utc; double t_Utc_daytime; @@ -76,4 +87,5 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const double Galileo_Utc_Model::UTC_time_to_GST(double t_Utc, int32_t WN) const { // TODO + return 0; } \ No newline at end of file diff --git a/src/core/system_parameters/galileo_utc_model.h b/src/core/system_parameters/galileo_utc_model.h index 6024a41d0..c762c428f 100644 --- a/src/core/system_parameters/galileo_utc_model.h +++ b/src/core/system_parameters/galileo_utc_model.h @@ -41,19 +41,29 @@ public: */ Galileo_Utc_Model() = default; + /** + * @brief Initialize the Galileo_UTC_Model with the provided data. + * + * This function initializes the Galileo_UTC_Model object with the given data. + * + * @param data The Galileo_UTC_Model object containing the data. + */ + static void init(const Galileo_Utc_Model& data); + // double TOW; - double GST_to_UTC_time(double t_e, int32_t WN) const; //!< GST-UTC Conversion Algorithm and Parameters + static double GST_to_UTC_time(double t_e, int32_t WN); //!< GST-UTC Conversion Algorithm and Parameters double UTC_time_to_GST(double t_Utc, int32_t WN) const; + // TODO - make them private? // Word type 6: GST-UTC conversion parameters - double A0{}; - double A1{}; - int32_t Delta_tLS{}; - int32_t tot{}; //!< UTC data reference Time of Week [s] - int32_t WNot{}; //!< UTC data reference Week number [week] - int32_t WN_LSF{}; - int32_t DN{}; - int32_t Delta_tLSF{}; + static double A0; + static double A1; + static int32_t Delta_tLS; + static int32_t tot; //!< UTC data reference Time of Week [s] + static int32_t WNot; //!< UTC data reference Week number [week] + static int32_t WN_LSF; + static int32_t DN; + static int32_t Delta_tLSF; // GPS to Galileo GST conversion parameters double A_0G{}; From dafa7403dce9ff027b6e9bc89503c418a3623f10 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Feb 2024 06:12:25 +0100 Subject: [PATCH 085/499] Revert "[TAS-111] Refactor Galileo_Utc_Model and time synchronization in osnma_msg_receiver" This reverts commit 51b4209535bdfc592e062896093871d65bb8b8b9. --- src/core/libs/osnma_msg_receiver.cc | 8 ++---- src/core/libs/osnma_msg_receiver.h | 3 +- .../system_parameters/galileo_utc_model.cc | 14 +--------- .../system_parameters/galileo_utc_model.h | 28 ++++++------------- 4 files changed, 14 insertions(+), 39 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1131ffbc3..1f96afb61 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -127,11 +127,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... - // instantiate galileo_utc_model and call init function, then call GST_to_UTC_time - Galileo_Utc_Model::init(nma_msg->utc_data); - double_t utc = Galileo_Utc_Model::GST_to_UTC_time(static_cast(d_GST_SIS), static_cast(nma_msg->WN_sf0)); - double_t T_L = 15.0; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time - if(abs(utc - d_receiver_time) <= T_L) + auto utc = galileo_utc_model.GST_to_UTC_time(d_GST_SIS, static_cast(nma_msg->WN_sf0)); + double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time + if(abs(d_GST_SIS - d_receiver_time) <= T_L) { process_osnma_message(nma_msg); } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index efaadd6a2..27c07ae56 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -72,7 +72,6 @@ private: void read_mack_body(); void process_mack_message(const std::shared_ptr& osnma_msg); -// Galileo_Utc_Model galileo_utc_model; boost::circular_buffer d_old_mack_message; boost::circular_buffer d_old_navdata_buffer; // buffer that holds last 10 received navdata messages std::unique_ptr d_dsm_reader; @@ -92,7 +91,7 @@ private: uint8_t d_Lt_min {}; // minimum equivalent tag length uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; - std::time_t d_receiver_time {}; // PVT time computed by the local receiver + std::time_t d_receiver_time {}; }; diff --git a/src/core/system_parameters/galileo_utc_model.cc b/src/core/system_parameters/galileo_utc_model.cc index 74ea2ba43..d14aa8c42 100644 --- a/src/core/system_parameters/galileo_utc_model.cc +++ b/src/core/system_parameters/galileo_utc_model.cc @@ -17,19 +17,8 @@ #include "galileo_utc_model.h" #include -void Galileo_Utc_Model::init(const Galileo_Utc_Model& data) -{ - A0 = data.A0; - A1 = data.A1; - Delta_tLS = data.Delta_tLS; - Delta_tLSF = data.Delta_tLSF; - DN = data.DN; - tot = data.tot; - WNot = data.WNot; - WN_LSF = data.WN_LSF; -} -double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) +double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const { double t_Utc; double t_Utc_daytime; @@ -87,5 +76,4 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) double Galileo_Utc_Model::UTC_time_to_GST(double t_Utc, int32_t WN) const { // TODO - return 0; } \ No newline at end of file diff --git a/src/core/system_parameters/galileo_utc_model.h b/src/core/system_parameters/galileo_utc_model.h index c762c428f..6024a41d0 100644 --- a/src/core/system_parameters/galileo_utc_model.h +++ b/src/core/system_parameters/galileo_utc_model.h @@ -41,29 +41,19 @@ public: */ Galileo_Utc_Model() = default; - /** - * @brief Initialize the Galileo_UTC_Model with the provided data. - * - * This function initializes the Galileo_UTC_Model object with the given data. - * - * @param data The Galileo_UTC_Model object containing the data. - */ - static void init(const Galileo_Utc_Model& data); - // double TOW; - static double GST_to_UTC_time(double t_e, int32_t WN); //!< GST-UTC Conversion Algorithm and Parameters + double GST_to_UTC_time(double t_e, int32_t WN) const; //!< GST-UTC Conversion Algorithm and Parameters double UTC_time_to_GST(double t_Utc, int32_t WN) const; - // TODO - make them private? // Word type 6: GST-UTC conversion parameters - static double A0; - static double A1; - static int32_t Delta_tLS; - static int32_t tot; //!< UTC data reference Time of Week [s] - static int32_t WNot; //!< UTC data reference Week number [week] - static int32_t WN_LSF; - static int32_t DN; - static int32_t Delta_tLSF; + double A0{}; + double A1{}; + int32_t Delta_tLS{}; + int32_t tot{}; //!< UTC data reference Time of Week [s] + int32_t WNot{}; //!< UTC data reference Week number [week] + int32_t WN_LSF{}; + int32_t DN{}; + int32_t Delta_tLSF{}; // GPS to Galileo GST conversion parameters double A_0G{}; From a32bdae396c4f0394d6abe2d4c4d9062a50f1dc0 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Feb 2024 06:12:26 +0100 Subject: [PATCH 086/499] Revert "[TAS-111] time synch check" This reverts commit ba2e392a5d58a08b3b123baf6e1c836de49141a4. --- src/core/libs/osnma_msg_receiver.cc | 12 +++--------- src/core/libs/osnma_msg_receiver.h | 3 +-- src/core/system_parameters/galileo_utc_model.cc | 5 ----- src/core/system_parameters/galileo_utc_model.h | 1 - src/core/system_parameters/osnma_data.cc | 2 +- 5 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1f96afb61..66099e054 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -23,7 +23,6 @@ #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "pvt_interface.h" -#include "galileo_utc_model.h" // for Galileo_Utc_Model #include // for DLOG #include // for gr::io_signature::make #include @@ -55,11 +54,9 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, osnma_msg_receiver::osnma_msg_receiver( const std::string& pemFilePath, - const std::string& merkleFilePath, - const Galileo_Utc_Model &utc_model) : gr::block("osnma_msg_receiver", + const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)), - galileo_utc_model(utc_model) + gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); @@ -96,9 +93,7 @@ void osnma_msg_receiver::msg_handler_pvt_to_osnma(const pmt::pmt_t& msg) { try { - // receive the UTC time - auto utc_time_from_pvt = wht::any_cast(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block - + d_receiver_time = wht::any_cast(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block } catch (const pmt::exception& e) { @@ -127,7 +122,6 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... - auto utc = galileo_utc_model.GST_to_UTC_time(d_GST_SIS, static_cast(nma_msg->WN_sf0)); double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time if(abs(d_GST_SIS - d_receiver_time) <= T_L) { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 27c07ae56..6b694f32d 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -57,7 +57,7 @@ public: private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); - osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath, const Galileo_Utc_Model &galileo_utc_model); + osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void msg_handler_pvt_to_osnma(const pmt::pmt_t& msg); @@ -83,7 +83,6 @@ private: std::array d_mack_message{}; // C: 480 b OSNMA_data d_osnma_data{}; - Galileo_Utc_Model galileo_utc_model; bool d_new_data{false}; bool d_public_key_verified{false}; bool d_kroot_verified{false}; diff --git a/src/core/system_parameters/galileo_utc_model.cc b/src/core/system_parameters/galileo_utc_model.cc index d14aa8c42..4f3a41df8 100644 --- a/src/core/system_parameters/galileo_utc_model.cc +++ b/src/core/system_parameters/galileo_utc_model.cc @@ -72,8 +72,3 @@ double Galileo_Utc_Model::GST_to_UTC_time(double t_e, int32_t WN) const t_Utc = secondsOfWeekBeforeToday + t_Utc_daytime; return t_Utc; } - -double Galileo_Utc_Model::UTC_time_to_GST(double t_Utc, int32_t WN) const -{ - // TODO -} \ No newline at end of file diff --git a/src/core/system_parameters/galileo_utc_model.h b/src/core/system_parameters/galileo_utc_model.h index 6024a41d0..adb941daa 100644 --- a/src/core/system_parameters/galileo_utc_model.h +++ b/src/core/system_parameters/galileo_utc_model.h @@ -43,7 +43,6 @@ public: // double TOW; double GST_to_UTC_time(double t_e, int32_t WN) const; //!< GST-UTC Conversion Algorithm and Parameters - double UTC_time_to_GST(double t_Utc, int32_t WN) const; // Word type 6: GST-UTC conversion parameters double A0{}; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 110b85241..db4b5c553 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -102,7 +102,7 @@ void NavData::generate_eph_iono_vector2() for (auto& var : variables) { // extract the bits from the variable - uint64_t binary_representation; // FIXME types have more bits than the specification size, e.g. 32 bits vs 10 bits + uint64_t binary_representation; memcpy(&binary_representation, var.first, var.second / 8); // Append the bits to the buffer and update the bit count From 77c160285d63d82d05bf0d940e86bf2f7d8b6a3a Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Feb 2024 06:37:49 +0100 Subject: [PATCH 087/499] [TAS-111] time synch check: GST-UTC conversion before comparison Refactored the code to use Galileo_Utc_Model's GST_to_UTC_time function. --- src/core/libs/osnma_msg_receiver.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 66099e054..857ea7db7 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -122,8 +122,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... + auto OSNMA_UTC_time = nma_msg->UtcModelData.GST_to_UTC_time(d_GST_SIS, nma_msg->WN_sf0); double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time - if(abs(d_GST_SIS - d_receiver_time) <= T_L) + if(abs(OSNMA_UTC_time - d_receiver_time) <= T_L) { process_osnma_message(nma_msg); } From a688ad984ddd85d74f8eb813e55c0834a35c65da Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Feb 2024 06:37:49 +0100 Subject: [PATCH 088/499] [TAS-111] time synch check: GST-UTC conversion before comparison Refactored the code to use Galileo_Utc_Model's GST_to_UTC_time function. Last two reverts are because I wrongly made the class static plus other brilliant ideas that turned out to be garbage. --- src/core/libs/osnma_msg_receiver.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 66099e054..857ea7db7 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -122,8 +122,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... + auto OSNMA_UTC_time = nma_msg->UtcModelData.GST_to_UTC_time(d_GST_SIS, nma_msg->WN_sf0); double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time - if(abs(d_GST_SIS - d_receiver_time) <= T_L) + if(abs(OSNMA_UTC_time - d_receiver_time) <= T_L) { process_osnma_message(nma_msg); } From aa45386cdf13a866cd8343d9be4b6833197622cd Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 6 Feb 2024 20:47:50 +0100 Subject: [PATCH 089/499] [TAS-135] Tag verification: L_T should exist when out of scope * Aditionally documentation was written for some important methods and compilation warnings were eliminated. --- src/core/libs/osnma_msg_receiver.cc | 210 ++++++++++++++---- src/core/libs/osnma_msg_receiver.h | 2 + .../system_parameters/galileo_inav_message.cc | 9 +- 3 files changed, 180 insertions(+), 41 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 857ea7db7..575e6d337 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -164,6 +164,14 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& } +/** + * @brief Reads the NMA header from the given input and stores the values in the d_osnma_data structure. + * + * The NMA header consists of several fields: d_nma_header.nmas, d_nma_header.cid, d_nma_header.cpks, and d_nma_header.reserved. + * Each field is retrieved using the corresponding getter functions from the d_dsm_reader auxiliary object. + * + * @param nma_header The input containing the NMA header. + */ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) { d_osnma_data.d_nma_header.nmas = d_dsm_reader->get_nmas(nma_header); @@ -173,6 +181,11 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) } +/** + * @brief Read the DSM header from the given dsm_header and populate the d_osnma_data structure. + * + * @param dsm_header The DSM header. + */ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = d_dsm_reader->get_dsm_id(dsm_header); @@ -189,15 +202,17 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) * */ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) { + // Fill d_dsm_message size_t index = 0; for (const auto* it = osnma_msg->hkroot.cbegin() + 2; it != osnma_msg->hkroot.cend(); ++it) { d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][SIZE_DSM_BLOCKS_BYTES * d_osnma_data.d_dsm_header.dsm_block_id + index] = *it; index++; } + // First block indicates number of blocks in DSM message if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { - // Get number of blocks in message + uint8_t nb = d_dsm_reader->get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); uint16_t number_of_blocks = 0; if (d_osnma_data.d_dsm_header.dsm_id < 12) @@ -263,7 +278,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } std::cout << "]" << std::endl; - // is message complete? -> Process DSM message + // if all inner blocks available -> Process DSM message if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cbegin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cend(), 0))) { @@ -479,9 +494,15 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } -// reads Mack message + +/** + * @brief Reads the Mack message from the given OSNMA_msg object. + * + * @param osnma_msg The OSNMA_msg object containing the Mack message. + */ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma_msg) { + // Retrieve Mack message uint32_t index = 0; for (uint32_t value : osnma_msg->mack) { @@ -491,6 +512,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma d_mack_message[index + 3] = static_cast(value & 0x000000FF); index = index + 4; } + // compute time of subrame and kroot time of applicability, used in read_mack_body and process_mack_message // TODO - find a better placement d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... @@ -501,10 +523,22 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma read_mack_header(); read_mack_body(); process_mack_message(osnma_msg); + // TODO - shorten the MACK processing for the cases where no TK verified or no Kroot verified (warm and cold start) + // still, for instance the NAvData and Mack storage (within process_mack_message) makes sense. } } +/** + * \brief Reads the MACk header from the d_mack_message array and updates the d_osnma_data structure. + * \details This function reads the message ACK header from the d_mack_message array and updates the d_osnma_data structure with the parsed data. The header consists of three fields +*: tag0, macseq, and cop. The size of the fields is determined by the number of tag length (lt) bits specified in OSNMA_TABLE_11 for the corresponding tag size in d_osnma_data.d_dsm_k +*root_message.ts. The lt_bits value is used to calculate the values of tag0, macseq, and cop based on the lt_bits value and the values of the elements of d_mack_message array. + * \pre The d_mack_message array and d_osnma_data.d_dsm_kroot_message.ts field must be properly populated. + * \post The d_osnma_data.d_mack_message.header.tag0, d_osnma_data.d_mack_message.header.macseq, and d_osnma_data.d_mack_message.header.cop fields are updated with the parsed values +*. + * \returns None. + */ void osnma_msg_receiver::read_mack_header() { // C: TODO - still to review computations. uint8_t lt_bits = 0; @@ -566,8 +600,19 @@ void osnma_msg_receiver::read_mack_header() } +/** + * @brief Reads the message body and verify Tesla key + * + * \details It retrieves all the tags and tag-info associated. Then it attempts to verify the Tesla Key by computing the + * number of hashes of distance between the key-to-verify and the Kroot and iteratively hashing the result, until the required number of hashes + * is achieved. The result is then compared with the Kroot. If the two values match, the Tesla key is verified. + * + * @return None + */ + // TODO - function's name not representative of logic,..., take the TK verification out? void osnma_msg_receiver::read_mack_body() { + // retrieve tag length uint8_t lt_bits = 0; const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it != OSNMA_TABLE_11.cend()) @@ -578,6 +623,7 @@ void osnma_msg_receiver::read_mack_body() { return; } + // retrieve key length uint16_t lk_bits = 0; const auto it2 = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); if (it2 != OSNMA_TABLE_10.cend()) @@ -588,9 +634,11 @@ void osnma_msg_receiver::read_mack_body() { return; } - uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); // C: compute number of tags + // compute number of tags in the given Mack message as per Eq. 8 ICD + uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); - for (uint16_t k = 0; k < (nt - 1); k++) // C: retrieve Tag&Info + // retrieve tags and tag-info associated with the tags + for (uint16_t k = 0; k < (nt - 1); k++) { uint64_t tag = 0; uint8_t PRN_d = 0; @@ -745,13 +793,15 @@ void osnma_msg_receiver::read_mack_body() d_osnma_data.d_mack_message.key[key_index_bytes] = d_mack_message[i]; } - // compute number of hashes required + // compute I: number of hashes required - Eq. 19 ICD + // TODO - this assumes that the baseline is Kroot, but there is the following possibility: + // - available K verified from another iteration, hence is nonsense to go back to the Kroot, when I could perform only, say, two hashes. uint8_t num_of_hashes_needed = (d_GST_Sf - d_GST_0) / 30 + 1; uint32_t GST_SFi = d_GST_Sf; std::vector K_II = d_osnma_data.d_mack_message.key; std::vector K_I; // result of the recursive hash operations uint8_t size_hash_f = d_osnma_data.d_dsm_kroot_message.ks / 8; - // compute the current tesla key , GST_SFi and K_II change in each iteration + // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) for (uint8_t i = 1; i < num_of_hashes_needed ; i++) { // build message digest m = (K_I+1 || GST_SFi || alpha) @@ -762,13 +812,12 @@ void osnma_msg_receiver::read_mack_body() msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); msg.push_back(d_GST_Sf & 0x000000FF); - - for (uint8_t k = 5; k >= 0;k--) + // extract alpha + for (int k = 5; k >= 0;k--) { // TODO: static extracts the MSB in case from larger to shorter int? msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. } - // compute hash std::vector hash; if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. @@ -790,58 +839,61 @@ void osnma_msg_receiver::read_mack_body() K_I.push_back(hash[i]); } - // set parameters + // set parameters for next iteration GST_SFi -= 30; // next SF time is the actual minus 30 seconds K_II = K_I; // next key is the actual one K_I.clear(); // empty the actual one for a new computation } // compare computed current key against received key - bool result_comparison; // TODO - not needed? if(K_I.size() != d_osnma_data.d_mack_message.key.size()) { std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; } if (K_II == d_osnma_data.d_mack_message.key) { - result_comparison = true; std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; // TODO - propagate result // TODO - save current tesla key as latest one? // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence - - } else { - result_comparison = false; std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; } } +/** + * @brief Verifies the tags. + * + * \details This function is responsible for processing the MACK message received (480 bits). It stores the last 10 MACK + * messages and last 10 NavData messages. It also performs MACSEQ validation and compares + * the ADKD of Mack tags with MACLT defined ADKDs. Finally, it verifies the tags. + * + * @param osnma_msg A reference to OSNMA_msg containing the MACK message to be processed. + */ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { d_old_mack_message.push_back(d_osnma_data.d_mack_message); // last 10 MACKs are needed to be stored as per ICD - // populate d_nav_data with three classes of osnma_msg + // populate d_nav_data with three classes of osnma_msg - needed for the tag verification d_osnma_data.d_nav_data.EphemerisData = osnma_msg->EphemerisData; d_osnma_data.d_nav_data.IonoData = osnma_msg->IonoData; d_osnma_data.d_nav_data.UtcData = osnma_msg->UtcModelData; d_osnma_data.d_nav_data.generate_eph_iono_vector2(); d_osnma_data.d_nav_data.generate_utc_vector(); d_old_navdata_buffer.push_back(d_osnma_data.d_nav_data); // last 10 NavData messages are needed to be stored as per ICD - // MACSEQ validation - case no FLX Tags // retrieve data to verify MACK tags uint8_t msg {0}; - uint8_t nt {0}; +// uint8_t nt {0}; std::vector sq1{}; std::vector sq2{}; const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); if (it != OSNMA_TABLE_16.cend()) { - uint8_t msg = it->second.msg; - uint8_t nt = it->second.nt; +// uint8_t msg = it->second.msg; +// uint8_t nt = it->second.nt; std::vector sq1 = it->second.sequence1; std::vector sq2 = it->second.sequence2; } @@ -850,6 +902,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& return; } std::vector sequence; + // Assign relevant sequence based on subframe time if (d_GST_Sf % 60 == 0) { sequence = sq1; @@ -885,15 +938,15 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // MACSEQ verification - // Case no tags defined as FLX in the MACLT - std::vector m(5 + flxTags.size()); // C: ICD - Eq. 22 + // Fixed as well as FLX Tags share first part - Eq. 22 ICD + std::vector m(5 + flxTags.size()); m[0] = static_cast(osnma_msg->PRN); // PRN_A m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); m[4] = static_cast(d_GST_Sf & 0x000000FF); - // Case tags flexible + // Case tags flexible - Eq. 21 ICD for (uint8_t i = 0; i < flxTags.size() ; i++) { m[i+5] = d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; @@ -902,6 +955,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& std::vector applicable_key; // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full // otherwise pick d_old_mack_message.back() + // compute mac applicable_key = d_old_mack_message.back().key; std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 @@ -919,7 +973,10 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& mac_msb = (mac[0] << 8) + mac[1]; } uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; // TODO - double check, it was 0x0FFF which presuposes little endian... - int num_tags_added = 0; + +// int num_tags_added = 0; + + // Verify tags if MACSEQ is authenticated if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) { std::cout << "OSNMA: MACSEQ authenticated for PRN_A " @@ -928,13 +985,15 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& << osnma_msg->TOW_sf0 << ". Verifying tags. " << std::endl; - uint8_t l_t_verified = 0; // tag bits verified - uint8_t i = 0; // TODO - configuration file must define which tags shall be verified - // e.g. NavDataVerification: A == ALL, T == Timing Parameters, ECS == Ephemeris,Clock and Status. - std::string navDataToVerify = "EphemerisClockAndStatus"; // ADKD 0 - // Timing Parameters ADKD 4 - // EphemerisClockAndStatus ADKD 12 10+ Delay + // e.g. NavDataVerification: A{0,12,4} == ALL, T == Timing Parameters {4}, ECS == Ephemeris,Clock and Status{0,12}. + std::string navDataToVerify = "EphemerisIonoAndClock"; // ADKD 0 +1 delay ADKD 12 +10 delay + // std::string navDataToVerify = "TimingParameters"; ADKD 4 +1 delay + // std::string navDataToVerify = "ALL"; + std::vector adkd; +// uint8_t adkd; + adkd = {0,12,4}; + m.clear(); uint8_t lt_bits = 0; const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); @@ -946,21 +1005,73 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. } - while (i < d_osnma_data.d_mack_message.tag_and_info.size() && l_t_verified < d_Lt_min) + + + + + // Verify each tag + // std::string tagsToVerify = "all"; // Ephemeris, UTC, SlowEphemeris, all + // all -> process ADKD 0, 12 and 4 + // Ephemeris -> process ADKD 0 and 12 only (and if 12, then the applicable key has 10 subframes delay) + // UTC -> process ADKD 4 only + uint8_t i = 0; + while (i < d_osnma_data.d_mack_message.tag_and_info.size() && + std::find(adkd.begin(),adkd.end(),d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD) != adkd.end()) { + // select applicable tesla key + if (d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 0) + { + applicable_key = d_old_mack_message.back().key; // SF - 1 + } + else if (d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 12) + { + // check is the buffer is full or not + if (d_old_mack_message.size() == d_old_mack_message.capacity()) + { + applicable_key = d_old_mack_message.front().key; // SF - 10 + } + else + { + std::cout << "Galileo OSNMA: Old MACK message buffer is not full. Cannot verify slow mac. " << std::endl; + } + } + else if (d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 4) + { + applicable_key = d_old_mack_message.back().key; // SF - 1 + } + else + { + std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; + } + // compute m m.push_back(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.PRN_d); - m.push_back(osnma_msg->PRN); + for(int i = 24; i >= 0; i -= 8) + { + m.push_back((osnma_msg->PRN >> i) & 0xFF); + } m.push_back(static_cast((d_GST_Sf & 0xFF000000) >> 24)); m.push_back(static_cast((d_GST_Sf & 0x00FF0000) >> 16)); m.push_back(static_cast((d_GST_Sf & 0x0000FF00) >> 8)); m.push_back(static_cast(d_GST_Sf & 0x000000FF)); - m.push_back(i+1); // CTRauto + m.push_back(i+1); // CTR m.push_back(d_osnma_data.d_nma_header.nmas); - // TODO - other ADKD need different data. - // TODO - store buffer the NavData of 11 last subframes, ADKD 0 and 12 => NavData belongs to SF-1 - m.insert(m.end(),osnma_msg->EphemerisClockAndStatusData.begin(),osnma_msg->EphemerisClockAndStatusData.end()) ; + if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 0 || + d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 12) + { + m.insert(m.end(),osnma_msg->EphemerisClockAndStatusData.begin(),osnma_msg->EphemerisClockAndStatusData.end()) ; + } + else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 4) + { + m.insert(m.end(),osnma_msg->TimingData.begin(),osnma_msg->TimingData.end()) ; + } + else + { + std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; + } i = 0; + // check that m has an integer number of bytes, if not, add padding zeroes + while (i<10/*TODO - number of padding zeroes to be computed*/) { m.push_back(0); @@ -977,7 +1088,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& mac = d_crypto->computeCMAC_AES(applicable_key, m); } - // compute tag = trunc(l_t, mac(K,m)) Eq. 23 ICD + // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD uint64_t computed_mac = static_cast(mac[0]) << (lt_bits - 8); computed_mac += (static_cast(mac[1]) << (lt_bits - 16)); if (lt_bits == 20) @@ -1008,15 +1119,34 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // Compare computed tag with received one truncated if (d_osnma_data.d_mack_message.tag_and_info[i].tag == computed_mac) { - std::cout << "Galileo OSNMA: Tag verification successful " << std::endl; - l_t_verified += lt_bits; + if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 0 || d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 12) + { + std::cout << "Galileo OSNMA: Tag verification successful - Ephemeris, Clock and Ionospheric data " << std::endl; + d_Lt_verified_eph += lt_bits; + } + else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 4) + { + std::cout << "Galileo OSNMA: Tag verification successful - Timing data " << std::endl; + d_Lt_verified_utc += lt_bits; + } } else { std::cout << "Galileo OSNMA: Tag verification failed " << std::endl; } + if (d_Lt_verified_eph >= d_Lt_min) + { + std::cout << "Galileo OSNMA: Ephemeris, Clock and Ionospheric data verified successfully " << std::endl; + d_Lt_verified_eph = 0; + } + if (d_Lt_verified_utc >= d_Lt_min) + { + std::cout << "Galileo OSNMA: Timing data verified successfully " << std::endl; + d_Lt_verified_utc = 0; + } } + } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 6b694f32d..99ee9d94b 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -88,6 +88,8 @@ private: bool d_kroot_verified{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification uint8_t d_Lt_min {}; // minimum equivalent tag length + uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris + uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; std::time_t d_receiver_time {}; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 869ba3c35..bccbb1ad7 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1382,6 +1382,14 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) } +/** + * @brief Get data relevant for Galileo OSNMA + * + * \details This function retrieves various parameters and data to compose the OSNMA_msg. + * It fills the TOW and WN fields of the message and retrieves ephemeris, iono, and + * + * @return The OSNMA message + */ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() { // TODO - why PRN of word 4 is done separately? @@ -1394,7 +1402,6 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() TOW_sf0 += 604800; } nma_msg.TOW_sf0 = static_cast(TOW_sf0); -// nma_msg.TOW_sf0 = static_cast(TOW_0); // get ephemeris, clock and iono correction datn and GST-UTC and GST-GPS converstion parameters (may be incomplete) nma_msg.EphemerisData = get_ephemeris(); nma_msg.IonoData = get_iono(); From ce6036e431e291143d8af0b0301ca703f2f29f48 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 12 Feb 2024 21:02:52 +0100 Subject: [PATCH 090/499] Increase time difference limit and refactor key length retrieval The time difference limit between local time and OSNMA subframe time has been increased from 15 to 120. Additionally, key length retrieval condensed. Minor adjustments in tesla key, padding of bits, and success messaging during data verification. --- src/core/libs/osnma_msg_receiver.cc | 42 +++++++++++------------------ 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 575e6d337..e4e43ebb0 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -123,8 +123,8 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // compare local time with OSNMA subframe time d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... auto OSNMA_UTC_time = nma_msg->UtcModelData.GST_to_UTC_time(d_GST_SIS, nma_msg->WN_sf0); - double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time - if(abs(OSNMA_UTC_time - d_receiver_time) <= T_L) + double_t T_L = 120; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time + if(abs(OSNMA_UTC_time - OSNMA_UTC_time /*d_receiver_time*/) <= T_L) { process_osnma_message(nma_msg); } @@ -624,19 +624,10 @@ void osnma_msg_receiver::read_mack_body() return; } // retrieve key length - uint16_t lk_bits = 0; - const auto it2 = OSNMA_TABLE_10.find(d_osnma_data.d_dsm_kroot_message.ks); - if (it2 != OSNMA_TABLE_10.cend()) - { - lk_bits = it2->second; - } - if (lk_bits == 0) - { - return; - } + const uint16_t lk_bits = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks); // compute number of tags in the given Mack message as per Eq. 8 ICD uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); - d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); + d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); // TODO - why nt-1? tag0 is not included? // retrieve tags and tag-info associated with the tags for (uint16_t k = 0; k < (nt - 1); k++) { @@ -800,7 +791,7 @@ void osnma_msg_receiver::read_mack_body() uint32_t GST_SFi = d_GST_Sf; std::vector K_II = d_osnma_data.d_mack_message.key; std::vector K_I; // result of the recursive hash operations - uint8_t size_hash_f = d_osnma_data.d_dsm_kroot_message.ks / 8; + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) for (uint8_t i = 1; i < num_of_hashes_needed ; i++) { @@ -833,8 +824,8 @@ void osnma_msg_receiver::read_mack_body() hash = std::vector(32); } // truncate hash - K_I.reserve(size_hash_f); // TODO - case hash function has 512 bits - for (uint16_t i = 0; i < size_hash_f; i++) + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + for (uint16_t i = 0; i < lk_bytes; i++) { K_I.push_back(hash[i]); } @@ -845,7 +836,7 @@ void osnma_msg_receiver::read_mack_body() K_I.clear(); // empty the actual one for a new computation } // compare computed current key against received key - if(K_I.size() != d_osnma_data.d_mack_message.key.size()) + if(K_II.size() != d_osnma_data.d_mack_message.key.size()) { std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; } @@ -991,9 +982,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // std::string navDataToVerify = "TimingParameters"; ADKD 4 +1 delay // std::string navDataToVerify = "ALL"; std::vector adkd; -// uint8_t adkd; - adkd = {0,12,4}; - + adkd = {0,12,4}; // ADKD will have 0, 12, 4 or any combination of those 3 - maybe more in the future (up to 16 values) m.clear(); uint8_t lt_bits = 0; const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); @@ -1071,12 +1060,9 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& } i = 0; // check that m has an integer number of bytes, if not, add padding zeroes - - while (i<10/*TODO - number of padding zeroes to be computed*/) - { - m.push_back(0); - i++; - } + // padding zeroes until size of vector is an integer number of bytes. + // I think not needed, if bytes of m correctly formatted (i.e. added in big-endianness) -> the unused bits will be zero + // and the vector has an integer number of uint8_t elements. // compute mac if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 @@ -1139,11 +1125,15 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { std::cout << "Galileo OSNMA: Ephemeris, Clock and Ionospheric data verified successfully " << std::endl; d_Lt_verified_eph = 0; + // send info to PVT: navdata SF i-1 authenticated + break; } if (d_Lt_verified_utc >= d_Lt_min) { std::cout << "Galileo OSNMA: Timing data verified successfully " << std::endl; d_Lt_verified_utc = 0; + // send info to PVT: navdata SF i-1 authenticated + break; } } From eb23504d0b71e916b6df413c103156360baca0e8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 18 Feb 2024 21:11:41 +0100 Subject: [PATCH 091/499] Bump local version of glog to 0.7.0 --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99e567462..9ad58d673 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,7 +337,7 @@ set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") ################################################################################ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.6.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") -set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") +set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.26") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") @@ -348,6 +348,9 @@ set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.3") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") # Downgrade versions if requirements are not met +if(CMAKE_VERSION VERSION_LESS "3.22") + set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") +endif() if(CMAKE_VERSION VERSION_LESS "3.16") set(GNSSSDR_GLOG_LOCAL_VERSION "0.5.0") endif() @@ -1729,6 +1732,9 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu if(GNSSSDR_GLOG_LOCAL_VERSION VERSION_GREATER 0.5.0) set(GLOG_GTEST -DWITH_GTEST=FALSE) endif() + if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) + set(GNSSSDR_GLOG_LOCAL_GFLAGS -DCMAKE_REQUIRED_INCLUDES=${GFlags_INCLUDE_DIRS}) + endif() ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} DEPENDS ${TARGET_GFLAGS} PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} @@ -1743,6 +1749,7 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu -DBUILD_SHARED_LIBS=OFF ${GLOG_GTEST} -DBUILD_TESTING=OFF + "${GNSSSDR_GLOG_LOCAL_GFLAGS}" BUILD_COMMAND "${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}" BUILD_BYPRODUCTS ${GLOG_BUILD_BYPRODUCTS} UPDATE_COMMAND "" @@ -1800,6 +1807,9 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu endif() endif() endif() + if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) + target_precompile_headers(Glog::glog INTERFACE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/glog/export.h) + endif() if(LIBUNWIND_FOUND) target_link_libraries(Glog::glog INTERFACE Libunwind::libunwind) From f446bf3238b194bac8ad9a4aef0ef00b7000059a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Feb 2024 17:54:18 +0100 Subject: [PATCH 092/499] Add missing include Fix compilation against glog-0.7.0 --- src/algorithms/signal_source/libs/fpga_buffer_monitor.cc | 1 + src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc | 1 + src/algorithms/signal_source/libs/fpga_switch.cc | 1 + 3 files changed, 3 insertions(+) diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 136409f12..449579441 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -31,6 +31,7 @@ #include // for string, ofstream #include // for cout #include // for mmap +#include // for close #include // for move diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc index 933d8b77f..8cec947ef 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc @@ -25,6 +25,7 @@ #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap +#include // for close Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band) : d_map_base_freq_band_1(nullptr), diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index 4bcbe4dc9..b56f63bf5 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -25,6 +25,7 @@ #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap +#include // for close Fpga_Switch::Fpga_Switch(const std::string &device_name) { From 80e6d8df187069c996ced4d65f5e4cae14bc5bff Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 20 Feb 2024 15:49:36 +0100 Subject: [PATCH 093/499] Add unit tests for GNSS_crypto Introduced unit tests in `gnss_crypto_test.cc` to verify the functionality set_public_key and verify_signature. The added tests check the correctness of signature verification and public key import processes. Further minor changes --- .../galileo_telemetry_decoder_gs.cc | 3 +- src/core/libs/osnma_msg_receiver.cc | 2 +- src/core/system_parameters/Galileo_OSNMA.h | 2 +- src/core/system_parameters/gnss_crypto.cc | 118 +++++++++++++- src/core/system_parameters/gnss_crypto.h | 4 + src/tests/CMakeLists.txt | 35 +++++ src/tests/test_main.cc | 1 + .../osnma/gnss_crypto_test.cc | 147 ++++++++++++++++++ .../osnma/osnma_sha2_test.cpp | 29 ---- 9 files changed, 303 insertions(+), 38 deletions(-) create mode 100644 src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc delete mode 100644 src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp 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 991fb6895..c3ee4b6e7 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 @@ -592,7 +592,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // get osnma message if the needed nav data is available auto adkd_4_12_nav_data_available = d_flag_osnma_iono_and_time && d_flag_osnma_ephemeris; - if (d_band == '1' && d_inav_nav.have_new_nma() == true && adkd_4_12_nav_data_available == true && d_flag_osnma_utc_model == true) + auto newOSNMA = d_inav_nav.have_new_nma(); + if (d_band == '1' && newOSNMA && adkd_4_12_nav_data_available == true && d_flag_osnma_utc_model == true) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e4e43ebb0..e71d77603 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -305,10 +305,10 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ * */ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg) { + // DSM-KROOT message if (d_osnma_data.d_dsm_header.dsm_id < 12) { LOG(WARNING) << "OSNMA: DSM-KROOT message received."; - // DSM-KROOT message d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg); d_osnma_data.d_dsm_kroot_message.cidkr = d_dsm_reader->get_cidkr(dsm_msg); diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 2cf1104af..44f607370 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -160,7 +160,7 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-256"), 512}, {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} -const std::string PEMFILE_DEFAULT("./OSNMA_PublicKey_20210920133026.pem"); +const std::string PEMFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem"); const std::string MERKLEFILE_DEFAULT("./OSNMA_MerkleTree_20210920133026.xml"); class Mack_lookup diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index eb9d38ca0..49beff26b 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -39,6 +39,7 @@ #include #include #include +#include #endif @@ -63,6 +64,11 @@ Gnss_Crypto::~Gnss_Crypto() EC_KEY_free(d_PublicKey); } #endif +#else // GNU-TLS + if (d_PublicKey != NULL) { + gnutls_pubkey_deinit(d_PublicKey); + d_PublicKey = NULL; + } #endif } @@ -473,9 +479,11 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) std::cerr << "GnuTLS: error reading the Public Key from file " << pemFilePath << ". Aborting import" << std::endl; + std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; return; } - d_PublicKey = pubkey; + + pubkey_copy(pubkey, &d_PublicKey); gnutls_pubkey_deinit(pubkey); #endif std::cout << "Public key successfully read from file " << pemFilePath << std::endl; @@ -486,6 +494,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { if (!have_public_key()) { + std::cerr << "GnuTLS error: public key not available"<< std::endl; return false; } bool success = false; @@ -539,10 +548,16 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #endif #else +// // GNU-TLS +// gnutls_global_init(); +// // debug info gnu-tls remove when not needed anymore! +// gnutls_global_set_log_level(9); +// gnutls_global_set_log_function(Gnss_Crypto::my_log_func); + unsigned int bit_size; if (gnutls_pubkey_get_pk_algorithm(d_PublicKey, &bit_size) != GNUTLS_PK_ECDSA) { - std::cout << "GnuTLS: the Public Key does not contain a ECDSA key. Aborting signature verification" << std::endl; + std::cerr << "GnuTLS: the Public Key does not contain a ECDSA key. Aborting signature verification" << std::endl; } gnutls_datum_t signature_{}; signature_.data = const_cast(signature.data()); @@ -557,8 +572,9 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } else { - std::cerr << "GnuTLS: message authentication failed" << std::endl; + std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; } +// gnutls_global_deinit(); #endif return success; } @@ -603,10 +619,40 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector& publicKey) { #if USE_OPENSSL_FALLBACK - // TODO - convert to OSSL PubKey format + // TODO #else -// GNU-TLS - // TODO - convert to gnutls_pubkey_st +// // GNU-TLS +// gnutls_global_init(); +// +// // debug info gnu-tls remove when not needed anymore! +// gnutls_global_set_log_level(9); +// gnutls_global_set_log_function(Gnss_Crypto::my_log_func); + + + gnutls_pubkey_t pubkey; + gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; + gnutls_pubkey_init(&pubkey); + int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); + //ret = gnutls_pubkey_import_x509_raw(pubkey, &pemDatum,GNUTLS_X509_FMT_PEM,0); + if (ret != GNUTLS_E_SUCCESS) + { + gnutls_pubkey_deinit(pubkey); + std::cerr << "GnuTLS: error setting the public key " + << ". Aborting import" << std::endl; + std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; + return; + } + // d_PublicKey = pubkey; + pubkey_copy(pubkey, &d_PublicKey); +// std::cout << "pubkey: " << std::endl; +// print_pubkey_hex(pubkey); +// std::cout << "d_PublicKey before : " << std::endl; +// print_pubkey_hex(d_PublicKey); + gnutls_pubkey_deinit(pubkey); +// std::cout << "d_PublicKey after: " << std::endl; +// print_pubkey_hex(d_PublicKey); + +// gnutls_global_deinit(); #endif } @@ -621,3 +667,63 @@ std::vector Gnss_Crypto::get_public_key() #endif return {}; } + + void Gnss_Crypto::my_log_func(int level, const char *msg) { + fprintf(stderr, " %s", level, msg);} + + // gnutls-specific functions + void Gnss_Crypto::print_pubkey_hex(gnutls_pubkey_t pubkey) + { + gnutls_datum_t key_datum; + int ret; + + // Export the public key from pubkey to memory in DER format + ret = gnutls_pubkey_export2(pubkey, GNUTLS_X509_FMT_PEM, &key_datum); + if (ret < 0) { + std::cerr << "Failed to export public key: " << gnutls_strerror(ret) << std::endl; + return; + } + + std::stringstream ss; + + // Iterate through each byte in key_datum.data and print its hex value + for (unsigned int i = 0; i < key_datum.size; ++i) { + ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(key_datum.data[i]); + } + + std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; + + // Free the memory allocated to key_datum.data + gnutls_free(key_datum.data); + } + + bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) + { + gnutls_datum_t key_datum; + int ret; + + // Export the public key from src to memory + ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); + if(ret < 0) { + gnutls_free(key_datum.data); + return false; + } + + // Initialize dest + ret = gnutls_pubkey_init(dest); + if(ret < 0) { + gnutls_free(key_datum.data); + return false; + } + + // Import the public key data from key_datum to dest + ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); + gnutls_free(key_datum.data); + + if(ret < 0) { + gnutls_pubkey_deinit(*dest); + return false; + } + + return true; + } diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 6f405cc24..96830b937 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -67,6 +67,10 @@ private: #endif #else gnutls_pubkey_t d_PublicKey{}; + void set_ecc_key(const std::vector& pK, const std::vector ecP); + static void my_log_func(int level, const char* msg); + void print_pubkey_hex(gnutls_pubkey_t); + bool pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest); #endif std::vector d_x_4_0; std::vector d_x_3_1; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 5863284ba..7d6951aba 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -7,6 +7,7 @@ add_subdirectory(unit-tests/signal-processing-blocks/libs) add_subdirectory(system-tests/libs) +include_directories("${GNSSSDR_SOURCE_DIR}/src/core/receiver") ################################################################################ # Google Test - https://github.com/google/googletest @@ -1267,3 +1268,37 @@ endif() if(ENABLE_BENCHMARKS) add_subdirectory(benchmarks) endif() + + +if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) + set(GNSS_CRYPTO_TEST_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc + ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc) + + # Configure the test executable: + if(USE_CMAKE_TARGET_SOURCES) + add_executable(gnss_crypto_test) + target_sources(gnss_crypto_test PRIVATE ${GNSS_CRYPTO_TEST_SOURCES}) + else() + add_executable(gnss_crypto_test ${GNSS_CRYPTO_TEST_SOURCES}) + endif() + + # Link libraries that gnss_crypto_test requires: + target_link_libraries(gnss_crypto_test + PRIVATE + Boost::thread + Gflags::gflags + Glog::glog + GTest::GTest + GTest::Main + core_system_parameters + ) + + # Include any directories your test needs for header files: + target_include_directories(gnss_crypto_test + PRIVATE + #${GNSSSDR_SOURCE_DIR}/src/algorithms, + #${GNSSSDR_SOURCE_DIR}/src/core, + #${GNSSSDR_SOURCE_DIR}/src/core/receiver, + ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) +endif() \ No newline at end of file diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 3769756aa..8fc8efd57 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -72,6 +72,7 @@ DECLARE_string(log_dir); #include "unit-tests/signal-processing-blocks/adapter/adapter_test.cc" #include "unit-tests/signal-processing-blocks/adapter/pass_through_test.cc" #include "unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc" +#include "unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc" #include "unit-tests/signal-processing-blocks/pvt/geohash_test.cc" #include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc" diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc new file mode 100644 index 000000000..89898ca99 --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -0,0 +1,147 @@ +#include +#include "gnss_crypto.h" +class GnssCryptoTest : public ::testing::Test +{ + +}; +TEST(GnssCryptoTest, VerifySignature) { + // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" + std::unique_ptr d_crypto = std::make_unique(); + + // RG example - import crt certificate + // std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; + // std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; + // std::vector publicKey { // PEM format - 1000 bits + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + // + // 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, + // + // 0x0A, + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; + + // own ECDSA-P256 key and message generated and signed and verified successfully with openssl + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final + std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, + 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, + 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; + std::vector publicKey{ + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + + 0x4D, 0x46, + 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, + 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, + 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, + 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, + 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, + + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x0A }; + + // own key - GnuTLS error: The curve is unsupported... x192 EC unsupported?? + // std::vector message = {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64 }; // hello world + // std::vector signature = {0x30, 0x34, 0x02, 0x18, 0x4F, 0xAC, 0x9C, 0x5A, 0x44, 0xCF, 0xFD, 0x42, 0x6A, 0x58, 0x97, 0xA4, 0x94, 0x53, 0x2C, 0x79, 0xD1, 0x7B, 0x8B, 0xF9, 0x93, 0x03, 0xA2, 0xAF, 0x02, 0x18, 0x46, 0xF2, 0xF3, 0xCF, 0x9A, 0x23, 0x39, 0xB4, 0x25, 0x11, 0x89, 0x9A, 0x44, 0x7E, 0x2F, 0xB1, 0xE1, 0x58, 0xAF, 0xCE, 0xC1,0xB4, 0xA1, 0x38 }; + // std::vector publicKey = { + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x45, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x49, 0x44, 0x4D, 0x67, 0x41, 0x45, 0x51, 0x55, 0x61, 0x30, 0x6C, 0x38, 0x4D, 0x35, 0x76, 0x50, 0x58, 0x2B, 0x74, 0x4A, 0x76, 0x63, 0x4C, 0x2B, 0x45, 0x45, 0x4C, 0x34, 0x6E, 0x71, 0x79, 0x75, 0x53, 0x43, 0x0A, 0x4D, 0x4E, 0x46, 0x4A, 0x64, 0x43, 0x5A, 0x62, 0x62, 0x58, + // 0x35, 0x70, 0x4D, 0x36, 0x69, 0x4C, 0x52, 0x53, 0x30, 0x43, 0x51, 0x59, 0x45, 0x67, 0x56, 0x47, 0x51, 0x6B, 0x65, 0x75, 0x74, 0x74, 0x35, 0x78, 0x2F, 0x45, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, + // 0x0A }; + // std::vector ecparam = { + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51, 0x4D, 0x42, 0x41, 0x67, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, + // 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; + + d_crypto->set_public_key(publicKey); + bool result = d_crypto->verify_signature(message, signature); + + ASSERT_TRUE(result); + +//TEST(GnssCryptoTest, sha256Test) +//{ +// std::unique_ptr d_crypto; +// +// auto str = "Hello World!"; +// std::vector input (str, str + strlen(str)); +// +// auto expectedOutputStr = "86933b0b147ac4c010266b99004158fa17937db89a03dd7bb2ca5ef7f43c325a"; +// std::vector expectedOutput(expectedOutputStr, expectedOutputStr + strlen(expectedOutputStr)); +// +// std::vector computedOutput = d_crypto->computeSHA256(input); +// +// ASSERT_TRUE(computedOutput == expectedOutput + } + + +TEST(GnssCryptoTest,VerifyPubKeyImport) +{ + // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" + std::unique_ptr d_crypto = std::make_unique(); + + // RG example - key is raw 520 bits example shown + // std::vector publicKey = { // base64 decoding error + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + // + // 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, + // 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, + // 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, + // 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, 0x47, 0x49, + // + // 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A + // + // }; + + // RG example crt exported and convert PK.pem - key is raw 1000 bits ,..., why mismatch!? does key get truncated? + // std::vector publicKey { + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; + // own ECDSA P 256 public key and own message generated (2024-02-19-Own-Key-ECDSA-openssl) + std::vector publicKey{ // PEM + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + + 0x4D, 0x46, + 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, + 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, + 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, + 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, + 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, + + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x0A }; + + d_crypto->set_public_key(publicKey); + + ASSERT_TRUE(d_crypto->have_public_key()); + + + + + + + + // std::vector publicKey = { // DER format +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, +// 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, +// 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x30, 0x82, 0x02, 0x6C, 0x30, 0x82, 0x02, 0x12, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47, 0xC4, 0xF1, 0x43, 0xC3, 0xFA, 0x61, 0xA5, 0x29, 0x4E, 0x63, +// 0xD5, 0x57, 0x2B, 0x01, 0x62, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x37, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x18, 0x30, +// 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x45, 0x55, 0x53, 0x50, 0x41, 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x49, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x33, 0x30, 0x37, 0x32, 0x30, 0x31, 0x31, 0x32, 0x32, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x35, 0x30, 0x38, 0x30, 0x38, 0x31, 0x31, 0x33, +// 0x33, 0x30, 0x30, 0x5A, 0x30, 0x3A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x12, 0x45, 0x55, 0x53, 0x50, 0x41, +// 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x45, 0x45, 0x20, 0x50, 0x4B, 0x52, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, +// 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, +// 0x47, 0x49, 0xA3, 0x81, 0xFC, 0x30, 0x81, 0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6A, 0x22, 0x16, 0x58, 0x9B, 0x23, 0xC9, 0x43, 0x41, 0x3C, 0xB6, 0xF8, 0x9D, 0x93, 0x0F, 0xE0, 0xFE, 0x6A, 0x3C, 0x54, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, +// 0x14, 0x20, 0xC0, 0x54, 0x85, 0xAF, 0x82, 0xAE, 0x96, 0x3C, 0xBC, 0xDF, 0xC1, 0xB9, 0x05, 0xDE, 0xD7, 0x46, 0x72, 0x32, 0xA3, 0x30, 0x63, 0x06, 0x03, 0x55, 0x1D, 0x20, 0x04, 0x5C, 0x30, 0x5A, 0x30, 0x4E, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0xD5, 0x11, 0x01, 0x01, 0x01, 0x30, 0x3F, 0x30, 0x3D, +// 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, +// 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x08, 0x06, 0x06, 0x04, 0x00, 0x8F, 0x7A, 0x01, 0x02, 0x30, 0x42, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x3B, 0x30, 0x39, 0x30, 0x37, 0xA0, 0x35, 0xA0, 0x33, 0x86, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, +// 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, +// 0x07, 0x80, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xE9, 0xBB, 0x90, 0x8E, 0xE5, 0x0C, 0xF3, 0xDA, 0x57, 0x71, 0xE3, 0xD0, 0xD2, 0xEA, 0xAC, 0x1B, 0x00, 0xF3, 0x51, 0xE9, 0xD8, 0xBB, 0x0A, 0xB2, 0x4C, 0x8A, 0x65, 0x52, 0x79, +// 0x9F, 0x43, 0xF6, 0x02, 0x20, 0x10, 0x65, 0x2F, 0x6A, 0xF8, 0x26, 0x20, 0x42, 0xFF, 0x09, 0x6B, 0xD0, 0x8D, 0x0B, 0x75, 0x15, 0x24, 0xBF, 0xE4, 0xFE, 0x60, 0xC3, 0x6E, 0x2D, 0x31, 0x32, 0xED, 0x65, 0x6C, 0x5C, 0x8B, 0x14 }; + +// std::vector publicKey= { // PEM format +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, +// 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, +// 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; + +} \ No newline at end of file diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp deleted file mode 100644 index 4e04a837f..000000000 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_sha2_test.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// Created by cghio on 17.01.24. -// -#include "gtest/gtest.h" -#include "gnss_crypto.h" -//#include "std" -#ifndef GNSS_SDR_GNSS_CRYPTO_SHA2_TEST_H -#define GNSS_SDR_GNSS_CRYPTO_SHA2_TEST_H - -class OsnmaCryptoTest : public :: testing ::Test{ -}; - -TEST_F(OsnmaCryptoTest, basicTest) -{ - std::unique_ptr d_crypto; - - auto str = "Hello World!"; - std::vector input (str, str + strlen(str)); - - auto expectedOutputStr = "86933b0b147ac4c010266b99004158fa17937db89a03dd7bb2ca5ef7f43c325a"; - std::vector expectedOutput(expectedOutputStr, expectedOutputStr + strlen(expectedOutputStr)); - - std::vector computedOutput = d_crypto->computeSHA256(input); - - ASSERT_TRUE(computedOutput == expectedOutput); - -} - -#endif // GNSS_SDR_GNSS_CRYPTO_SHA2_TEST_H From 11b3a4a8174681704f67477026c16ff66d305913 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 20 Feb 2024 15:52:30 +0100 Subject: [PATCH 094/499] Fix unknown command line flag 'gtest_color' Command line parameters are now parsed after initializing gtest. --- src/tests/single_test_main.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 5f8d52aab..5f3783f9d 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -15,7 +15,6 @@ * ----------------------------------------------------------------------------- */ - #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" @@ -39,10 +38,11 @@ DECLARE_string(log_dir); int main(int argc, char **argv) { - gflags::ParseCommandLineFlags(&argc, &argv, true); + try { testing::InitGoogleTest(&argc, argv); + gflags::ParseCommandLineFlags(&argc, &argv, true); } catch (...) { From 58c066bd9eae311ae6d0ac9f8e1878b665e7caea Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 21 Feb 2024 17:39:43 +0100 Subject: [PATCH 095/499] Find dependencies in the loongarch64 architecture --- CMakeLists.txt | 1 + cmake/Modules/FindCPUFEATURES.cmake | 1 + cmake/Modules/FindGFLAGS.cmake | 1 + cmake/Modules/FindGFORTRAN.cmake | 1 + cmake/Modules/FindGLOG.cmake | 1 + cmake/Modules/FindGNURADIO.cmake | 1 + cmake/Modules/FindGRIIO.cmake | 1 + cmake/Modules/FindGRLIMESDR.cmake | 1 + cmake/Modules/FindGROSMOSDR.cmake | 1 + cmake/Modules/FindLIBAD9361.cmake | 1 + cmake/Modules/FindLIBIIO.cmake | 1 + docs/CHANGELOG.md | 12 +++++++++++- 12 files changed, 22 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ad58d673..245d429eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2160,6 +2160,7 @@ find_library(GNUTLS_OPENSSL_LIBRARY /usr/lib/sparc64-linux-gnu /usr/lib/x86_64-linux-gnux32 /usr/lib/sh4-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindCPUFEATURES.cmake b/cmake/Modules/FindCPUFEATURES.cmake index 6f25e91d2..7c25e69c2 100644 --- a/cmake/Modules/FindCPUFEATURES.cmake +++ b/cmake/Modules/FindCPUFEATURES.cmake @@ -34,6 +34,7 @@ find_library(CPUFEATURES_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindGFLAGS.cmake b/cmake/Modules/FindGFLAGS.cmake index 2649380c9..08a5056b8 100644 --- a/cmake/Modules/FindGFLAGS.cmake +++ b/cmake/Modules/FindGFLAGS.cmake @@ -78,6 +78,7 @@ else() /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindGFORTRAN.cmake b/cmake/Modules/FindGFORTRAN.cmake index a6eb38a53..89530518d 100644 --- a/cmake/Modules/FindGFORTRAN.cmake +++ b/cmake/Modules/FindGFORTRAN.cmake @@ -89,6 +89,7 @@ find_library(GFORTRAN NAMES gfortran /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /usr/local/lib/i386 diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index e483dfbe9..4805b3eaf 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -71,6 +71,7 @@ macro(_FIND_GLOG_LIBRARIES _var) /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 5ce37cba6..9855ddc29 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -131,6 +131,7 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE) /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindGRIIO.cmake b/cmake/Modules/FindGRIIO.cmake index e08290252..1abd5caf4 100644 --- a/cmake/Modules/FindGRIIO.cmake +++ b/cmake/Modules/FindGRIIO.cmake @@ -96,6 +96,7 @@ find_library(IIO_LIBRARIES /usr/lib/sparc64-linux-gnu /usr/lib/x86_64-linux-gnux32 /usr/lib/sh4-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindGRLIMESDR.cmake b/cmake/Modules/FindGRLIMESDR.cmake index cfd546feb..2fb60cb3f 100644 --- a/cmake/Modules/FindGRLIMESDR.cmake +++ b/cmake/Modules/FindGRLIMESDR.cmake @@ -96,6 +96,7 @@ find_library(GRLIMESDR_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/riscv64-linux-gnu /usr/lib/alpha-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindGROSMOSDR.cmake b/cmake/Modules/FindGROSMOSDR.cmake index cfaef1494..22ee7d51e 100644 --- a/cmake/Modules/FindGROSMOSDR.cmake +++ b/cmake/Modules/FindGROSMOSDR.cmake @@ -96,6 +96,7 @@ find_library(GROSMOSDR_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/riscv64-linux-gnu /usr/lib/alpha-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindLIBAD9361.cmake b/cmake/Modules/FindLIBAD9361.cmake index 80df49673..e1ff8e4a3 100644 --- a/cmake/Modules/FindLIBAD9361.cmake +++ b/cmake/Modules/FindLIBAD9361.cmake @@ -75,6 +75,7 @@ find_library(LIBAD9361_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/sh4-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindLIBIIO.cmake b/cmake/Modules/FindLIBIIO.cmake index 31f152b6f..44f4d367e 100644 --- a/cmake/Modules/FindLIBIIO.cmake +++ b/cmake/Modules/FindLIBIIO.cmake @@ -77,6 +77,7 @@ find_library( /usr/lib/x86_64-linux-gnux32 /usr/lib/sh4-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 0a1b7fee4..7fb402e3a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,10 +14,20 @@ All notable changes to GNSS-SDR will be documented in this file. ## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next) -### Improvements in Usability +### Improvements in Portability: + +- Fix building against google-glog 0.7.0 +- Find dependencies in the loongarch64 architecture. + +### Improvements in Usability: - Tidy up the `conf/` folder. +See the definitions of concepts and metrics at +https://gnss-sdr.org/design-forces/ + +  + ## [GNSS-SDR v0.0.19.1](https://github.com/gnss-sdr/gnss-sdr/releases/tag/v0.0.19.1) - 2024-01-26 [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.10579595.svg)](https://doi.org/10.5281/zenodo.10579595) From fbca34a4b41bfeefed02e2796efcd3e3648dce07 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 21 Feb 2024 17:49:24 +0100 Subject: [PATCH 096/499] Fix typo in changelog --- docs/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 7fb402e3a..c453414f6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -112,7 +112,7 @@ https://gnss-sdr.org/design-forces/ overkilling nine (the ninth decimal place worths up to 110 microns). Similarly, height in meters is now reported with two decimal places instead of three, and velocity in m/s also with two decimal places instead of three. -- Fixed the rate at which KLM, GPX, GeoJSON, and NMEA annotations are made. The +- Fixed the rate at which KML, GPX, GeoJSON, and NMEA annotations are made. The rate is now set by `PVT.output_rate_ms` (`500` ms by default), and can be particularized by `PVT.kml_rate_ms`, `PVT.gpx_rate_ms`, `PVT.geojson_rate_ms`, and `PVT.nmea_rate_ms`. Those values should be multiples of From 8e5d636132f111c8e2927ff4375ca7e2c40f0f5d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 23 Feb 2024 12:52:32 +0100 Subject: [PATCH 097/499] Bump local version of googletest to v1.14.0 --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 245d429eb..bda1423c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,7 +341,7 @@ set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.26") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") -set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0") +set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.0.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.3") @@ -375,6 +375,10 @@ if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() +if(CMAKE_VERSION VERSION_LESS "3.13") + set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") +endif() + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR CMAKE_VERSION VERSION_LESS 3.5) From 0a66cca3819458bb462b3fd3edb80bf025041387 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 25 Feb 2024 08:20:56 +0100 Subject: [PATCH 098/499] Fix for glog 0.7.0 --- cmake/Modules/FindGLOG.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index 4805b3eaf..bef1f7b6a 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -179,3 +179,8 @@ if(GLOG_FOUND AND NOT TARGET Glog::glog) INTERFACE_LINK_LIBRARIES "${GLOG_LIBRARIES}" ) endif() + +# Fix for glog 0.7.0 +if(EXISTS ${GLOG_INCLUDE_DIRS}/export.h) + target_precompile_headers(Glog::glog INTERFACE ${GLOG_INCLUDE_DIRS}/export.h) +endif() \ No newline at end of file From a10a465d304298b1b73dfb57d5745932077b704d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 25 Feb 2024 10:08:43 +0100 Subject: [PATCH 099/499] Be more strict in googletest requirements --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bda1423c2..5c1eeddc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -375,7 +375,9 @@ if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() -if(CMAKE_VERSION VERSION_LESS "3.13") +if(CMAKE_VERSION VERSION_LESS "3.13" OR + (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.1) OR + (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)) set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") endif() From 661a8aec0b7174e749f905660242f462d42efad4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 25 Feb 2024 10:32:34 +0100 Subject: [PATCH 100/499] Fix googletest tag --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5c1eeddc7..8aa6c5190 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -378,7 +378,7 @@ endif() if(CMAKE_VERSION VERSION_LESS "3.13" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.1) OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)) - set(GNSSSDR_GTEST_LOCAL_VERSION "1.12.1") + set(GNSSSDR_GTEST_LOCAL_VERSION "1.13.0") endif() if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) OR From 2988e2ac4a69e3d3c7906e091da6a3f1e39d5f1d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 26 Feb 2024 14:44:20 +0100 Subject: [PATCH 101/499] Fix CI for macos-based jobs --- .github/workflows/main.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 183a871ef..eeecbaf38 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,8 +54,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install ninja hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf - pip3 install mako + gflags glog gnuradio log4cpp openssl pugixml protobuf python-mako - name: configure run: cd build && cmake -GNinja .. - name: build @@ -83,8 +82,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf - pip3 install mako + gflags glog gnuradio log4cpp openssl pugixml protobuf python-mako - name: configure run: cd build && cmake -GXcode .. - name: build @@ -131,8 +129,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio \ - log4cpp openssl pugixml protobuf - pip3 install mako + log4cpp openssl pugixml protobuf python-mako ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin From ccbbd7b2e41f1ce5a58860ad1d6249924eb64b0f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 26 Feb 2024 15:05:01 +0100 Subject: [PATCH 102/499] Fix clang-tidy job --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index eeecbaf38..56e631df8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2020-2022 Carles Fernandez-Prades +# SPDX-FileCopyrightText: 2020-2024 Carles Fernandez-Prades name: Simple CI on: @@ -134,7 +134,7 @@ jobs: ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin - name: Prepare run - run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.13.0 core_monitor core_libs pvt_libs + run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.14.0 core_monitor core_libs pvt_libs - name: run clang-tidy run: cd build && run-clang-tidy -fix - name: check From 5a7087f3a75667882cb00dc361fb2d6f97de4e84 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 27 Feb 2024 08:08:53 +0100 Subject: [PATCH 103/499] Fix clang-tidy CI job --- CMakeLists.txt | 3 +++ cmake/Modules/FindGLOG.cmake | 3 +++ 2 files changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8aa6c5190..02724fe03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1815,6 +1815,9 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu endif() if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) target_precompile_headers(Glog::glog INTERFACE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/glog/export.h) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -x c++-header -include ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/glog/export.h) + endif() endif() if(LIBUNWIND_FOUND) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index bef1f7b6a..3bec26aa9 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -183,4 +183,7 @@ endif() # Fix for glog 0.7.0 if(EXISTS ${GLOG_INCLUDE_DIRS}/export.h) target_precompile_headers(Glog::glog INTERFACE ${GLOG_INCLUDE_DIRS}/export.h) + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -x c++-header -include ${GLOG_INCLUDE_DIRS}/export.h) + endif() endif() \ No newline at end of file From cb42c595541a605faeae206c4e5a77e044d25324 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 27 Feb 2024 08:27:22 +0100 Subject: [PATCH 104/499] Fix homebrew instructions in README.md file --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index 7e9fd62d9..e745bf336 100644 --- a/README.md +++ b/README.md @@ -867,20 +867,12 @@ $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/inst The script explains what it will do, and then it pauses before doing it. There are more installation options [here](https://docs.brew.sh/Installation.html). -Install pip3: - -``` -$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py -$ sudo python3 get-pip.py -``` - Install the required dependencies: ``` $ brew update && brew upgrade $ brew install armadillo cmake hdf5 gflags glog gnuradio libmatio log4cpp \ - openssl pkg-config protobuf pugixml -$ pip3 install mako + openssl pkg-config protobuf pugixml pyhon-mako $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ``` From 7a58a3e39b924c282e133521da1876c74169de9f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 27 Feb 2024 13:45:38 +0100 Subject: [PATCH 105/499] Better way to consume google-glog --- CMakeLists.txt | 7 +++---- cmake/Modules/FindGLOG.cmake | 5 +---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 02724fe03..889c6e09c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1814,10 +1814,9 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu endif() endif() if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) - target_precompile_headers(Glog::glog INTERFACE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/glog/export.h) - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -x c++-header -include ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/glog/export.h) - endif() + set_target_properties(Glog::glog PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT;GLOG_USE_GFLAGS" + INTERFACE_COMPILE_FEATURES "cxx_std_14") endif() if(LIBUNWIND_FOUND) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index 3bec26aa9..6c506643e 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -182,8 +182,5 @@ endif() # Fix for glog 0.7.0 if(EXISTS ${GLOG_INCLUDE_DIRS}/export.h) - target_precompile_headers(Glog::glog INTERFACE ${GLOG_INCLUDE_DIRS}/export.h) - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(CMAKE_CXX_COMPILE_OPTIONS_USE_PCH -Winvalid-pch -x c++-header -include ${GLOG_INCLUDE_DIRS}/export.h) - endif() + set_target_properties(Glog::glog PROPERTIES INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT") endif() \ No newline at end of file From 31f8e65c6d833baba6a4565705cdd71a0403b154 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 27 Feb 2024 15:52:49 +0100 Subject: [PATCH 106/499] CI: update uraimo/run-on-arch-action --- .github/workflows/gnss-sdr_archs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gnss-sdr_archs.yml b/.github/workflows/gnss-sdr_archs.yml index 6ba71fb64..ca9595187 100644 --- a/.github/workflows/gnss-sdr_archs.yml +++ b/.github/workflows/gnss-sdr_archs.yml @@ -41,7 +41,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2.6.0 + - uses: uraimo/run-on-arch-action@v2.7.1 name: Test in non-x86 container continue-on-error: ${{ contains(fromJson('["ppc64le", "s390x"]'), matrix.arch) }} id: test From 15264a69e89b0f6de2ea3be9188a8a83d07810b8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 27 Feb 2024 16:48:14 +0100 Subject: [PATCH 107/499] CI: update actions --- .github/workflows/citation.yml | 2 +- .github/workflows/volk_gnsssdr_archs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/citation.yml b/.github/workflows/citation.yml index 9de637fed..db667992c 100644 --- a/.github/workflows/citation.yml +++ b/.github/workflows/citation.yml @@ -24,7 +24,7 @@ jobs: uses: dieghernan/cff-validator@main # Upload artifact in case of failure - name: Update artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: citation-cff-errors diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index 0e3489647..734cda533 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2.6.0 + - uses: uraimo/run-on-arch-action@v2.7.2 name: Build in non-x86 container # continue-on-error: ${{ contains(fromJson('["ppc64le", "s390x"]'), matrix.arch) }} id: build From 9488008b89520eb572ae752d4776a8f134b239c2 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 27 Feb 2024 19:06:36 +0100 Subject: [PATCH 108/499] [TAS-153] Re-design time check requirement and how time is computed The OSNMA message receiver has been refactored to correct errors. It introduces new functions to process local time verification as well as DSM blocks. Flow of information between these functions is also changed, to improve readabilty and responsibility. Several TODO comments have been addressed as part of the changes. This commit also includes minor changes to the unit tests and system parameters classes. --- src/core/libs/osnma_msg_receiver.cc | 157 ++++++++++++------ src/core/libs/osnma_msg_receiver.h | 6 +- src/core/system_parameters/gnss_crypto.cc | 12 +- .../osnma/gnss_crypto_test.cc | 4 +- 4 files changed, 116 insertions(+), 63 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e71d77603..b3d0099fd 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -121,17 +121,20 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) << std::endl; // compare local time with OSNMA subframe time - d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... - auto OSNMA_UTC_time = nma_msg->UtcModelData.GST_to_UTC_time(d_GST_SIS, nma_msg->WN_sf0); - double_t T_L = 120; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time - if(abs(OSNMA_UTC_time - OSNMA_UTC_time /*d_receiver_time*/) <= T_L) - { +// if(d_receiver_time != 0) +// { +// // d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... +// // auto OSNMA_UTC_time = nma_msg->UtcModelData.GST_to_UTC_time(d_GST_SIS, nma_msg->WN_sf0); +// if(abs(OSNMA_UTC_time - OSNMA_UTC_time /*d_receiver_time*/) <= d_T_L) +// { process_osnma_message(nma_msg); - } - else - { - LOG(WARNING) << "OSNMA: Subframe received with time difference greater than " << T_L << " seconds"; - } +// } +// else +// { +// LOG(WARNING) << "OSNMA: Subframe received with time difference greater than " << T_L << " seconds"; +// } +// } + } else { @@ -160,6 +163,8 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_nma_header(osnma_msg->hkroot[0]); read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); + local_time_verification(osnma_msg); + process_dsm_block(osnma_msg); read_mack_block(osnma_msg); } @@ -276,8 +281,43 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } } } - std::cout << "]" << std::endl; + std::cout << "]" << std::endl; // TODO update documentation +} +void osnma_msg_receiver::local_time_verification(const std::shared_ptr& osnma_msg) +{ + // compute local time based on GST_SIS and GST_0 + d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; + d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; + // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. + if(d_receiver_time != 0) + { + + d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0)/30); // Eq. 3 R.G. +// d_receiver_time += 30; + std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; + + } + else + {// local time not initialised -> compute it. + d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // Eq. 3 R.G. + std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; + } + // verify time constraint + if( abs(d_receiver_time - d_GST_SIS) > d_T_L) + { + std::cerr << "Galileo OSNMA: time constraint violation" << std::endl; + std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << std::endl; + } + else + std::cout << "Galileo OSNMA: time constraint OK (|local_t - GST_SIS| < T_L) [|"<< static_cast(d_receiver_time - d_GST_SIS) + <<"|<"<< static_cast(d_T_L) <<"]"<< std::endl; + // TODO set flag to false to avoid processing dsm and MACK messages + // set global variables accordingly + +} +void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osnma_msg) +{ // if all inner blocks available -> Process DSM message if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cbegin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cend(), 0))) @@ -334,7 +374,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg l_ds_bits = it->second; } const uint16_t l_ds_bytes = l_ds_bits / 8; - d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); + d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); // C: this accounts for padding in case needed. for (uint16_t k = 0; k < l_ds_bytes; k++) { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + l_lk_bytes + k]; @@ -358,7 +398,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // validation of padding const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; - MSG.reserve(size_m + l_ds_bytes + 1); + MSG.reserve(size_m + l_ds_bytes + 1); // C: message will get too many zeroes? ((12+1)+16) + 64 + 1? MSG.push_back(osnma_msg->hkroot[0]); // C: NMA header for (uint16_t i = 1; i < size_m; i++) { @@ -393,27 +433,30 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // Check that the padding bits received match the computed values if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { - bool authenticated = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); + LOG(WARNING) << "OSNMA: DSM-KROOT message received ok."; std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; - if (authenticated) + d_kroot_verified = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); + if (d_kroot_verified) { - std::cout << " authenticated" << std::endl; // C: proceed with Tesla chain key verification. + std::cout << "Galileo OSNMA: KROOT authentication successful !" << std::endl; + std::cout << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " + << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } else { - std::cout << " validated" << std::endl; // C: Kroot not verified => retrieve it again + std::cout << " Galileo OSNMA: KROOT authentication failed. " << std::endl; } - std::cout << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " - << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " - << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; + } else { std::cout << "Galileo OSNMA: Error computing padding bits." << std::endl; + // TODO - here will have to decide if perform the verification or not. Since this step is not mandatory, one could as well have skipped it. } } } @@ -513,13 +556,9 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma index = index + 4; } - // compute time of subrame and kroot time of applicability, used in read_mack_body and process_mack_message - // TODO - find a better placement - d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... - d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k; - d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // Eq. 3 R.G. if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 { + d_GST_Sf = d_receiver_time; // TODO needed? read_mack_header(); read_mack_body(); process_mack_message(osnma_msg); @@ -531,7 +570,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma /** * \brief Reads the MACk header from the d_mack_message array and updates the d_osnma_data structure. - * \details This function reads the message ACK header from the d_mack_message array and updates the d_osnma_data structure with the parsed data. The header consists of three fields + * \details This function reads the message MACK header from the d_mack_message array and updates the d_osnma_data structure with the parsed data. The header consists of three fields *: tag0, macseq, and cop. The size of the fields is determined by the number of tag length (lt) bits specified in OSNMA_TABLE_11 for the corresponding tag size in d_osnma_data.d_dsm_k *root_message.ts. The lt_bits value is used to calculate the values of tag0, macseq, and cop based on the lt_bits value and the values of the elements of d_mack_message array. * \pre The d_mack_message array and d_osnma_data.d_dsm_kroot_message.ts field must be properly populated. @@ -603,13 +642,10 @@ void osnma_msg_receiver::read_mack_header() /** * @brief Reads the message body and verify Tesla key * - * \details It retrieves all the tags and tag-info associated. Then it attempts to verify the Tesla Key by computing the - * number of hashes of distance between the key-to-verify and the Kroot and iteratively hashing the result, until the required number of hashes - * is achieved. The result is then compared with the Kroot. If the two values match, the Tesla key is verified. + * \details It retrieves all the tags and tag-info associated, as well as the TESLA key. * * @return None */ - // TODO - function's name not representative of logic,..., take the TK verification out? void osnma_msg_receiver::read_mack_body() { // retrieve tag length @@ -783,12 +819,47 @@ void osnma_msg_receiver::read_mack_body() { d_osnma_data.d_mack_message.key[key_index_bytes] = d_mack_message[i]; } +} + + +/** + * @brief Verifies the tags. + * + * \details This function is responsible for processing the MACK message received (480 bits). It stores the last 10 MACK + * messages and last 10 NavData messages. * Then it attempts to verify the Tesla Key by computing the + * number of hashes of distance between the key-to-verify and the Kroot and iteratively hashing the result, until the required number of hashes + * is achieved. The result is then compared with the Kroot. If the two values match, the Tesla key is verified. + * It also performs MACSEQ validation and compares the ADKD of Mack tags with MACLT defined ADKDs. Finally, it verifies the tags. + * \pre Kroot or already a TESLA key shall be available. + * \post Number of tags bits verified for each ADKD. MACSEQ verification success + * @param osnma_msg A reference to OSNMA_msg containing the MACK message to be processed. + */ +void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) +{ + // prepare needed data + d_old_mack_message.push_back(d_osnma_data.d_mack_message); // last 10 MACKs are needed to be stored as per ICD + // populate d_nav_data with three classes of osnma_msg - needed for the tag verification + d_osnma_data.d_nav_data.EphemerisData = osnma_msg->EphemerisData; + d_osnma_data.d_nav_data.IonoData = osnma_msg->IonoData; + d_osnma_data.d_nav_data.UtcData = osnma_msg->UtcModelData; + d_osnma_data.d_nav_data.generate_eph_iono_vector2(); + d_osnma_data.d_nav_data.generate_utc_vector(); + d_old_navdata_buffer.push_back(d_osnma_data.d_nav_data); // last 10 NavData messages are needed to be stored as per ICD + + if(d_kroot_verified == false && d_tesla_key_verified == false) + { + std::cout << "Galileo OSNMA: MACK cannot be processed. "<< ", " + << "No Kroot nor TESLA key available" << static_cast(d_osnma_data.d_nma_header.cid) << std::endl; + return; // early return, cannot proceed further without one of the two verified. + } + + // Verify tesla key // compute I: number of hashes required - Eq. 19 ICD // TODO - this assumes that the baseline is Kroot, but there is the following possibility: // - available K verified from another iteration, hence is nonsense to go back to the Kroot, when I could perform only, say, two hashes. uint8_t num_of_hashes_needed = (d_GST_Sf - d_GST_0) / 30 + 1; - uint32_t GST_SFi = d_GST_Sf; + uint32_t GST_SFi = d_receiver_time; std::vector K_II = d_osnma_data.d_mack_message.key; std::vector K_I; // result of the recursive hash operations const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; @@ -852,30 +923,8 @@ void osnma_msg_receiver::read_mack_body() { std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; } -} - -/** - * @brief Verifies the tags. - * - * \details This function is responsible for processing the MACK message received (480 bits). It stores the last 10 MACK - * messages and last 10 NavData messages. It also performs MACSEQ validation and compares - * the ADKD of Mack tags with MACLT defined ADKDs. Finally, it verifies the tags. - * - * @param osnma_msg A reference to OSNMA_msg containing the MACK message to be processed. - */ -void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) -{ - d_old_mack_message.push_back(d_osnma_data.d_mack_message); // last 10 MACKs are needed to be stored as per ICD - // populate d_nav_data with three classes of osnma_msg - needed for the tag verification - d_osnma_data.d_nav_data.EphemerisData = osnma_msg->EphemerisData; - d_osnma_data.d_nav_data.IonoData = osnma_msg->IonoData; - d_osnma_data.d_nav_data.UtcData = osnma_msg->UtcModelData; - d_osnma_data.d_nav_data.generate_eph_iono_vector2(); - d_osnma_data.d_nav_data.generate_utc_vector(); - d_old_navdata_buffer.push_back(d_osnma_data.d_nav_data); // last 10 NavData messages are needed to be stored as per ICD - - // retrieve data to verify MACK tags + // verify MACK tags - MACSEQ uint8_t msg {0}; // uint8_t nt {0}; std::vector sq1{}; diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 99ee9d94b..3097845c4 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -65,6 +65,8 @@ private: void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); + void local_time_verification(const std::shared_ptr& osnma_msg); + void process_dsm_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); bool verify_dsm_pkr(DSM_PKR_message message); void read_mack_block(const std::shared_ptr& osnma_msg); @@ -86,13 +88,15 @@ private: bool d_new_data{false}; bool d_public_key_verified{false}; bool d_kroot_verified{false}; + bool d_tesla_key_verified{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification uint8_t d_Lt_min {}; // minimum equivalent tag length uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; - std::time_t d_receiver_time {}; + std::time_t d_receiver_time {0}; + const uint8_t d_T_L{30}; // s RG Section 2.1 }; diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 49beff26b..0465abd15 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -548,11 +548,11 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #endif #else -// // GNU-TLS -// gnutls_global_init(); -// // debug info gnu-tls remove when not needed anymore! -// gnutls_global_set_log_level(9); -// gnutls_global_set_log_function(Gnss_Crypto::my_log_func); + // GNU-TLS + gnutls_global_init(); + // debug info gnu-tls remove when not needed anymore! + gnutls_global_set_log_level(9); + gnutls_global_set_log_function(Gnss_Crypto::my_log_func); unsigned int bit_size; if (gnutls_pubkey_get_pk_algorithm(d_PublicKey, &bit_size) != GNUTLS_PK_ECDSA) @@ -574,7 +574,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; } -// gnutls_global_deinit(); + gnutls_global_deinit(); #endif return success; } diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 89898ca99..96304ef02 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -25,8 +25,8 @@ TEST(GnssCryptoTest, VerifySignature) { std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, - 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; - std::vector publicKey{ + 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK + std::vector publicKey{ // PK associated to the PrK 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, From 35cfbd7f055c1ba73fd85018a4125fd89d0eda27 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 27 Feb 2024 19:18:39 +0100 Subject: [PATCH 109/499] gitignore --- .gitignore | 1 + src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 007b9ab0c..5514c9cb4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ docs/doxygen/Doxyfile docs/html docs/latex docs/GNSS-SDR_manual.pdf +conf/* src/tests/data/output.dat thirdparty/ src/utils/nav-listener/build diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 298634dd1..ec7db2067 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -188,8 +188,6 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, this->message_port_register_out(pmt::mp("pvt_to_trk")); // Send PVT status to gnss_flowgraph this->message_port_register_out(pmt::mp("status")); - // Send PVT time to OSNMA - this->message_port_register_out(pmt::mp("pvt_to_osnma")); // GPS Ephemeris data message port in this->message_port_register_in(pmt::mp("telemetry")); @@ -2141,7 +2139,6 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item // #### solve PVT and store the corrected observable set if (d_internal_pvt_solver->get_PVT(d_gnss_observables_map, d_observable_interval_ms / 1000.0)) { - this->message_port_pub(pmt::mp("pvt_to_osnma"), pmt::make_any(convert_to_time_t(d_internal_pvt_solver->get_position_UTC_time()))); d_pvt_errors_counter = 0; // Reset consecutive PVT error counter const double Rx_clock_offset_s = d_internal_pvt_solver->get_time_offset_s(); From aca6c21944842d7b17bb31714c65d30a4227074f Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 27 Feb 2024 21:13:23 +0100 Subject: [PATCH 110/499] Revert "[TAS-111] time synch check: first draft" This reverts commit 50fbc3e9 --- src/core/libs/osnma_msg_receiver.cc | 31 +++++------------------------ src/core/libs/osnma_msg_receiver.h | 1 - 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index b3d0099fd..eb75c71eb 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -22,7 +22,6 @@ #include "gnss_crypto.h" #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader -#include "pvt_interface.h" #include // for DLOG #include // for gr::io_signature::make #include @@ -63,6 +62,9 @@ osnma_msg_receiver::osnma_msg_receiver( d_old_mack_message.set_capacity(10); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); + // register OSNMA output message port to PVT block + this->message_port_register_out(pmt::mp("OSNMA_to_PVT")); + this->set_msg_handler(pmt::mp("OSNMA_from_TLM"), #if HAS_GENERIC_LAMBDA [this](auto&& PH1) { msg_handler_osnma(PH1); }); @@ -73,33 +75,9 @@ osnma_msg_receiver::osnma_msg_receiver( boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, _1)); #endif #endif - // register OSNMA input message port from PVT block - this->message_port_register_in(pmt::mp("pvt_to_osnma")); - this->set_msg_handler(pmt::mp("pvt_to_osnma"), -#if HAS_GENERIC_LAMBDA - [this](auto&& PH1) { msg_handler_pvt_to_osnma(PH1); }); -#else -#if USE_BOOST_BIND_PLACEHOLDERS - boost::bind(&osnma_msg_receiver::msg_handler_pvt_to_osnma, this, boost::placeholders::_1)); -#else - boost::bind(&osnma_msg_receiver::msg_handler_pvt_to_osnma, this, _1)); -#endif -#endif - // register OSNMA output message port to PVT block - this->message_port_register_out(pmt::mp("OSNMA_to_PVT")); } -void osnma_msg_receiver::msg_handler_pvt_to_osnma(const pmt::pmt_t& msg) -{ - try - { - d_receiver_time = wht::any_cast(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block - } - catch (const pmt::exception& e) - { - LOG(WARNING) << "osnma_msg_receiver pmt exception: " << e.what(); - } -} + void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { // requires mutex with msg_handler_osnma function called by the scheduler @@ -135,6 +113,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // } // } + process_osnma_message(nma_msg); } else { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 3097845c4..664921d35 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -60,7 +60,6 @@ private: osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); - void msg_handler_pvt_to_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); From ca00d7ad1fa7ab1841a8cfb87fc7d2d025cdbdd8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 28 Feb 2024 07:57:05 +0100 Subject: [PATCH 111/499] CI: update action --- .github/workflows/volk_gnsssdr_archs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index 734cda533..6f4e31454 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2.7.2 + - uses: uraimo/run-on-arch-action@v2.7.1 name: Build in non-x86 container # continue-on-error: ${{ contains(fromJson('["ppc64le", "s390x"]'), matrix.arch) }} id: build From 2d9bb1b79c71d2493f58c5734b5280bdd0def6fa Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 3 Mar 2024 13:55:09 +0100 Subject: [PATCH 112/499] Improve architecture reporting --- CMakeLists.txt | 4 ++-- cmake/Modules/DetectLinuxDistro.cmake | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 889c6e09c..13cbeb617 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3485,7 +3485,7 @@ message(STATUS "* SUMMARY REPORT *") message(STATUS "***************************************") message(STATUS "") if(CMAKE_CROSSCOMPILING) - message(STATUS "Cross-compiling on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR} ${ARCHITECTURE_STRING}") + message(STATUS "Cross-compiling on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR}") else() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") message(STATUS "Building on GNU/Linux ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCHITECTURE_STRING}") @@ -3508,7 +3508,7 @@ file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "******************************** file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "GNSS-SDR version: ${VERSION}\n") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") if(CMAKE_CROSSCOMPILING) - file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "Cross-compiling on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR} ${ARCHITECTURE_STRING}\n") + file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "Cross-compiling on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR}\n") else() file(APPEND ${GNSSSDR_BINARY_DIR}/features.log "Building on GNU/Linux ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCHITECTURE_STRING}\n") endif() diff --git a/cmake/Modules/DetectLinuxDistro.cmake b/cmake/Modules/DetectLinuxDistro.cmake index 3fa556ba4..014b2a8d3 100644 --- a/cmake/Modules/DetectLinuxDistro.cmake +++ b/cmake/Modules/DetectLinuxDistro.cmake @@ -4,10 +4,14 @@ # SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(ARCHITECTURE_STRING "(64 bits)") +if(CMAKE_VERSION VERSION_LESS 3.19) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(ARCHITECTURE_STRING "(64 bits)") + else() + set(ARCHITECTURE_STRING "(32 bits)") + endif() else() - set(ARCHITECTURE_STRING "(32 bits)") + set(ARCHITECTURE_STRING "(${CMAKE_HOST_SYSTEM_PROCESSOR})") endif() if(EXISTS "/etc/lsb-release") From b879549748ff13e4fe6f724ac81d2fb10ef25615 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 Mar 2024 12:56:34 +0100 Subject: [PATCH 113/499] Update local Armadillo version to 12.8.x and instructions in README.md file --- CMakeLists.txt | 2 +- README.md | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 13cbeb617..7c3bf7d38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -335,7 +335,7 @@ set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") ################################################################################ # Versions to download and build (but not to install system-wide) if not found ################################################################################ -set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.6.x") +set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.26") diff --git a/README.md b/README.md index e745bf336..edac6e4af 100644 --- a/README.md +++ b/README.md @@ -403,9 +403,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux $ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux -$ wget https://sourceforge.net/projects/arma/files/armadillo-12.0.1.tar.xz -$ tar xvfz armadillo-12.0.1.tar.xz -$ cd armadillo-12.0.1 +$ wget https://sourceforge.net/projects/arma/files/armadillo-12.8.1.tar.xz +$ tar xvfz armadillo-12.8.1.tar.xz +$ cd armadillo-12.8.1 $ cmake . $ make $ sudo make install @@ -433,9 +433,9 @@ $ sudo ldconfig #### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging ``` -$ wget https://github.com/google/glog/archive/v0.6.0.tar.gz -$ tar xvfz v0.6.0.tar.gz -$ cd glog-0.6.0 +$ wget https://github.com/google/glog/archive/v0.7.0.tar.gz +$ tar xvfz v0.7.0.tar.gz +$ cd glog-0.7.0 $ mkdir build && cd build $ cmake .. $ make @@ -460,9 +460,9 @@ GNSS-SDR can also work well with #### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library ``` -$ wget https://github.com/tbeu/matio/releases/download/v1.5.23/matio-1.5.23.tar.gz -$ tar xvfz matio-1.5.23.tar.gz -$ cd matio-1.5.23 +$ wget https://github.com/tbeu/matio/releases/download/v1.5.26/matio-1.5.26.tar.gz +$ tar xvfz matio-1.5.26.tar.gz +$ cd matio-1.5.26 $ ./configure $ make $ sudo make install @@ -489,9 +489,9 @@ For more options, please check the #### Install [Pugixml](https://pugixml.org/ "Pugixml's Homepage"), a light-weight C++ XML processing library ``` -$ wget https://github.com/zeux/pugixml/releases/download/v1.13/pugixml-1.13.tar.gz -$ tar xvfz pugixml-1.13.tar.gz -$ cd pugixml-1.13 +$ wget https://github.com/zeux/pugixml/releases/download/v1.14/pugixml-1.14.tar.gz +$ tar xvfz pugixml-1.14.tar.gz +$ cd pugixml-1.14 $ mkdir build && cd build $ cmake .. $ make @@ -502,8 +502,8 @@ $ sudo ldconfig #### Download [GoogleTest](https://github.com/google/googletest "Googletest Homepage") ``` -$ wget https://github.com/google/googletest/archive/refs/tags/v1.13.0.zip -$ unzip v1.13.0.zip +$ wget https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip +$ unzip v1.14.0.zip ``` Please **DO NOT build or install** Google Test. Every user needs to compile @@ -527,10 +527,10 @@ downloaded resides. Just type in your terminal (or add it to your `$HOME/.bashrc` file for a permanent solution) the following line: ``` -export GTEST_DIR=/home/username/googletest-1.13.0 +export GTEST_DIR=/home/username/googletest-1.14.0 ``` -changing `/home/username/googletest-1.13.0` by the actual path where you +changing `/home/username/googletest-1.14.0` by the actual path where you unpacked Google Test. If the CMake script does not find that folder, or the environment variable is not defined, or the source code is not installed by a package, then it will download a fresh copy of the Google Test source code and @@ -872,7 +872,7 @@ Install the required dependencies: ``` $ brew update && brew upgrade $ brew install armadillo cmake hdf5 gflags glog gnuradio libmatio log4cpp \ - openssl pkg-config protobuf pugixml pyhon-mako + openssl pkg-config protobuf pugixml python-mako $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ``` From 4a13e446b6e778b6bfced608f3f7ad5d7e8b92be Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 7 Mar 2024 10:27:04 +0100 Subject: [PATCH 114/499] [TAS-153] Re-design time check requirement [TAS-140] Tag verification: accumulation tags of PRNd and ADKD for T_COP This update introduces updated time verification functions and DSM block processes. TAS-140 introduces work (in progress) for taking into account the COP when validating tags. This accounts for significant structural changes in process_mack_message(). The update also resolves several TODO comments and includes minor adjustments to unit tests and system parameters. --- src/core/libs/osnma_msg_receiver.cc | 656 ++++++++++++++--------- src/core/libs/osnma_msg_receiver.h | 13 +- src/core/system_parameters/osnma_data.cc | 58 +- src/core/system_parameters/osnma_data.h | 19 +- 4 files changed, 437 insertions(+), 309 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index eb75c71eb..e7b824d6c 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -59,7 +59,8 @@ osnma_msg_receiver::osnma_msg_receiver( { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); - d_old_mack_message.set_capacity(10); + //d_old_mack_message.set_capacity(10); + d_old_OSNMA_buffer.set_capacity(12); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -144,7 +145,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_dsm_block(osnma_msg); local_time_verification(osnma_msg); process_dsm_block(osnma_msg); - read_mack_block(osnma_msg); + read_and_process_mack_block(osnma_msg); } @@ -263,6 +264,11 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ std::cout << "]" << std::endl; // TODO update documentation } +/** + * @brief Function to verify the local time based on GST_SIS and GST_0 + * + * @param osnma_msg Shared pointer to OSNMA message structure + */ void osnma_msg_receiver::local_time_verification(const std::shared_ptr& osnma_msg) { // compute local time based on GST_SIS and GST_0 @@ -283,18 +289,47 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr d_T_L) + std::time_t delta_T = abs(d_receiver_time - d_GST_SIS); + if( delta_T <= d_T_L ) { - std::cerr << "Galileo OSNMA: time constraint violation" << std::endl; - std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << std::endl; + d_tags_allowed = tags_to_verify::all; + d_tags_to_verify = {0,4,12}; + std::cout << "Galileo OSNMA: time constraint OK \n"; + std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; + std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; + + // TODO set flag to false to avoid processing dsm and MACK messagesy + } + else if( delta_T > d_T_L && delta_T <= 10* delta_T ) + { + d_tags_allowed = tags_to_verify::slow_eph; + d_tags_to_verify = {12}; + std::cout << "Galileo OSNMA: time constraint allows only slow MACs to be verified\n"; + std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; + std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; + } else - std::cout << "Galileo OSNMA: time constraint OK (|local_t - GST_SIS| < T_L) [|"<< static_cast(d_receiver_time - d_GST_SIS) - <<"|<"<< static_cast(d_T_L) <<"]"<< std::endl; - // TODO set flag to false to avoid processing dsm and MACK messages - // set global variables accordingly + { + d_tags_allowed = tags_to_verify::none; + d_tags_to_verify = {}; + std::cerr << "Galileo OSNMA: time constraint violation\n"; + std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; + std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; + + } } + +/** + * @brief Process DSM block of an OSNMA message. + * + * \details This function checks if all inner blocks of the DSM message are available and if so, calls process_dsm_message(). + * \post It creates a vector to hold the DSM message data, copies the data from the inner blocks into the vector, + * resets the inner block arrays to empty + * + * @param osnma_msg The OSNMA message. + */ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osnma_msg) { // if all inner blocks available -> Process DSM message @@ -522,7 +557,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg * * @param osnma_msg The OSNMA_msg object containing the Mack message. */ -void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma_msg) +void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr& osnma_msg) { // Retrieve Mack message uint32_t index = 0; @@ -537,7 +572,6 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma if (d_osnma_data.d_dsm_kroot_message.ts != 0) // C: 4 ts < ts < 10 { - d_GST_Sf = d_receiver_time; // TODO needed? read_mack_header(); read_mack_body(); process_mack_message(osnma_msg); @@ -551,7 +585,7 @@ void osnma_msg_receiver::read_mack_block(const std::shared_ptr& osnma * \brief Reads the MACk header from the d_mack_message array and updates the d_osnma_data structure. * \details This function reads the message MACK header from the d_mack_message array and updates the d_osnma_data structure with the parsed data. The header consists of three fields *: tag0, macseq, and cop. The size of the fields is determined by the number of tag length (lt) bits specified in OSNMA_TABLE_11 for the corresponding tag size in d_osnma_data.d_dsm_k -*root_message.ts. The lt_bits value is used to calculate the values of tag0, macseq, and cop based on the lt_bits value and the values of the elements of d_mack_message array. +*root_message.ts. The lt_bits value is used to calculate tag0, MACSEQ, and COP. * \pre The d_mack_message array and d_osnma_data.d_dsm_kroot_message.ts field must be properly populated. * \post The d_osnma_data.d_mack_message.header.tag0, d_osnma_data.d_mack_message.header.macseq, and d_osnma_data.d_mack_message.header.cop fields are updated with the parsed values *. @@ -619,10 +653,10 @@ void osnma_msg_receiver::read_mack_header() /** - * @brief Reads the message body and verify Tesla key + * @brief Reads the MACK message body * * \details It retrieves all the tags and tag-info associated, as well as the TESLA key. - * + * \post populates d_osnma_data.d_mack_message with all tags and tag_info associated of MACK message, as well as the TESLA key into d_osnma_data.d_mack_message.key * @return None */ void osnma_msg_receiver::read_mack_body() @@ -802,124 +836,131 @@ void osnma_msg_receiver::read_mack_body() /** - * @brief Verifies the tags. + * @brief Verifies the tags transmitted in the past. * - * \details This function is responsible for processing the MACK message received (480 bits). It stores the last 10 MACK - * messages and last 10 NavData messages. * Then it attempts to verify the Tesla Key by computing the - * number of hashes of distance between the key-to-verify and the Kroot and iteratively hashing the result, until the required number of hashes - * is achieved. The result is then compared with the Kroot. If the two values match, the Tesla key is verified. - * It also performs MACSEQ validation and compares the ADKD of Mack tags with MACLT defined ADKDs. Finally, it verifies the tags. - * \pre Kroot or already a TESLA key shall be available. + * \details This function is responsible for processing the MACK message received (480 bits) at time SF(i). + * It stores the last 10 MACK messages and the last 11 NavData messages. + * Then attempts to verify the Tesla Key by computing the number of hashes of distance between the key-to-verify and the + * Kroot and iteratively hashing the result, until the required number of hashes is achieved. + * The result is then compared with the Kroot. If the two values match, the Tesla key is verified. + * It also performs MACSEQ validation and compares the ADKD of Mack tags with MACLT defined ADKDs. + * Finally, it verifies the tags. + * \pre Kroot or already a TESLA key shall be available. Depending on the ADKD of the tag, NavData of SF(i-2)...SF(i-11) * \post Number of tags bits verified for each ADKD. MACSEQ verification success * @param osnma_msg A reference to OSNMA_msg containing the MACK message to be processed. */ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { - // prepare needed data - d_old_mack_message.push_back(d_osnma_data.d_mack_message); // last 10 MACKs are needed to be stored as per ICD - // populate d_nav_data with three classes of osnma_msg - needed for the tag verification - d_osnma_data.d_nav_data.EphemerisData = osnma_msg->EphemerisData; - d_osnma_data.d_nav_data.IonoData = osnma_msg->IonoData; - d_osnma_data.d_nav_data.UtcData = osnma_msg->UtcModelData; - d_osnma_data.d_nav_data.generate_eph_iono_vector2(); - d_osnma_data.d_nav_data.generate_utc_vector(); - d_old_navdata_buffer.push_back(d_osnma_data.d_nav_data); // last 10 NavData messages are needed to be stored as per ICD + // populate d_nav_data with needed data from subframe + d_osnma_data.d_nav_data.init(osnma_msg); + // store MACK, KROOT and NavData needed. + d_old_OSNMA_buffer.push_back(d_osnma_data); if(d_kroot_verified == false && d_tesla_key_verified == false) { - std::cout << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "No Kroot nor TESLA key available" << static_cast(d_osnma_data.d_nma_header.cid) << std::endl; + std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " + << "No Kroot nor TESLA key available" << static_cast(d_osnma_data.d_nma_header.cid) << std::endl; return; // early return, cannot proceed further without one of the two verified. } // Verify tesla key - - // compute I: number of hashes required - Eq. 19 ICD - // TODO - this assumes that the baseline is Kroot, but there is the following possibility: - // - available K verified from another iteration, hence is nonsense to go back to the Kroot, when I could perform only, say, two hashes. - uint8_t num_of_hashes_needed = (d_GST_Sf - d_GST_0) / 30 + 1; - uint32_t GST_SFi = d_receiver_time; - std::vector K_II = d_osnma_data.d_mack_message.key; - std::vector K_I; // result of the recursive hash operations - const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint8_t i = 1; i < num_of_hashes_needed ; i++) + if(d_tesla_key_verified) { - // build message digest m = (K_I+1 || GST_SFi || alpha) - std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); - std::copy(K_II.begin(),K_II.end(),msg.begin()); - - msg.push_back((d_GST_Sf & 0xFF000000) >> 24); - msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); - msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); - msg.push_back(d_GST_Sf & 0x000000FF); - // extract alpha - for (int k = 5; k >= 0;k--) - { - // TODO: static extracts the MSB in case from larger to shorter int? - msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. - } - // compute hash - std::vector hash; - if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. - { - hash = d_crypto->computeSHA256(msg); - } - else if (d_osnma_data.d_dsm_kroot_message.hf == 2) - { - hash = d_crypto->computeSHA3_256(msg); - } - else - { - hash = std::vector(32); - } - // truncate hash - K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits - for (uint16_t i = 0; i < lk_bytes; i++) - { - K_I.push_back(hash[i]); - } - - // set parameters for next iteration - GST_SFi -= 30; // next SF time is the actual minus 30 seconds - K_II = K_I; // next key is the actual one - K_I.clear(); // empty the actual one for a new computation - } - // compare computed current key against received key - if(K_II.size() != d_osnma_data.d_mack_message.key.size()) - { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - } - if (K_II == d_osnma_data.d_mack_message.key) - { - std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; - // TODO - propagate result - // TODO - save current tesla key as latest one? - // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + // TODO - find out I bt. both tesla keys, then hash until then, then compare. } else + {// have to go until Kroot + uint8_t num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD + uint32_t GST_SFi = d_receiver_time; + std::vector K_II = d_osnma_data.d_mack_message.key; + std::vector K_I; // result of the recursive hash operations + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; + // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) + for (uint8_t i = 1; i < num_of_hashes_needed ; i++) + { + // build message digest m = (K_I+1 || GST_SFi || alpha) + std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::copy(K_II.begin(),K_II.end(),msg.begin()); - { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + msg.push_back((d_GST_Sf & 0xFF000000) >> 24); + msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); + msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); + msg.push_back(d_GST_Sf & 0x000000FF); + // extract alpha + for (int k = 5; k >= 0;k--) + { + // TODO: static extracts the MSB in case from larger to shorter int? + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. + } + // compute hash + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + { + hash = d_crypto->computeSHA256(msg); + } + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + { + hash = d_crypto->computeSHA3_256(msg); + } + else + { + hash = std::vector(32); + } + // truncate hash + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + for (uint16_t i = 0; i < lk_bytes; i++) + { + K_I.push_back(hash[i]); + } + + // set parameters for next iteration + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation + } + // compare computed current key against received key + if(K_II.size() != d_osnma_data.d_mack_message.key.size()) + { + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + return; + } + if (K_II == d_osnma_data.d_mack_message.key) + { + std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + d_tesla_key_verified = true; + // TODO - propagate result + // TODO - save current tesla key as latest one? propose a map with + // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + } + else + + { + std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + return; + } } + // verify MACK tags - MACSEQ - uint8_t msg {0}; -// uint8_t nt {0}; std::vector sq1{}; std::vector sq2{}; - const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); + + // for OSNMA data (MACK, KROOT messages): + // if ADKD=12, pick d_old_OSNMA_buffer.front() or d_old_OSNMA_buffer[1] iff d_old_OSNMA_buffer is full (guaranteed 10 SF above) + // otherwise pick d_old_OSNMA_buffer[size-2] + OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ + + // for the applicable tesla key: + // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] + std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key + + const auto it = OSNMA_TABLE_16.find(applicable_OSNMA.d_dsm_kroot_message.maclt); if (it != OSNMA_TABLE_16.cend()) { -// uint8_t msg = it->second.msg; -// uint8_t nt = it->second.nt; std::vector sq1 = it->second.sequence1; std::vector sq2 = it->second.sequence2; } - if (msg == 0) - { - return; - } std::vector sequence; // Assign relevant sequence based on subframe time if (d_GST_Sf % 60 == 0) @@ -935,7 +976,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& std::cout << "Galileo OSNMA: Mismatch in the GST verification => should end in 30 or 60 seconds but it dit not." << std::endl; } // compare ADKD of Mack tags with MACLT defined ADKDs - if(d_osnma_data.d_mack_message.tag_and_info.size() != sq1.size()) + if(applicable_OSNMA.d_mack_message.tag_and_info.size() != sq1.size()) { std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; return; @@ -959,7 +1000,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // Fixed as well as FLX Tags share first part - Eq. 22 ICD std::vector m(5 + flxTags.size()); - m[0] = static_cast(osnma_msg->PRN); // PRN_A + m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); @@ -968,20 +1009,18 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // Case tags flexible - Eq. 21 ICD for (uint8_t i = 0; i < flxTags.size() ; i++) { - m[i+5] = d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; - m[i+6] = d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | d_osnma_data.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; + m[i+5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[i+6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; } - std::vector applicable_key; - // if ADKD=12, pick d_old_mack_message.front() if d_old_mack_message[10] is full - // otherwise pick d_old_mack_message.back() + // compute mac - applicable_key = d_old_mack_message.back().key; std::vector mac; - if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); } - else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { mac = d_crypto->computeCMAC_AES(applicable_key, m); } @@ -993,25 +1032,14 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& } uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; // TODO - double check, it was 0x0FFF which presuposes little endian... -// int num_tags_added = 0; - // Verify tags if MACSEQ is authenticated - if (computed_macseq == d_osnma_data.d_mack_message.header.macseq) + if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq) { std::cout << "OSNMA: MACSEQ authenticated for PRN_A " << osnma_msg->PRN << " with WN=" << osnma_msg->WN_sf0 << ", TOW=" << osnma_msg->TOW_sf0 << ". Verifying tags. " << std::endl; - - // TODO - configuration file must define which tags shall be verified - // e.g. NavDataVerification: A{0,12,4} == ALL, T == Timing Parameters {4}, ECS == Ephemeris,Clock and Status{0,12}. - std::string navDataToVerify = "EphemerisIonoAndClock"; // ADKD 0 +1 delay ADKD 12 +10 delay - // std::string navDataToVerify = "TimingParameters"; ADKD 4 +1 delay - // std::string navDataToVerify = "ALL"; - std::vector adkd; - adkd = {0,12,4}; // ADKD will have 0, 12, 4 or any combination of those 3 - maybe more in the future (up to 16 values) - m.clear(); uint8_t lt_bits = 0; const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it2 != OSNMA_TABLE_11.cend()) @@ -1023,148 +1051,109 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. } + // Tag verification + // tag[i-1]: + // adkd = 4/0 : use TK[i], NavData[i-2] to validate Tag[i-1] + // adkd = 12 : ignore it -> not possible to verify yet + // tag[i-10] + // adkd = 4/0 : use TK[i-9], NavData[i-11] to validate Tag[i-10] would already be done by tag[i-1] + // adkd = 12 : use TK[i], NavData[i-11] to validate Tag[i-10] TODO - pending better logic for not repeating this while twice. + int t = d_old_OSNMA_buffer.size() - 2; + applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ - - - // Verify each tag - // std::string tagsToVerify = "all"; // Ephemeris, UTC, SlowEphemeris, all - // all -> process ADKD 0, 12 and 4 - // Ephemeris -> process ADKD 0 and 12 only (and if 12, then the applicable key has 10 subframes delay) - // UTC -> process ADKD 4 only - uint8_t i = 0; - while (i < d_osnma_data.d_mack_message.tag_and_info.size() && - std::find(adkd.begin(),adkd.end(),d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD) != adkd.end()) + int i = 0; + while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message + std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs + applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) + != d_tags_to_verify.end()) { - // select applicable tesla key - if (d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 0) + // TODO - if a subsequent tag was already part of the verification (inner loop), this while is going to ignore that and try to validate it anyway. + + // Take tag_k and check its ADKD, COP, PRN_d, this will be the reference for the iteration and search of other Tags + uint8_t Nt = d_Lt_min / applicable_OSNMA.d_dsm_kroot_message.ts; // Tags needed to be verified + uint8_t applicable_ADKD = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD; + uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; + uint8_t counter_COP = 1; + uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; + applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe + NavData applicable_NavData{}; + if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) { - applicable_key = d_old_mack_message.back().key; // SF - 1 + applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; } - else if (d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 12) + else if(applicable_ADKD == 12 && d_old_OSNMA_buffer.size() > 11) + { + applicable_NavData = d_old_OSNMA_buffer[t - 11].d_nav_data; + } + else + { + std::cout << "Galileo OSNMA: MACK message buffer elements not enough. Cannot verify tags. " << std::endl; + } + + + int k = i + 1; + uint8_t nt = 0; + bool flag_cancel_tag_verification = false; // if a tag fails, cancel whole NavData verification set + // Look for tags relative to reference NavData until Nt achieved, + // this may require going back in time, as long as COP is valid + while (nt <= Nt && counter_COP <= applicable_COP && !flag_cancel_tag_verification) + { + auto start_it = std::next(applicable_OSNMA.d_mack_message.tag_and_info.begin(), k); + + // check the vector of tags of aplicable OSNMA for a match against the chosen + for (auto it = start_it; it != applicable_OSNMA.d_mack_message.tag_and_info.end() && nt <= Nt; ++it) + { + // Check if ADKD, COP, and PRN_d match + if(it->tag_info.ADKD == applicable_ADKD + // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. + && it->tag_info.PRN_d == applicable_PRNd) + { + if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key )) + { + nt++; + } + else + { + // failure, discard this k-th tag + flag_cancel_tag_verification = true; + std::cout << "Galileo OSNMA: tag verification failed for PRN_a " + << applicable_OSNMA.d_nav_data.PRNa << " with WN=" + << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" + << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " + << std::endl; + } + + } + if(flag_cancel_tag_verification) + break; + } + // Check if Nt is achieved, if not, switch to older frame + if(nt < Nt && t > 0 /*not end of buffer*/ && counter_COP <= applicable_COP && !flag_cancel_tag_verification) { - // check is the buffer is full or not - if (d_old_mack_message.size() == d_old_mack_message.capacity()) - { - applicable_key = d_old_mack_message.front().key; // SF - 10 - } - else - { - std::cout << "Galileo OSNMA: Old MACK message buffer is not full. Cannot verify slow mac. " << std::endl; - } + t--; + applicable_OSNMA = d_old_OSNMA_buffer[t]; + applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; + applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; + d_GST_Sf -= 30; + counter_COP++; + k = 0; } - else if (d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 4) + } + + if (nt >= Nt) { - applicable_key = d_old_mack_message.back().key; // SF - 1 - } - else - { - std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; + nt = 0; + std::cout << "Galileo OSNMA: tag verification accumulation succesful for PRN_a " + << applicable_OSNMA.d_nav_data.PRNa << " with WN=" + << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" + << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " + << std::endl; } - // compute m - m.push_back(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.PRN_d); - for(int i = 24; i >= 0; i -= 8) - { - m.push_back((osnma_msg->PRN >> i) & 0xFF); - } - m.push_back(static_cast((d_GST_Sf & 0xFF000000) >> 24)); - m.push_back(static_cast((d_GST_Sf & 0x00FF0000) >> 16)); - m.push_back(static_cast((d_GST_Sf & 0x0000FF00) >> 8)); - m.push_back(static_cast(d_GST_Sf & 0x000000FF)); - m.push_back(i+1); // CTR - m.push_back(d_osnma_data.d_nma_header.nmas); - if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 0 || - d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 12) - { - m.insert(m.end(),osnma_msg->EphemerisClockAndStatusData.begin(),osnma_msg->EphemerisClockAndStatusData.end()) ; - } - else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 4) - { - m.insert(m.end(),osnma_msg->TimingData.begin(),osnma_msg->TimingData.end()) ; - } - else - { - std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; - } - i = 0; - // check that m has an integer number of bytes, if not, add padding zeroes - // padding zeroes until size of vector is an integer number of bytes. - // I think not needed, if bytes of m correctly formatted (i.e. added in big-endianness) -> the unused bits will be zero - // and the vector has an integer number of uint8_t elements. - - // compute mac - if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 - { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); - } - else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES - { - mac = d_crypto->computeCMAC_AES(applicable_key, m); - } - - // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD - uint64_t computed_mac = static_cast(mac[0]) << (lt_bits - 8); - computed_mac += (static_cast(mac[1]) << (lt_bits - 16)); - if (lt_bits == 20) - { - computed_mac += (static_cast(mac[1] & 0xF0) >> 4); - } - else if (lt_bits == 24) - { - computed_mac += static_cast(mac[2]); - } - else if (lt_bits == 28) - { - computed_mac += (static_cast(mac[2]) << 4); - computed_mac += (static_cast(mac[3] & 0xF0) >> 4); - } - else if (lt_bits == 32) - { - computed_mac += (static_cast(mac[2]) << 8); - computed_mac += static_cast(mac[3]); - } - else if (lt_bits == 40) - { - computed_mac += (static_cast(mac[2]) << 16); - computed_mac += (static_cast(mac[3]) << 8); - computed_mac += static_cast(mac[4]); - } - - // Compare computed tag with received one truncated - if (d_osnma_data.d_mack_message.tag_and_info[i].tag == computed_mac) - { - if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 0 || d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 12) - { - std::cout << "Galileo OSNMA: Tag verification successful - Ephemeris, Clock and Ionospheric data " << std::endl; - d_Lt_verified_eph += lt_bits; - } - else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD == 4) - { - std::cout << "Galileo OSNMA: Tag verification successful - Timing data " << std::endl; - d_Lt_verified_utc += lt_bits; - } - } - else - { - std::cout << "Galileo OSNMA: Tag verification failed " << std::endl; - } - - if (d_Lt_verified_eph >= d_Lt_min) - { - std::cout << "Galileo OSNMA: Ephemeris, Clock and Ionospheric data verified successfully " << std::endl; - d_Lt_verified_eph = 0; - // send info to PVT: navdata SF i-1 authenticated - break; - } - if (d_Lt_verified_utc >= d_Lt_min) - { - std::cout << "Galileo OSNMA: Timing data verified successfully " << std::endl; - d_Lt_verified_utc = 0; - // send info to PVT: navdata SF i-1 authenticated - break; - } } + } } @@ -1212,3 +1201,154 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) return false; } } +bool osnma_msg_receiver::verify_tag(MACK_tag_and_info tag_and_info, + OSNMA_data applicable_OSNMA, uint8_t tag_position, + const std::vector& applicable_key, + NavData applicable_NavData) +{ + bool verified = false; + auto CTR = tag_position + 2; // CTR, first tag is CTR(tag0)=1 + 1 == 2 + // NAvData, tag_and_info[i] + + // check if enough osnma messages stored in the buffer. + if (tag_and_info.tag_info.ADKD == 0 + || tag_and_info.tag_info.ADKD == 4) + { + if (d_old_OSNMA_buffer.size() < 3) + { + std::cout << "Galileo OSNMA: MACK message buffer empty. Cannot verify tags. " << std::endl; + return verified; + } + } + else if (tag_and_info.tag_info.ADKD == 12) + { + + if (d_old_OSNMA_buffer.size() < 10+15) + { + std::cout << "Galileo OSNMA: Tesla key not yet available. Cannot verify slow mac. at " << + d_receiver_time << "s. "<< std::endl; + return verified; + } + } + else + { + std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; + return verified; + } + + // compute m + std::vector m; + m.push_back(tag_and_info.tag_info.PRN_d); + for(int i = 24; i >= 0; i -= 8) + { + m.push_back((applicable_NavData.PRNa >> i) & 0xFF); + } + m.push_back(static_cast((d_GST_Sf & 0xFF000000) >> 24)); + m.push_back(static_cast((d_GST_Sf & 0x00FF0000) >> 16)); + m.push_back(static_cast((d_GST_Sf & 0x0000FF00) >> 8)); + m.push_back(static_cast(d_GST_Sf & 0x000000FF)); + m.push_back(CTR); + m.push_back(applicable_OSNMA.d_nma_header.nmas); + if(tag_and_info.tag_info.ADKD == 0) + { + m.insert(m.end(), + applicable_NavData.ephemeris_iono_vector.begin(), + applicable_NavData.ephemeris_iono_vector.end()) ; + } + else if(tag_and_info.tag_info.ADKD == 4) + { + m.insert(m.end(),applicable_NavData.utc_vector.begin(),applicable_NavData.utc_vector.end()) ; + } + else + { + std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; + } + + // check that m has an integer number of bytes, if not, add padding zeroes + // padding zeroes until size of vector is an integer number of bytes. + // I think not needed, if bytes of m correctly formatted (i.e. added in big-endianness) -> the unused bits will be zero + // and the vector has an integer number of uint8_t elements. + + // compute mac + std::vector mac; + if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + + // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD + uint8_t lt_bits = 0; // TODO - remove this duplication of code. + const auto it2 = OSNMA_TABLE_11.find(applicable_OSNMA.d_dsm_kroot_message.ts); + if (it2 != OSNMA_TABLE_11.cend()) + { + lt_bits = it2->second; + } + if (lt_bits == 0) + { + return verified; + } + uint64_t computed_mac = static_cast(mac[0]) << (lt_bits - 8); + computed_mac += (static_cast(mac[1]) << (lt_bits - 16)); + if (lt_bits == 20) + { + computed_mac += (static_cast(mac[1] & 0xF0) >> 4); + } + else if (lt_bits == 24) + { + computed_mac += static_cast(mac[2]); + } + else if (lt_bits == 28) + { + computed_mac += (static_cast(mac[2]) << 4); + computed_mac += (static_cast(mac[3] & 0xF0) >> 4); + } + else if (lt_bits == 32) + { + computed_mac += (static_cast(mac[2]) << 8); + computed_mac += static_cast(mac[3]); + } + else if (lt_bits == 40) + { + computed_mac += (static_cast(mac[2]) << 16); + computed_mac += (static_cast(mac[3]) << 8); + computed_mac += static_cast(mac[4]); + } + + // Compare computed tag with received one truncated + if (tag_and_info.tag == computed_mac) + { + verified = true; + if(tag_and_info.tag_info.ADKD == 0 || tag_and_info.tag_info.ADKD == 12) + { + std::cout << "Galileo OSNMA: tag verification successful for PRN_a " + << applicable_NavData.PRNa << " with WN=" + << applicable_NavData.WN_sf0 << ", TOW=" + << applicable_NavData.TOW_sf0 << "NavData= " + << "Ephemeris, Clock and Ionospheric data" << ". " + << std::endl; + } + else if(tag_and_info.tag_info.ADKD == 4) + { + std::cout << "Galileo OSNMA: tag verification successful for PRN_a " + << applicable_NavData.PRNa << " with WN=" + << applicable_NavData.WN_sf0 << ", TOW=" + << applicable_NavData.TOW_sf0 << "NavData= " + << "Timing data" << ". " + << std::endl; + } + + } + else + { + std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " + << applicable_NavData.PRNa << " with WN=" + << applicable_NavData.WN_sf0 << ", TOW=" + << applicable_NavData.TOW_sf0 << ". " + << std::endl; + } + return verified; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 664921d35..5cde3ddfa 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -68,13 +68,14 @@ private: void process_dsm_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); bool verify_dsm_pkr(DSM_PKR_message message); - void read_mack_block(const std::shared_ptr& osnma_msg); + void read_and_process_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); void process_mack_message(const std::shared_ptr& osnma_msg); + bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); - boost::circular_buffer d_old_mack_message; - boost::circular_buffer d_old_navdata_buffer; // buffer that holds last 10 received navdata messages + //boost::circular_buffer d_old_mack_message; + boost::circular_buffer d_old_OSNMA_buffer; // buffer that holds last 12 received OSNMA messages, including current one at back() std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; @@ -92,10 +93,14 @@ private: uint8_t d_Lt_min {}; // minimum equivalent tag length uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing + uint8_t const d_T_L{30}; // s RG Section 2.1 + uint8_t const d_delta_COP{30}; // s SIS ICD Table 14 uint32_t d_GST_0 {}; uint32_t d_GST_SIS {}; std::time_t d_receiver_time {0}; - const uint8_t d_T_L{30}; // s RG Section 2.1 + enum tags_to_verify{all,utc,slow_eph, eph, none}; // TODO is this safe? I hope so + tags_to_verify d_tags_allowed{tags_to_verify::all}; + std::vector d_tags_to_verify{0,4,12}; }; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index db4b5c553..9a291330d 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -16,37 +16,27 @@ #include "osnma_data.h" #include +#include +/** + * @brief Constructs a NavData object with the given osnma_msg. + * \details Packs the ephemeris, iono and utc data from the current subframe into the NavData structure. It also gets the PRNa and the GST. + * @param osnma_msg The shared pointer to the OSNMA_msg object. + */ +void NavData::init(const std::shared_ptr &osnma_msg) +{ + EphemerisData = osnma_msg->EphemerisData; + IonoData = osnma_msg->IonoData; + UtcData = osnma_msg->UtcModelData; + generate_eph_iono_vector(); + generate_utc_vector(); + PRNa = osnma_msg->PRN; + WN_sf0 = osnma_msg->WN_sf0; + TOW_sf0 = osnma_msg->TOW_sf0; +}; void NavData::generate_eph_iono_vector() { ephemeris_iono_vector.clear(); - ephemeris_iono_vector.push_back(static_cast((EphemerisData.IOD_nav & 0b0000'0000'0000'0000'0000'0011'1111'1100) >> 2)); - ephemeris_iono_vector.push_back(static_cast((EphemerisData.IOD_nav & 0b0000'0000'0000'0000'0000'0000'0000'0011) << 6 - | (EphemerisData.toe & 0b0000'0000'0000'0000'0011'1111'1111'1111) >> 8)); - ephemeris_iono_vector.push_back(static_cast(EphemerisData.toe)); - uint64_t binary_representation; - memcpy(&binary_representation, &EphemerisData.M_0, sizeof(EphemerisData.M_0)); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 8))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 16))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 24))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 32))); - memcpy(&binary_representation, &EphemerisData.ecc, sizeof(EphemerisData.ecc)); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 8))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 16))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 24))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 32))); - memcpy(&binary_representation, &EphemerisData.sqrtA, sizeof(EphemerisData.sqrtA)); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 8))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 16))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 24))); - ephemeris_iono_vector.push_back(static_cast(binary_representation >> (64 - 32))); - - // TODO: Implement the function to generate the rest of pages -} - -void NavData::generate_eph_iono_vector2() -{ - std::vector eph_iono_vector; uint64_t bit_buffer = 0; // variable to store the bits to be extracted, it can contain bits from different variables int bit_count = 0; // Number of bits in the buffer, i.e. to be extracted @@ -113,7 +103,7 @@ void NavData::generate_eph_iono_vector2() { // Extract the 8 bits starting from last bit position and add them to the vector uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; - eph_iono_vector.push_back(extracted_bits); + ephemeris_iono_vector.push_back(extracted_bits); // Remove the extracted bits from the buffer bit_count -= 8; @@ -125,7 +115,7 @@ void NavData::generate_eph_iono_vector2() // If there are any bits left in the buffer, add them to the vector if (bit_count > 0) { - eph_iono_vector.push_back(static_cast(bit_buffer)); + ephemeris_iono_vector.push_back(static_cast(bit_buffer)); } } @@ -173,13 +163,3 @@ void NavData::generate_utc_vector() utc_vector.push_back(static_cast(bit_buffer)); } } - -std::vector NavData::get_eph_iono_vector() -{ - return ephemeris_iono_vector; -} - -std::vector NavData::get_utc_vector() -{ - return utc_vector; -} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 941e7c8bc..4bc78ebbb 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -19,6 +19,7 @@ #define GNSS_SDR_OSNMA_DATA_H #include "galileo_ephemeris.h" +#include "galileo_inav_message.h" #include "galileo_iono.h" #include "galileo_utc_model.h" #include @@ -125,18 +126,20 @@ public: class NavData { public: - NavData() = default; + NavData()=default; + void init(const std::shared_ptr &osnma_msg); + std::vector ephemeris_iono_vector{}; + std::vector utc_vector{}; + uint32_t PRNa{}; + uint32_t WN_sf0{}; + uint32_t TOW_sf0{}; +private: Galileo_Ephemeris EphemerisData; Galileo_Iono IonoData; Galileo_Utc_Model UtcData; - void generate_eph_iono_vector(); // TODO check with Carles procedure and compare with v2 - void generate_eph_iono_vector2(); + void generate_eph_iono_vector(); // TODO pass data directly fro Telemetry Decoder (if bits are in the needed order) void generate_utc_vector(); // TODO - std::vector get_eph_iono_vector(); // TODO - std::vector get_utc_vector(); // TODO -private: - std::vector ephemeris_iono_vector; - std::vector utc_vector; + }; From 816c20b77b70f0b4544cb68d9e918b4a02464f22 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 11 Mar 2024 17:03:20 +0100 Subject: [PATCH 115/499] Force use of OpenSSL library --- CMakeLists.txt | 4 +++- src/core/system_parameters/CMakeLists.txt | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c3bf7d38..32b0a0b64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2173,7 +2173,8 @@ find_library(GNUTLS_OPENSSL_LIBRARY /usr/local/lib64 /opt/local/lib ) -if(NOT GNUTLS_OPENSSL_LIBRARY) +#if(NOT GNUTLS_OPENSSL_LIBRARY) +if(GNUTLS_OPENSSL_LIBRARY) if(GnuTLS_FOUND) message(STATUS " But it was not built with openssl compatibility.") endif() @@ -2188,6 +2189,7 @@ if(NOT GNUTLS_OPENSSL_LIBRARY) PURPOSE "Used for the SUPL protocol implementation." TYPE REQUIRED ) + message("OPENSSL_FOUND: " ${OPENSSL_FOUND}) if(OPENSSL_FOUND) set_package_properties(GnuTLS PROPERTIES PURPOSE "Not found, but OpenSSL can replace it." diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index dc78ae094..4c6e9fb20 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -134,6 +134,7 @@ target_include_directories(core_system_parameters ) if(OPENSSL_FOUND) + message("OPENSSL_FOUND: " ${OPENSSL_FOUND}) if(TARGET OpenSSL::SSL) target_link_libraries(core_system_parameters PUBLIC @@ -150,10 +151,14 @@ if(OPENSSL_FOUND) ) endif() if(OPENSSL_VERSION) + message("OPENSSL_VERSION: " ${OPENSSL_VERSION}) if(OPENSSL_VERSION VERSION_GREATER "3.0.0") - target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_3=1) + target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_FALLBACK=1 -DUSE_OPENSSL_3=1) + message("USE_OPENSSL_3: " ${DUSE_OPENSSL_3}) + message("USE_OPENSSL_FALLBACK:" ${USE_OPENSSL_FALLBACK}) endif() endif() + else() target_link_libraries(core_system_parameters PUBLIC From 950c7310f9137d84f646922a65ca3dcba8cb5a38 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 11 Mar 2024 20:08:28 +0100 Subject: [PATCH 116/499] [TAS-154] signature verification with ossl 3 Several changes were made on gnss_crypto to ensure that the unit test passes. Public key copying and hex printing features were added. The OpenSSL header includes were updated. --- src/core/libs/osnma_msg_receiver.cc | 2 +- src/core/system_parameters/gnss_crypto.cc | 214 ++++++++++++++++------ src/core/system_parameters/gnss_crypto.h | 4 +- 3 files changed, 166 insertions(+), 54 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e7b824d6c..e7ca80da1 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1109,7 +1109,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. && it->tag_info.PRN_d == applicable_PRNd) { - if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key )) + if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key,applicable_NavData)) { nt++; } diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 0465abd15..965469433 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -30,6 +30,9 @@ #include #include #if USE_OPENSSL_3 +#include +#include +#include #include #define OPENSSL_ENGINE nullptr #else @@ -42,7 +45,6 @@ #include #endif - Gnss_Crypto::Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath) { #if USE_OPENSSL_FALLBACK @@ -492,6 +494,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) { + std::vector digest = this->computeSHA256(message); if (!have_public_key()) { std::cerr << "GnuTLS error: public key not available"<< std::endl; @@ -501,7 +504,8 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; - ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr /* no engine */); + print_pubkey_hex(d_PublicKey); + ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); bool do_operation = true; if (!ctx) @@ -519,7 +523,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st int verification = 0; if (do_operation) { - verification = EVP_PKEY_verify(ctx, signature.data(), signature.size(), message.data(), message.size()); + verification = EVP_PKEY_verify(ctx, signature.data(), signature.size(), digest.data(), digest.size()); } EVP_PKEY_CTX_free(ctx); if (verification == 1) @@ -528,7 +532,9 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } else { - std::cerr << "OpenSSL: message authentication failed" << std::endl; + unsigned long errCode = ERR_get_error(); + char* err = ERR_error_string(errCode, NULL); + std::cerr << "OpenSSL: message authentication failed: " << err << std::endl; } #else auto digest = this->computeSHA256(message); @@ -619,7 +625,28 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector& publicKey) { #if USE_OPENSSL_FALLBACK - // TODO + BIO *bio = NULL; + EVP_PKEY *pkey = NULL; + bio = BIO_new_mem_buf(publicKey.data(), publicKey.size()); + if (!bio) { + std::cerr << "Failed to create BIO for key \n"; + return; + } + + pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL); + BIO_free(bio); + + if (!pkey) { + std::cerr << "OpenSSL: error setting the public key " + << ". Aborting import" << std::endl; + return; + } + print_pubkey_hex(pkey); + + if(!pubkey_copy(pkey, &d_PublicKey)) + return + + EVP_PKEY_free(pkey); #else // // GNU-TLS // gnutls_global_init(); @@ -668,62 +695,145 @@ std::vector Gnss_Crypto::get_public_key() return {}; } - void Gnss_Crypto::my_log_func(int level, const char *msg) { - fprintf(stderr, " %s", level, msg);} +// TODO make them compilable with any prepro directive +// void Gnss_Crypto::my_log_func(int level, const char *msg) { +// fprintf(stderr, " %s", level, msg);} +// +// // gnutls-specific functions - // gnutls-specific functions - void Gnss_Crypto::print_pubkey_hex(gnutls_pubkey_t pubkey) - { - gnutls_datum_t key_datum; - int ret; +#if USE_OPENSSL_FALLBACK +bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) +{ + // Open a memory buffer + BIO* mem_bio = BIO_new(BIO_s_mem()); + if (mem_bio == NULL) + { + return false; + } - // Export the public key from pubkey to memory in DER format - ret = gnutls_pubkey_export2(pubkey, GNUTLS_X509_FMT_PEM, &key_datum); - if (ret < 0) { - std::cerr << "Failed to export public key: " << gnutls_strerror(ret) << std::endl; - return; - } + // Export the public key from src into the memory buffer in PEM format + if (!PEM_write_bio_PUBKEY(mem_bio, src)) + { + BIO_free(mem_bio); + return false; + } - std::stringstream ss; + // Add a null-terminator to the data in the memory buffer + //BIO_write(mem_bio, "\0", 1); - // Iterate through each byte in key_datum.data and print its hex value - for (unsigned int i = 0; i < key_datum.size; ++i) { - ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(key_datum.data[i]); - } + // Read the data from the memory buffer + char* bio_data; + long data_len = BIO_get_mem_data(mem_bio, &bio_data); - std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; + // Create a new memory buffer and load the data into it + BIO* mem_bio2 = BIO_new_mem_buf(bio_data, data_len); + if (mem_bio2 == NULL) + { + BIO_free(mem_bio); + return false; + } - // Free the memory allocated to key_datum.data - gnutls_free(key_datum.data); - } + // Read the public key from the new memory buffer + *dest = PEM_read_bio_PUBKEY(mem_bio2, NULL, NULL, NULL); + if (*dest == NULL) + { + BIO_free(mem_bio); + BIO_free(mem_bio2); + return false; + } - bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) - { - gnutls_datum_t key_datum; - int ret; + // Clean up + BIO_free(mem_bio); + BIO_free(mem_bio2); - // Export the public key from src to memory - ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); - if(ret < 0) { - gnutls_free(key_datum.data); - return false; - } + return true; +} +void Gnss_Crypto::print_pubkey_hex(EVP_PKEY* pubkey) +{ + BIO* mem_bio = BIO_new(BIO_s_mem()); + if (!mem_bio) { + std::cerr << "Failed to create new memory BIO\n"; + return; + } - // Initialize dest - ret = gnutls_pubkey_init(dest); - if(ret < 0) { - gnutls_free(key_datum.data); - return false; - } + if (!PEM_write_bio_PUBKEY(mem_bio, pubkey)){ + std::cerr << "Failed to write public key to BIO\n"; + BIO_free(mem_bio); + return; + } - // Import the public key data from key_datum to dest - ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); - gnutls_free(key_datum.data); + BUF_MEM* mem_ptr; + BIO_get_mem_ptr(mem_bio, &mem_ptr); // Fetch the underlying BUF_MEM structure from the BIO. - if(ret < 0) { - gnutls_pubkey_deinit(*dest); - return false; - } + std::stringstream ss; - return true; - } + // Iterate through each byte in mem_ptr->data and print its hex value. + for (size_t i = 0; i < mem_ptr->length; i++) { + ss << std::hex << std::setw(2) << std::setfill('0') << + static_cast(static_cast(mem_ptr->data[i])); + } + + std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; + + BIO_free(mem_bio); +} +#else + bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) + { + gnutls_datum_t key_datum; + int ret; + + // Export the public key from src to memory + ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); + if (ret < 0) + { + gnutls_free(key_datum.data); + return false; + } + + // Initialize dest + ret = gnutls_pubkey_init(dest); + if (ret < 0) + { + gnutls_free(key_datum.data); + return false; + } + + // Import the public key data from key_datum to dest + ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); + gnutls_free(key_datum.data); + + if (ret < 0) + { + gnutls_pubkey_deinit(*dest); + return false; + } + + return true; + } + + void Gnss_Crypto::print_pubkey_hex(gnutls_pubkey_t pubkey) + { + gnutls_datum_t key_datum; + int ret; + + // Export the public key from pubkey to memory in DER format + ret = gnutls_pubkey_export2(pubkey, GNUTLS_X509_FMT_PEM, &key_datum); + if (ret < 0) { + std::cerr << "Failed to export public key: " << gnutls_strerror(ret) << std::endl; + return; + } + + std::stringstream ss; + + // Iterate through each byte in key_datum.data and print its hex value + for (unsigned int i = 0; i < key_datum.size; ++i) { + ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(key_datum.data[i]); + } + + std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; + + // Free the memory allocated to key_datum.data + gnutls_free(key_datum.data); + } +#endif diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 96830b937..1191a7ed5 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -60,8 +60,10 @@ public: private: #if USE_OPENSSL_FALLBACK + bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); + void print_pubkey_hex(EVP_PKEY* pubkey); #if USE_OPENSSL_3 - EVP_PKEY* d_PublicKey; + EVP_PKEY* d_PublicKey{}; #else EC_KEY* d_PublicKey = nullptr; #endif From b5765048de89f52694503cbfeaa9bc6608e60561 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 16 Mar 2024 18:40:02 +0100 Subject: [PATCH 117/499] [TAS-160] bugfix readMack for tag size 20. Subframe filter if TOW repeated. Unit test for HMAC 256. Update OSNMA tables. --- src/core/libs/osnma_msg_receiver.cc | 221 ++++++++++-------- src/core/libs/osnma_msg_receiver.h | 3 + src/core/libs/supl/CMakeLists.txt | 3 +- src/core/system_parameters/Galileo_OSNMA.h | 13 +- src/core/system_parameters/gnss_crypto.cc | 53 ++++- .../osnma/gnss_crypto_test.cc | 24 ++ 6 files changed, 203 insertions(+), 114 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e7ca80da1..f439b97b8 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -60,7 +60,7 @@ osnma_msg_receiver::osnma_msg_receiver( d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); //d_old_mack_message.set_capacity(10); - d_old_OSNMA_buffer.set_capacity(12); + d_old_OSNMA_buffer.set_capacity(25); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -99,22 +99,8 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) << sat << std::endl; - // compare local time with OSNMA subframe time -// if(d_receiver_time != 0) -// { -// // d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,... -// // auto OSNMA_UTC_time = nma_msg->UtcModelData.GST_to_UTC_time(d_GST_SIS, nma_msg->WN_sf0); -// if(abs(OSNMA_UTC_time - OSNMA_UTC_time /*d_receiver_time*/) <= d_T_L) -// { process_osnma_message(nma_msg); -// } -// else -// { -// LOG(WARNING) << "OSNMA: Subframe received with time difference greater than " << T_L << " seconds"; -// } -// } - process_osnma_message(nma_msg); } else { @@ -144,8 +130,8 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); local_time_verification(osnma_msg); - process_dsm_block(osnma_msg); - read_and_process_mack_block(osnma_msg); + process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 + read_and_process_mack_block(osnma_msg); // only process them if a least 3 available. } @@ -231,7 +217,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; - + // TODO FIXME Galileo OSNMA: Available blocks for DSM_ID 6: [ - - - - - X - - - - - - - - - - ] in the first received Sf.. size 16? std::cout << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) { @@ -272,21 +258,24 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ void osnma_msg_receiver::local_time_verification(const std::shared_ptr& osnma_msg) { // compute local time based on GST_SIS and GST_0 - d_GST_SIS = osnma_msg->TOW_sf0 + osnma_msg->WN_sf0 * 604800; - d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; + d_GST_SIS = (osnma_msg->WN_sf0 & 0x00000FFF) << 20 | osnma_msg->TOW_sf0 & 0x000FFFFF; + //std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; + //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; + d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | d_osnma_data.d_dsm_kroot_message.towh_k & 0x000FFFFF) + 30; + //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. if(d_receiver_time != 0) { - d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0)/30); // Eq. 3 R.G. + d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. // d_receiver_time += 30; - std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; + //std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; } else {// local time not initialised -> compute it. - d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS-d_GST_0)/30); // Eq. 3 R.G. - std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; + d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. + //std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; } // verify time constraint std::time_t delta_T = abs(d_receiver_time - d_GST_SIS); @@ -296,9 +285,9 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; + //std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; - // TODO set flag to false to avoid processing dsm and MACK messagesy + // TODO set flag to false to avoid processing dsm and MACK messages } else if( delta_T > d_T_L && delta_T <= 10* delta_T ) { @@ -412,7 +401,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // validation of padding const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; - MSG.reserve(size_m + l_ds_bytes + 1); // C: message will get too many zeroes? ((12+1)+16) + 64 + 1? + MSG.reserve(size_m + l_ds_bytes + 1); // C: message will get too many zeroes? ((12+1)+16) + 64 + 1? => in theory not, allocating is not assigning MSG.push_back(osnma_msg->hkroot[0]); // C: NMA header for (uint16_t i = 1; i < size_m; i++) { @@ -570,8 +559,9 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr(d_mack_message[1]) << (lt_bits - 16)); if (lt_bits == 20) { - first_lt_bits += (static_cast(d_mack_message[1] & 0xF0) >> 4); - macseq += (static_cast(d_mack_message[1] & 0x0F) << 8); - macseq += static_cast(d_mack_message[2]); - cop += ((d_mack_message[3] & 0xF0) >> 4); + first_lt_bits += (static_cast(d_mack_message[2] & 0xF0) >> 4); + macseq += (static_cast(d_mack_message[2] & 0x0F) << 8); + macseq += static_cast(d_mack_message[3]); + cop += ((d_mack_message[4] & 0xF0) >> 4); } else if (lt_bits == 24) { @@ -651,7 +641,6 @@ void osnma_msg_receiver::read_mack_header() d_osnma_data.d_mack_message.header.cop = cop; } - /** * @brief Reads the MACK message body * @@ -676,7 +665,7 @@ void osnma_msg_receiver::read_mack_body() const uint16_t lk_bits = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks); // compute number of tags in the given Mack message as per Eq. 8 ICD uint16_t nt = std::floor((480.0 - float(lk_bits)) / (float(lt_bits) + 16.0)); - d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); // TODO - why nt-1? tag0 is not included? + d_osnma_data.d_mack_message.tag_and_info = std::vector(nt - 1); // retrieve tags and tag-info associated with the tags for (uint16_t k = 0; k < (nt - 1); k++) { @@ -689,36 +678,36 @@ void osnma_msg_receiver::read_mack_body() const uint16_t step = std::ceil(4.5 * k); if (k % 2 == 0) { - tag += (static_cast((d_mack_message[3 + step] & 0x0F)) << 16); - tag += (static_cast(d_mack_message[4 + step]) << 8); - tag += static_cast(d_mack_message[5 + step]); - PRN_d += d_mack_message[6 + step]; - ADKD += ((d_mack_message[7 + step] & 0xF0) >> 4); - cop += (d_mack_message[7 + step] & 0x0F); + tag += (static_cast((d_mack_message[4 + step] & 0x0F)) << 16); + tag += (static_cast(d_mack_message[5 + step]) << 8); + tag += static_cast(d_mack_message[6 + step]); + PRN_d += d_mack_message[7 + step]; + ADKD += ((d_mack_message[8 + step] & 0xF0) >> 4); + cop += (d_mack_message[8 + step] & 0x0F); if (k == (nt - 2)) { d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) { - d_osnma_data.d_mack_message.key[j] = d_mack_message[8 + step + j]; + d_osnma_data.d_mack_message.key[j] = d_mack_message[9 + step + j]; } } } else { - tag += (static_cast(d_mack_message[3 + step]) << 12); - tag += (static_cast(d_mack_message[4 + step]) << 4); - tag += (static_cast((d_mack_message[5 + step] & 0xF0)) >> 4); - PRN_d += (d_mack_message[5 + step] & 0x0F) << 4; - PRN_d += (d_mack_message[6 + step] & 0xF0) >> 4; - ADKD += (d_mack_message[6 + step] & 0x0F); - cop += (d_mack_message[7 + step] & 0xF0) >> 4; + tag += (static_cast(d_mack_message[4 + step]) << 12); + tag += (static_cast(d_mack_message[5 + step]) << 4); + tag += (static_cast((d_mack_message[6 + step] & 0xF0)) >> 4); + PRN_d += (d_mack_message[6 + step] & 0x0F) << 4; + PRN_d += (d_mack_message[7 + step] & 0xF0) >> 4; + ADKD += (d_mack_message[7 + step] & 0x0F); + cop += (d_mack_message[8 + step] & 0xF0) >> 4; if (k == (nt - 2)) { d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) { - d_osnma_data.d_mack_message.key[j] = ((d_mack_message[7 + step + j] & 0x0F) << 4) + ((d_mack_message[8 + step + j] & 0xF0) >> 4); + d_osnma_data.d_mack_message.key[j] = ((d_mack_message[8 + step + j] & 0x0F) << 4) + ((d_mack_message[9 + step + j] & 0xF0) >> 4); } } } @@ -801,7 +790,7 @@ void osnma_msg_receiver::read_mack_body() } else if (lt_bits == 40) { - tag += (static_cast((d_mack_message[7 + k * 7])) << 32); + tag += (static_cast((d_mack_message[7/* bytes of MACK header */ + k * 7 /* offset of k-th tag */])) << 32); tag += (static_cast((d_mack_message[8 + k * 7])) << 24); tag += (static_cast((d_mack_message[9 + k * 7])) << 16); tag += (static_cast((d_mack_message[10 + k * 7])) << 8); @@ -809,7 +798,7 @@ void osnma_msg_receiver::read_mack_body() PRN_d += d_mack_message[12 + k * 7]; ADKD += ((d_mack_message[13 + k * 7] & 0xF0) >> 4); cop += (d_mack_message[13 + k * 7] & 0x0F); - if (k == (nt - 2)) + if (k == (nt - 2)) // end of Tag&Info { d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) @@ -823,15 +812,7 @@ void osnma_msg_receiver::read_mack_body() d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = ADKD; d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; } - - // retrieve tesla key - uint8_t start_index_bytes = ( 480 - (lt_bits + 16) - (nt - 1) * ( lt_bits + 16 ) - 1 ) / 8; // includes -1 to start at [i-1] - uint8_t last_index_bytes = ( start_index_bytes * 8 + lk_bits ) / 8; - uint8_t key_index_bytes = 0; - for (uint8_t i = start_index_bytes; i < last_index_bytes ; i++, key_index_bytes++) - { - d_osnma_data.d_mack_message.key[key_index_bytes] = d_mack_message[i]; - } + // rest are padding bits, used for anything ? } @@ -851,34 +832,48 @@ void osnma_msg_receiver::read_mack_body() */ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& osnma_msg) { + d_flag_debug = true; // populate d_nav_data with needed data from subframe d_osnma_data.d_nav_data.init(osnma_msg); // store MACK, KROOT and NavData needed. d_old_OSNMA_buffer.push_back(d_osnma_data); - + if(d_old_OSNMA_buffer.size() < 3) + { + std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " + << "Not enough OSNMA messages available" + << "buffer size: "<< d_old_OSNMA_buffer.size() << std::endl; + return; + } if(d_kroot_verified == false && d_tesla_key_verified == false) { std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "No Kroot nor TESLA key available" << static_cast(d_osnma_data.d_nma_header.cid) << std::endl; - return; // early return, cannot proceed further without one of the two verified. + << "No Kroot nor TESLA key available" << std::endl; + if(!d_flag_debug) + return; // early return, cannot proceed further without one of the two verified. } // Verify tesla key - if(d_tesla_key_verified) + if(d_tesla_key_verified || d_flag_debug) { // TODO - find out I bt. both tesla keys, then hash until then, then compare. + // retrieve latest tesla key + // compute hashes needed + // hash current key until num_hashes and compare } else {// have to go until Kroot - uint8_t num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD + uint32_t num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; + auto start = std::chrono::high_resolution_clock::now(); uint32_t GST_SFi = d_receiver_time; std::vector K_II = d_osnma_data.d_mack_message.key; std::vector K_I; // result of the recursive hash operations const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint8_t i = 1; i < num_of_hashes_needed ; i++) + for (uint32_t i = 1; i < num_of_hashes_needed ; i++) { // build message digest m = (K_I+1 || GST_SFi || alpha) + // TODO sizeof() wrong. std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); std::copy(K_II.begin(),K_II.end(),msg.begin()); @@ -919,6 +914,10 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& K_I.clear(); // empty the actual one for a new computation } // compare computed current key against received key + auto end = std::chrono::high_resolution_clock::now(); + std::chrono::duration elapsed = end - start; + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + if(K_II.size() != d_osnma_data.d_mack_message.key.size()) { std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; @@ -936,62 +935,56 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return; + if(!d_flag_debug) + return; } } - // verify MACK tags - MACSEQ + OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe + d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; - - // for OSNMA data (MACK, KROOT messages): - // if ADKD=12, pick d_old_OSNMA_buffer.front() or d_old_OSNMA_buffer[1] iff d_old_OSNMA_buffer is full (guaranteed 10 SF above) - // otherwise pick d_old_OSNMA_buffer[size-2] - OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ - - // for the applicable tesla key: - // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] - std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key - + std::vector applicable_sequence; const auto it = OSNMA_TABLE_16.find(applicable_OSNMA.d_dsm_kroot_message.maclt); + // TODO as per RG example appears that the seq. q shall also be validated ageints either next or former Sf (depending on GST) if (it != OSNMA_TABLE_16.cend()) { - std::vector sq1 = it->second.sequence1; - std::vector sq2 = it->second.sequence2; + sq1 = it->second.sequence1; + sq2 = it->second.sequence2; } - std::vector sequence; + // Assign relevant sequence based on subframe time - if (d_GST_Sf % 60 == 0) + if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 < 30) // tried GST_Sf and it does not support the data present. { - sequence = sq1; + applicable_sequence = sq1; } - else if (d_GST_Sf % 60 == 30) + else if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 >= 30) { - sequence = sq2; + applicable_sequence = sq2; } else { - std::cout << "Galileo OSNMA: Mismatch in the GST verification => should end in 30 or 60 seconds but it dit not." << std::endl; + std::cout << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; } // compare ADKD of Mack tags with MACLT defined ADKDs - if(applicable_OSNMA.d_mack_message.tag_and_info.size() != sq1.size()) + if(applicable_OSNMA.d_mack_message.tag_and_info.size() != applicable_sequence.size()-1) { std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; return; } std::vector flxTags {}; std::string tempADKD; - for (uint8_t i = 0; i < d_osnma_data.d_mack_message.tag_and_info.size(); i++) + for (uint8_t i = 0; i < applicable_OSNMA.d_mack_message.tag_and_info.size(); i++) { - tempADKD = sequence[i]; + tempADKD = applicable_sequence[i+1]; if(tempADKD == "FLX") { flxTags.push_back(i); // C: just need to save the index in the sequence } - else if(d_osnma_data.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(sequence[i])) - { std::cout << "Galileo OSNMA: Unsuccessful verification of received ADKD against MAC Look-up table. " << std::endl; + else if(applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) + { std::cout << "Galileo OSNMA: Unsuccessful verification of MACSEQ - received ADKD against MAC Look-up table. " << std::endl; return; // C: suffices one incorrect to abort and not process the rest of the tags } } @@ -999,8 +992,8 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // MACSEQ verification // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + flxTags.size()); - m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A - SVID of the satellite transmiting the tag m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); @@ -1009,11 +1002,14 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& // Case tags flexible - Eq. 21 ICD for (uint8_t i = 0; i < flxTags.size() ; i++) { - m[i+5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; - m[i+6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + m[2*i + 5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[2*i + 6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; } - +// m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; +// applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, +// 0xb0, 0xf2, 0xa7, 0x24, 0x00, 0x22, 0xba, 0x8f}; +// applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; // compute mac std::vector mac; if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 @@ -1030,11 +1026,10 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { mac_msb = (mac[0] << 8) + mac[1]; } - uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; // TODO - double check, it was 0x0FFF which presuposes little endian... - + uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; // Verify tags if MACSEQ is authenticated if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq) - { + { // TODO this shall affect only flx tags verification - and currently all tags of a MACK are affected which is undesired std::cout << "OSNMA: MACSEQ authenticated for PRN_A " << osnma_msg->PRN << " with WN=" << osnma_msg->WN_sf0 << ", TOW=" @@ -1062,7 +1057,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ - int i = 0; + size_t i = 0; while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) @@ -1076,6 +1071,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; uint8_t counter_COP = 1; uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; + // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe NavData applicable_NavData{}; if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) @@ -1352,3 +1348,22 @@ bool osnma_msg_receiver::verify_tag(MACK_tag_and_info tag_and_info, } return verified; } +/** + * @brief Checks if the current subframe time is bigger than last one received. + * + * \details It compares the current GST value with the previous one and updates the old value with the new one. + * + * @param sharedPtr A shared pointer to an instance of OSNMA_msg. + * @return True if the current subframe is the next subframe, False otherwise. + */ +bool osnma_msg_receiver::is_next_subframe() +{ + bool is_bigger = d_GST_SIS > d_old_GST_SIS; + if(d_GST_SIS != d_old_GST_SIS + 30 && d_old_GST_SIS != 0){ + std::cout << "Galileo OSNMA:: Mack processing - skip " << std::endl; + } + + d_old_GST_SIS = d_GST_SIS; + + return is_bigger; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 5cde3ddfa..b6a7bb812 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -89,7 +89,9 @@ private: bool d_public_key_verified{false}; bool d_kroot_verified{false}; bool d_tesla_key_verified{false}; + bool d_flag_debug{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification + uint32_t d_old_GST_SIS{0}; uint8_t d_Lt_min {}; // minimum equivalent tag length uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing @@ -101,6 +103,7 @@ private: enum tags_to_verify{all,utc,slow_eph, eph, none}; // TODO is this safe? I hope so tags_to_verify d_tags_allowed{tags_to_verify::all}; std::vector d_tags_to_verify{0,4,12}; + bool is_next_subframe(); }; diff --git a/src/core/libs/supl/CMakeLists.txt b/src/core/libs/supl/CMakeLists.txt index a08631e91..743852047 100644 --- a/src/core/libs/supl/CMakeLists.txt +++ b/src/core/libs/supl/CMakeLists.txt @@ -49,7 +49,8 @@ endif() if(OPENSSL_FOUND) target_compile_definitions(core_libs_supl PUBLIC -DUSE_OPENSSL_FALLBACK=1) endif() - +message("OPENSSL_FOUND: " ${OPENSSL_FOUND}) +message("USE_OPENSSL_FALLBACK:" ${USE_OPENSSL_FALLBACK}) target_link_libraries(core_libs_supl PUBLIC ${GNUTLS_LIBRARIES} diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 44f607370..e6530b610 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -143,7 +143,7 @@ const std::unordered_map OSNMA_TABLE_11 = { {4, 0}, {5, 20}, {6, 24}, - {7, 26}, + {7, 28}, {8, 32}, {9, 40}, {10, 0}, @@ -184,7 +184,16 @@ const std::unordered_map OSNMA_TABLE_16 = { {27, {2, 6, {"00S", "00E", "00E", "00E", "12S", "00E"}, {"00S ", "00E", "00E", "04S", "12S", "00E"}}}, {28, {2, 10, {"00S", "00E", "00E", "00E", "00S", "00E", "00E", "12S", "00E", "00E"}, {"00S", "00E", "00E", "00S", "00E", "00E", "04S", "12S", "00E", "00E"}}}, {31, {2, 5, {"00S", "00E", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "04S"}}}, - {33, {2, 6, {"00S", "00E", "04S", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "00E", "12E"}}}}; + {33, {2, 6, {"00S", "00E", "04S", "00E", "12S", "00E"}, {"00S", "00E", "00E", "12S", "00E", "12E"}}}, + {34, {2, 6, {"00S", "FLX", "04S", "FLX", "12S", "00E"}, {"00S", "FLX", "00E", "12S", "00E", "12E"}}}, + {35, {2, 6, {"00S", "FLX", "04S", "FLX", "12S", "FLX"}, {"00S", "FLX", "FLX", "12S", "FLX", "FLX"}}}, + {36, {2, 5, {"00S", "FLX", "04S", "FLX", "12S"}, {"00S", "FLX", "00E", "12S", "12E"}}}, + {37, {2, 5, {"00S", "00E", "04S", "00E", "12S"}, {"00S", "00E", "00E", "12S", "12E"}}}, + {38, {2, 5, {"00S", "FLX", "04S", "FLX", "12S"}, {"00S", "FLX", "FLX", "12S", "FLX"}}}, + {39, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "00E", "12S"}}}, + {40, {2, 4, {"00S", "00E", "04S", "12S"}, {"00S", "00E", "00E", "12E"}}}, + {41, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "FLX", "12S"}}} +}; /** \} */ /** \} */ diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 965469433..af7df7899 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -502,6 +502,45 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } bool success = false; #if USE_OPENSSL_FALLBACK + + EVP_MD_CTX *mdctx = NULL; // verification context; a struct that wraps the message to be verified. + int ret = 0; // error + + /* Create the Message Digest Context */ + if(!(mdctx = EVP_MD_CTX_new())) goto err; // Allocates and returns a digest context. + + /* Initialize `key` with a public key */ + // hashes cnt bytes of data at d into the verification context ctx + if(1 != EVP_DigestVerifyInit(mdctx, NULL /*TODO null?*/, EVP_sha256(), NULL, d_PublicKey)) goto err; + + /* Initialize `key` with a public key */ + if(1 != EVP_DigestVerifyUpdate(mdctx, message.data(), message.size())) goto err; + + + if( 1== EVP_DigestVerifyFinal(mdctx, signature.data(), signature.size())) + { + return true; + } + else + { + unsigned long errCode = ERR_get_error(); + int lib_code = ERR_GET_LIB(errCode); + char* err = ERR_error_string(errCode, NULL); + const char* error_string = ERR_error_string(errCode, NULL); + std::cerr << "OpenSSL: message authentication failed: " << err /*<< + "from library with code " << lib_code << + " error string: " << error_string */<< std::endl; + } +err: + if(ret != 1) + { + /* Do some error handling */ + // notify other blocks + std::cout << "ECDSA_Verify_OSSL()::error " << ret << std::endl; + + } + + #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; print_pubkey_hex(d_PublicKey); @@ -695,11 +734,6 @@ std::vector Gnss_Crypto::get_public_key() return {}; } -// TODO make them compilable with any prepro directive -// void Gnss_Crypto::my_log_func(int level, const char *msg) { -// fprintf(stderr, " %s", level, msg);} -// -// // gnutls-specific functions #if USE_OPENSSL_FALLBACK bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) @@ -777,8 +811,11 @@ void Gnss_Crypto::print_pubkey_hex(EVP_PKEY* pubkey) BIO_free(mem_bio); } -#else - bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) +#else // gnutls-specific functions + void Gnss_Crypto::my_log_func(int level, const char *msg){ + fprintf(stderr, " %s", level, msg);} + + bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) { gnutls_datum_t key_datum; int ret; @@ -812,7 +849,7 @@ void Gnss_Crypto::print_pubkey_hex(EVP_PKEY* pubkey) return true; } - void Gnss_Crypto::print_pubkey_hex(gnutls_pubkey_t pubkey) + void Gnss_Crypto::print_pubkey_hex(gnutls_pubkey_t pubkey) { gnutls_datum_t key_datum; int ret; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 96304ef02..4f57162fa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -144,4 +144,28 @@ TEST(GnssCryptoTest,VerifyPubKeyImport) // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; +} + +// Unit test for computeHMAC_SHA_256 function. +TEST(GnssCryptoTest, TestComputeHMACSHA256) { + std::unique_ptr d_crypto = std::make_unique(); + std::vector key = { + 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, + 0x7D, 0x48, 0xE7, 0xF1, 0x48, 0x0C, 0xC2, 0x98, + 0xEB, 0x62, 0x3E, 0x95, 0x6B, 0x2B, 0xCE, 0xA3, + 0xB4, 0xD4, 0xDB, 0x31, 0xEE, 0x96, 0xAB, 0xFA }; + + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A + std::vector expected_output = { + 0xC3, 0x51, 0xF6, 0xFD, 0xDD, 0xC9, 0x8B, 0x41, + 0xD6, 0xF4, 0x77, 0x6D, 0xAC, 0xE8, 0xE0, 0x14, + 0xB2, 0x7A, 0xCC, 0x22, 0x00, 0xAA, 0xD2, 0x37, + 0xD0, 0x79, 0x06, 0x12, 0x83, 0x40, 0xB7, 0xA6 }; + + + std::vector output = d_crypto->computeHMAC_SHA_256(key, message); + + ASSERT_EQ(expected_output, output); + + } \ No newline at end of file From 37b343391c13db4ad062f891f497c520479139e9 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 16 Mar 2024 19:05:01 +0100 Subject: [PATCH 118/499] Refactor tag verification logic WIP --- src/core/libs/osnma_msg_receiver.cc | 614 ++++++++++++++--------- src/core/libs/osnma_msg_receiver.h | 17 +- src/core/system_parameters/osnma_data.cc | 1 + src/core/system_parameters/osnma_data.h | 41 ++ 4 files changed, 439 insertions(+), 234 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f439b97b8..21fe08b1e 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -38,6 +38,7 @@ #if PMT_USES_BOOST_ANY #include +#include namespace wht = boost; #else #include @@ -169,7 +170,7 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) } /* - * accumulates dsm messages until completeness, then calls process_dsm_message + * accumulates dsm messages * */ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) { @@ -559,9 +560,12 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr& osnma_msg) { d_flag_debug = true; - // populate d_nav_data with needed data from subframe - d_osnma_data.d_nav_data.init(osnma_msg); - // store MACK, KROOT and NavData needed. - d_old_OSNMA_buffer.push_back(d_osnma_data); - if(d_old_OSNMA_buffer.size() < 3) - { - std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "Not enough OSNMA messages available" - << "buffer size: "<< d_old_OSNMA_buffer.size() << std::endl; - return; - } + if(d_kroot_verified == false && d_tesla_key_verified == false) { std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "No Kroot nor TESLA key available" << std::endl; + << "No Kroot nor TESLA key available" << std::endl; if(!d_flag_debug) return; // early return, cannot proceed further without one of the two verified. } - - // Verify tesla key - if(d_tesla_key_verified || d_flag_debug) - { - // TODO - find out I bt. both tesla keys, then hash until then, then compare. - // retrieve latest tesla key - // compute hashes needed - // hash current key until num_hashes and compare + // verify tesla key and add it to the container of verified keys if successful + bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key); + if(retV){ + d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); } - else - {// have to go until Kroot - uint32_t num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; - auto start = std::chrono::high_resolution_clock::now(); - uint32_t GST_SFi = d_receiver_time; - std::vector K_II = d_osnma_data.d_mack_message.key; - std::vector K_I; // result of the recursive hash operations - const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint32_t i = 1; i < num_of_hashes_needed ; i++) - { - // build message digest m = (K_I+1 || GST_SFi || alpha) - // TODO sizeof() wrong. - std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); - std::copy(K_II.begin(),K_II.end(),msg.begin()); - msg.push_back((d_GST_Sf & 0xFF000000) >> 24); - msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); - msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); - msg.push_back(d_GST_Sf & 0x000000FF); - // extract alpha - for (int k = 5; k >= 0;k--) - { - // TODO: static extracts the MSB in case from larger to shorter int? - msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. - } - // compute hash - std::vector hash; - if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. - { - hash = d_crypto->computeSHA256(msg); - } - else if (d_osnma_data.d_dsm_kroot_message.hf == 2) - { - hash = d_crypto->computeSHA3_256(msg); - } + // MACSEQ - verify current macks, then add current retrieved mack to the end. + for (auto& mack : d_macks_awating_MACSEQ_verification){ + if(d_tesla_keys.find(mack.TOW) != d_tesla_keys.end()){ + bool ret = verify_macseq(mack); + + } + + } + // TODO verify MACSEQ of FLX tags + // add newly retrieved tags to the container + for (const auto& MTI: d_osnma_data.d_mack_message.tag_and_info){ + Tag tag(MTI, d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_nav_data.PRNa); + d_tags_awaiting_verify.insert({tag.TOW, tag}); + } + + // d_satellite_data already updated from a msg_handler coming from TD. TODO + +// d_old_OSNMA_buffer.push_back(d_osnma_data); // TODO deprecate +// if(d_keys.size() < 2) +// { +// std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " +// << "Not enough OSNMA messages available" +// << "buffer size: "<< d_old_OSNMA_buffer.size() << std::endl; +// return; +// } + + // verify tags + for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end(); ++it){ + bool ret; + if(d_tesla_keys.find(it->first) != d_tesla_keys.end() && nav_data_available(it->second)){ + ret = verify_tag(it->second); + if(ret) + int a; + // TODO notify PVT via pmt else - { - hash = std::vector(32); - } - // truncate hash - K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits - for (uint16_t i = 0; i < lk_bytes; i++) - { - K_I.push_back(hash[i]); - } - - // set parameters for next iteration - GST_SFi -= 30; // next SF time is the actual minus 30 seconds - K_II = K_I; // next key is the actual one - K_I.clear(); // empty the actual one for a new computation - } - // compare computed current key against received key - auto end = std::chrono::high_resolution_clock::now(); - std::chrono::duration elapsed = end - start; - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; - - if(K_II.size() != d_osnma_data.d_mack_message.key.size()) - { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return; - } - if (K_II == d_osnma_data.d_mack_message.key) - { - std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; - d_tesla_key_verified = true; - // TODO - propagate result - // TODO - save current tesla key as latest one? propose a map with - // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence - } - else - - { - std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - if(!d_flag_debug) - return; + int a; + // also } } + remove_verified_tags(); + + control_tags_awaiting_verify_size(); // remove oldest tags if size is too big. + + + + + + + + + + + + // verify MACK tags - MACSEQ OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe - d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + + //d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; @@ -968,7 +935,6 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& { std::cout << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; } - // compare ADKD of Mack tags with MACLT defined ADKDs if(applicable_OSNMA.d_mack_message.tag_and_info.size() != applicable_sequence.size()-1) { std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; @@ -976,6 +942,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& } std::vector flxTags {}; std::string tempADKD; + // MACLT verification for (uint8_t i = 0; i < applicable_OSNMA.d_mack_message.tag_and_info.size(); i++) { tempADKD = applicable_sequence[i+1]; @@ -989,121 +956,96 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& } } - // MACSEQ verification - // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A - SVID of the satellite transmiting the tag - m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); - m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); - m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); - m[4] = static_cast(d_GST_Sf & 0x000000FF); - - // Case tags flexible - Eq. 21 ICD - for (uint8_t i = 0; i < flxTags.size() ; i++) - { - m[2*i + 5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; - m[2*i + 6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | - applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; - } -// m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; -// applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, -// 0xb0, 0xf2, 0xa7, 0x24, 0x00, 0x22, 0xba, 0x8f}; -// applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; - // compute mac - std::vector mac; - if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 - { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); - } - else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES - { - mac = d_crypto->computeCMAC_AES(applicable_key, m); - } - // Truncate the twelve MSBits and compare with received MACSEQ - uint16_t mac_msb = 0; - if (!mac.empty()) - { - mac_msb = (mac[0] << 8) + mac[1]; - } - uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; // Verify tags if MACSEQ is authenticated - if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq) - { // TODO this shall affect only flx tags verification - and currently all tags of a MACK are affected which is undesired - std::cout << "OSNMA: MACSEQ authenticated for PRN_A " + bool flxTagsV = false; + if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq && flxTags.size() > 0) + { + std::cout << "Galileo OSNMA: FLX tags authenticated for PRN_A " << osnma_msg->PRN << " with WN=" << osnma_msg->WN_sf0 << ", TOW=" << osnma_msg->TOW_sf0 << ". Verifying tags. " << std::endl; - uint8_t lt_bits = 0; - const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); - if (it2 != OSNMA_TABLE_11.cend()) - { - lt_bits = it2->second; - } - if (lt_bits == 0) - { - return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. + flxTagsV = true; + } + + uint8_t lt_bits = 0; + const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it2 != OSNMA_TABLE_11.cend()) + { + lt_bits = it2->second; + } + if (lt_bits == 0) + { + return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. + } + + // Tag verification + // tag[i-1]: + // adkd = 4/0 : use TK[i], NavData[i-2] to validate Tag[i-1] + // adkd = 12 : ignore it -> not possible to verify yet + // tag[i-10] + // adkd = 4/0 : use TK[i-9], NavData[i-11] to validate Tag[i-10] would already be done by tag[i-1] + // adkd = 12 : use TK[i], NavData[i-11] to validate Tag[i-10] TODO - pending better logic for not repeating this while twice. + int t = d_old_OSNMA_buffer.size() - 2; + applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ + + size_t i = 0; + while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message + std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs + applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) + != d_tags_to_verify.end()) + { + // TODO - if a subsequent tag was already part of the verification (inner loop), this while is going to ignore that and try to validate it anyway. + + // check if tag is flx + bool is_flexible_tag = std::find(flxTags.begin(),flxTags.end(), i) != flxTags.end(); + if(is_flexible_tag && flxTagsV == false){ + //std::cout << "Galileo OSNMA: cannot verify flx tag. " << std::endl; + continue; } - // Tag verification - // tag[i-1]: - // adkd = 4/0 : use TK[i], NavData[i-2] to validate Tag[i-1] - // adkd = 12 : ignore it -> not possible to verify yet - // tag[i-10] - // adkd = 4/0 : use TK[i-9], NavData[i-11] to validate Tag[i-10] would already be done by tag[i-1] - // adkd = 12 : use TK[i], NavData[i-11] to validate Tag[i-10] TODO - pending better logic for not repeating this while twice. - int t = d_old_OSNMA_buffer.size() - 2; - applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ - size_t i = 0; - while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message - std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs - applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) - != d_tags_to_verify.end()) + // Take tag_k and check its ADKD, COP, PRN_d, this will be the reference for the iteration and search of other Tags + uint8_t Nt = d_Lt_min / applicable_OSNMA.d_dsm_kroot_message.ts; // Tags needed to be verified + uint8_t applicable_ADKD = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD; + uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; + uint8_t counter_COP = 1; + uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; + // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] + applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe + NavData applicable_NavData{}; + if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) { - // TODO - if a subsequent tag was already part of the verification (inner loop), this while is going to ignore that and try to validate it anyway. - - // Take tag_k and check its ADKD, COP, PRN_d, this will be the reference for the iteration and search of other Tags - uint8_t Nt = d_Lt_min / applicable_OSNMA.d_dsm_kroot_message.ts; // Tags needed to be verified - uint8_t applicable_ADKD = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD; - uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; - uint8_t counter_COP = 1; - uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; - // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] - applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe - NavData applicable_NavData{}; - if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) - { - applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; - } - else if(applicable_ADKD == 12 && d_old_OSNMA_buffer.size() > 11) - { - applicable_NavData = d_old_OSNMA_buffer[t - 11].d_nav_data; - } - else - { - std::cout << "Galileo OSNMA: MACK message buffer elements not enough. Cannot verify tags. " << std::endl; - } + applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; + } + else if(applicable_ADKD == 12 && d_old_OSNMA_buffer.size() > 11) + { + applicable_NavData = d_old_OSNMA_buffer[t - 11].d_nav_data; + } + else + { + std::cout << "Galileo OSNMA: MACK message buffer elements not enough. Cannot verify tags. " << std::endl; + } - int k = i + 1; - uint8_t nt = 0; - bool flag_cancel_tag_verification = false; // if a tag fails, cancel whole NavData verification set - // Look for tags relative to reference NavData until Nt achieved, - // this may require going back in time, as long as COP is valid - while (nt <= Nt && counter_COP <= applicable_COP && !flag_cancel_tag_verification) - { - auto start_it = std::next(applicable_OSNMA.d_mack_message.tag_and_info.begin(), k); + int k = i + 1; + uint8_t nt = 0; + bool flag_cancel_tag_verification = false; // if a tag fails, cancel whole NavData verification set + // Look for tags relative to reference NavData until Nt achieved, + // this may require going back in time, as long as COP is valid + while (nt <= Nt && counter_COP <= applicable_COP && !flag_cancel_tag_verification) + { + auto start_it = std::next(applicable_OSNMA.d_mack_message.tag_and_info.begin(), k); - // check the vector of tags of aplicable OSNMA for a match against the chosen - for (auto it = start_it; it != applicable_OSNMA.d_mack_message.tag_and_info.end() && nt <= Nt; ++it) + // check the vector of tags of aplicable OSNMA for a match against the chosen + for (auto it = start_it; it != applicable_OSNMA.d_mack_message.tag_and_info.end() && nt <= Nt; ++it) { - // Check if ADKD, COP, and PRN_d match - if(it->tag_info.ADKD == applicable_ADKD - // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. - && it->tag_info.PRN_d == applicable_PRNd) + // Check if ADKD, COP, and PRN_d match + if(it->tag_info.ADKD == applicable_ADKD + // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. + && it->tag_info.PRN_d == applicable_PRNd) { if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key,applicable_NavData)) { @@ -1111,46 +1053,44 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& } else { - // failure, discard this k-th tag - flag_cancel_tag_verification = true; - std::cout << "Galileo OSNMA: tag verification failed for PRN_a " - << applicable_OSNMA.d_nav_data.PRNa << " with WN=" - << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" - << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " - << std::endl; + // failure, discard this k-th tag + flag_cancel_tag_verification = true; + std::cout << "Galileo OSNMA: tag verification failed for PRN_a " + << applicable_OSNMA.d_nav_data.PRNa << " with WN=" + << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" + << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " + << std::endl; } } - if(flag_cancel_tag_verification) - break; + if(flag_cancel_tag_verification) + break; } - // Check if Nt is achieved, if not, switch to older frame - if(nt < Nt && t > 0 /*not end of buffer*/ && counter_COP <= applicable_COP && !flag_cancel_tag_verification) - { - t--; - applicable_OSNMA = d_old_OSNMA_buffer[t]; - applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; - applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; - d_GST_Sf -= 30; - counter_COP++; - k = 0; - } - } - - if (nt >= Nt) + // Check if Nt is achieved, if not, switch to older frame + if(nt < Nt && t > 0 /*not end of buffer*/ && counter_COP <= applicable_COP && !flag_cancel_tag_verification) { - nt = 0; - std::cout << "Galileo OSNMA: tag verification accumulation succesful for PRN_a " - << applicable_OSNMA.d_nav_data.PRNa << " with WN=" - << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" - << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " - << std::endl; + t--; + applicable_OSNMA = d_old_OSNMA_buffer[t]; + applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; + applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; + d_GST_Sf -= 30; + counter_COP++; + k = 0; } - } + if (nt >= Nt) + { + nt = 0; + std::cout << "Galileo OSNMA: tag verification accumulation succesful for PRN_a " + << applicable_OSNMA.d_nav_data.PRNa << " with WN=" + << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" + << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " + << std::endl; + } } + } bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) @@ -1348,6 +1288,27 @@ bool osnma_msg_receiver::verify_tag(MACK_tag_and_info tag_and_info, } return verified; } +bool osnma_msg_receiver::verify_tag(Tag& tag) +{ + // TODO +// m = t.build_message(t) // **needs d_nav_data[t.PRNd][t.TOW-30]** +// +// t.hasKey()?: k = t.**getKey**() +// +// computed_tag = d_crypto→hmac(m,k) +// +// if t.tag == computed_tag +// +// t.verified::true; +// +// return true +// +// else +// +// t.verified::false +// +// return false; +} /** * @brief Checks if the current subframe time is bigger than last one received. * @@ -1367,3 +1328,194 @@ bool osnma_msg_receiver::is_next_subframe() return is_bigger; } +void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) +{ + while (d_satellite_data[SV_ID].size() >= 25) { + d_satellite_data[SV_ID].erase(d_satellite_data[SV_ID].begin()); + } + d_osnma_data[TOW] = crypto; // crypto + d_satellite_data[SV_ID][TOW] = data; // nav + std::cout << "Galileo OSNMA: added element, size is " << d_satellite_data[SV_ID].size() << std::endl; +} +void osnma_msg_receiver::display_data() +{ + if(d_satellite_data.empty()) + return; + + for(const auto& satellite : d_satellite_data) { + std::cout << "SV_ID: " << satellite.first << std::endl; + for(const auto& towData : satellite.second) { + std::cout << "\tTOW: " << towData.first << " key: "; + for(size_t i = 0; i < towData.second.d_mack_message.key.size(); i++) { + std::cout << std::hex << std::setfill('0') << std::setw(2) + << static_cast(towData.second.d_mack_message.key[i]) << " "; + } + } + } +} +bool osnma_msg_receiver::verify_tesla_key(std::vector& key) +{ + if(d_tesla_key_verified || d_flag_debug) + { + // TODO - find out I bt. both tesla keys, then hash until then, then compare. + // retrieve latest tesla key + // compute hashes needed + // hash current key until num_hashes and compare + } + else + {// have to go until Kroot + uint32_t num_of_hashes_needed = (d_GST_SIS - d_GST_0) / 30 + 1; // Eq. 19 ICD + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; + auto start = std::chrono::high_resolution_clock::now(); + uint32_t GST_SFi = d_GST_SIS; + std::vector K_II = applicable_MACK.key; + std::vector K_I; // result of the recursive hash operations + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; + // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) + for (uint32_t i = 1; i < num_of_hashes_needed ; i++) + { + // build message digest m = (K_I+1 || GST_SFi || alpha) + std::vector msg(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::copy(K_II.begin(),K_II.end(),msg.begin()); + + msg.push_back((d_GST_Sf & 0xFF000000) >> 24); + msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); + msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); + msg.push_back(d_GST_Sf & 0x000000FF); + // extract alpha + for (int k = 5; k >= 0;k--) + { + // TODO: static extracts the MSB in case from larger to shorter int? + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. + } + // compute hash + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + { + hash = d_crypto->computeSHA256(msg); + } + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + { + hash = d_crypto->computeSHA3_256(msg); + } + else + { + hash = std::vector(32); + } + // truncate hash + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + for (uint16_t i = 0; i < lk_bytes; i++) + { + K_I.push_back(hash[i]); + } + + // set parameters for next iteration + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation + } + // compare computed current key against received key + auto end = std::chrono::high_resolution_clock::now(); + std::chrono::duration elapsed = end - start; + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + + if(K_II.size() != applicable_MACK.key.size()) + { + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + return; + } + if (K_II == applicable_MACK.key) + { + std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + d_keys.insert(std::pair(applicable_MACK.TOW,applicable_MACK.key)); + d_tesla_key_verified = true; + // TODO - propagate result + // TODO - save current tesla key as latest one? propose a map with + // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + } + else + + { + std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + if(!d_flag_debug) + return; + } + } + +} +void osnma_msg_receiver::remove_verified_tags() +{ + for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end() ; ){ + if (it->second.status == Tag::SUCCESS || it->second.status == Tag::FAIL) + it = d_tags_awaiting_verify.erase(it); + else + ++it; + } +} +void osnma_msg_receiver::control_tags_awaiting_verify_size() +{ + // TODO +} +bool osnma_msg_receiver::verify_macseq(MACK_message& message) +{ + // MACSEQ verification + + // Fixed as well as FLX Tags share first part - Eq. 22 ICD + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); + m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); + m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); + m[4] = static_cast(d_GST_Sf & 0x000000FF); + // Case tags flexible - Eq. 21 ICD + for (uint8_t i = 0; i < flxTags.size() ; i++) + { + m[2*i + 5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[2*i + 6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; + } + // m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; + // applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, + // 0xb0, 0xf2, 0xa7, 0x24, 0x00, 0x22, 0xba, 0x8f}; + // applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; + // compute mac + std::vector mac; + if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + // Truncate the twelve MSBits and compare with received MACSEQ + uint16_t mac_msb = 0; + if (!mac.empty()) + { + mac_msb = (mac[0] << 8) + mac[1]; + } + uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; + if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq && flxTags.size() > 0) + return true; + else + return false; +} +bool osnma_msg_receiver::nav_data_available(Tag t) +{ + auto prn_it = d_satellite_nav_data.find(t.PRNa); + if (prn_it != d_satellite_nav_data.end()) { + // PRN was found, check if TOW exists in inner map + std::map& tow_map = prn_it->second; + auto tow_it = tow_map.find(t.TOW); + if (tow_it != tow_map.end()) { + return true; + } else { + // TOW not found + return false; + } + } else { + // PRN was not found + return false; + } + return false; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index b6a7bb812..1a2703bcd 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -72,14 +72,23 @@ private: void read_mack_header(); void read_mack_body(); void process_mack_message(const std::shared_ptr& osnma_msg); + void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); + bool verify_tesla_key(std::vector& key); + void const display_data(); bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); + bool verify_tag(Tag& tag); + bool is_next_subframe(); + bool nav_data_available(Tag& t); - //boost::circular_buffer d_old_mack_message; + std::map> d_satellite_nav_data; // map holding NavData sorted by SVID and TOW. boost::circular_buffer d_old_OSNMA_buffer; // buffer that holds last 12 received OSNMA messages, including current one at back() + std::map> d_tesla_keys; // tesla keys over time, sorted by TOW + std::vector d_macks_awating_MACSEQ_verification; + std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; - std::array, 16> d_dsm_message{}; // C: each dsm[0-15] has 2048 bits + std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. std::array, 16> d_dsm_id_received{}; std::array d_number_of_blocks{}; std::array d_mack_message{}; // C: 480 b @@ -103,7 +112,9 @@ private: enum tags_to_verify{all,utc,slow_eph, eph, none}; // TODO is this safe? I hope so tags_to_verify d_tags_allowed{tags_to_verify::all}; std::vector d_tags_to_verify{0,4,12}; - bool is_next_subframe(); + void remove_verified_tags(); + void control_tags_awaiting_verify_size(); + bool verify_macseq(MACK_message& message); }; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 9a291330d..44f343286 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -163,3 +163,4 @@ void NavData::generate_utc_vector() utc_vector.push_back(static_cast(bit_buffer)); } } + diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 4bc78ebbb..4a05ddabb 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -121,6 +121,7 @@ public: MACK_header header; std::vector tag_and_info; std::vector key; + uint32_t TOW; // TODO duplicated variable }; class NavData @@ -157,9 +158,49 @@ public: DSM_KROOT_message d_dsm_kroot_message; MACK_message d_mack_message; NavData d_nav_data; + }; +class Tag +{ +public: + enum e_verification_status{ + SUCCESS, + FAIL, + UNVERIFIED}; + Tag(const MACK_tag_and_info& MTI, uint32_t TOW, uint32_t PRNa) + : tag_id(id_counter++), + received_tag(MTI.tag), + computed_tag(0), + PRN_d(MTI.tag_info.PRN_d), + ADKD(MTI.tag_info.ADKD), + cop(MTI.tag_info.cop), + TOW(TOW), + PRNa(PRNa), + status(UNVERIFIED) + { + } + const uint32_t tag_id; + uint32_t TOW; + uint32_t PRNa; + std::vector build_message(); + e_verification_status status; + +private: + uint32_t static id_counter; + uint64_t received_tag; + uint64_t computed_tag; + + + uint8_t PRN_d; + uint8_t ADKD; + uint8_t cop; + + + +; +}; /** \} */ /** \} */ #endif // GNSS_SDR_OSNMA_DATA_H From f03608ac827b0b3eac471bbc6af9c47131ad2573 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 29 Mar 2024 14:39:32 +0100 Subject: [PATCH 119/499] Update links --- CMakeLists.txt | 6 +++--- README.md | 31 +++++++++++++++------------ cmake/Modules/FindLOG4CPP.cmake | 2 +- cmake/Modules/FindPCAP.cmake | 2 +- docs/CHANGELOG.md | 5 ++--- docs/doxygen/other/main_page.dox | 6 +++--- docs/doxygen/other/reference_docs.dox | 14 ++++++------ docs/protobuf/README.md | 5 ++--- src/utils/nav-listener/README.md | 2 +- src/utils/rinex-tools/README.md | 2 +- 10 files changed, 38 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7c3bf7d38..324e118fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1927,7 +1927,7 @@ endif() ################################################################################ -# Armadillo - http://arma.sourceforge.net/ +# Armadillo - https://arma.sourceforge.net/ ################################################################################ if(ENABLE_OWN_ARMADILLO) unset(Armadillo::armadillo CACHE) @@ -1939,7 +1939,7 @@ else() endif() set_package_properties(Armadillo PROPERTIES - URL "http://arma.sourceforge.net/" + URL "https://arma.sourceforge.net/" PURPOSE "Used for matrix computations." TYPE REQUIRED ) @@ -2538,7 +2538,7 @@ endif() ################################################################################ find_package(Protobuf) set_package_properties(Protobuf PROPERTIES - URL "https://developers.google.com/protocol-buffers/" + URL "https://protobuf.dev/" PURPOSE "Used to serialize output data in a way that can be read by other applications." TYPE REQUIRED ) diff --git a/README.md b/README.md index edac6e4af..bba7566a3 100644 --- a/README.md +++ b/README.md @@ -396,7 +396,7 @@ or manually as explained below, and then please follow instructions on how to ### Manual installation of other required dependencies -#### Install [Armadillo](http://arma.sourceforge.net/ "Armadillo's Homepage"), a C++ linear algebra library +#### Install [Armadillo](https://arma.sourceforge.net/ "Armadillo's Homepage"), a C++ linear algebra library ``` $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint @@ -469,7 +469,7 @@ $ sudo make install $ sudo ldconfig ``` -#### Install [Protocol Buffers](https://developers.google.com/protocol-buffers/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data +#### Install [Protocol Buffers](https://protobuf.dev/ "Protocol Buffers' Homepage"), a portable mechanism for serialization of structured data GNSS-SDR requires Protocol Buffers v3.0.0 or later. If the packages that come with your distribution are older than that (_e.g._, Ubuntu 16.04 Xenial came @@ -886,7 +886,7 @@ $ brew install lapack ### Other package managers GNU Radio and other dependencies can also be installed using other package -managers than Macports, such as [Fink](http://www.finkproject.org/ "Fink"). +managers than Macports, such as [Fink](https://www.finkproject.org/ "Fink"). Since the version of Python that ships with OS X is great for learning but it is not good for development, you could have another Python executable in a non-standard location. If that is the case, you need to inform GNSS-SDR's @@ -976,7 +976,7 @@ do so.

- **GNSS-SDR in embedded platforms**: we provide a Software Development Kit - (SDK) based on [OpenEmbedded](http://www.openembedded.org/wiki/Main_Page) for + (SDK) based on [OpenEmbedded](https://www.openembedded.org/wiki/Main_Page) for cross-compiling GNSS-SDR in your desktop computer and for producing executables that can run in embedded platforms, such as Xilinx's Zynq and ZynqMP architectures, Raspberry Pi, and many others. Please check @@ -1991,11 +1991,11 @@ PVT.rtcm_MT1077_rate_ms=1000 Notation (JSON) supported by numerous mapping and GIS software packages, including [OpenLayers](https://openlayers.org), [Leaflet](https://leafletjs.com), [MapServer](https://mapserver.org/), - [GeoServer](http://geoserver.org), [GeoDjango](https://www.djangoproject.com), - [GDAL](https://gdal.org/), and [CartoDB](https://cartodb.com). It is also - possible to use GeoJSON with [PostGIS](https://postgis.net/) and - [Mapnik](https://mapnik.org/), both of which handle the format via the GDAL - OGR conversion library. The + [GeoServer](https://geoserver.org/), + [GeoDjango](https://www.djangoproject.com), [GDAL](https://gdal.org/), and + [CartoDB](https://cartodb.com). It is also possible to use GeoJSON with + [PostGIS](https://postgis.net/) and [Mapnik](https://mapnik.org/), both of + which handle the format via the GDAL OGR conversion library. The [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/) v3 directly supports the [integration of GeoJSON data layers](https://developers.google.com/maps/documentation/javascript/examples/layer-data-simple), @@ -2008,8 +2008,9 @@ PVT.rtcm_MT1077_rate_ms=1000 (OGC KML), and it is maintained by the Open Geospatial Consortium, Inc. (OGC). KML files can be displayed in geobrowsers such as [Google Earth](https://www.google.com/earth/), - [Marble](https://marble.kde.org), [osgEarth](http://osgearth.org), or used - with the [NASA World Wind SDK for Java](https://worldwind.arc.nasa.gov/java/). + [Marble](https://marble.kde.org), + [osgEarth](https://github.com/gwaldron/osgearth), or used with the + [NASA World Wind SDK for Java](https://worldwind.arc.nasa.gov/java/). - **GPX** (the GPS Exchange Format) is a lightweight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications @@ -2044,9 +2045,11 @@ PVT.rtcm_MT1077_rate_ms=1000 (usually with other data unknown to the original receiver, such as better models of the atmospheric conditions at time of measurement). RINEX files can be used by software packages such as - [GNSSTK](https://github.com/SGL-UT/gnsstk), [RTKLIB](http://www.rtklib.com/), - and [gLAB](https://gage.upc.edu/gLAB/). GNSS-SDR by default generates RINEX - version [3.02](ftp://igs.org/pub/data/format/rinex302.pdf). If + [GNSSTK](https://github.com/SGL-UT/gnsstk), [RTKLIB](https://www.rtklib.com/), + and + [gLAB](https://gage.upc.edu/en/learning-materials/software-tools/glab-tool-suite). + GNSS-SDR by default generates RINEX version + [3.02](ftp://igs.org/pub/data/format/rinex302.pdf). If [2.11](ftp://igs.org/pub/data/format/rinex211.txt) is needed, it can be requested through the `rinex_version` parameter in the configuration file: diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 73876d1da..95a14cf62 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -121,7 +121,7 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LOG4CPP DEFAULT_MSG LOG4CPP_INCLUDE_DIRS LOG4CPP_LIBRARIES) set_package_properties(LOG4CPP PROPERTIES - URL "http://log4cpp.sourceforge.net/" + URL "https://log4cpp.sourceforge.net/" ) if(LOG4CPP_FOUND AND PC_LOG4CPP_VERSION) diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index b72b5f5d1..ae4b049f6 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -6,7 +6,7 @@ # - Find pcap # Find the PCAP includes and library -# http://www.tcpdump.org/ +# https://www.tcpdump.org/ # # The environment variable PCAPDIR allows to specify where to find # libpcap in non standard location. diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c453414f6..3d797d433 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -328,7 +328,7 @@ https://gnss-sdr.org/design-forces/ - Fixed building against GNU Radio v3.10.X.Y, which does not support the C++20 standard. - Fixed building against GNU Radio v3.10.X.Y, which replaced - [log4cpp](http://log4cpp.sourceforge.net/) by the + [log4cpp](https://log4cpp.sourceforge.net/) by the [spdlog](https://github.com/gabime/spdlog) and [fmt](https://github.com/fmtlib/fmt) libraries. - Updated `cpu_features` library for improved processor detection. @@ -475,8 +475,7 @@ https://gnss-sdr.org/design-forces/ inconsistencies in the configuration file. - Fix segmentation fault if the RINEX output was disabled. - Added a feature that optionally enables the remote monitoring of GPS and - Galileo ephemeris using UDP and - [Protocol Buffers](https://developers.google.com/protocol-buffers). + Galileo ephemeris using UDP and [Protocol Buffers](https://protobuf.dev/). - Now building the software passing the `-DENABLE_FPGA=ON` to CMake does not make the receiver unusable when running on non-FPGA-enabled platforms. On FPGA-enabled platforms, now it is possible to run non-FPGA-enabled diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 0968c3eb9..5545c2bae 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -77,19 +77,19 @@ As outputs, it provides: In principle, GNSS-SDR can be built in any Unix-like system. In practice, it depends on being able to install all the required dependencies. See the building guide page for details about the project's dependencies and build process. Mainly, it consists on installing GNU Radio plus some few more libraries: -\li Armadillo, a C++ linear algebra library, +\li Armadillo, a C++ linear algebra library, \li Boost, a set of free peer-reviewed portable C++ source libraries, \li Gflags, a library that implements commandline flags processing, \li Glog, a library that implements application-level logging, \li Googletest, Google's framework for writing C++ tests, \li Mako, a template library written in Python, \li Matio, a MATLAB MAT File I/O Library, -\li Protocol Buffers, a language-neutral, platform-neutral extensible mechanism for serializing structured data, +\li Protocol Buffers, a language-neutral, platform-neutral extensible mechanism for serializing structured data, \li PugiXML, a light-weight, simple and fast XML parser for C++ with XPath support, \li Volk, a Vector-Optimized Library of Kernels which provides an abstraction of optimized math routines targeting several SIMD processors, and, optionally, -\li GNU Radio modules for hardware interface (gr-uhd, gr-osmosdr, gr-iio), +\li GNU Radio modules for hardware interface (gr-uhd, gr-osmosdr, gr-iio), \li Benchmark, a library to benchmark code snippets, \li Gperftools, which provides fast, multi-threaded malloc() and performance analysis tools. diff --git a/docs/doxygen/other/reference_docs.dox b/docs/doxygen/other/reference_docs.dox index 00af2e1a2..5871776d5 100644 --- a/docs/doxygen/other/reference_docs.dox +++ b/docs/doxygen/other/reference_docs.dox @@ -153,7 +153,7 @@ automatically selected by the CMake script): You can get it from ISO, IEC - or ANSI. The closest free working document available is ISO, IEC - or ANSI. The closest free working document available is N4659.
  • C++14: A former ISO C++ standard was officially known as ISO International Standard ISO/IEC 14882:2014 – Programming languages – C++. You can get it from ISO or ANSI. The closest free working document available is N4296.
  • C++11: An older ISO C++ standard was ISO/IEC 14882:2011. You can get it from ISO. The closest free working document available is N3337.
  • @@ -207,7 +207,7 @@ User plane protocols: \li Open Mobile Alliance (OMA), Secure User Plane Location Architecture Version 2 (SUPL 2.0), April 2012. LTE Release 9 introduced extension hooks in LPP messages, so that the bodies external to 3GPP could extend the LPP feature set. OMA LPP extensions (LPPe), supported in SUPL 3.0, build on top of the 3GPP LPP reusing its procedures and data types. -Check the OMA Specifications webpage for updated information about LPP Extensions (LPPe) Specification. +Check the OMA Specifications webpage for updated information about LPP Extensions (LPPe) Specification. \li The OMA Mobile Location Protocol (MLP) V3.5 is an application-level protocol for getting the position of mobile stations diff --git a/docs/protobuf/README.md b/docs/protobuf/README.md index a555ae44c..438a9d66d 100644 --- a/docs/protobuf/README.md +++ b/docs/protobuf/README.md @@ -11,9 +11,8 @@ SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades Files in this folder describe structured data formats that are generated by -GNSS-SDR. They use -[Protocol Buffers](https://developers.google.com/protocol-buffers/)' -[proto3](https://developers.google.com/protocol-buffers/docs/proto3) syntax. +GNSS-SDR. They use [Protocol Buffers](https://protobuf.dev/)' +[proto3](https://protobuf.dev/programming-guides/proto3/) syntax. From those files, the protocol buffer compiler creates classes that implement automatic encoding and parsing of the protocol buffer data with an efficient diff --git a/src/utils/nav-listener/README.md b/src/utils/nav-listener/README.md index 147e9717f..76b2aedaf 100644 --- a/src/utils/nav-listener/README.md +++ b/src/utils/nav-listener/README.md @@ -17,7 +17,7 @@ as a example on how to retrieve data using the `nav_message.proto` file. # Build the software This software requires [Boost](https://www.boost.org/) and -[Protocol Buffers](https://developers.google.com/protocol-buffers). +[Protocol Buffers](https://protobuf.dev/). In a terminal, type: diff --git a/src/utils/rinex-tools/README.md b/src/utils/rinex-tools/README.md index 58a1bd259..453ccd7a9 100644 --- a/src/utils/rinex-tools/README.md +++ b/src/utils/rinex-tools/README.md @@ -17,7 +17,7 @@ observation files. Requirements: -- [Armadillo](http://arma.sourceforge.net/): A C++ library for linear algebra +- [Armadillo](https://arma.sourceforge.net/): A C++ library for linear algebra and scientific computing. This program requires version 9.800 or higher. If your installed Armadillo version is older, see below. - [Gflags](https://github.com/gflags/gflags): A C++ library that implements From 4d934017c6f9b0e9f9d07f5992d0ddc0d958ddd4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 29 Mar 2024 22:57:49 +0100 Subject: [PATCH 120/499] CI: Fix macos-based jobs --- .github/workflows/main.yml | 27 +++++++++++++++++++++------ README.md | 3 ++- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 56e631df8..ad507ba20 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,6 +40,9 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: install dependencies run: | brew update @@ -53,8 +56,10 @@ jobs: rm /usr/local/bin/pydoc3.1* || true rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + brew link --overwrite python@3.12 brew install ninja hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf python-mako + gflags glog gnuradio log4cpp openssl pugixml protobuf + pip3 install mako - name: configure run: cd build && cmake -GNinja .. - name: build @@ -68,6 +73,9 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: install dependencies run: | brew update @@ -81,8 +89,10 @@ jobs: rm /usr/local/bin/pydoc3.1* || true rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 + brew link --overwrite python@3.12 brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf python-mako + gflags glog gnuradio log4cpp openssl pugixml protobuf + pip3 install mako - name: configure run: cd build && cmake -GXcode .. - name: build @@ -115,6 +125,9 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' - name: install dependencies run: | brew update @@ -128,15 +141,17 @@ jobs: rm /usr/local/bin/pydoc3.1* || true rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 - brew install llvm pkg-config hdf5 armadillo lapack gflags glog gnuradio libmatio \ - log4cpp openssl pugixml protobuf python-mako + brew link --overwrite python@3.12 + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ + gflags glog gnuradio log4cpp openssl pugixml protobuf llvm + pip3 install mako ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin - ln -s $(brew --prefix llvm)/bin/run-clang-tidy /usr/local/bin + ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.14.0 core_monitor core_libs pvt_libs - name: run clang-tidy - run: cd build && run-clang-tidy -fix + run: cd build && /usr/local/opt/llvm/bin/run-clang-tidy -fix - name: check run: | git diff > clang_tidy.patch diff --git a/README.md b/README.md index bba7566a3..02bc80df7 100644 --- a/README.md +++ b/README.md @@ -872,9 +872,10 @@ Install the required dependencies: ``` $ brew update && brew upgrade $ brew install armadillo cmake hdf5 gflags glog gnuradio libmatio log4cpp \ - openssl pkg-config protobuf pugixml python-mako + openssl pkg-config protobuf pugixml $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen +¢ pip3 install mako ``` For macOS versions older than Sonoma, you will also need LAPACK: From d0b170547470da859fe08b86682cd27c6d7d1170 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 30 Mar 2024 00:10:55 +0100 Subject: [PATCH 121/499] Bump local version of Protocol Buffers to 26.1 and GNSSTk to 14.3.0 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 324e118fb..a20109162 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -339,11 +339,11 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.26") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "26.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") -set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.0.0") +set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.3") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") From 9120f5e59a1f9d0bab01f9ed0ff1082fc49c049e Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 16 Mar 2024 19:05:01 +0100 Subject: [PATCH 122/499] Refactor tag verification logic WIP --- src/core/libs/osnma_msg_receiver.cc | 837 ++++++++++++++--------- src/core/libs/osnma_msg_receiver.h | 17 +- src/core/system_parameters/osnma_data.cc | 6 + src/core/system_parameters/osnma_data.h | 37 + 4 files changed, 588 insertions(+), 309 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f439b97b8..21321e685 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -38,6 +38,7 @@ #if PMT_USES_BOOST_ANY #include +#include namespace wht = boost; #else #include @@ -169,7 +170,7 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) } /* - * accumulates dsm messages until completeness, then calls process_dsm_message + * accumulates dsm messages * */ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) { @@ -559,9 +560,12 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr& osnma_msg) { d_flag_debug = true; - // populate d_nav_data with needed data from subframe - d_osnma_data.d_nav_data.init(osnma_msg); - // store MACK, KROOT and NavData needed. - d_old_OSNMA_buffer.push_back(d_osnma_data); - if(d_old_OSNMA_buffer.size() < 3) - { - std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "Not enough OSNMA messages available" - << "buffer size: "<< d_old_OSNMA_buffer.size() << std::endl; - return; - } + if(d_kroot_verified == false && d_tesla_key_verified == false) { std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "No Kroot nor TESLA key available" << std::endl; + << "No Kroot nor TESLA key available" << std::endl; if(!d_flag_debug) return; // early return, cannot proceed further without one of the two verified. } - - // Verify tesla key - if(d_tesla_key_verified || d_flag_debug) - { - // TODO - find out I bt. both tesla keys, then hash until then, then compare. - // retrieve latest tesla key - // compute hashes needed - // hash current key until num_hashes and compare - } - else - {// have to go until Kroot - uint32_t num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; - auto start = std::chrono::high_resolution_clock::now(); - uint32_t GST_SFi = d_receiver_time; - std::vector K_II = d_osnma_data.d_mack_message.key; - std::vector K_I; // result of the recursive hash operations - const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint32_t i = 1; i < num_of_hashes_needed ; i++) - { - // build message digest m = (K_I+1 || GST_SFi || alpha) - // TODO sizeof() wrong. - std::vector msg(sizeof(K_II) + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); - std::copy(K_II.begin(),K_II.end(),msg.begin()); - - msg.push_back((d_GST_Sf & 0xFF000000) >> 24); - msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); - msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); - msg.push_back(d_GST_Sf & 0x000000FF); - // extract alpha - for (int k = 5; k >= 0;k--) - { - // TODO: static extracts the MSB in case from larger to shorter int? - msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. - } - // compute hash - std::vector hash; - if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. - { - hash = d_crypto->computeSHA256(msg); - } - else if (d_osnma_data.d_dsm_kroot_message.hf == 2) - { - hash = d_crypto->computeSHA3_256(msg); - } - else - { - hash = std::vector(32); - } - // truncate hash - K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits - for (uint16_t i = 0; i < lk_bytes; i++) - { - K_I.push_back(hash[i]); - } - - // set parameters for next iteration - GST_SFi -= 30; // next SF time is the actual minus 30 seconds - K_II = K_I; // next key is the actual one - K_I.clear(); // empty the actual one for a new computation - } - // compare computed current key against received key - auto end = std::chrono::high_resolution_clock::now(); - std::chrono::duration elapsed = end - start; - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; - - if(K_II.size() != d_osnma_data.d_mack_message.key.size()) - { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return; - } - if (K_II == d_osnma_data.d_mack_message.key) - { - std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; - d_tesla_key_verified = true; - // TODO - propagate result - // TODO - save current tesla key as latest one? propose a map with - // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence - } - else - - { - std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - if(!d_flag_debug) - return; - } + // verify tesla key and add it to the container of verified keys if successful + bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key); + if(retV){ + d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); } - // verify MACK tags - MACSEQ - OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe - d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. - std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key ie transmitted in the next subframe - std::vector sq1{}; - std::vector sq2{}; - std::vector applicable_sequence; - const auto it = OSNMA_TABLE_16.find(applicable_OSNMA.d_dsm_kroot_message.maclt); - // TODO as per RG example appears that the seq. q shall also be validated ageints either next or former Sf (depending on GST) - if (it != OSNMA_TABLE_16.cend()) - { - sq1 = it->second.sequence1; - sq2 = it->second.sequence2; - } - - // Assign relevant sequence based on subframe time - if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 < 30) // tried GST_Sf and it does not support the data present. - { - applicable_sequence = sq1; - } - else if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 >= 30) - { - applicable_sequence = sq2; - } - else - { - std::cout << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; - } - // compare ADKD of Mack tags with MACLT defined ADKDs - if(applicable_OSNMA.d_mack_message.tag_and_info.size() != applicable_sequence.size()-1) - { - std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; - return; - } - std::vector flxTags {}; - std::string tempADKD; - for (uint8_t i = 0; i < applicable_OSNMA.d_mack_message.tag_and_info.size(); i++) - { - tempADKD = applicable_sequence[i+1]; - if(tempADKD == "FLX") - { - flxTags.push_back(i); // C: just need to save the index in the sequence - } - else if(applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) - { std::cout << "Galileo OSNMA: Unsuccessful verification of MACSEQ - received ADKD against MAC Look-up table. " << std::endl; - return; // C: suffices one incorrect to abort and not process the rest of the tags - } - } - - // MACSEQ verification - - // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A - SVID of the satellite transmiting the tag - m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); - m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); - m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); - m[4] = static_cast(d_GST_Sf & 0x000000FF); - - // Case tags flexible - Eq. 21 ICD - for (uint8_t i = 0; i < flxTags.size() ; i++) - { - m[2*i + 5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; - m[2*i + 6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | - applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; - } -// m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; -// applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, -// 0xb0, 0xf2, 0xa7, 0x24, 0x00, 0x22, 0xba, 0x8f}; -// applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; - // compute mac - std::vector mac; - if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 - { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); - } - else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES - { - mac = d_crypto->computeCMAC_AES(applicable_key, m); - } - // Truncate the twelve MSBits and compare with received MACSEQ - uint16_t mac_msb = 0; - if (!mac.empty()) - { - mac_msb = (mac[0] << 8) + mac[1]; - } - uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; - // Verify tags if MACSEQ is authenticated - if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq) - { // TODO this shall affect only flx tags verification - and currently all tags of a MACK are affected which is undesired - std::cout << "OSNMA: MACSEQ authenticated for PRN_A " - << osnma_msg->PRN << " with WN=" - << osnma_msg->WN_sf0 << ", TOW=" - << osnma_msg->TOW_sf0 << ". Verifying tags. " - << std::endl; - uint8_t lt_bits = 0; - const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); - if (it2 != OSNMA_TABLE_11.cend()) - { - lt_bits = it2->second; - } - if (lt_bits == 0) - { - return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. - } - - // Tag verification - // tag[i-1]: - // adkd = 4/0 : use TK[i], NavData[i-2] to validate Tag[i-1] - // adkd = 12 : ignore it -> not possible to verify yet - // tag[i-10] - // adkd = 4/0 : use TK[i-9], NavData[i-11] to validate Tag[i-10] would already be done by tag[i-1] - // adkd = 12 : use TK[i], NavData[i-11] to validate Tag[i-10] TODO - pending better logic for not repeating this while twice. - int t = d_old_OSNMA_buffer.size() - 2; - applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ - - size_t i = 0; - while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message - std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs - applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) - != d_tags_to_verify.end()) - { - // TODO - if a subsequent tag was already part of the verification (inner loop), this while is going to ignore that and try to validate it anyway. - - // Take tag_k and check its ADKD, COP, PRN_d, this will be the reference for the iteration and search of other Tags - uint8_t Nt = d_Lt_min / applicable_OSNMA.d_dsm_kroot_message.ts; // Tags needed to be verified - uint8_t applicable_ADKD = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD; - uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; - uint8_t counter_COP = 1; - uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; - // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] - applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe - NavData applicable_NavData{}; - if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) - { - applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; - } - else if(applicable_ADKD == 12 && d_old_OSNMA_buffer.size() > 11) - { - applicable_NavData = d_old_OSNMA_buffer[t - 11].d_nav_data; - } - else - { - std::cout << "Galileo OSNMA: MACK message buffer elements not enough. Cannot verify tags. " << std::endl; - } - - - int k = i + 1; - uint8_t nt = 0; - bool flag_cancel_tag_verification = false; // if a tag fails, cancel whole NavData verification set - // Look for tags relative to reference NavData until Nt achieved, - // this may require going back in time, as long as COP is valid - while (nt <= Nt && counter_COP <= applicable_COP && !flag_cancel_tag_verification) - { - auto start_it = std::next(applicable_OSNMA.d_mack_message.tag_and_info.begin(), k); - - // check the vector of tags of aplicable OSNMA for a match against the chosen - for (auto it = start_it; it != applicable_OSNMA.d_mack_message.tag_and_info.end() && nt <= Nt; ++it) - { - // Check if ADKD, COP, and PRN_d match - if(it->tag_info.ADKD == applicable_ADKD - // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. - && it->tag_info.PRN_d == applicable_PRNd) + // MACSEQ - verify current macks, then add current retrieved mack to the end. + auto mack = d_macks_awaiting_MACSEQ_verification.begin(); + while (mack != d_macks_awaiting_MACSEQ_verification.end()){ + if(d_tesla_keys.find(mack->TOW) != d_tesla_keys.end()){ + bool ret = verify_macseq(*mack); + if (ret || d_flag_debug){ + for(auto& tag:mack->tag_and_info) { - if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key,applicable_NavData)) - { - nt++; - } - else - { - // failure, discard this k-th tag - flag_cancel_tag_verification = true; - std::cout << "Galileo OSNMA: tag verification failed for PRN_a " - << applicable_OSNMA.d_nav_data.PRNa << " with WN=" - << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" - << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " - << std::endl; - } - + Tag t(tag, mack->TOW, mack->PRNa); + d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); } - if(flag_cancel_tag_verification) - break; + mack = d_macks_awaiting_MACSEQ_verification.erase(mack); } - // Check if Nt is achieved, if not, switch to older frame - if(nt < Nt && t > 0 /*not end of buffer*/ && counter_COP <= applicable_COP && !flag_cancel_tag_verification) - { - t--; - applicable_OSNMA = d_old_OSNMA_buffer[t]; - applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; - applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; - d_GST_Sf -= 30; - counter_COP++; - k = 0; - } - } - - if (nt >= Nt) + else { - nt = 0; - std::cout << "Galileo OSNMA: tag verification accumulation succesful for PRN_a " - << applicable_OSNMA.d_nav_data.PRNa << " with WN=" - << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" - << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " - << std::endl; + mack = d_macks_awaiting_MACSEQ_verification.erase(mack); } - } - - + else { // key not yet available - keep in container until then -- might be deleted if container size exceeds max allowed + ++mack; + } } + // add current received MACK to the container to be verified in the next iteration (on this one no key available) + d_macks_awaiting_MACSEQ_verification.push_back(d_osnma_data.d_mack_message); + + + // d_satellite_data already updated from a msg_handler coming from TD. TODO + +// d_old_OSNMA_buffer.push_back(d_osnma_data); // TODO deprecate +// if(d_keys.size() < 2) +// { +// std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " +// << "Not enough OSNMA messages available" +// << "buffer size: "<< d_old_OSNMA_buffer.size() << std::endl; +// return; +// } + + // verify tags + for (auto & it : d_tags_awaiting_verify){ + bool ret; + if(d_tesla_keys.find(it.first) != d_tesla_keys.end() && nav_data_available(it.second)){ + ret = verify_tag(it.second); + /* TODO - take into account: + * - COP: if + * - ADKD type + * - NavData the tag verifies (min. number of bits verified to consider NavData OK) + * */ + if(ret) + int a; + /* TODO notify PVT via pmt + * have_new_data() true + * signal which one is verified + * communicate to PVT*/ + else + int a; + // also + } + } + + remove_verified_tags(); + + control_tags_awaiting_verify_size(); // remove oldest tags if size is too big. + + // deprecated tag verification - it includes steps not yet present on verify_tag, so keep it until then. + // Tag verification + // tag[i-1]: + // adkd = 4/0 : use TK[i], NavData[i-2] to validate Tag[i-1] + // adkd = 12 : ignore it -> not possible to verify yet + // tag[i-10] + // adkd = 4/0 : use TK[i-9], NavData[i-11] to validate Tag[i-10] would already be done by tag[i-1] + // adkd = 12 : use TK[i], NavData[i-11] to validate Tag[i-10] TODO - pending better logic for not repeating this while twice. +// int t = d_old_OSNMA_buffer.size() - 2; +// applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe +// d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ +// +// size_t i = 0; +// while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message +// std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs +// applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) +// != d_tags_to_verify.end()) +// { +// // TODO - if a subsequent tag was already part of the verification (inner loop), this while is going to ignore that and try to validate it anyway. +// +// // check if tag is flx +// bool is_flexible_tag = std::find(flxTags.begin(),flxTags.end(), i) != flxTags.end(); +// if(is_flexible_tag && flxTagsV == false){ +// //std::cout << "Galileo OSNMA: cannot verify flx tag. " << std::endl; +// continue; +// } +// +// +// // Take tag_k and check its ADKD, COP, PRN_d, this will be the reference for the iteration and search of other Tags +// uint8_t Nt = d_Lt_min / applicable_OSNMA.d_dsm_kroot_message.ts; // Tags needed to be verified +// uint8_t applicable_ADKD = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD; +// uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; +// uint8_t counter_COP = 1; +// uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; +// // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] +// applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe +// NavData applicable_NavData{}; +// if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) +// { +// applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; +// } +// else if(applicable_ADKD == 12 && d_old_OSNMA_buffer.size() > 11) +// { +// applicable_NavData = d_old_OSNMA_buffer[t - 11].d_nav_data; +// } +// else +// { +// std::cout << "Galileo OSNMA: MACK message buffer elements not enough. Cannot verify tags. " << std::endl; +// } +// +// +// int k = i + 1; +// uint8_t nt = 0; +// bool flag_cancel_tag_verification = false; // if a tag fails, cancel whole NavData verification set +// // Look for tags relative to reference NavData until Nt achieved, +// // this may require going back in time, as long as COP is valid +// while (nt <= Nt && counter_COP <= applicable_COP && !flag_cancel_tag_verification) +// { +// auto start_it = std::next(applicable_OSNMA.d_mack_message.tag_and_info.begin(), k); +// +// // check the vector of tags of aplicable OSNMA for a match against the chosen +// for (auto it = start_it; it != applicable_OSNMA.d_mack_message.tag_and_info.end() && nt <= Nt; ++it) +// { +// // Check if ADKD, COP, and PRN_d match +// if(it->tag_info.ADKD == applicable_ADKD +// // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. +// && it->tag_info.PRN_d == applicable_PRNd) +// { +// if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key,applicable_NavData)) +// { +// nt++; +// } +// else +// { +// // failure, discard this k-th tag +// flag_cancel_tag_verification = true; +// std::cout << "Galileo OSNMA: tag verification failed for PRN_a " +// << applicable_OSNMA.d_nav_data.PRNa << " with WN=" +// << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" +// << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " +// << std::endl; +// } +// +// } +// if(flag_cancel_tag_verification) +// break; +// } +// // Check if Nt is achieved, if not, switch to older frame +// if(nt < Nt && t > 0 /*not end of buffer*/ && counter_COP <= applicable_COP && !flag_cancel_tag_verification) +// { +// t--; +// applicable_OSNMA = d_old_OSNMA_buffer[t]; +// applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; +// applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; +// d_GST_Sf -= 30; +// counter_COP++; +// k = 0; +// } +// } +// +// if (nt >= Nt) +// { +// nt = 0; +// std::cout << "Galileo OSNMA: tag verification accumulation succesful for PRN_a " +// << applicable_OSNMA.d_nav_data.PRNa << " with WN=" +// << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" +// << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " +// << std::endl; +// } +// +// } + } bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) @@ -1348,6 +1223,91 @@ bool osnma_msg_receiver::verify_tag(MACK_tag_and_info tag_and_info, } return verified; } +bool osnma_msg_receiver::verify_tag(Tag& tag) +{ + std::vector m = tag.build_message(); + + std::vector mac; + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + { + mac = d_crypto->computeHMAC_SHA_256(d_tesla_keys[tag.TOW], m); + } + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + { + mac = d_crypto->computeCMAC_AES(d_tesla_keys[tag.TOW], m); + } + + // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD + uint8_t lt_bits = 0; // TODO - remove this duplication of code. + const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it2 != OSNMA_TABLE_11.cend()) + { + lt_bits = it2->second; + } + if (lt_bits == 0) + { + return false; + } + uint64_t computed_mac = static_cast(mac[0]) << (lt_bits - 8); + computed_mac += (static_cast(mac[1]) << (lt_bits - 16)); + if (lt_bits == 20) + { + computed_mac += (static_cast(mac[1] & 0xF0) >> 4); + } + else if (lt_bits == 24) + { + computed_mac += static_cast(mac[2]); + } + else if (lt_bits == 28) + { + computed_mac += (static_cast(mac[2]) << 4); + computed_mac += (static_cast(mac[3] & 0xF0) >> 4); + } + else if (lt_bits == 32) + { + computed_mac += (static_cast(mac[2]) << 8); + computed_mac += static_cast(mac[3]); + } + else if (lt_bits == 40) + { + computed_mac += (static_cast(mac[2]) << 16); + computed_mac += (static_cast(mac[3]) << 8); + computed_mac += static_cast(mac[4]); + } + + // Compare computed tag with received one truncated + if (tag.received_tag == computed_mac) + { + if(tag.ADKD == 0 || tag.ADKD == 12) + { + std::cout << "Galileo OSNMA: tag verification successful for PRN_a " + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " + << "Ephemeris, Clock and Ionospheric data" << ". " + << std::endl; + } + else if(tag.ADKD == 4) + { + std::cout << "Galileo OSNMA: tag verification successful for PRN_a " + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " + << "Timing data" << ". " + << std::endl; + } + return true; + + } + else + { + std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" + << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << std::endl; + return false; + } +} /** * @brief Checks if the current subframe time is bigger than last one received. * @@ -1367,3 +1327,268 @@ bool osnma_msg_receiver::is_next_subframe() return is_bigger; } +void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) +{ + while (d_satellite_data[SV_ID].size() >= 25) { + d_satellite_data[SV_ID].erase(d_satellite_data[SV_ID].begin()); + } + d_osnma_data[TOW] = crypto; // crypto + d_satellite_data[SV_ID][TOW] = data; // nav + std::cout << "Galileo OSNMA: added element, size is " << d_satellite_data[SV_ID].size() << std::endl; +} +void osnma_msg_receiver::display_data() +{ + if(d_satellite_data.empty()) + return; + + for(const auto& satellite : d_satellite_data) { + std::cout << "SV_ID: " << satellite.first << std::endl; + for(const auto& towData : satellite.second) { + std::cout << "\tTOW: " << towData.first << " key: "; + for(size_t i = 0; i < towData.second.d_mack_message.key.size(); i++) { + std::cout << std::hex << std::setfill('0') << std::setw(2) + << static_cast(towData.second.d_mack_message.key[i]) << " "; + } + } + } +} +bool osnma_msg_receiver::verify_tesla_key(std::vector& key) +{ + if(d_tesla_key_verified || d_flag_debug) + { + // TODO - find out I bt. both tesla keys, then hash until then, then compare. + // retrieve latest tesla key + // compute hashes needed + // hash current key until num_hashes and compare + } + else + {// have to go until Kroot + uint32_t num_of_hashes_needed = (d_GST_SIS - d_GST_0) / 30 + 1; // Eq. 19 ICD + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; + auto start = std::chrono::high_resolution_clock::now(); + uint32_t GST_SFi = d_GST_SIS; + std::vector K_II = applicable_MACK.key; + std::vector K_I; // result of the recursive hash operations + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; + // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) + for (uint32_t i = 1; i < num_of_hashes_needed ; i++) + { + // build message digest m = (K_I+1 || GST_SFi || alpha) + std::vector msg(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::copy(K_II.begin(),K_II.end(),msg.begin()); + + msg.push_back((d_GST_Sf & 0xFF000000) >> 24); + msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); + msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); + msg.push_back(d_GST_Sf & 0x000000FF); + // extract alpha + for (int k = 5; k >= 0;k--) + { + // TODO: static extracts the MSB in case from larger to shorter int? + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. + } + // compute hash + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + { + hash = d_crypto->computeSHA256(msg); + } + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + { + hash = d_crypto->computeSHA3_256(msg); + } + else + { + hash = std::vector(32); + } + // truncate hash + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + for (uint16_t i = 0; i < lk_bytes; i++) + { + K_I.push_back(hash[i]); + } + + // set parameters for next iteration + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation + } + // compare computed current key against received key + auto end = std::chrono::high_resolution_clock::now(); + std::chrono::duration elapsed = end - start; + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + + if(K_II.size() != applicable_MACK.key.size()) + { + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + return; + } + if (K_II == applicable_MACK.key) + { + std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + d_keys.insert(std::pair(applicable_MACK.TOW,applicable_MACK.key)); + d_tesla_key_verified = true; + // TODO - propagate result + // TODO - save current tesla key as latest one? propose a map with + // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + } + else + + { + std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + if(!d_flag_debug) + return; + } + } + +} +/** + * @brief Removes the tags that have been verified from the multimap d_tags_awaiting_verify. + * + * This function iterates through the multimap d_tags_awaiting_verify, and removes the tags that have a status of SUCCESS or FAIL. + */ +void osnma_msg_receiver::remove_verified_tags() +{ + for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end() ; ){ + if (it->second.status == Tag::SUCCESS || it->second.status == Tag::FAIL) + it = d_tags_awaiting_verify.erase(it); + else + ++it; + } +} +/** + * @brief Control the size of the tags awaiting verification multimap. + * + * This function checks the size of the multimap `d_tags_awaiting_verify` and removes + * elements from the beginning until the size is no longer greater than 60. + * The purpose is to limit the size of the multimap and prevent it from consuming + * excessive memory. + */ +void osnma_msg_receiver::control_tags_awaiting_verify_size() +{ + while(d_tags_awaiting_verify.size() > 60) + { + d_tags_awaiting_verify.erase(d_tags_awaiting_verify.begin()); + } +} + +/** + * @brief Verifies the MACSEQ of a received MACK_message. + * + * \details checks for each tag in the retrieved mack message if its flexible (MACSEQ) or not (MACSEQ/MACLT depending on configuration param. (TODO) + * @param message The MACK_message to verify. + * @return True if the MACSEQ is valid, false otherwise. + */ +bool osnma_msg_receiver::verify_macseq(MACK_message& message) +{ + // MACSEQ verification + + // verify MACK tags - MACSEQ + OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe + + //d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key ie transmitted in the next subframe + std::vector sq1{}; + std::vector sq2{}; + std::vector applicable_sequence; + const auto it = OSNMA_TABLE_16.find(applicable_OSNMA.d_dsm_kroot_message.maclt); + // TODO as per RG example appears that the seq. q shall also be validated ageints either next or former Sf (depending on GST) + if (it != OSNMA_TABLE_16.cend()) + { + sq1 = it->second.sequence1; + sq2 = it->second.sequence2; + } + + // Assign relevant sequence based on subframe time + if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 < 30) // tried GST_Sf and it does not support the data present. + { + applicable_sequence = sq1; + } + else if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 >= 30) + { + applicable_sequence = sq2; + } + else + { + std::cout << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; + } + if(applicable_OSNMA.d_mack_message.tag_and_info.size() != applicable_sequence.size()-1) + { + std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; + return; + } + std::vector flxTags {}; + std::string tempADKD; + // MACLT verification + for (uint8_t i = 0; i < applicable_OSNMA.d_mack_message.tag_and_info.size(); i++) + { + tempADKD = applicable_sequence[i+1]; + if(tempADKD == "FLX") + { + flxTags.push_back(i); // C: just need to save the index in the sequence + } + else if(applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) + { std::cout << "Galileo OSNMA: Unsuccessful verification of MACSEQ - received ADKD against MAC Look-up table. " << std::endl; + return; // C: suffices one incorrect to abort and not process the rest of the tags + } + } + + // Fixed as well as FLX Tags share first part - Eq. 22 ICD + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); + m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); + m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); + m[4] = static_cast(d_GST_Sf & 0x000000FF); + // Case tags flexible - Eq. 21 ICD + for (uint8_t i = 0; i < flxTags.size() ; i++) + { + m[2*i + 5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[2*i + 6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; + } + // m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; + // applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, + // 0xb0, 0xf2, 0xa7, 0x24, 0x00, 0x22, 0xba, 0x8f}; + // applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; + // compute mac + std::vector mac; + if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + // Truncate the twelve MSBits and compare with received MACSEQ + uint16_t mac_msb = 0; + if (!mac.empty()) + { + mac_msb = (mac[0] << 8) + mac[1]; + } + uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; + if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq && !flxTags.empty()) + return true; + else + return false; +} +bool osnma_msg_receiver::nav_data_available(Tag t) +{ + auto prn_it = d_satellite_nav_data.find(t.PRNa); + if (prn_it != d_satellite_nav_data.end()) { + // PRN was found, check if TOW exists in inner map + std::map& tow_map = prn_it->second; + auto tow_it = tow_map.find(t.TOW); + if (tow_it != tow_map.end()) { + return true; + } else { + // TOW not found + return false; + } + } else { + // PRN was not found + return false; + } + return false; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index b6a7bb812..9fde2d386 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -72,14 +72,23 @@ private: void read_mack_header(); void read_mack_body(); void process_mack_message(const std::shared_ptr& osnma_msg); + void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); + bool verify_tesla_key(std::vector& key); + void const display_data(); bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); + bool verify_tag(Tag& tag); + bool is_next_subframe(); + bool nav_data_available(Tag& t); - //boost::circular_buffer d_old_mack_message; + std::map> d_satellite_nav_data; // map holding NavData sorted by SVID and TOW. boost::circular_buffer d_old_OSNMA_buffer; // buffer that holds last 12 received OSNMA messages, including current one at back() + std::map> d_tesla_keys; // tesla keys over time, sorted by TOW + std::vector d_macks_awaiting_MACSEQ_verification; + std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; - std::array, 16> d_dsm_message{}; // C: each dsm[0-15] has 2048 bits + std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. std::array, 16> d_dsm_id_received{}; std::array d_number_of_blocks{}; std::array d_mack_message{}; // C: 480 b @@ -103,7 +112,9 @@ private: enum tags_to_verify{all,utc,slow_eph, eph, none}; // TODO is this safe? I hope so tags_to_verify d_tags_allowed{tags_to_verify::all}; std::vector d_tags_to_verify{0,4,12}; - bool is_next_subframe(); + void remove_verified_tags(); + void control_tags_awaiting_verify_size(); + bool verify_macseq(MACK_message& message); }; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 9a291330d..cb76b9107 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -163,3 +163,9 @@ void NavData::generate_utc_vector() utc_vector.push_back(static_cast(bit_buffer)); } } + +std::vector Tag::build_message() +{ + // TODO + return std::vector(); +} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 4bc78ebbb..c9598e396 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -121,6 +121,8 @@ public: MACK_header header; std::vector tag_and_info; std::vector key; + uint32_t TOW; // TODO duplicated variable + uint32_t PRNa; }; class NavData @@ -157,9 +159,44 @@ public: DSM_KROOT_message d_dsm_kroot_message; MACK_message d_mack_message; NavData d_nav_data; + }; +class Tag +{ +public: + enum e_verification_status{ + SUCCESS, + FAIL, + UNVERIFIED}; + Tag(const MACK_tag_and_info& MTI, uint32_t TOW, uint32_t PRNa) + : tag_id(id_counter++), + TOW(TOW), + PRNa(PRNa), + status(UNVERIFIED), + received_tag(MTI.tag), + computed_tag(0), + PRN_d(MTI.tag_info.PRN_d), + ADKD(MTI.tag_info.ADKD), + cop(MTI.tag_info.cop) + { + } + + const uint32_t tag_id; + uint32_t TOW; + uint32_t PRNa; + e_verification_status status; + uint64_t received_tag; + std::vector build_message(); + + uint32_t static id_counter; + uint64_t computed_tag; + + uint8_t PRN_d; + uint8_t ADKD; + uint8_t cop; +}; /** \} */ /** \} */ #endif // GNSS_SDR_OSNMA_DATA_H From 8fa1a86f242a800b2578b08f601fc4cb867b6395 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 2 Apr 2024 18:04:19 +0200 Subject: [PATCH 123/499] Refactor tag verification logic - solve build errors --- src/core/libs/osnma_msg_receiver.cc | 116 +++++++++++++---------- src/core/libs/osnma_msg_receiver.h | 8 +- src/core/system_parameters/osnma_data.cc | 2 + 3 files changed, 72 insertions(+), 54 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 21321e685..a62f03dd6 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -259,10 +259,10 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ void osnma_msg_receiver::local_time_verification(const std::shared_ptr& osnma_msg) { // compute local time based on GST_SIS and GST_0 - d_GST_SIS = (osnma_msg->WN_sf0 & 0x00000FFF) << 20 | osnma_msg->TOW_sf0 & 0x000FFFFF; + d_GST_SIS = (osnma_msg->WN_sf0 & 0x00000FFF) << 20 | (osnma_msg->TOW_sf0 & 0x000FFFFF); //std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | d_osnma_data.d_dsm_kroot_message.towh_k & 0x000FFFFF) + 30; + d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k & 0x000FFFFF)) + 30; //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. if(d_receiver_time != 0) @@ -568,7 +568,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr& osnma_msg) +void osnma_msg_receiver::process_mack_message() { d_flag_debug = true; @@ -846,7 +846,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& return; // early return, cannot proceed further without one of the two verified. } // verify tesla key and add it to the container of verified keys if successful - bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key); + bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_mack_message.TOW); if(retV){ d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); } @@ -855,7 +855,7 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& auto mack = d_macks_awaiting_MACSEQ_verification.begin(); while (mack != d_macks_awaiting_MACSEQ_verification.end()){ if(d_tesla_keys.find(mack->TOW) != d_tesla_keys.end()){ - bool ret = verify_macseq(*mack); + bool ret = verify_macseq(); if (ret || d_flag_debug){ for(auto& tag:mack->tag_and_info) { @@ -899,14 +899,27 @@ void osnma_msg_receiver::process_mack_message(const std::shared_ptr& * - NavData the tag verifies (min. number of bits verified to consider NavData OK) * */ if(ret) - int a; + std::cout << "Galileo OSNMA: Tag verification failure at " + << "TOW=" + << it.second.TOW + << ", ADKD=" + << it.second.ADKD + << ", from satellite " + << it.second.PRN_d + << std::endl; /* TODO notify PVT via pmt * have_new_data() true * signal which one is verified * communicate to PVT*/ else - int a; - // also + std::cout << "Galileo OSNMA: Tag verification failure at " + << "TOW=" + << it.second.TOW + << ", ADKD=" + << it.second.ADKD + << ", from satellite " + << it.second.PRN_d + << std::endl; } } @@ -1316,43 +1329,44 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) * @param sharedPtr A shared pointer to an instance of OSNMA_msg. * @return True if the current subframe is the next subframe, False otherwise. */ -bool osnma_msg_receiver::is_next_subframe() -{ - bool is_bigger = d_GST_SIS > d_old_GST_SIS; - if(d_GST_SIS != d_old_GST_SIS + 30 && d_old_GST_SIS != 0){ - std::cout << "Galileo OSNMA:: Mack processing - skip " << std::endl; - } - - d_old_GST_SIS = d_GST_SIS; - - return is_bigger; -} +//bool osnma_msg_receiver::is_next_subframe() +//{ +// bool is_bigger = d_GST_SIS > d_old_GST_SIS; +// if(d_GST_SIS != d_old_GST_SIS + 30 && d_old_GST_SIS != 0){ +// std::cout << "Galileo OSNMA:: Mack processing - skip " << std::endl; +// } +// +// d_old_GST_SIS = d_GST_SIS; +// +// return is_bigger; +//} void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) { - while (d_satellite_data[SV_ID].size() >= 25) { - d_satellite_data[SV_ID].erase(d_satellite_data[SV_ID].begin()); + // control size of container + while (d_satellite_nav_data[SV_ID].size() >= 25) { + d_satellite_nav_data[SV_ID].erase(d_satellite_nav_data[SV_ID].begin()); } - d_osnma_data[TOW] = crypto; // crypto - d_satellite_data[SV_ID][TOW] = data; // nav - std::cout << "Galileo OSNMA: added element, size is " << d_satellite_data[SV_ID].size() << std::endl; + //d_osnma_data[TOW] = crypto; // crypto + d_satellite_nav_data[SV_ID][TOW] = data; // nav + std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; } void osnma_msg_receiver::display_data() { - if(d_satellite_data.empty()) - return; - - for(const auto& satellite : d_satellite_data) { - std::cout << "SV_ID: " << satellite.first << std::endl; - for(const auto& towData : satellite.second) { - std::cout << "\tTOW: " << towData.first << " key: "; - for(size_t i = 0; i < towData.second.d_mack_message.key.size(); i++) { - std::cout << std::hex << std::setfill('0') << std::setw(2) - << static_cast(towData.second.d_mack_message.key[i]) << " "; - } - } - } +// if(d_satellite_nav_data.empty()) +// return; +// +// for(const auto& satellite : d_satellite_nav_data) { +// std::cout << "SV_ID: " << satellite.first << std::endl; +// for(const auto& towData : satellite.second) { +// std::cout << "\tTOW: " << towData.first << " key: "; +// for(size_t i = 0; i < towData.second.d_mack_message.key.size(); i++) { +// std::cout << std::hex << std::setfill('0') << std::setw(2) +// << static_cast(towData.second.d_mack_message.key[i]) << " "; +// } +// } +// } } -bool osnma_msg_receiver::verify_tesla_key(std::vector& key) +bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TOW) { if(d_tesla_key_verified || d_flag_debug) { @@ -1360,6 +1374,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key) // retrieve latest tesla key // compute hashes needed // hash current key until num_hashes and compare + return false; } else {// have to go until Kroot @@ -1367,7 +1382,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key) std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; auto start = std::chrono::high_resolution_clock::now(); uint32_t GST_SFi = d_GST_SIS; - std::vector K_II = applicable_MACK.key; + std::vector K_II = key; std::vector K_I; // result of the recursive hash operations const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) @@ -1418,15 +1433,15 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key) std::chrono::duration elapsed = end - start; std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; - if(K_II.size() != applicable_MACK.key.size()) + if(K_II.size() != key.size()) { std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return; + return false; } - if (K_II == applicable_MACK.key) + if (K_II == key) { std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; - d_keys.insert(std::pair(applicable_MACK.TOW,applicable_MACK.key)); + d_tesla_keys.insert(std::pair(TOW,key)); d_tesla_key_verified = true; // TODO - propagate result // TODO - save current tesla key as latest one? propose a map with @@ -1436,9 +1451,10 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key) { std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - if(!d_flag_debug) - return; + if(d_flag_debug) + d_tesla_key_verified = true; } + return d_tesla_key_verified; } } @@ -1479,7 +1495,7 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() * @param message The MACK_message to verify. * @return True if the MACSEQ is valid, false otherwise. */ -bool osnma_msg_receiver::verify_macseq(MACK_message& message) +bool osnma_msg_receiver::verify_macseq() { // MACSEQ verification @@ -1515,7 +1531,7 @@ bool osnma_msg_receiver::verify_macseq(MACK_message& message) if(applicable_OSNMA.d_mack_message.tag_and_info.size() != applicable_sequence.size()-1) { std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; - return; + return false; } std::vector flxTags {}; std::string tempADKD; @@ -1529,7 +1545,7 @@ bool osnma_msg_receiver::verify_macseq(MACK_message& message) } else if(applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) { std::cout << "Galileo OSNMA: Unsuccessful verification of MACSEQ - received ADKD against MAC Look-up table. " << std::endl; - return; // C: suffices one incorrect to abort and not process the rest of the tags + return false; // C: suffices one incorrect to abort and not process the rest of the tags } } @@ -1573,7 +1589,7 @@ bool osnma_msg_receiver::verify_macseq(MACK_message& message) else return false; } -bool osnma_msg_receiver::nav_data_available(Tag t) +bool osnma_msg_receiver::nav_data_available(Tag& t) { auto prn_it = d_satellite_nav_data.find(t.PRNa); if (prn_it != d_satellite_nav_data.end()) { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 9fde2d386..7915d408e 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -71,10 +71,10 @@ private: void read_and_process_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); - void process_mack_message(const std::shared_ptr& osnma_msg); + void process_mack_message(); void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); - bool verify_tesla_key(std::vector& key); - void const display_data(); + bool verify_tesla_key(std::vector& key, uint32_t TOW); + void display_data(); bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); bool verify_tag(Tag& tag); bool is_next_subframe(); @@ -114,7 +114,7 @@ private: std::vector d_tags_to_verify{0,4,12}; void remove_verified_tags(); void control_tags_awaiting_verify_size(); - bool verify_macseq(MACK_message& message); + bool verify_macseq(); }; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index cb76b9107..65145ae16 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -23,6 +23,8 @@ * \details Packs the ephemeris, iono and utc data from the current subframe into the NavData structure. It also gets the PRNa and the GST. * @param osnma_msg The shared pointer to the OSNMA_msg object. */ + +uint32_t Tag::id_counter = 0; void NavData::init(const std::shared_ptr &osnma_msg) { EphemerisData = osnma_msg->EphemerisData; From 3f014b4a64ee45a8ff18f2c18d6b961294ce0526 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 4 Apr 2024 19:13:55 +0200 Subject: [PATCH 124/499] Fixed a deadlock issue in the FPGA-based tracking loops --- .../tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 070f0d46f..0d450d469 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 @@ -1530,11 +1530,12 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un { boost::mutex::scoped_lock lock(d_mutex); d_worker_is_done = false; + l.unlock(); while (!d_worker_is_done) { d_m_condition.wait(lock); } - + l.lock(); // Signal alignment (skip samples until the incoming signal is aligned with local replica) int64_t acq_trk_diff_samples; double acq_trk_diff_seconds; From 7e7994552927ed3a89e3f81d8de64de11191974d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 5 Apr 2024 13:37:45 +0200 Subject: [PATCH 125/499] Update Flexiband_Signal_Source to admit modern GNU Radio versions --- cmake/Modules/FindTELEORBIT.cmake | 1 + .../signal_source/adapters/flexiband_signal_source.cc | 2 +- .../signal_source/adapters/flexiband_signal_source.h | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/FindTELEORBIT.cmake b/cmake/Modules/FindTELEORBIT.cmake index b0d5e6c20..db888984a 100644 --- a/cmake/Modules/FindTELEORBIT.cmake +++ b/cmake/Modules/FindTELEORBIT.cmake @@ -38,6 +38,7 @@ set(TELEORBIT_ROOT_USER_DEFINED find_path(TELEORBIT_INCLUDE_DIRS NAMES teleorbit/api.h HINTS ${PC_TELEORBIT_INCLUDEDIR} + PATH_SUFFIXES gnuradio PATHS ${TELEORBIT_ROOT_USER_DEFINED}/include /usr/include /usr/local/include diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index 03065374e..66683bf7f 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -34,7 +34,7 @@ FlexibandSignalSource::FlexibandSignalSource(const ConfigurationInterface* confi Concurrent_Queue* queue __attribute__((unused))) : SignalSourceBase(configuration, role, "Flexiband_Signal_Source"s), in_stream_(in_stream), out_stream_(out_stream) { - const std::string default_item_type("byte"); + const std::string default_item_type("gr_complex"); item_type_ = configuration->property(role + ".item_type", default_item_type); const std::string default_firmware_file("flexiband_I-1b.bit"); diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.h b/src/algorithms/signal_source/adapters/flexiband_signal_source.h index 7366d7ce9..47160a32a 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.h +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.h @@ -66,10 +66,10 @@ public: gr::basic_block_sptr get_right_block(int RF_channel) override; private: - boost::shared_ptr flexiband_source_; + gnss_shared_ptr flexiband_source_; - std::vector> char_to_float; - std::vector> float_to_complex_; + std::vector> char_to_float; + std::vector> float_to_complex_; std::vector null_sinks_; std::string item_type_; From a17b04cb22d10d9ec10986de55aa374c7e367226 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 7 Apr 2024 14:27:14 +0200 Subject: [PATCH 126/499] [TAS-159 ] d_tesla_key_verified => do not hash until Kroot(every time) - improve efficiency of verify_tesla_key by computing only the needed hashes until chronologically closest key, instead of going back to Kroot. Aditional chanches are: * rename unused variable d_old_GST_SISto d_last_verified_key_GST and use it for tesla key verification * fix bug on verify_tesla_key during the comparison of computed and received key * deleted d_old_OSNMA_buffer * fill PRNa and TOW for MACK message when parsing it * fix parameter bug for verify_macseq() * immplement tag_has_key_available * delete old verify_tag implementation --- src/core/libs/osnma_msg_receiver.cc | 571 ++++++++++------------------ src/core/libs/osnma_msg_receiver.h | 11 +- 2 files changed, 211 insertions(+), 371 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index a62f03dd6..f5e084ffe 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -60,8 +60,6 @@ osnma_msg_receiver::osnma_msg_receiver( { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); - //d_old_mack_message.set_capacity(10); - d_old_OSNMA_buffer.set_capacity(25); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -541,7 +539,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } - /** * @brief Reads the Mack message from the given OSNMA_msg object. * @@ -574,7 +571,6 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrTOW) != d_tesla_keys.end()){ - bool ret = verify_macseq(); + if(d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()){ + bool ret = verify_macseq(*mack); if (ret || d_flag_debug){ for(auto& tag:mack->tag_and_info) { @@ -877,21 +875,10 @@ void osnma_msg_receiver::process_mack_message() d_macks_awaiting_MACSEQ_verification.push_back(d_osnma_data.d_mack_message); - // d_satellite_data already updated from a msg_handler coming from TD. TODO - -// d_old_OSNMA_buffer.push_back(d_osnma_data); // TODO deprecate -// if(d_keys.size() < 2) -// { -// std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " -// << "Not enough OSNMA messages available" -// << "buffer size: "<< d_old_OSNMA_buffer.size() << std::endl; -// return; -// } - - // verify tags + // Tag verification for (auto & it : d_tags_awaiting_verify){ bool ret; - if(d_tesla_keys.find(it.first) != d_tesla_keys.end() && nav_data_available(it.second)){ + if(tag_has_key_available(it.second) && tag_has_nav_data_available(it.second)){ ret = verify_tag(it.second); /* TODO - take into account: * - COP: if @@ -899,146 +886,52 @@ void osnma_msg_receiver::process_mack_message() * - NavData the tag verifies (min. number of bits verified to consider NavData OK) * */ if(ret) - std::cout << "Galileo OSNMA: Tag verification failure at " - << "TOW=" - << it.second.TOW - << ", ADKD=" - << it.second.ADKD - << ", from satellite " - << it.second.PRN_d - << std::endl; + { + it.second.status = Tag::SUCCESS; + std::cout << "Galileo OSNMA: Tag verification failure for tag Id= " + << it.second.tag_id + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", from satellite " + << it.second.PRNa + << std::endl; + } /* TODO notify PVT via pmt * have_new_data() true * signal which one is verified * communicate to PVT*/ else - std::cout << "Galileo OSNMA: Tag verification failure at " - << "TOW=" + { + it.second.status = Tag::FAIL; + std::cout << "Galileo OSNMA: Tag verification failure for tag Id= " + << it.second.tag_id + << ", TOW=" << it.second.TOW << ", ADKD=" - << it.second.ADKD + << static_cast(it.second.ADKD) << ", from satellite " - << it.second.PRN_d + << it.second.PRNa << std::endl; + } + } + else { + std::cout << "Galileo OSNMA: Tag verification skipped for Tag Id= " + << it.second.tag_id + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", from satellite " + << it.second.PRNa + << std::endl; } } remove_verified_tags(); - control_tags_awaiting_verify_size(); // remove oldest tags if size is too big. - - // deprecated tag verification - it includes steps not yet present on verify_tag, so keep it until then. - // Tag verification - // tag[i-1]: - // adkd = 4/0 : use TK[i], NavData[i-2] to validate Tag[i-1] - // adkd = 12 : ignore it -> not possible to verify yet - // tag[i-10] - // adkd = 4/0 : use TK[i-9], NavData[i-11] to validate Tag[i-10] would already be done by tag[i-1] - // adkd = 12 : use TK[i], NavData[i-11] to validate Tag[i-10] TODO - pending better logic for not repeating this while twice. -// int t = d_old_OSNMA_buffer.size() - 2; -// applicable_OSNMA = d_old_OSNMA_buffer[t]; // former subframe -// d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ -// -// size_t i = 0; -// while (i < applicable_OSNMA.d_mack_message.tag_and_info.size() && // loop over all tags in MACK message -// std::find(d_tags_to_verify.begin(),d_tags_to_verify.end(), // ADKD[i] is within allowed ADKDs -// applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD) -// != d_tags_to_verify.end()) -// { -// // TODO - if a subsequent tag was already part of the verification (inner loop), this while is going to ignore that and try to validate it anyway. -// -// // check if tag is flx -// bool is_flexible_tag = std::find(flxTags.begin(),flxTags.end(), i) != flxTags.end(); -// if(is_flexible_tag && flxTagsV == false){ -// //std::cout << "Galileo OSNMA: cannot verify flx tag. " << std::endl; -// continue; -// } -// -// -// // Take tag_k and check its ADKD, COP, PRN_d, this will be the reference for the iteration and search of other Tags -// uint8_t Nt = d_Lt_min / applicable_OSNMA.d_dsm_kroot_message.ts; // Tags needed to be verified -// uint8_t applicable_ADKD = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD; -// uint8_t applicable_COP = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.cop; // * d_delta_COP; -// uint8_t counter_COP = 1; -// uint8_t applicable_PRNd = applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.PRN_d; -// // ADKD=12 or ADKD = 4/0 => pick d_old_OSNMA_buffer.back() or [size-1] -// applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; // current subframe -// NavData applicable_NavData{}; -// if((applicable_ADKD == 0 || applicable_ADKD == 4) && d_old_OSNMA_buffer.size() > 3) -// { -// applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; -// } -// else if(applicable_ADKD == 12 && d_old_OSNMA_buffer.size() > 11) -// { -// applicable_NavData = d_old_OSNMA_buffer[t - 11].d_nav_data; -// } -// else -// { -// std::cout << "Galileo OSNMA: MACK message buffer elements not enough. Cannot verify tags. " << std::endl; -// } -// -// -// int k = i + 1; -// uint8_t nt = 0; -// bool flag_cancel_tag_verification = false; // if a tag fails, cancel whole NavData verification set -// // Look for tags relative to reference NavData until Nt achieved, -// // this may require going back in time, as long as COP is valid -// while (nt <= Nt && counter_COP <= applicable_COP && !flag_cancel_tag_verification) -// { -// auto start_it = std::next(applicable_OSNMA.d_mack_message.tag_and_info.begin(), k); -// -// // check the vector of tags of aplicable OSNMA for a match against the chosen -// for (auto it = start_it; it != applicable_OSNMA.d_mack_message.tag_and_info.end() && nt <= Nt; ++it) -// { -// // Check if ADKD, COP, and PRN_d match -// if(it->tag_info.ADKD == applicable_ADKD -// // && it->tag_info.cop == applicable_COP // TODO - I think this may be skipped as the relevant is the COP distance. -// && it->tag_info.PRN_d == applicable_PRNd) -// { -// if(verify_tag(it.operator*(), applicable_OSNMA, k,applicable_key,applicable_NavData)) -// { -// nt++; -// } -// else -// { -// // failure, discard this k-th tag -// flag_cancel_tag_verification = true; -// std::cout << "Galileo OSNMA: tag verification failed for PRN_a " -// << applicable_OSNMA.d_nav_data.PRNa << " with WN=" -// << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" -// << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " -// << std::endl; -// } -// -// } -// if(flag_cancel_tag_verification) -// break; -// } -// // Check if Nt is achieved, if not, switch to older frame -// if(nt < Nt && t > 0 /*not end of buffer*/ && counter_COP <= applicable_COP && !flag_cancel_tag_verification) -// { -// t--; -// applicable_OSNMA = d_old_OSNMA_buffer[t]; -// applicable_key = d_old_OSNMA_buffer[t+1].d_mack_message.key; -// applicable_NavData = d_old_OSNMA_buffer[t-1].d_nav_data; -// d_GST_Sf -= 30; -// counter_COP++; -// k = 0; -// } -// } -// -// if (nt >= Nt) -// { -// nt = 0; -// std::cout << "Galileo OSNMA: tag verification accumulation succesful for PRN_a " -// << applicable_OSNMA.d_nav_data.PRNa << " with WN=" -// << applicable_OSNMA.d_nav_data.WN_sf0 << ", TOW=" -// << applicable_OSNMA.d_nav_data.TOW_sf0 << ". " -// << std::endl; -// } -// -// } - + control_tags_awaiting_verify_size(); // remove the oldest tags if size is too big. } bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) @@ -1085,157 +978,6 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) return false; } } -bool osnma_msg_receiver::verify_tag(MACK_tag_and_info tag_and_info, - OSNMA_data applicable_OSNMA, uint8_t tag_position, - const std::vector& applicable_key, - NavData applicable_NavData) -{ - bool verified = false; - auto CTR = tag_position + 2; // CTR, first tag is CTR(tag0)=1 + 1 == 2 - // NAvData, tag_and_info[i] - - // check if enough osnma messages stored in the buffer. - if (tag_and_info.tag_info.ADKD == 0 - || tag_and_info.tag_info.ADKD == 4) - { - if (d_old_OSNMA_buffer.size() < 3) - { - std::cout << "Galileo OSNMA: MACK message buffer empty. Cannot verify tags. " << std::endl; - return verified; - } - } - else if (tag_and_info.tag_info.ADKD == 12) - { - - if (d_old_OSNMA_buffer.size() < 10+15) - { - std::cout << "Galileo OSNMA: Tesla key not yet available. Cannot verify slow mac. at " << - d_receiver_time << "s. "<< std::endl; - return verified; - } - } - else - { - std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; - return verified; - } - - // compute m - std::vector m; - m.push_back(tag_and_info.tag_info.PRN_d); - for(int i = 24; i >= 0; i -= 8) - { - m.push_back((applicable_NavData.PRNa >> i) & 0xFF); - } - m.push_back(static_cast((d_GST_Sf & 0xFF000000) >> 24)); - m.push_back(static_cast((d_GST_Sf & 0x00FF0000) >> 16)); - m.push_back(static_cast((d_GST_Sf & 0x0000FF00) >> 8)); - m.push_back(static_cast(d_GST_Sf & 0x000000FF)); - m.push_back(CTR); - m.push_back(applicable_OSNMA.d_nma_header.nmas); - if(tag_and_info.tag_info.ADKD == 0) - { - m.insert(m.end(), - applicable_NavData.ephemeris_iono_vector.begin(), - applicable_NavData.ephemeris_iono_vector.end()) ; - } - else if(tag_and_info.tag_info.ADKD == 4) - { - m.insert(m.end(),applicable_NavData.utc_vector.begin(),applicable_NavData.utc_vector.end()) ; - } - else - { - std::cout << "Galileo OSNMA: Unknown ADKD. " << std::endl; - } - - // check that m has an integer number of bytes, if not, add padding zeroes - // padding zeroes until size of vector is an integer number of bytes. - // I think not needed, if bytes of m correctly formatted (i.e. added in big-endianness) -> the unused bits will be zero - // and the vector has an integer number of uint8_t elements. - - // compute mac - std::vector mac; - if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 - { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); - } - else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES - { - mac = d_crypto->computeCMAC_AES(applicable_key, m); - } - - // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD - uint8_t lt_bits = 0; // TODO - remove this duplication of code. - const auto it2 = OSNMA_TABLE_11.find(applicable_OSNMA.d_dsm_kroot_message.ts); - if (it2 != OSNMA_TABLE_11.cend()) - { - lt_bits = it2->second; - } - if (lt_bits == 0) - { - return verified; - } - uint64_t computed_mac = static_cast(mac[0]) << (lt_bits - 8); - computed_mac += (static_cast(mac[1]) << (lt_bits - 16)); - if (lt_bits == 20) - { - computed_mac += (static_cast(mac[1] & 0xF0) >> 4); - } - else if (lt_bits == 24) - { - computed_mac += static_cast(mac[2]); - } - else if (lt_bits == 28) - { - computed_mac += (static_cast(mac[2]) << 4); - computed_mac += (static_cast(mac[3] & 0xF0) >> 4); - } - else if (lt_bits == 32) - { - computed_mac += (static_cast(mac[2]) << 8); - computed_mac += static_cast(mac[3]); - } - else if (lt_bits == 40) - { - computed_mac += (static_cast(mac[2]) << 16); - computed_mac += (static_cast(mac[3]) << 8); - computed_mac += static_cast(mac[4]); - } - - // Compare computed tag with received one truncated - if (tag_and_info.tag == computed_mac) - { - verified = true; - if(tag_and_info.tag_info.ADKD == 0 || tag_and_info.tag_info.ADKD == 12) - { - std::cout << "Galileo OSNMA: tag verification successful for PRN_a " - << applicable_NavData.PRNa << " with WN=" - << applicable_NavData.WN_sf0 << ", TOW=" - << applicable_NavData.TOW_sf0 << "NavData= " - << "Ephemeris, Clock and Ionospheric data" << ". " - << std::endl; - } - else if(tag_and_info.tag_info.ADKD == 4) - { - std::cout << "Galileo OSNMA: tag verification successful for PRN_a " - << applicable_NavData.PRNa << " with WN=" - << applicable_NavData.WN_sf0 << ", TOW=" - << applicable_NavData.TOW_sf0 << "NavData= " - << "Timing data" << ". " - << std::endl; - } - - } - else - { - std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " - << applicable_NavData.PRNa << " with WN=" - << applicable_NavData.WN_sf0 << ", TOW=" - << applicable_NavData.TOW_sf0 << ". " - << std::endl; - } - return verified; -} bool osnma_msg_receiver::verify_tag(Tag& tag) { std::vector m = tag.build_message(); @@ -1291,55 +1033,36 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) { - if(tag.ADKD == 0 || tag.ADKD == 12) - { - std::cout << "Galileo OSNMA: tag verification successful for PRN_a " - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " - << "Ephemeris, Clock and Ionospheric data" << ". " - << std::endl; - } - else if(tag.ADKD == 4) - { - std::cout << "Galileo OSNMA: tag verification successful for PRN_a " - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " - << "Timing data" << ". " - << std::endl; - } +// if(tag.ADKD == 0 || tag.ADKD == 12) +// { +// std::cout << "Galileo OSNMA: tag verification successful for PRN_a " +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " +// << "Ephemeris, Clock and Ionospheric data" << ". " +// << std::endl; +// } +// else if(tag.ADKD == 4) +// { +// std::cout << "Galileo OSNMA: tag verification successful for PRN_a " +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " +// << "Timing data" << ". " +// << std::endl; +// } return true; } else { - std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" - << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << std::endl; +// std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" +// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << std::endl; return false; } } -/** - * @brief Checks if the current subframe time is bigger than last one received. - * - * \details It compares the current GST value with the previous one and updates the old value with the new one. - * - * @param sharedPtr A shared pointer to an instance of OSNMA_msg. - * @return True if the current subframe is the next subframe, False otherwise. - */ -//bool osnma_msg_receiver::is_next_subframe() -//{ -// bool is_bigger = d_GST_SIS > d_old_GST_SIS; -// if(d_GST_SIS != d_old_GST_SIS + 30 && d_old_GST_SIS != 0){ -// std::cout << "Galileo OSNMA:: Mack processing - skip " << std::endl; -// } -// -// d_old_GST_SIS = d_GST_SIS; -// -// return is_bigger; -//} void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) { // control size of container @@ -1368,13 +1091,95 @@ void osnma_msg_receiver::display_data() } bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TOW) { - if(d_tesla_key_verified || d_flag_debug) + if(d_tesla_key_verified) { // TODO - find out I bt. both tesla keys, then hash until then, then compare. - // retrieve latest tesla key + // retrieve latest tesla key from d_tesla_keys + std::vector validated_key = d_tesla_keys.rbegin()->second; // compute hashes needed + uint32_t num_of_hashes_needed = (d_GST_SIS - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; // hash current key until num_hashes and compare - return false; + auto start = std::chrono::high_resolution_clock::now(); + uint32_t GST_SFi = d_GST_SIS; // TODO + std::vector K_II = key; + std::vector K_I; // result of the recursive hash operations + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; + // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) + for (uint32_t i = 1; i < num_of_hashes_needed ; i++) + { + // build message digest m = (K_I+1 || GST_SFi || alpha) + std::vector msg(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::copy(K_II.begin(),K_II.end(),msg.begin()); + + msg.push_back((d_GST_Sf & 0xFF000000) >> 24); + msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); + msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); + msg.push_back(d_GST_Sf & 0x000000FF); + // extract alpha + for (int k = 5; k >= 0;k--) + { + // TODO: static extracts the MSB in case from larger to shorter int? + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. + } + // compute hash + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + { + hash = d_crypto->computeSHA256(msg); + } + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + { + hash = d_crypto->computeSHA3_256(msg); + } + else + { + hash = std::vector(32); + } + // truncate hash + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + for (uint16_t i = 0; i < lk_bytes; i++) + { + K_I.push_back(hash[i]); + } + + // set parameters for next iteration + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation + } + // compare computed current key against received key + auto end = std::chrono::high_resolution_clock::now(); + std::chrono::duration elapsed = end - start; + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + + if(K_II.size() != key.size()) + { + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + return false; + } + if (K_II == validated_key) + { + std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + d_tesla_keys.insert(std::pair(TOW,key)); + d_last_verified_key_GST = d_GST_SIS; + d_tesla_key_verified = true; // TODO this boolean only shows that a tesla key is verified, re-setting it all the time is not beautiful + // case one verified and after a time another one not, what would happen in the next MAck processed is that because false + // it would try to verifiy against kroot, but it could as well try against last validated key. This needs to be adressed in the future. + } + else + + { + std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + if(d_flag_debug){ + d_last_verified_key_GST = d_GST_SIS; + d_tesla_key_verified = true; + } + + else + d_tesla_key_verified = false; + } + return d_tesla_key_verified; } else {// have to go until Kroot @@ -1438,11 +1243,12 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; return false; } - if (K_II == key) + if (K_II == d_osnma_data.d_dsm_kroot_message.kroot) { std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; d_tesla_keys.insert(std::pair(TOW,key)); d_tesla_key_verified = true; + d_last_verified_key_GST = d_GST_SIS; // TODO - propagate result // TODO - save current tesla key as latest one? propose a map with // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence @@ -1451,8 +1257,10 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO { std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - if(d_flag_debug) + if(d_flag_debug){ + d_last_verified_key_GST = d_GST_SIS; d_tesla_key_verified = true; + } } return d_tesla_key_verified; } @@ -1467,7 +1275,15 @@ void osnma_msg_receiver::remove_verified_tags() { for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end() ; ){ if (it->second.status == Tag::SUCCESS || it->second.status == Tag::FAIL) - it = d_tags_awaiting_verify.erase(it); + { + std::cout << "Galileo OSNMA: delete tag for tag Id= " + << it->second.tag_id << ", PRN_a= " + << it->second.PRNa << ", TOW=" + << it->second.TOW << ", ADKD= " + << static_cast(it->second.ADKD) << ", status= " + << it->second.status << std::endl; + it = d_tags_awaiting_verify.erase(it); + } else ++it; } @@ -1495,19 +1311,15 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() * @param message The MACK_message to verify. * @return True if the MACSEQ is valid, false otherwise. */ -bool osnma_msg_receiver::verify_macseq() +bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) { // MACSEQ verification - - // verify MACK tags - MACSEQ - OSNMA_data applicable_OSNMA = d_old_OSNMA_buffer[d_old_OSNMA_buffer.size() - 2]; // former subframe - //d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. - std::vector applicable_key = d_old_OSNMA_buffer.back().d_mack_message.key; // current tesla key ie transmitted in the next subframe + std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; std::vector applicable_sequence; - const auto it = OSNMA_TABLE_16.find(applicable_OSNMA.d_dsm_kroot_message.maclt); + const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); // TODO as per RG example appears that the seq. q shall also be validated ageints either next or former Sf (depending on GST) if (it != OSNMA_TABLE_16.cend()) { @@ -1516,11 +1328,11 @@ bool osnma_msg_receiver::verify_macseq() } // Assign relevant sequence based on subframe time - if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 < 30) // tried GST_Sf and it does not support the data present. + if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. { applicable_sequence = sq1; } - else if (applicable_OSNMA.d_nav_data.TOW_sf0 % 60 >= 30) + else if (mack.TOW % 60 >= 30) { applicable_sequence = sq2; } @@ -1528,7 +1340,7 @@ bool osnma_msg_receiver::verify_macseq() { std::cout << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; } - if(applicable_OSNMA.d_mack_message.tag_and_info.size() != applicable_sequence.size()-1) + if(mack.tag_and_info.size() != applicable_sequence.size() - 1) { std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; return false; @@ -1536,14 +1348,14 @@ bool osnma_msg_receiver::verify_macseq() std::vector flxTags {}; std::string tempADKD; // MACLT verification - for (uint8_t i = 0; i < applicable_OSNMA.d_mack_message.tag_and_info.size(); i++) + for (uint8_t i = 0; i < mack.tag_and_info.size(); i++) { tempADKD = applicable_sequence[i+1]; if(tempADKD == "FLX") { flxTags.push_back(i); // C: just need to save the index in the sequence } - else if(applicable_OSNMA.d_mack_message.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) + else if(mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) { std::cout << "Galileo OSNMA: Unsuccessful verification of MACSEQ - received ADKD against MAC Look-up table. " << std::endl; return false; // C: suffices one incorrect to abort and not process the rest of the tags } @@ -1551,7 +1363,7 @@ bool osnma_msg_receiver::verify_macseq() // Fixed as well as FLX Tags share first part - Eq. 22 ICD std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(applicable_OSNMA.d_nav_data.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); @@ -1559,9 +1371,9 @@ bool osnma_msg_receiver::verify_macseq() // Case tags flexible - Eq. 21 ICD for (uint8_t i = 0; i < flxTags.size() ; i++) { - m[2*i + 5] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.PRN_d; - m[2*i + 6] = applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | - applicable_OSNMA.d_mack_message.tag_and_info[flxTags[i]].tag_info.cop; + m[2*i + 5] = mack.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[2*i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + mack.tag_and_info[flxTags[i]].tag_info.cop; } // m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; // applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, @@ -1569,11 +1381,11 @@ bool osnma_msg_receiver::verify_macseq() // applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; // compute mac std::vector mac; - if (applicable_OSNMA.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); } - else if (applicable_OSNMA.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { mac = d_crypto->computeCMAC_AES(applicable_key, m); } @@ -1584,16 +1396,17 @@ bool osnma_msg_receiver::verify_macseq() mac_msb = (mac[0] << 8) + mac[1]; } uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; - if (computed_macseq == applicable_OSNMA.d_mack_message.header.macseq && !flxTags.empty()) + if (computed_macseq == mack.header.macseq && !flxTags.empty()) return true; else return false; } -bool osnma_msg_receiver::nav_data_available(Tag& t) +bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) { auto prn_it = d_satellite_nav_data.find(t.PRNa); if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map + std::cout << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW); if (tow_it != tow_map.end()) { @@ -1604,7 +1417,35 @@ bool osnma_msg_receiver::nav_data_available(Tag& t) } } else { // PRN was not found + std::cout << "Galileo OSNMA: hasData = false " << std::endl; return false; } return false; } +bool osnma_msg_receiver::tag_has_key_available(Tag& t){ + // check adkd of tag + // if adkd = 0 or 4 => look for d_tesla_keys[t.TOW+30] + // if adkd = 12 => look for d_tesla_keys[t.TOW+300] + // return true if available, otherwise false + + if (t.ADKD == 0 || t.ADKD == 4) + { + auto it = d_tesla_keys.find(t.TOW + 30); + if (it != d_tesla_keys.end()) + { + std::cout << "Galileo OSNMA: hasKey = true " << std::endl; + return true; + } + } + else if (t.ADKD == 12) + { + auto it = d_tesla_keys.find(t.TOW + 300); + if (it != d_tesla_keys.end()) + { + std::cout << "Galileo OSNMA: hasKey = true " << std::endl; + return true; + } + } + std::cout << "Galileo OSNMA: hasKey = false " << std::endl; + return false; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 7915d408e..c921fd62d 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -74,14 +74,13 @@ private: void process_mack_message(); void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); bool verify_tesla_key(std::vector& key, uint32_t TOW); - void display_data(); - bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); + void display_data();bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); bool verify_tag(Tag& tag); bool is_next_subframe(); - bool nav_data_available(Tag& t); + bool tag_has_nav_data_available(Tag& t); + bool tag_has_key_available(Tag& t); std::map> d_satellite_nav_data; // map holding NavData sorted by SVID and TOW. - boost::circular_buffer d_old_OSNMA_buffer; // buffer that holds last 12 received OSNMA messages, including current one at back() std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::vector d_macks_awaiting_MACSEQ_verification; std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW @@ -100,7 +99,7 @@ private: bool d_tesla_key_verified{false}; bool d_flag_debug{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification - uint32_t d_old_GST_SIS{0}; + uint32_t d_last_verified_key_GST{0}; uint8_t d_Lt_min {}; // minimum equivalent tag length uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing @@ -114,7 +113,7 @@ private: std::vector d_tags_to_verify{0,4,12}; void remove_verified_tags(); void control_tags_awaiting_verify_size(); - bool verify_macseq(); + bool verify_macseq(const MACK_message& mack); }; From ff5118db5451bbdfeeef6b6dbce2aff698c2db6e Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 10 Apr 2024 17:51:43 +0200 Subject: [PATCH 127/499] [TAS-156] debug verify_tesla_key various bugfixes plus refactor recursive hash computation --- src/core/libs/osnma_msg_receiver.cc | 284 +++++++----------- src/core/libs/osnma_msg_receiver.h | 3 +- src/core/system_parameters/gnss_crypto.cc | 78 ++--- .../osnma/gnss_crypto_test.cc | 9 +- 4 files changed, 158 insertions(+), 216 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f5e084ffe..d058f92a6 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -128,9 +128,10 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_nma_header(osnma_msg->hkroot[0]); read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); - local_time_verification(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 - read_and_process_mack_block(osnma_msg); // only process them if a least 3 available. + if(d_osnma_data.d_dsm_kroot_message.towh_k != 0) + local_time_verification(osnma_msg); + read_and_process_mack_block(osnma_msg); // only process them if at least 3 available. } @@ -260,7 +261,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptrWN_sf0 & 0x00000FFF) << 20 | (osnma_msg->TOW_sf0 & 0x000FFFFF); //std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k & 0x000FFFFF)) + 30; + d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k & 0x000FFFFF)) + 30; // applicable time (GST_Kroot + 30) //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. if(d_receiver_time != 0) @@ -350,6 +351,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // DSM-KROOT message if (d_osnma_data.d_dsm_header.dsm_id < 12) { + // Parse Kroot message LOG(WARNING) << "OSNMA: DSM-KROOT message received."; d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg); @@ -364,10 +366,10 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.wn_k = d_dsm_reader->get_wn_k(dsm_msg); d_osnma_data.d_dsm_kroot_message.towh_k = d_dsm_reader->get_towh_k(dsm_msg); d_osnma_data.d_dsm_kroot_message.alpha = d_dsm_reader->get_alpha(dsm_msg); - + // Kroot field const uint16_t l_lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, l_lk_bytes); - + // DS field std::string hash_function = d_dsm_reader->get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); uint16_t l_ds_bits = 0; const auto it = OSNMA_TABLE_15.find(hash_function); @@ -381,6 +383,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + l_lk_bytes + k]; } + // Padding const uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); const uint16_t l_dk_bytes = l_dk_bits / 8; const uint16_t l_pdk_bytes = (l_dk_bytes - 13 - l_lk_bytes - l_ds_bytes); @@ -406,7 +409,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { MSG.push_back(dsm_msg[i]); } - std::vector message = MSG; // C: MSG == M || DS from ICD. Eq. 7 + std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); @@ -435,12 +438,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // Check that the padding bits received match the computed values if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { - LOG(WARNING) << "OSNMA: DSM-KROOT message received ok."; std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << std::endl; + local_time_verification(osnma_msg); d_kroot_verified = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); if (d_kroot_verified) { @@ -1091,179 +1094,51 @@ void osnma_msg_receiver::display_data() } bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TOW) { - if(d_tesla_key_verified) + uint32_t num_of_hashes_needed; + uint32_t GST_SFi = d_receiver_time - 30; + std::vector hash; + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; + std::vector validated_key; + if(d_tesla_key_verified){ // have to go up to last verified key + validated_key = d_tesla_keys.rbegin()->second; + num_of_hashes_needed = (d_receiver_time - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key " << std::endl; + + hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); + } + else{// have to go until Kroot + validated_key = d_osnma_data.d_dsm_kroot_message.kroot; + num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to Kroot " << std::endl; + + hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); + } + + if(hash.size() != key.size()) { - // TODO - find out I bt. both tesla keys, then hash until then, then compare. - // retrieve latest tesla key from d_tesla_keys - std::vector validated_key = d_tesla_keys.rbegin()->second; - // compute hashes needed - uint32_t num_of_hashes_needed = (d_GST_SIS - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; - // hash current key until num_hashes and compare - auto start = std::chrono::high_resolution_clock::now(); - uint32_t GST_SFi = d_GST_SIS; // TODO - std::vector K_II = key; - std::vector K_I; // result of the recursive hash operations - const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint32_t i = 1; i < num_of_hashes_needed ; i++) - { - // build message digest m = (K_I+1 || GST_SFi || alpha) - std::vector msg(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); - std::copy(K_II.begin(),K_II.end(),msg.begin()); - - msg.push_back((d_GST_Sf & 0xFF000000) >> 24); - msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); - msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); - msg.push_back(d_GST_Sf & 0x000000FF); - // extract alpha - for (int k = 5; k >= 0;k--) - { - // TODO: static extracts the MSB in case from larger to shorter int? - msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. - } - // compute hash - std::vector hash; - if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. - { - hash = d_crypto->computeSHA256(msg); - } - else if (d_osnma_data.d_dsm_kroot_message.hf == 2) - { - hash = d_crypto->computeSHA3_256(msg); - } - else - { - hash = std::vector(32); - } - // truncate hash - K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits - for (uint16_t i = 0; i < lk_bytes; i++) - { - K_I.push_back(hash[i]); - } - - // set parameters for next iteration - GST_SFi -= 30; // next SF time is the actual minus 30 seconds - K_II = K_I; // next key is the actual one - K_I.clear(); // empty the actual one for a new computation - } - // compare computed current key against received key - auto end = std::chrono::high_resolution_clock::now(); - std::chrono::duration elapsed = end - start; - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; - - if(K_II.size() != key.size()) - { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return false; - } - if (K_II == validated_key) - { - std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; - d_tesla_keys.insert(std::pair(TOW,key)); - d_last_verified_key_GST = d_GST_SIS; - d_tesla_key_verified = true; // TODO this boolean only shows that a tesla key is verified, re-setting it all the time is not beautiful - // case one verified and after a time another one not, what would happen in the next MAck processed is that because false - // it would try to verifiy against kroot, but it could as well try against last validated key. This needs to be adressed in the future. - } - else - - { - std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - if(d_flag_debug){ - d_last_verified_key_GST = d_GST_SIS; - d_tesla_key_verified = true; - } - - else - d_tesla_key_verified = false; - } - return d_tesla_key_verified; + std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + return false; } - else - {// have to go until Kroot - uint32_t num_of_hashes_needed = (d_GST_SIS - d_GST_0) / 30 + 1; // Eq. 19 ICD - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed. " << std::endl; - auto start = std::chrono::high_resolution_clock::now(); - uint32_t GST_SFi = d_GST_SIS; - std::vector K_II = key; - std::vector K_I; // result of the recursive hash operations - const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint32_t i = 1; i < num_of_hashes_needed ; i++) - { - // build message digest m = (K_I+1 || GST_SFi || alpha) - std::vector msg(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); - std::copy(K_II.begin(),K_II.end(),msg.begin()); - - msg.push_back((d_GST_Sf & 0xFF000000) >> 24); - msg.push_back((d_GST_Sf & 0x00FF0000) >> 16); - msg.push_back((d_GST_Sf & 0x0000FF00) >> 8); - msg.push_back(d_GST_Sf & 0x000000FF); - // extract alpha - for (int k = 5; k >= 0;k--) - { - // TODO: static extracts the MSB in case from larger to shorter int? - msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (i * 8)) & 0xFF)); // extract first 6 bytes of alpha. - } - // compute hash - std::vector hash; - if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. - { - hash = d_crypto->computeSHA256(msg); - } - else if (d_osnma_data.d_dsm_kroot_message.hf == 2) - { - hash = d_crypto->computeSHA3_256(msg); - } - else - { - hash = std::vector(32); - } - // truncate hash - K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits - for (uint16_t i = 0; i < lk_bytes; i++) - { - K_I.push_back(hash[i]); - } - - // set parameters for next iteration - GST_SFi -= 30; // next SF time is the actual minus 30 seconds - K_II = K_I; // next key is the actual one - K_I.clear(); // empty the actual one for a new computation - } - // compare computed current key against received key - auto end = std::chrono::high_resolution_clock::now(); - std::chrono::duration elapsed = end - start; - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; - - if(K_II.size() != key.size()) - { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return false; - } - if (K_II == d_osnma_data.d_dsm_kroot_message.kroot) - { - std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + if (hash == validated_key) + { + std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + d_tesla_keys.insert(std::pair(TOW,key)); + d_tesla_key_verified = true; + d_last_verified_key_GST = d_receiver_time; + // TODO - propagate result + // TODO - save current tesla key as latest one? propose a map with + // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + } + else{ + std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + if(d_flag_debug){ d_tesla_keys.insert(std::pair(TOW,key)); + d_last_verified_key_GST = d_receiver_time; d_tesla_key_verified = true; - d_last_verified_key_GST = d_GST_SIS; - // TODO - propagate result - // TODO - save current tesla key as latest one? propose a map with - // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence + // TODO - if intermediate verification fails, can one still use the former verified tesla key or should go to Kroot or even retrieve new Kroot? } - else - - { - std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - if(d_flag_debug){ - d_last_verified_key_GST = d_GST_SIS; - d_tesla_key_verified = true; - } - } - return d_tesla_key_verified; } + return d_tesla_key_verified; } /** @@ -1449,3 +1324,62 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t){ std::cout << "Galileo OSNMA: hasKey = false " << std::endl; return false; } +std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes) +{ + auto start = std::chrono::high_resolution_clock::now(); + std::vector K_II = {0x2D,0xC3,0xA3,0xCD,0xB1,0x17,0xFA,0xAD,0xB8,0x3B,0x5F,0x0B,0x6F,0xEA,0x88,0xEB};//key; + std::vector K_I; // result of the recursive hash operations + GST_SFi = 0x4E054600; + std::vector msg; + // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) + for (uint32_t i = 1; i <= num_of_hashes_needed ; i++) + { + // build message digest m = (K_I+1 || GST_SFi || alpha) + msg.reserve(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); + std::copy(K_II.begin(),K_II.end(),std::back_inserter(msg)); + + msg.push_back((GST_SFi & 0xFF000000) >> 24); + msg.push_back((GST_SFi & 0x00FF0000) >> 16); + msg.push_back((GST_SFi & 0x0000FF00) >> 8); + msg.push_back(GST_SFi & 0x000000FF); + // extract alpha + d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; + for (int k = 5; k >= 0;k--) + { + // TODO: static extracts the MSB in case from larger to shorter int? + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (k * 8)) & 0xFF)); // extract first 6 bytes of alpha. + } + // compute hash + std::vector hash; + if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + { + hash = d_crypto->computeSHA256(msg); + } + else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + { + hash = d_crypto->computeSHA3_256(msg); + } + else + { + hash = std::vector(32); + } + // truncate hash + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + for (int k = 0; k < lk_bytes; k++) + { + K_I.push_back(hash[k]); + } + // set parameters for next iteration + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation + msg.clear(); + } + if(GST_SFi + 30 != d_GST_0 - 30 && d_tesla_key_verified == false) + std::cout << "Galileo OSNMA: TESLA verification error. Kroot time mismatch! \n"; // ICD. Eq. 18 + // compare computed current key against received key + auto end = std::chrono::high_resolution_clock::now(); + std::chrono::duration elapsed = end - start; + std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + return K_II; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index c921fd62d..a443850ac 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -74,6 +74,7 @@ private: void process_mack_message(); void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); bool verify_tesla_key(std::vector& key, uint32_t TOW); + std::vector hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes); void display_data();bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); bool verify_tag(Tag& tag); bool is_next_subframe(); @@ -98,7 +99,7 @@ private: bool d_kroot_verified{false}; bool d_tesla_key_verified{false}; bool d_flag_debug{false}; - uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification + uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification TODO need really to be global var? uint32_t d_last_verified_key_GST{0}; uint8_t d_Lt_min {}; // minimum equivalent tag length uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index af7df7899..f55b5f609 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -468,6 +468,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) std::cerr << "OpenSSL: error reading the Public Key from file " << pemFilePath << ". Aborting import" << std::endl; return; } + #else // Import the PEM data gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(pemContent.data())), static_cast(pemContent.size())}; @@ -489,6 +490,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) gnutls_pubkey_deinit(pubkey); #endif std::cout << "Public key successfully read from file " << pemFilePath << std::endl; + print_pubkey_hex(d_PublicKey); } @@ -497,48 +499,48 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st std::vector digest = this->computeSHA256(message); if (!have_public_key()) { - std::cerr << "GnuTLS error: public key not available"<< std::endl; + std::cerr << "Galileo OSNMA::Kroot verification error::Public key not available"<< std::endl; return false; } bool success = false; #if USE_OPENSSL_FALLBACK - - EVP_MD_CTX *mdctx = NULL; // verification context; a struct that wraps the message to be verified. - int ret = 0; // error - - /* Create the Message Digest Context */ - if(!(mdctx = EVP_MD_CTX_new())) goto err; // Allocates and returns a digest context. - - /* Initialize `key` with a public key */ - // hashes cnt bytes of data at d into the verification context ctx - if(1 != EVP_DigestVerifyInit(mdctx, NULL /*TODO null?*/, EVP_sha256(), NULL, d_PublicKey)) goto err; - - /* Initialize `key` with a public key */ - if(1 != EVP_DigestVerifyUpdate(mdctx, message.data(), message.size())) goto err; - - - if( 1== EVP_DigestVerifyFinal(mdctx, signature.data(), signature.size())) - { - return true; - } - else - { - unsigned long errCode = ERR_get_error(); - int lib_code = ERR_GET_LIB(errCode); - char* err = ERR_error_string(errCode, NULL); - const char* error_string = ERR_error_string(errCode, NULL); - std::cerr << "OpenSSL: message authentication failed: " << err /*<< - "from library with code " << lib_code << - " error string: " << error_string */<< std::endl; - } -err: - if(ret != 1) - { - /* Do some error handling */ - // notify other blocks - std::cout << "ECDSA_Verify_OSSL()::error " << ret << std::endl; - - } +// using low-level API to test function -- it works in unit tests, not in real bytes. +// EVP_MD_CTX *mdctx = NULL; // verification context; a struct that wraps the message to be verified. +// int ret = 0; // error +// +// /* Create the Message Digest Context */ +// if(!(mdctx = EVP_MD_CTX_new())) goto err; // Allocates and returns a digest context. +// +// /* Initialize `key` with a public key */ +// // hashes cnt bytes of data at d into the verification context ctx +// if(1 != EVP_DigestVerifyInit(mdctx, NULL /*TODO null?*/, EVP_sha256(), NULL, d_PublicKey)) goto err; +// +// /* Initialize `key` with a public key */ +// if(1 != EVP_DigestVerifyUpdate(mdctx, message.data(), message.size())) goto err; +// +// +// if( 1 == EVP_DigestVerifyFinal(mdctx, signature.data(), signature.size())) +// { +// return true; +// } +// else +// { +// unsigned long errCode = ERR_get_error(); +// int lib_code = ERR_GET_LIB(errCode); +// char* err = ERR_error_string(errCode, NULL); +// const char* error_string = ERR_error_string(errCode, NULL); +// std::cerr << "OpenSSL: message authentication failed: " << err /*<< +// "from library with code " << lib_code << +// " error string: " << error_string */<< std::endl; +// } +//err: +// if(ret != 1) +// { +// /* Do some error handling */ +// // notify other blocks +// std::cout << "ECDSA_Verify_OSSL()::error " << ret << std::endl; +// +// } #if USE_OPENSSL_3 diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 4f57162fa..563cf5a46 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -22,11 +22,16 @@ TEST(GnssCryptoTest, VerifySignature) { // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; // own ECDSA-P256 key and message generated and signed and verified successfully with openssl - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK - std::vector publicKey{ // PK associated to the PrK +// std::vector publicKey{// PK associated to the PrK, in der format ---test +// 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4A, 0xF3, +// 0xEE, 0x3A, 0x94, 0x25, 0x25, 0x3D, 0x55, 0xC2, 0x5A, 0xC2, 0x2D, 0xCF, 0x14, 0x4D, 0x39, 0x0D, 0xB1, 0xFC, 0x7F, 0x31, 0x5A, 0x2A, 0x19, 0xAE, 0x4E, 0xD6, 0xCB, 0xA6, 0x59, +// 0xD6, 0x99, 0x7C, 0xE8, 0xBD, 0x1F, 0x43, 0x34, 0x1C, 0x59, 0xD9, 0xD9, 0xCA, 0xC3, 0xEE, 0x58, 0xE5, 0xEA, 0xD3, 0x55, 0x44, 0xEA, 0x89, 0x71, 0x65, 0xD0, 0x92, 0x72, 0xA2, +// 0xC8, 0x3C, 0x87, 0x5D }; + std::vector publicKey{ // PK associated to the PrK, in pem format 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, From 6fc04b34f2956aca6bcba16b1b574244482c2e1c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 12 Apr 2024 18:15:33 +0200 Subject: [PATCH 128/499] Fix duplicate warning from Xcode --- cmake/Modules/XcodeDeleteDuplicates.cmake | 23 +++++++++++++++++++ .../volk_gnsssdr/apps/CMakeLists.txt | 5 ++++ .../cmake/Modules/XcodeDeleteDuplicates.cmake | 23 +++++++++++++++++++ .../volk_gnsssdr/lib/CMakeLists.txt | 9 ++++++++ src/main/CMakeLists.txt | 3 +++ src/tests/CMakeLists.txt | 21 +++++++++++++++++ src/utils/front-end-cal/CMakeLists.txt | 3 +++ 7 files changed, 87 insertions(+) create mode 100644 cmake/Modules/XcodeDeleteDuplicates.cmake create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake diff --git a/cmake/Modules/XcodeDeleteDuplicates.cmake b/cmake/Modules/XcodeDeleteDuplicates.cmake new file mode 100644 index 000000000..129059c07 --- /dev/null +++ b/cmake/Modules/XcodeDeleteDuplicates.cmake @@ -0,0 +1,23 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(DEFINED __INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE) + return() +endif() +set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE) + +function(xcode_delete_duplicates target) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") + # A bug in Xcode 15 adds duplicate flags to the linker. In addition, the + # `-warn_duplicate_libraries` is now enabled by default which may result + # in several 'duplicate libraries warning'. + # - https://gitlab.kitware.com/cmake/cmake/-/issues/25297 and + # - https://indiestack.com/2023/10/xcode-15-duplicate-library-linker-warnings/ + target_link_options(${target} PUBLIC "LINKER:-no_warn_duplicate_libraries") + endif() + endif() +endfunction() \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt index e4bfcf4d7..acfece40a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt @@ -77,6 +77,9 @@ if(UNIX) ) endif() +include(XcodeDeleteDuplicates) +xcode_delete_duplicates(volk_gnsssdr_profile) + if(ENABLE_STRIP) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) set_target_properties(volk_gnsssdr_profile @@ -106,6 +109,8 @@ if(UNIX) ) endif() +xcode_delete_duplicates(volk_gnsssdr-config-info) + if(ENABLE_STRIP) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) set_target_properties(volk_gnsssdr-config-info diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake new file mode 100644 index 000000000..129059c07 --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake @@ -0,0 +1,23 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(DEFINED __INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE) + return() +endif() +set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE) + +function(xcode_delete_duplicates target) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") + # A bug in Xcode 15 adds duplicate flags to the linker. In addition, the + # `-warn_duplicate_libraries` is now enabled by default which may result + # in several 'duplicate libraries warning'. + # - https://gitlab.kitware.com/cmake/cmake/-/issues/25297 and + # - https://indiestack.com/2023/10/xcode-15-duplicate-library-linker-warnings/ + target_link_options(${target} PUBLIC "LINKER:-no_warn_duplicate_libraries") + endif() + endif() +endfunction() \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 2562bd90c..e9a641c59 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -4,6 +4,7 @@ # SPDX-FileCopyrightText: 2010-2021 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause +include(XcodeDeleteDuplicates) ######################################################################## # header file detection @@ -595,6 +596,9 @@ if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode))) else() target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries}) endif() + + xcode_delete_duplicates(volk_gnsssdr) + target_include_directories(volk_gnsssdr PUBLIC $ PUBLIC $ @@ -676,6 +680,8 @@ if(ENABLE_STATIC_LIBS) ) set_target_properties(volk_gnsssdr_static PROPERTIES OUTPUT_NAME volk_gnsssdr) + xcode_delete_duplicates(volk_gnsssdr_static) + install(TARGETS volk_gnsssdr_static EXPORT VOLK_GNSSSDR-export ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" @@ -702,6 +708,9 @@ if(ENABLE_TESTING) TARGET_DEPS volk_gnsssdr ) endif() + + xcode_delete_duplicates(volk_gnsssdr_test_all) + foreach(kernel ${h_files}) get_filename_component(kernel ${kernel} NAME) string(REPLACE ".h" "" kernel ${kernel}) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 2895d5973..c1d5fc11a 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -65,6 +65,9 @@ if(ENABLE_STRIP) set_target_properties(gnss-sdr PROPERTIES LINK_FLAGS "-s") endif() +include(XcodeDeleteDuplicates) +xcode_delete_duplicates(gnss-sdr) + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(gnss-sdr diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 5863284ba..0193d572c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -8,6 +8,8 @@ add_subdirectory(unit-tests/signal-processing-blocks/libs) add_subdirectory(system-tests/libs) +include(XcodeDeleteDuplicates) + ################################################################################ # Google Test - https://github.com/google/googletest ################################################################################ @@ -645,6 +647,7 @@ if(ENABLE_UNIT_TESTING) target_compile_definitions(run_tests PRIVATE -DGNSSTK_OLDER_THAN_9=1) endif() endif() + xcode_delete_duplicates(run_tests) if(ENABLE_STRIP) set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s") endif() @@ -823,6 +826,9 @@ function(add_system_test executable) ${LOCAL_INSTALL_BASE_DIR}/install/$ ) endif() + + xcode_delete_duplicates(${executable}) + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(${executable} @@ -937,6 +943,9 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) PRIVATE ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) + + xcode_delete_duplicates(flowgraph_test) + add_test(flowgraph_test flowgraph_test) set_property(TEST flowgraph_test PROPERTY TIMEOUT 30) @@ -992,6 +1001,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_compile_definitions(gnss_block_test PRIVATE -DENABLE_FPGA=1) endif() + xcode_delete_duplicates(gnss_block_test) + add_test(gnss_block_test gnss_block_test) set_property(TEST gnss_block_test PROPERTY TIMEOUT 60) @@ -1029,6 +1040,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) algorithms_libs ) + xcode_delete_duplicates(gnuradio_block_test) + add_test(gnuradio_block_test gnuradio_block_test) set_property(TEST gnuradio_block_test PROPERTY TIMEOUT 30) @@ -1063,6 +1076,8 @@ target_include_directories(matio_test ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) +xcode_delete_duplicates(matio_test) + add_test(matio_test matio_test) set_property(TEST matio_test PROPERTY TIMEOUT 30) @@ -1112,6 +1127,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ) endif() + xcode_delete_duplicates(acq_test) + add_test(acq_test acq_test) if(USE_GENERIC_LAMBDAS) @@ -1208,6 +1225,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ) endif() + xcode_delete_duplicates(trk_test) + add_test(trk_test trk_test) set_property(TEST trk_test PROPERTY TIMEOUT 30) @@ -1239,6 +1258,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver ) + xcode_delete_duplicates(control_thread_test) + add_test(control_thread_test control_thread_test) set_property(TEST control_thread_test PROPERTY TIMEOUT 30) diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index 14e55ca99..b27a94351 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -102,6 +102,9 @@ if(PMT_USES_BOOST_ANY) ) endif() +include(XcodeDeleteDuplicates) +xcode_delete_duplicates(front-end-cal) + if(ENABLE_STRIP) set_target_properties(front-end-cal PROPERTIES LINK_FLAGS "-s") endif() From fc695cb6f6f3538f9a2684d2dda767f33707e803 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 12 Apr 2024 19:51:37 +0200 Subject: [PATCH 129/499] CI: make cmakelint happy --- cmake/Modules/XcodeDeleteDuplicates.cmake | 2 +- .../volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/Modules/XcodeDeleteDuplicates.cmake b/cmake/Modules/XcodeDeleteDuplicates.cmake index 129059c07..0f8656f36 100644 --- a/cmake/Modules/XcodeDeleteDuplicates.cmake +++ b/cmake/Modules/XcodeDeleteDuplicates.cmake @@ -10,7 +10,7 @@ endif() set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE) function(xcode_delete_duplicates target) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") # A bug in Xcode 15 adds duplicate flags to the linker. In addition, the # `-warn_duplicate_libraries` is now enabled by default which may result diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake index 129059c07..0f8656f36 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake @@ -10,7 +10,7 @@ endif() set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE) function(xcode_delete_duplicates target) - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") # A bug in Xcode 15 adds duplicate flags to the linker. In addition, the # `-warn_duplicate_libraries` is now enabled by default which may result From fd5174e7ecce6f57073a0cd6cefa2e80958ac582 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 13 Apr 2024 09:03:46 +0200 Subject: [PATCH 130/499] Remove duplicate libraries warning emitted by Xcode 15 --- ...ake => XcodeRemoveWarningDuplicates.cmake} | 6 +++--- .../volk_gnsssdr/apps/CMakeLists.txt | 6 +++--- ...ake => XcodeRemoveWarningDuplicates.cmake} | 6 +++--- .../volk_gnsssdr/lib/CMakeLists.txt | 8 ++++---- src/main/CMakeLists.txt | 4 ++-- src/tests/CMakeLists.txt | 20 +++++++++---------- src/utils/front-end-cal/CMakeLists.txt | 4 ++-- src/utils/rinex-tools/CMakeLists.txt | 3 +++ 8 files changed, 30 insertions(+), 27 deletions(-) rename cmake/Modules/{XcodeDeleteDuplicates.cmake => XcodeRemoveWarningDuplicates.cmake} (84%) rename src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/{XcodeDeleteDuplicates.cmake => XcodeRemoveWarningDuplicates.cmake} (84%) diff --git a/cmake/Modules/XcodeDeleteDuplicates.cmake b/cmake/Modules/XcodeRemoveWarningDuplicates.cmake similarity index 84% rename from cmake/Modules/XcodeDeleteDuplicates.cmake rename to cmake/Modules/XcodeRemoveWarningDuplicates.cmake index 0f8656f36..f4e150fcc 100644 --- a/cmake/Modules/XcodeDeleteDuplicates.cmake +++ b/cmake/Modules/XcodeRemoveWarningDuplicates.cmake @@ -4,12 +4,12 @@ # SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -if(DEFINED __INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE) +if(DEFINED __INCLUDED_XCODE_REMOVE_WARNING_DUPLICATES_CMAKE) return() endif() -set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE) +set(__INCLUDED_XCODE_REMOVE_WARNING_DUPLICATES_CMAKE TRUE) -function(xcode_delete_duplicates target) +function(xcode_remove_warning_duplicates target) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") # A bug in Xcode 15 adds duplicate flags to the linker. In addition, the diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt index acfece40a..e821363c6 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/CMakeLists.txt @@ -77,8 +77,8 @@ if(UNIX) ) endif() -include(XcodeDeleteDuplicates) -xcode_delete_duplicates(volk_gnsssdr_profile) +include(XcodeRemoveWarningDuplicates) +xcode_remove_warning_duplicates(volk_gnsssdr_profile) if(ENABLE_STRIP) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) @@ -109,7 +109,7 @@ if(UNIX) ) endif() -xcode_delete_duplicates(volk_gnsssdr-config-info) +xcode_remove_warning_duplicates(volk_gnsssdr-config-info) if(ENABLE_STRIP) if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeRemoveWarningDuplicates.cmake similarity index 84% rename from src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake rename to src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeRemoveWarningDuplicates.cmake index 0f8656f36..f4e150fcc 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeDeleteDuplicates.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/XcodeRemoveWarningDuplicates.cmake @@ -4,12 +4,12 @@ # SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -if(DEFINED __INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE) +if(DEFINED __INCLUDED_XCODE_REMOVE_WARNING_DUPLICATES_CMAKE) return() endif() -set(__INCLUDED_XCODE_DELETE_DUPLICATES_CMAKE TRUE) +set(__INCLUDED_XCODE_REMOVE_WARNING_DUPLICATES_CMAKE TRUE) -function(xcode_delete_duplicates target) +function(xcode_remove_warning_duplicates target) if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15.0.0") # A bug in Xcode 15 adds duplicate flags to the linker. In addition, the diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index e9a641c59..6296881d0 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2010-2021 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -include(XcodeDeleteDuplicates) +include(XcodeRemoveWarningDuplicates) ######################################################################## # header file detection @@ -597,7 +597,7 @@ if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode))) target_link_libraries(volk_gnsssdr PUBLIC ${volk_gnsssdr_libraries}) endif() - xcode_delete_duplicates(volk_gnsssdr) + xcode_remove_warning_duplicates(volk_gnsssdr) target_include_directories(volk_gnsssdr PUBLIC $ @@ -680,7 +680,7 @@ if(ENABLE_STATIC_LIBS) ) set_target_properties(volk_gnsssdr_static PROPERTIES OUTPUT_NAME volk_gnsssdr) - xcode_delete_duplicates(volk_gnsssdr_static) + xcode_remove_warning_duplicates(volk_gnsssdr_static) install(TARGETS volk_gnsssdr_static EXPORT VOLK_GNSSSDR-export @@ -709,7 +709,7 @@ if(ENABLE_TESTING) ) endif() - xcode_delete_duplicates(volk_gnsssdr_test_all) + xcode_remove_warning_duplicates(volk_gnsssdr_test_all) foreach(kernel ${h_files}) get_filename_component(kernel ${kernel} NAME) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index c1d5fc11a..9f7ead3c7 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -65,8 +65,8 @@ if(ENABLE_STRIP) set_target_properties(gnss-sdr PROPERTIES LINK_FLAGS "-s") endif() -include(XcodeDeleteDuplicates) -xcode_delete_duplicates(gnss-sdr) +include(XcodeRemoveWarningDuplicates) +xcode_remove_warning_duplicates(gnss-sdr) if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 0193d572c..bd0a8e92c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -8,7 +8,7 @@ add_subdirectory(unit-tests/signal-processing-blocks/libs) add_subdirectory(system-tests/libs) -include(XcodeDeleteDuplicates) +include(XcodeRemoveWarningDuplicates) ################################################################################ # Google Test - https://github.com/google/googletest @@ -647,7 +647,7 @@ if(ENABLE_UNIT_TESTING) target_compile_definitions(run_tests PRIVATE -DGNSSTK_OLDER_THAN_9=1) endif() endif() - xcode_delete_duplicates(run_tests) + xcode_remove_warning_duplicates(run_tests) if(ENABLE_STRIP) set_target_properties(run_tests PROPERTIES LINK_FLAGS "-s") endif() @@ -827,7 +827,7 @@ function(add_system_test executable) ) endif() - xcode_delete_duplicates(${executable}) + xcode_remove_warning_duplicates(${executable}) if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) @@ -944,7 +944,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) - xcode_delete_duplicates(flowgraph_test) + xcode_remove_warning_duplicates(flowgraph_test) add_test(flowgraph_test flowgraph_test) @@ -1001,7 +1001,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_compile_definitions(gnss_block_test PRIVATE -DENABLE_FPGA=1) endif() - xcode_delete_duplicates(gnss_block_test) + xcode_remove_warning_duplicates(gnss_block_test) add_test(gnss_block_test gnss_block_test) @@ -1040,7 +1040,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) algorithms_libs ) - xcode_delete_duplicates(gnuradio_block_test) + xcode_remove_warning_duplicates(gnuradio_block_test) add_test(gnuradio_block_test gnuradio_block_test) @@ -1076,7 +1076,7 @@ target_include_directories(matio_test ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) -xcode_delete_duplicates(matio_test) +xcode_remove_warning_duplicates(matio_test) add_test(matio_test matio_test) @@ -1127,7 +1127,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ) endif() - xcode_delete_duplicates(acq_test) + xcode_remove_warning_duplicates(acq_test) add_test(acq_test acq_test) @@ -1225,7 +1225,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) ) endif() - xcode_delete_duplicates(trk_test) + xcode_remove_warning_duplicates(trk_test) add_test(trk_test trk_test) @@ -1258,7 +1258,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver ) - xcode_delete_duplicates(control_thread_test) + xcode_remove_warning_duplicates(control_thread_test) add_test(control_thread_test control_thread_test) diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index b27a94351..f8abe59a5 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -102,8 +102,8 @@ if(PMT_USES_BOOST_ANY) ) endif() -include(XcodeDeleteDuplicates) -xcode_delete_duplicates(front-end-cal) +include(XcodeRemoveWarningDuplicates) +xcode_remove_warning_duplicates(front-end-cal) if(ENABLE_STRIP) set_target_properties(front-end-cal PROPERTIES LINK_FLAGS "-s") diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 94906c04c..107d4be37 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -110,6 +110,9 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s") endif() + include(XcodeRemoveWarningDuplicates) + xcode_remove_warning_duplicates(obsdiff) + add_custom_command(TARGET obsdiff POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${LOCAL_INSTALL_BASE_DIR}/install/$ From f1fb4abec0228f550bc9fcda5e29044542e27591 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 13 Apr 2024 09:17:18 +0200 Subject: [PATCH 131/499] Bump CMake max policy to 3.29 --- CMakeLists.txt | 2 +- .../libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a20109162..dea7423b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.28) +cmake_minimum_required(VERSION 2.8.12...3.29) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index bca6d3d23..a57544a7f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.28) +cmake_minimum_required(VERSION 2.8.12...3.29) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel") project(volk_gnsssdr) enable_language(CXX) From b99e431f8b299866fd622d6d1323def7e1520c73 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Apr 2024 12:11:49 +0200 Subject: [PATCH 132/499] Workaround for OpenSUSE/Leap --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dea7423b0..85e689102 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -371,7 +371,8 @@ if(CMAKE_VERSION VERSION_LESS "3.4") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10") endif() -if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13") +if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13" + OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)) set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() @@ -2622,7 +2623,7 @@ if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING) endif() endif() -if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})) +if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION}) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0"))) unset(Protobuf_PROTOC_EXECUTABLE) if(CMAKE_CROSSCOMPILING) if(NOT Protobuf_FOUND) @@ -2660,6 +2661,10 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI set(absl_FOUND OFF) endif() endif() + if((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")) + unset(absl_FOUND CACHE) + set(absl_FOUND OFF) + endif() if(absl_FOUND) set_package_properties(absl PROPERTIES DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library (found: v${absl_VERSION})" From 14da62a0ada4858c57c3f4a0e60367ab02855ff7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Apr 2024 13:51:01 +0200 Subject: [PATCH 133/499] Workaround for OpenSUSE/Leap --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 85e689102..ae71dd91c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -371,8 +371,8 @@ if(CMAKE_VERSION VERSION_LESS "3.4") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10") endif() -if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13" - OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)) +if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13" OR + (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)) set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() @@ -2792,8 +2792,8 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI if(NOT TARGET protobuf::protoc) add_executable(protobuf::protoc IMPORTED) - add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}) endif() + add_dependencies(protobuf::protoc protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}) unset(Protobuf_PROTOC_EXECUTABLE) set(PROTOBUF_PROTOC_EXECUTABLE "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/bin/protoc") set_target_properties(protobuf::protoc PROPERTIES From 1a8fc61479833764b42996d82fedee11ca08ef8a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 16 Apr 2024 14:29:19 +0200 Subject: [PATCH 134/499] Fix for OpenSUSE/leap --- CMakeLists.txt | 16 +++++++++++++--- README.md | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae71dd91c..418fa97a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,7 +372,9 @@ if(CMAKE_VERSION VERSION_LESS "3.4") endif() if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13" OR - (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)) + ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0")) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11"))) set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() @@ -2537,7 +2539,13 @@ endif() ################################################################################ # Protocol Buffers https://github.com/protocolbuffers/protobuf ################################################################################ -find_package(Protobuf) +if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0")) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11"))) + find_package(Protobuf 21.12 EXACT) +else() + find_package(Protobuf) +endif() set_package_properties(Protobuf PROPERTIES URL "https://protobuf.dev/" PURPOSE "Used to serialize output data in a way that can be read by other applications." @@ -2679,7 +2687,9 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI DESCRIPTION "An open-source collection of C++ code designed to augment the C++ standard library" ) endif() - message(STATUS "The Abseil library (https://github.com/abseil/abseil-cpp) >= v20230117 is required to be installed before building Protocol Buffers >22.x on the fly.") + if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")) + message(STATUS "The Abseil library (https://github.com/abseil/abseil-cpp) >= v20230117 is required to be installed before building Protocol Buffers >22.x on the fly.") + endif() message(STATUS " Instead, Protocol Buffers v21.12 will be built, which does not require Abseil.") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() diff --git a/README.md b/README.md index 02bc80df7..0413da74a 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ $ zypper install cmake git gcc-c++ boost-devel libboost_atomic-devel \ libboost_system-devel libboost_filesystem-devel libboost_chrono-devel \ libboost_thread-devel libboost_serialization-devel log4cpp-devel \ gnuradio-devel pugixml-devel libpcap-devel armadillo-devel libtool \ - automake hdf5-devel openssl-devel python3-Mako protobuf-devel + automake hdf5-devel openssl-devel python3-Mako libmatio-devel ``` If you are using openSUSE Tumbleweed: From c6010d943ef99e2ad3acbd70aecc6960d7b818a9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 18 Apr 2024 08:31:21 +0200 Subject: [PATCH 135/499] CMake fixes for old distros --- CMakeLists.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 418fa97a0..b780e3144 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2542,7 +2542,11 @@ endif() if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0")) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0")) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11"))) - find_package(Protobuf 21.12 EXACT) + if(CMAKE_VERSION VERSION_LESS 3.19) + find_package(Protobuf) + else() + find_package(Protobuf 3.0...21.12) + endif() else() find_package(Protobuf) endif() @@ -2631,7 +2635,7 @@ if(Protobuf_FOUND AND CMAKE_CROSSCOMPILING) endif() endif() -if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION}) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0"))) +if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSION} VERSION_LESS ${GNSSSDR_PROTOBUF_MIN_VERSION})) unset(Protobuf_PROTOC_EXECUTABLE) if(CMAKE_CROSSCOMPILING) if(NOT Protobuf_FOUND) From e13fc392149437b07c5c2e45693015d59928262f Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Fri, 19 Apr 2024 00:47:31 +0200 Subject: [PATCH 136/499] [TAS-177] implement OsnmaTestVectorsSimulation This commit introduces two new unit tests for the osnma_msg_receiver class: 'TeslaKeyVerification' and 'OsnmaTestVectorsSimulation'. The first test verifies the Tesla key handling within the class. The second test uses real-world test vectors to simulate osnma message receiving and verifies correct parsing and processing of messages. --- src/core/libs/osnma_msg_receiver.cc | 3 +- src/core/libs/osnma_msg_receiver.h | 6 +- src/tests/CMakeLists.txt | 34 +++ src/tests/test_main.cc | 1 + .../osnma/gnss_crypto_test.cc | 28 +- .../osnma/osnma_msg_receiver_test.cc | 265 ++++++++++++++++++ 6 files changed, 322 insertions(+), 15 deletions(-) create mode 100644 src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d058f92a6..9b546366e 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -149,6 +149,7 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) d_osnma_data.d_nma_header.cid = d_dsm_reader->get_cid(nma_header); d_osnma_data.d_nma_header.cpks = d_dsm_reader->get_cpks(nma_header); d_osnma_data.d_nma_header.reserved = d_dsm_reader->get_nma_header_reserved(nma_header); + std::cout<< "NMAS: " << static_cast(d_osnma_data.d_nma_header.nmas) << " CPKS: " << static_cast(d_osnma_data.d_nma_header.cpks) << std::endl; } @@ -438,7 +439,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // Check that the padding bits received match the computed values if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { - LOG(WARNING) << "OSNMA: DSM-KROOT message received ok."; + LOG(WARNING) << "Galileo OSNMA: DSM-KROOT message received ok."; std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index a443850ac..9f3c76fec 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -18,6 +18,8 @@ #ifndef GNSS_SDR_OSNMA_MSG_RECEIVER_H #define GNSS_SDR_OSNMA_MSG_RECEIVER_H +#define FRIEND_TEST(test_case_name, test_name)\ +friend class test_case_name##_##test_name##_Test #include "galileo_inav_message.h" // for OSNMA_msg #include "gnss_block_interface.h" // for gnss_shared_ptr @@ -54,7 +56,6 @@ class osnma_msg_receiver : public gr::block { public: ~osnma_msg_receiver() = default; //!< Default destructor - private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); @@ -115,6 +116,9 @@ private: void remove_verified_tags(); void control_tags_awaiting_verify_size(); bool verify_macseq(const MACK_message& mack); + + FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); + FRIEND_TEST(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation); }; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 7d6951aba..72b12bc9e 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1301,4 +1301,38 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) #${GNSSSDR_SOURCE_DIR}/src/core, #${GNSSSDR_SOURCE_DIR}/src/core/receiver, ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) +endif() + + +if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) + set(OSNMA_MSG_RECEIVER_TEST_SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc + ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc) + + # Configure the test executable: + if(USE_CMAKE_TARGET_SOURCES) + add_executable(osnma_msg_receiver_test) + target_sources(osnma_msg_receiver_test PRIVATE ${OSNMA_MSG_RECEIVER_TEST_SOURCES}) + else() + add_executable(osnma_msg_receiver_test ${OSNMA_MSG_RECEIVER_TEST_SOURCES}) + endif() + + # Link libraries that gnss_crypto_test requires: + target_link_libraries(osnma_msg_receiver_test + PRIVATE + Boost::thread + Gflags::gflags + Glog::glog + GTest::GTest + GTest::Main + core_libs + ) + + # Include any directories your test needs for header files: + target_include_directories(osnma_msg_receiver_test + PRIVATE + #${GNSSSDR_SOURCE_DIR}/src/algorithms, + #${GNSSSDR_SOURCE_DIR}/src/core, + #${GNSSSDR_SOURCE_DIR}/src/core/receiver, + ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) endif() \ No newline at end of file diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 8fc8efd57..e589fb972 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -73,6 +73,7 @@ DECLARE_string(log_dir); #include "unit-tests/signal-processing-blocks/adapter/pass_through_test.cc" #include "unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc" #include "unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc" +#include "unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc" #include "unit-tests/signal-processing-blocks/pvt/geohash_test.cc" #include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc" diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 563cf5a46..b0ecaf2cc 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -8,21 +8,21 @@ TEST(GnssCryptoTest, VerifySignature) { // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" std::unique_ptr d_crypto = std::make_unique(); - // RG example - import crt certificate - // std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; - // std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - // std::vector publicKey { // PEM format - 1000 bits - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - // - // 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, - // - // 0x0A, - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; +// RG example - import crt certificate - result: FAIL +//std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; +//std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; +//std::vector publicKey { // PEM format - 1000 bits +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, +// +// 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, +// 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, +// 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, +// +// 0x0A, +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; // own ECDSA-P256 key and message generated and signed and verified successfully with openssl - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK @@ -56,6 +56,8 @@ TEST(GnssCryptoTest, VerifySignature) { // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51, 0x4D, 0x42, 0x41, 0x67, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, // 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; + + d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature(message, signature); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc new file mode 100644 index 000000000..047832490 --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -0,0 +1,265 @@ +#include +#include +#include +#include +#include + + +struct TestVector +{ + int svId; + int numNavBits; + std::vector navBits; +}; + +class OsnmaMsgReceiverTest : public ::testing::Test +{ +protected: + osnma_msg_receiver_sptr osnma; + Galileo_Inav_Message galileo_message; + uint8_t page_position_in_inav_subframe; + bool flag_CRC_test; + std::string page_even; + OSNMA_msg osnma_msg{}; + std::array nma_position_filled; + uint32_t d_GST_SIS{}; // 16 AUG 2023 05 00 01 + int T {}; + uint32_t TOW{}; + uint32_t WN{}; + void set_time(std::tm& input); + + void SetUp() override + { + flag_CRC_test = false; + page_even = ""; + + std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; + set_time(input_time); + std::string pemFilePath = "OSNMA_PublicKey_20230803105952_newPKID_1.pem"; + std::string merkleFilePath = "OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); + } + +public: + static std::vector parseNavBits(const std::string& hex); + static std::vector readTestVectorsFromFile(const std::string& filename); + std::string bytes_to_str(const std::vector& bytes); + std::vector extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes); +}; + + +TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { + // Arrange + osnma->d_tesla_key_verified = false; + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; + osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + osnma->d_receiver_time = 345630; + osnma->d_GST_0 = 345600; + osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; + uint32_t TOW = 345630; + + + + // Act + bool result = osnma->verify_tesla_key(key, TOW); + + // Assert + ASSERT_TRUE(result); // Adjust this according to what you expect + +} + +TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) +{ + // Arrange + std::vector testVectors = readTestVectorsFromFile(/*"/home/cgm/CLionProjects/osnma/src/tests/data/*/"16_AUG_2023_GST_05_00_01.csv"); + bool end_of_hex_stream{false}; + int offset_byte{0}; + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240/8}; + const int SIZE_SUBFRAME_PAGES{15}; + const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; + const int DURATION_SUBFRAME{30}; + + std::cout << "OsnmaTestVectorsSimulation:" << std::endl; + std::cout << "d_GST_SIS: " << d_GST_SIS << std::endl; + std::cout << "T: " << T << std::endl; + std::cout << "TOW: " << TOW << std::endl; + std::cout << "WN: " << WN << std::endl; + + + // Act + while (end_of_hex_stream == false){ // loop over all bytes of data. Note all TestVectors have same amount of data. + for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe + auto osnmaMsg_sptr = std::make_shared(); + std::array hkroot{}; + std::array mack{}; + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + { + // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index + std::vector page_bytes = extract_page_bytes(tv,byte_index,SIZE_PAGE_BYTES); + if(page_bytes.empty()){ + std::cout<< "OsnmaTestVectorsSimulation: end of TestVectors \n" << "byte_index="< osnmaBits(odd_page.substr(18, 40)); + // Extract bits for hkroot and mack + std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); + std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); + hkroot[idx] = static_cast(hkrootBits.to_ulong()); + mack[idx] = static_cast(mackBits.to_ulong()); + + byte_index += SIZE_PAGE_BYTES; + } + if(end_of_hex_stream) + break; + osnmaMsg_sptr->hkroot = hkroot; + osnmaMsg_sptr->mack = mack; + + osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; + osnmaMsg_sptr->PRN = tv.svId; + + auto temp_obj = pmt::make_any(osnmaMsg_sptr); + + osnma->msg_handler_osnma(temp_obj); // osnma entry point + } + + + if(!end_of_hex_stream){ + offset_byte = byte_index; // update offset for the next subframe + d_GST_SIS += DURATION_SUBFRAME; + T = d_GST_SIS % 30; + TOW = d_GST_SIS & 0x000FFFFF; + WN = (d_GST_SIS & 0xFFF00000) >> 20 ; + std::cout << "OsnmaTestVectorsSimulation:" << std::endl; + std::cout << "d_GST_SIS: " << d_GST_SIS << std::endl; + std::cout << "T: " << T << std::endl; + std::cout << "TOW: " << TOW << std::endl; + std::cout << "WN: " << WN << std::endl; + } + + + } + + + + // Assert + // TODO +} + +std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) +{ + std::ifstream file(filename); + std::vector testVectors; + if (!file.is_open()) { + std::cerr<<"Error reading the file \"" << filename <<"\" \n"; + return testVectors; + } + + std::string line; + std::getline(file, line); + if (line != "SVID,NumNavBits,NavBitsHEX\r" ){ + std::cerr<<"Error parsing first line" <<"\n"; + } + + while (std::getline(file, line)) + { + std::stringstream ss(line); + TestVector tv; + + std::string val; + + std::getline(ss, val, ','); + tv.svId = std::stoi(val); + + std::getline(ss, val, ','); + tv.numNavBits = std::stoi(val); + + std::getline(ss, val, ','); + tv.navBits = OsnmaMsgReceiverTest::parseNavBits(val); + + testVectors.push_back(tv); + } + + return testVectors; +} +std::vector OsnmaMsgReceiverTest::parseNavBits(const std::string& hex) +{ + std::vector bytes; + + for (unsigned int i = 0; i < hex.length()-1; i += 2) + { + std::string byteString = hex.substr(i, 2); + uint8_t byte = (uint8_t) strtol(byteString.c_str(), NULL, 16); + bytes.push_back(byte); + } + return bytes; +} +std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes) +{ + std::string bit_string; + bit_string.reserve(bytes.size() * 8); + for(const auto& byte : bytes) + { + std::bitset<8> bits(byte); + bit_string += bits.to_string(); + } + return bit_string; +} +std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes) +{ + // Ensure we don't go beyond the end of tv.navBits + int num_bytes_to_extract = std::min(num_bytes, static_cast(tv.navBits.size() - byte_index)); + + // If byte_index is beyond the end of tv.navBits, return an empty vector + if (num_bytes_to_extract <= 0) + { + return std::vector(); + } + + // Use std::next to get an iterator to the range to extract + std::vector extracted_bytes(tv.navBits.begin() + byte_index, tv.navBits.begin() + byte_index + num_bytes_to_extract); + + return extracted_bytes; +} + +void OsnmaMsgReceiverTest::set_time(std::tm& input) +{ + // GST epoch (start of GST time) + std::tm tm_epoch = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; + + auto epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&tm_epoch)); + auto input_time_point = std::chrono::system_clock::from_time_t(mktime(&input)); + + // Get the duration from epoch in seconds + auto duration_sec = std::chrono::duration_cast(input_time_point - epoch_time_point); + + // Calculate the week number (WN) and time of week (TOW) + uint32_t sec_in_week = 7 * 24 * 60 * 60; + uint32_t week_number = duration_sec.count() / sec_in_week; + uint32_t time_of_week = duration_sec.count() % sec_in_week; + this->WN = week_number; + this->TOW = time_of_week; + // Return the week number and time of week as a pair + + this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); + this->T = d_GST_SIS % 30; + + +} From c91c31bd35cbaa178cbf8e6e4a8ca443d84ede68 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Apr 2024 09:48:28 +0200 Subject: [PATCH 137/499] Fix wrong order of arguments in calloc --- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index f216e1344..12e3fed4d 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1034,7 +1034,7 @@ double *zeros(int n, int m) { return nullptr; } - if (!(p = static_cast(calloc(sizeof(double), n * m)))) + if (!(p = static_cast(calloc(n * m, sizeof(double))))) { fatalerr("matrix memory allocation error: n=%d,m=%d\n", n, m); } From 95e9c13cd5bdbe503b74d0586fac580bd021df82 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Apr 2024 12:22:43 +0200 Subject: [PATCH 138/499] Find dependencies in the loongarch64 architecture --- cmake/Modules/FindMATIO.cmake | 1 + cmake/Modules/FindORC.cmake | 6 ++++++ cmake/Modules/FindPCAP.cmake | 1 + cmake/Modules/FindPUGIXML.cmake | 1 + cmake/Modules/FindUHD.cmake | 1 + cmake/Modules/FindVOLK.cmake | 1 + cmake/Modules/FindZEROMQ.cmake | 1 + 7 files changed, 12 insertions(+) diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake index 49e0bf8cd..d9a6cebd2 100644 --- a/cmake/Modules/FindMATIO.cmake +++ b/cmake/Modules/FindMATIO.cmake @@ -108,6 +108,7 @@ find_library(MATIO_LIBRARY /usr/lib/x86_64-linux-gnux32 /usr/lib/x86_64-kfreebsd-gnu /usr/lib/i386-kfreebsd-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindORC.cmake b/cmake/Modules/FindORC.cmake index 97cd0e4a8..b6a4ba364 100644 --- a/cmake/Modules/FindORC.cmake +++ b/cmake/Modules/FindORC.cmake @@ -80,6 +80,8 @@ find_path(ORC_LIBRARY_DIR /usr/lib/powerpc64le-linux-gnu /usr/lib/hppa-linux-gnu /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib @@ -106,6 +108,8 @@ find_library(ORC_LIB orc-0.4 /usr/lib/powerpc64le-linux-gnu /usr/lib/hppa-linux-gnu /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib @@ -134,6 +138,8 @@ find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STA /usr/lib/powerpc64le-linux-gnu /usr/lib/hppa-linux-gnu /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index ae4b049f6..39a7aff15 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -105,6 +105,7 @@ else() /usr/lib/powerpc64-linux-gnu /usr/lib/powerpc64le-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/lib/s390x-linux-gnu /usr/lib/sh4-linux-gnu /usr/lib/sparc64-linux-gnu diff --git a/cmake/Modules/FindPUGIXML.cmake b/cmake/Modules/FindPUGIXML.cmake index c5c1ea637..5f7f5dcb2 100644 --- a/cmake/Modules/FindPUGIXML.cmake +++ b/cmake/Modules/FindPUGIXML.cmake @@ -88,6 +88,7 @@ find_library(PUGIXML_LIBRARY /usr/lib/sparc64-linux-gnu /usr/lib/x86_64-linux-gnux32 /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/lib/x86_64-kfreebsd-gnu /usr/lib/i386-kfreebsd-gnu /usr/local/lib diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index 772cf436a..a6ed654a3 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -86,6 +86,7 @@ find_library(UHD_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindVOLK.cmake b/cmake/Modules/FindVOLK.cmake index f67efdfbb..bda662186 100644 --- a/cmake/Modules/FindVOLK.cmake +++ b/cmake/Modules/FindVOLK.cmake @@ -83,6 +83,7 @@ find_library(VOLK_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/cmake/Modules/FindZEROMQ.cmake b/cmake/Modules/FindZEROMQ.cmake index 0ef937139..6579d9ed7 100644 --- a/cmake/Modules/FindZEROMQ.cmake +++ b/cmake/Modules/FindZEROMQ.cmake @@ -46,6 +46,7 @@ find_library(ZEROMQ_LIBRARIES /usr/lib/powerpc64-linux-gnu /usr/lib/powerpc64le-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/lib/s390x-linux-gnu /usr/lib/sh4-linux-gnu /usr/lib/sparc64-linux-gnu From 78295866e61367beb074b43b32dda5a4f5e63a5a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Apr 2024 12:41:11 +0200 Subject: [PATCH 139/499] Find dependencies in the loongarch64 architecture --- .../volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake | 1 + .../volk_gnsssdr/cmake/Modules/FindORC.cmake | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake index 6f25e91d2..7c25e69c2 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake @@ -34,6 +34,7 @@ find_library(CPUFEATURES_LIBRARIES /usr/lib/x86_64-linux-gnux32 /usr/lib/alpha-linux-gnu /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake index facb29f51..9ac9f5ccb 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake @@ -71,6 +71,8 @@ find_path(ORC_LIBRARY_DIR /usr/lib/powerpc64le-linux-gnu /usr/lib/hppa-linux-gnu /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib @@ -97,6 +99,8 @@ find_library(ORC_LIB orc-0.4 /usr/lib/powerpc64le-linux-gnu /usr/lib/hppa-linux-gnu /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib @@ -125,6 +129,8 @@ find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STA /usr/lib/powerpc64le-linux-gnu /usr/lib/hppa-linux-gnu /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu /usr/local/lib /usr/local/lib64 /opt/local/lib From 1ad631128f185389bbdf6312a974a54208d87ff8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Apr 2024 13:03:31 +0200 Subject: [PATCH 140/499] cpu_features: Update AArch64 features to Linux 6.6 --- .../volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h | 4 ++++ .../volk_gnsssdr/cpu_features/include/internal/hwcaps.h | 2 ++ .../cpu_features/src/impl_aarch64__base_implementation.inl | 5 ++++- .../volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc | 2 ++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h index 618f17def..a8cb0d41a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h @@ -180,6 +180,8 @@ typedef struct int smebi32i32 : 1; // 1-bit binary to 32-bit integer outer product. int smeb16b16 : 1; // SME2.1 BFloat16 instructions. int smef16f16 : 1; // FP16 to FP16 outer product. + int mops : 1; // Standardized memory operations. + int hbc : 1; // Hinted conditional branches. // Make sure to update Aarch64FeaturesEnum below if you add a field here. } Aarch64Features; @@ -276,6 +278,8 @@ typedef enum AARCH64_SME_BI32I32, AARCH64_SME_B16B16, AARCH64_SME_F16F16, + AARCH64_MOPS, + AARCH64_HBC, AARCH64_LAST_, } Aarch64FeaturesEnum; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h index a787aa966..63baa1fff 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h @@ -92,6 +92,8 @@ CPU_FEATURES_START_CPP_NAMESPACE #define AARCH64_HWCAP2_SME_BI32I32 (1UL << 40) #define AARCH64_HWCAP2_SME_B16B16 (1UL << 41) #define AARCH64_HWCAP2_SME_F16F16 (1UL << 42) +#define AARCH64_HWCAP2_MOPS (1UL << 43) +#define AARCH64_HWCAP2_HBC (1UL << 44) // http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h #define ARM_HWCAP_SWP (1UL << 0) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl index 36fd9a65c..14be5a726 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl @@ -100,7 +100,10 @@ AARCH64_HWCAP2_SME_BI32I32) \ LINE(AARCH64_SME_B16B16, smeb16b16, "smeb16b16", 0, \ AARCH64_HWCAP2_SME_B16B16) \ - LINE(AARCH64_SME_F16F16, smef16f16, "smef16f16", 0, AARCH64_HWCAP2_SME_F16F16) + LINE(AARCH64_SME_F16F16, smef16f16, "smef16f16", 0, \ + AARCH64_HWCAP2_SME_F16F16) \ + LINE(AARCH64_MOPS, mops, "mops", 0, AARCH64_HWCAP2_MOPS) \ + LINE(AARCH64_HBC, hbc, "hbc", 0, AARCH64_HWCAP2_HBC) #define INTROSPECTION_PREFIX Aarch64 #define INTROSPECTION_ENUM_PREFIX AARCH64 #include "define_introspection_and_hwcaps.inl" \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc index d6ac50110..fc8abf8fe 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc @@ -324,6 +324,8 @@ CPU revision : 3)"); EXPECT_FALSE(info.features.smebi32i32); EXPECT_FALSE(info.features.smeb16b16); EXPECT_FALSE(info.features.smef16f16); + EXPECT_FALSE(info.features.mops); + EXPECT_FALSE(info.features.hbc); } #elif defined(CPU_FEATURES_OS_MACOS) TEST_F(CpuidAarch64Test, FromDarwinSysctlFromName) From 4910629a5d88bb936c821e4656a6279211dbaa6f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Apr 2024 13:36:14 +0200 Subject: [PATCH 141/499] CI: update actions/setup-python to v5 in volk-gnsssdr-windows job --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ad507ba20..060517643 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -204,7 +204,7 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install dependencies From 4c8cde1ec756c3188e2dd720d62f3f0ca6ce7c74 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Apr 2024 00:55:11 +0200 Subject: [PATCH 142/499] Add work on reading Galileo Integrity Support Message --- src/core/system_parameters/CMakeLists.txt | 3 + src/core/system_parameters/Galileo_INAV.h | 17 ++ .../system_parameters/galileo_inav_message.cc | 40 ++++ .../system_parameters/galileo_inav_message.h | 8 + src/core/system_parameters/galileo_ism.cc | 196 +++++++++++++++++ src/core/system_parameters/galileo_ism.h | 205 ++++++++++++++++++ 6 files changed, 469 insertions(+) create mode 100644 src/core/system_parameters/galileo_ism.cc create mode 100644 src/core/system_parameters/galileo_ism.h diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 3e25387ed..a34944710 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -19,6 +19,7 @@ set(SYSTEM_PARAMETERS_SOURCES galileo_fnav_message.cc galileo_has_data.cc galileo_inav_message.cc + galileo_ism.cc galileo_reduced_ced.cc beidou_dnav_navigation_message.cc beidou_dnav_ephemeris.cc @@ -55,6 +56,7 @@ set(SYSTEM_PARAMETERS_HEADERS galileo_fnav_message.h galileo_has_data.h galileo_inav_message.h + galileo_ism.h galileo_reduced_ced.h sbas_ephemeris.h gps_cnav_ephemeris.h @@ -115,6 +117,7 @@ target_link_libraries(core_system_parameters Boost::date_time Boost::serialization PRIVATE + Boost::headers Gflags::gflags Glog::glog ) diff --git a/src/core/system_parameters/Galileo_INAV.h b/src/core/system_parameters/Galileo_INAV.h index 72222baf2..9c9f19315 100644 --- a/src/core/system_parameters/Galileo_INAV.h +++ b/src/core/system_parameters/Galileo_INAV.h @@ -274,6 +274,23 @@ constexpr int32_t BITS_IN_OCTET = 8; constexpr int32_t FIRST_RS_BIT = 7; constexpr int32_t FIRST_RS_BIT_AFTER_IODNAV = 17; +/* Page 22 */ +const std::vector> ISM_CONSTELLATION_ID_BIT({{7, 3}}); +const std::vector> ISM_SERVICE_LEVEL_ID_BIT({{10, 3}}); +const std::vector> ISM_WN_BIT({{13, 12}}); +const std::vector> ISM_T0_BIT({{25, 9}}); +const std::vector> ISM_MASK_MSB_BIT({{34, 1}}); +const std::vector> ISM_MASK_BIT({{35, 32}}); +const std::vector> ISM_PCONST_BIT({{67, 4}}); +const std::vector> ISM_PSAT_BIT({{71, 4}}); +const std::vector> ISM_URA_BIT({{75, 4}}); +const std::vector> ISM_URE_BIT({{79, 4}}); +const std::vector> ISM_BNOM_BIT({{83, 4}}); +const std::vector> ISM_TVALIDITY_BIT({{87, 4}}); +const std::vector> ISM_CRC_BIT({{97, 32}}); +constexpr int32_t GALILEO_ISM_CRC_DATA_BITS = 96; +constexpr int32_t GALILEO_ISM_CRC_DATA_BYTES = 12; + /* Page 0 */ const std::vector> TIME_0_BIT({{7, 2}}); const std::vector> WN_0_BIT({{97, 12}}); diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 81c47c3bb..fb28d0adc 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1315,6 +1315,40 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) break; } + case 22: // Word Type 22: ARAIM Integrity Support Message (ISM) + DLOG(INFO) << "Word type 22 arrived"; + ism_constellation_id = read_octet_unsigned(data_jk_bits, ISM_CONSTELLATION_ID_BIT); + ism_service_level_id = read_octet_unsigned(data_jk_bits, ISM_SERVICE_LEVEL_ID_BIT); + ism_crc = static_cast(read_navigation_unsigned(data_jk_bits, ISM_CRC_BIT)); + gal_ism.set_ism_crc(ism_crc); + if (gal_ism.check_ism_crc(data_jk_bits)) + { + DLOG(INFO) << "I/NAV ARAIM Integrity Support Message CRC OK"; + gal_ism.set_ism_constellation_id(ism_constellation_id); + gal_ism.set_ism_service_level_id(ism_service_level_id); + if (ism_constellation_id == 0) + { + DLOG(INFO) << "I/NAV ARAIM Integrity Support Message in Test"; + } + if (ism_constellation_id == 1) + { + if (ism_service_level_id == 2) + { + gal_ism.set_ism_wn(static_cast(read_navigation_unsigned(data_jk_bits, ISM_WN_BIT))); + gal_ism.set_ism_t0(static_cast(read_navigation_unsigned(data_jk_bits, ISM_T0_BIT))); + gal_ism.set_ism_mask_msb(read_navigation_bool(data_jk_bits, ISM_MASK_MSB_BIT)); + gal_ism.set_ism_mask(static_cast(read_navigation_unsigned(data_jk_bits, ISM_MASK_BIT))); + gal_ism.set_ism_pconst(read_octet_unsigned(data_jk_bits, ISM_PCONST_BIT)); + gal_ism.set_ism_psat(read_octet_unsigned(data_jk_bits, ISM_PSAT_BIT)); + gal_ism.set_ism_ura(read_octet_unsigned(data_jk_bits, ISM_URA_BIT)); + gal_ism.set_ism_ure(read_octet_unsigned(data_jk_bits, ISM_URE_BIT)); + gal_ism.set_ism_bnom(read_octet_unsigned(data_jk_bits, ISM_BNOM_BIT)); + gal_ism.set_ism_Tvalidity(read_octet_unsigned(data_jk_bits, ISM_TVALIDITY_BIT)); + } + } + } + break; + case 0: // Word type 0: I/NAV Spare Word Time_0 = static_cast(read_navigation_unsigned(data_jk_bits, TIME_0_BIT)); DLOG(INFO) << "Time_0= " << Time_0; @@ -1336,3 +1370,9 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) } return page_number; } + + +Galileo_ISM Galileo_Inav_Message::get_galileo_ism() const +{ + return gal_ism; +} \ No newline at end of file diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 1b37e9083..3acacecdd 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -23,6 +23,7 @@ #include "galileo_almanac_helper.h" #include "galileo_ephemeris.h" #include "galileo_iono.h" +#include "galileo_ism.h" #include "galileo_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::unique_ptr in C++11 #include @@ -114,6 +115,8 @@ public: */ Galileo_Ephemeris get_reduced_ced() const; + Galileo_ISM get_galileo_ism() const; + inline bool get_flag_CRC_test() const { return flag_CRC_test; @@ -236,6 +239,7 @@ private: std::bitset regenerate_page_3(const std::vector& decoded) const; std::bitset regenerate_page_4(const std::vector& decoded) const; + Galileo_ISM gal_ism{}; std::string page_Even{}; std::vector rs_buffer; // Reed-Solomon buffer @@ -399,6 +403,10 @@ private: uint8_t IODnav_LSB19{}; uint8_t IODnav_LSB20{}; + uint32_t ism_crc{}; + uint8_t ism_constellation_id{}; + uint8_t ism_service_level_id{}; + bool flag_CRC_test{}; bool flag_all_ephemeris{}; // Flag indicating that all words containing ephemeris have been received bool flag_ephemeris_1{}; // Flag indicating that ephemeris 1/4 (word 1) have been received diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc new file mode 100644 index 000000000..847a4ecd6 --- /dev/null +++ b/src/core/system_parameters/galileo_ism.cc @@ -0,0 +1,196 @@ +/*! + * \file galileo_ism.cc + * \brief Interface of a Galileo Integrity Support Message + * \author Carles Fernandez, 2024. cfernandez(at)cttc.cat + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "galileo_ism.h" +#include +#include +#include +#include + +void Galileo_ISM::set_ism_constellation_id(uint8_t const_id) +{ + this->ism_constellation_id = const_id; +} + + +void Galileo_ISM::set_ism_service_level_id(uint8_t sl_id) +{ + this->ism_service_level_id = sl_id; +} + + +void Galileo_ISM::set_ism_wn(uint16_t wn_ism) +{ + this->ism_wn = wn_ism; +} + + +void Galileo_ISM::set_ism_t0(uint16_t t0) +{ + this->ism_t0 = t0; +} + + +void Galileo_ISM::set_ism_mask_msb(bool mask_msb) +{ + this->ism_mask_msb = mask_msb; +} + + +void Galileo_ISM::set_ism_mask(uint32_t mask) +{ + this->ism_mask = mask; +} + + +void Galileo_ISM::set_ism_pconst(uint8_t pconst) +{ + this->ism_pconst = pconst; +} + + +void Galileo_ISM::set_ism_psat(uint8_t psat) +{ + this->ism_psat = psat; +} + + +void Galileo_ISM::set_ism_ura(uint8_t ura) +{ + this->ism_ura = ura; +} + + +void Galileo_ISM::set_ism_ure(uint8_t ure) +{ + this->ism_ure = ure; +} + + +void Galileo_ISM::set_ism_bnom(uint8_t bnom) +{ + this->ism_bnom = bnom; +} + + +void Galileo_ISM::set_ism_Tvalidity(uint8_t tvalidity) +{ + this->ism_Tvalidity = tvalidity; +} + + +void Galileo_ISM::set_ism_crc(uint32_t crc) +{ + this->ism_crc = crc; +} + + +uint16_t Galileo_ISM::get_WN_ISM() const +{ + return this->ism_wn; +} + + +uint16_t Galileo_ISM::get_t0_ISM() const +{ + return (this->ism_t0 * 1800); +} + + +double Galileo_ISM::get_pconst_value() const +{ + auto it = ISM_PCONST_MAP.find(this->ism_pconst); + if (it == ISM_PCONST_MAP.end()) + { + return 0.0; + } + return it->second; +} + + +double Galileo_ISM::get_psat_value() const +{ + auto it = ISM_PSAT_MAP.find(this->ism_psat); + if (it == ISM_PSAT_MAP.end()) + { + return 0.0; + } + return it->second; +} + + +float Galileo_ISM::get_ura_m() const +{ + auto it = ISM_URA_MAP.find(this->ism_ura); + if (it == ISM_URA_MAP.end()) + { + return 0.0; + } + return it->second; +} + + +float Galileo_ISM::get_ure_m() const +{ + auto it = ISM_URE_MAP.find(this->ism_ure); + if (it == ISM_URE_MAP.end()) + { + return 0.0; + } + return it->second; +} + + +float Galileo_ISM::get_bnom_m() const +{ + auto it = ISM_BNOM_MAP.find(this->ism_bnom); + if (it == ISM_BNOM_MAP.end()) + { + return 5.0; // + } + return it->second; +} + + +uint16_t Galileo_ISM::get_Tvalidity_hours() const +{ + auto it = ISM_TVALIDITY_MAP.find(this->ism_Tvalidity); + if (it == ISM_TVALIDITY_MAP.end()) + { + return 0.0; + } + return it->second; +} + + +bool Galileo_ISM::check_ism_crc(const std::bitset& bits) const +{ + boost::dynamic_bitset frame_bits(bits.to_string().substr(0, GALILEO_ISM_CRC_DATA_BITS)); + + std::vector bytes; + boost::to_block_range(frame_bits, std::back_inserter(bytes)); + std::reverse(bytes.begin(), bytes.end()); + + boost::crc_32_type crc32_ism; + crc32_ism.process_bytes(bytes.data(), GALILEO_ISM_CRC_DATA_BYTES); + const uint32_t crc_computed = crc32_ism.checksum(); + if (this->ism_crc == crc_computed) + { + return true; + } + + return false; +} \ No newline at end of file diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h new file mode 100644 index 000000000..12436a606 --- /dev/null +++ b/src/core/system_parameters/galileo_ism.h @@ -0,0 +1,205 @@ +/*! + * \file galileo_ism.h + * \brief Interface of a Galileo Integrity Support Message + * \author Carles Fernandez, 2024. cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_GALILEO_ISM_H +#define GNSS_SDR_GALILEO_ISM_H + +#include "Galileo_INAV.h" +#include +#include +#include + +/** \addtogroup Core + * \{ */ +/** \addtogroup System_Parameters + * \{ */ + + +/*! + * \brief This class is a storage for the GALILEO Integrity Support Message as described + * in Galileo ICD paragraph 5.2 + * + * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo_OS_SIS_ICD_v2.1.pdf + */ +class Galileo_ISM +{ +public: + /*! + * Default constructor + */ + Galileo_ISM() = default; + + void set_ism_constellation_id(uint8_t const_id); + void set_ism_service_level_id(uint8_t sl_id); + void set_ism_wn(uint16_t wn_ism); + void set_ism_t0(uint16_t t0); + void set_ism_mask_msb(bool mask_msb); + void set_ism_mask(uint32_t mask); + void set_ism_pconst(uint8_t pconst); + void set_ism_psat(uint8_t psat); + void set_ism_ura(uint8_t ura); + void set_ism_ure(uint8_t ure); + void set_ism_bnom(uint8_t bnom); + void set_ism_Tvalidity(uint8_t tvalidity); + void set_ism_crc(uint32_t crc); + + bool check_ism_crc(const std::bitset& bits) const; + + double get_pconst_value() const; + double get_psat_value() const; + float get_ura_m() const; + float get_ure_m() const; + float get_bnom_m() const; + uint16_t get_WN_ISM() const; + uint16_t get_t0_ISM() const; + uint16_t get_Tvalidity_hours() const; + +private: + // ICD 2.1 Table 97 + std::unordered_map ISM_PCONST_MAP = { + {0, 1.0e-8}, + {1, 1.0e-7}, + {2, 1.0e-6}, + {3, 3.0e-6}, + {4, 6.0e-6}, + {5, 8.0e-6}, + {6, 1.0e-5}, + {7, 2.0e-5}, + {8, 4.0e-5}, + {9, 6.0e-5}, + {10, 8.0e-5}, + {11, 1.0e-4}, + {12, 1.25e-4}, + {13, 1.5e-4}, + {14, 1.75e-4}, + {15, 2.0e-4}}; + + // ICD 2.1 Table 98 + std::unordered_map ISM_PSAT_MAP = { + {0, 1.0e-7}, + {1, 3.0e-7}, + {2, 6.0e-7}, + {3, 1.0e-6}, + {4, 2.0e-6}, + {5, 3.0e-6}, + {6, 5.0e-6}, + {7, 7.0e-6}, + {8, 1.0e-5}, + {9, 1.2e-5}, + {10, 1.4e-5}, + {11, 1.7e-5}, + {12, 2.05e-5}, + {13, 2.4e-5}, + {14, 2.8e-5}, + {15, 3.0e-5}}; + + // ICD 2.1 Table 99 + std::unordered_map ISM_URA_MAP = { + {0, 0.75}, + {1, 1.0}, + {2, 1.5}, + {3, 2.0}, + {4, 2.25}, + {5, 2.50}, + {6, 2.75}, + {7, 3.0}, + {8, 3.25}, + {9, 3.50}, + {10, 3.75}, + {11, 4.0}, + {12, 4.50}, + {13, 5.0}, + {14, 5.50}, + {15, 6.0}}; + + // ICD 2.1 Table 100 + std::unordered_map ISM_URE_MAP = { + {0, 0.25}, + {1, 0.50}, + {2, 0.75}, + {3, 1.00}, + {4, 1.25}, + {5, 1.50}, + {6, 1.75}, + {7, 2.0}, + {8, 2.25}, + {9, 2.50}, + {10, 2.75}, + {11, 3.0}, + {12, 3.25}, + {13, 3.50}, + {14, 3.75}, + {15, 4.00}}; + + + // ICD 2.1 Table 101 + std::unordered_map ISM_BNOM_MAP = { + {0, 0.0}, + {1, 0.10}, + {2, 0.20}, + {3, 0.30}, + {4, 0.40}, + {5, 0.50}, + {6, 0.60}, + {7, 0.75}, + {8, 0.85}, + {9, 1.0}, + {10, 1.20}, + {11, 1.40}, + {12, 1.60}, + {13, 1.80}, + {14, 2.0}, + {15, 2.4}}; + + + // ICD 2.1 Table 102 + std::unordered_map ISM_TVALIDITY_MAP = { + {0, 1}, + {1, 2}, + {2, 3}, + {3, 4}, + {4, 6}, + {5, 8}, + {6, 12}, + {7, 18}, + {8, 24}, + {9, 36}, + {10, 48}, + {11, 72}, + {12, 120}, + {13, 168}, + {14, 720}, + {15, 1440}}; + + uint32_t ism_crc{}; + uint32_t ism_mask{}; + uint16_t ism_wn{}; + uint16_t ism_t0{}; + uint8_t ism_constellation_id{}; + uint8_t ism_service_level_id{}; + uint8_t ism_pconst{}; + uint8_t ism_psat{}; + uint8_t ism_ura{}; + uint8_t ism_ure{}; + uint8_t ism_bnom{}; + uint8_t ism_Tvalidity{}; + bool ism_mask_msb{}; +}; + +/** \} */ +/** \} */ +#endif // GNSS_SDR_GALILEO_ISM_H \ No newline at end of file From 95596b8f918a95ee9d5c6f03e3f7a5d606e99f7b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 29 Apr 2024 08:27:33 +0200 Subject: [PATCH 143/499] Soft transition from Gflags and Glog to Abseil. Some CI fixes --- .clang-tidy | 1 - .github/workflows/main.yml | 31 +- CMakeLists.txt | 873 ++++++++++-------- README.md | 19 +- docs/CHANGELOG.md | 31 +- src/algorithms/PVT/adapters/CMakeLists.txt | 8 +- src/algorithms/PVT/adapters/rtklib_pvt.cc | 25 +- .../PVT/gnuradio_blocks/CMakeLists.txt | 9 +- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 7 +- src/algorithms/PVT/libs/CMakeLists.txt | 11 +- src/algorithms/PVT/libs/an_packet_printer.cc | 7 +- src/algorithms/PVT/libs/geohash.cc | 2 +- src/algorithms/PVT/libs/geojson_printer.cc | 7 +- src/algorithms/PVT/libs/gpx_printer.cc | 6 +- src/algorithms/PVT/libs/has_simple_printer.cc | 7 +- src/algorithms/PVT/libs/kml_printer.cc | 6 +- src/algorithms/PVT/libs/nmea_printer.cc | 7 +- src/algorithms/PVT/libs/pvt_kf.cc | 6 +- src/algorithms/PVT/libs/pvt_solution.cc | 6 +- src/algorithms/PVT/libs/rinex_printer.cc | 6 +- src/algorithms/PVT/libs/rtcm.h | 7 +- src/algorithms/PVT/libs/rtcm_printer.cc | 6 +- src/algorithms/PVT/libs/rtklib_solver.cc | 6 +- .../acquisition/adapters/CMakeLists.txt | 8 +- .../adapters/beidou_b1i_pcps_acquisition.cc | 14 +- .../adapters/beidou_b3i_pcps_acquisition.cc | 14 +- ...lileo_e1_pcps_8ms_ambiguous_acquisition.cc | 14 +- .../galileo_e1_pcps_ambiguous_acquisition.cc | 14 +- ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 14 +- ...eo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 13 +- ...e1_pcps_quicksync_ambiguous_acquisition.cc | 14 +- ...ileo_e1_pcps_tong_ambiguous_acquisition.cc | 14 +- ...ileo_e5a_noncoherent_iq_acquisition_caf.cc | 14 +- .../adapters/galileo_e5a_pcps_acquisition.cc | 14 +- .../galileo_e5a_pcps_acquisition_fpga.cc | 14 +- .../adapters/galileo_e5b_pcps_acquisition.cc | 14 +- .../galileo_e5b_pcps_acquisition_fpga.cc | 14 +- .../adapters/galileo_e6_pcps_acquisition.cc | 14 +- .../glonass_l1_ca_pcps_acquisition.cc | 14 +- .../glonass_l2_ca_pcps_acquisition.cc | 14 +- .../adapters/gps_l1_ca_pcps_acquisition.cc | 14 +- ...gps_l1_ca_pcps_acquisition_fine_doppler.cc | 13 +- .../gps_l1_ca_pcps_acquisition_fpga.cc | 14 +- .../gps_l1_ca_pcps_assisted_acquisition.cc | 13 +- .../gps_l1_ca_pcps_opencl_acquisition.cc | 14 +- .../gps_l1_ca_pcps_quicksync_acquisition.cc | 14 +- .../gps_l1_ca_pcps_tong_acquisition.cc | 14 +- .../adapters/gps_l2_m_pcps_acquisition.cc | 14 +- .../gps_l2_m_pcps_acquisition_fpga.cc | 14 +- .../adapters/gps_l5i_pcps_acquisition.cc | 15 +- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 14 +- .../gnuradio_blocks/CMakeLists.txt | 9 +- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 7 +- .../galileo_pcps_8ms_acquisition_cc.cc | 6 +- .../gnuradio_blocks/pcps_acquisition.cc | 18 + .../gnuradio_blocks/pcps_acquisition.h | 13 +- .../pcps_acquisition_fine_doppler_cc.cc | 7 +- .../gnuradio_blocks/pcps_acquisition_fpga.cc | 17 +- .../gnuradio_blocks/pcps_acquisition_fpga.h | 10 +- .../pcps_assisted_acquisition_cc.cc | 6 +- .../pcps_cccwsr_acquisition_cc.cc | 7 +- .../pcps_opencl_acquisition_cc.cc | 7 +- .../pcps_quicksync_acquisition_cc.cc | 7 +- .../pcps_tong_acquisition_cc.cc | 7 +- .../acquisition/libs/CMakeLists.txt | 9 +- src/algorithms/acquisition/libs/acq_conf.cc | 7 +- .../acquisition/libs/acq_conf_fpga.cc | 7 +- .../acquisition/libs/fpga_acquisition.cc | 6 +- .../channel/adapters/CMakeLists.txt | 8 +- src/algorithms/channel/adapters/channel.cc | 13 +- src/algorithms/channel/libs/CMakeLists.txt | 9 +- src/algorithms/channel/libs/channel_fsm.cc | 7 +- .../channel/libs/channel_msg_receiver_cc.cc | 7 +- .../conditioner/adapters/CMakeLists.txt | 10 +- .../adapters/array_signal_conditioner.cc | 6 +- .../adapters/signal_conditioner.cc | 6 +- .../data_type_adapter/adapters/CMakeLists.txt | 9 +- .../adapters/byte_to_short.cc | 7 +- .../adapters/ibyte_to_cbyte.cc | 7 +- .../adapters/ibyte_to_complex.cc | 5 + .../adapters/ibyte_to_cshort.cc | 6 +- .../adapters/ishort_to_complex.cc | 6 +- .../adapters/ishort_to_cshort.cc | 6 +- .../input_filter/adapters/CMakeLists.txt | 9 +- .../adapters/beamformer_filter.cc | 6 +- .../input_filter/adapters/fir_filter.cc | 6 +- .../adapters/freq_xlating_fir_filter.cc | 6 +- .../input_filter/adapters/notch_filter.cc | 6 +- .../adapters/notch_filter_lite.cc | 6 +- .../adapters/pulse_blanking_filter.cc | 6 +- src/algorithms/libs/CMakeLists.txt | 24 +- src/algorithms/libs/gnss_sdr_flags.cc | 30 +- src/algorithms/libs/gnss_sdr_flags.h | 128 ++- src/algorithms/libs/pass_through.cc | 6 +- src/algorithms/libs/rtklib/CMakeLists.txt | 9 +- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 7 +- .../observables/adapters/CMakeLists.txt | 8 +- .../adapters/hybrid_observables.cc | 11 +- .../gnuradio_blocks/CMakeLists.txt | 9 +- .../gnuradio_blocks/hybrid_observables_gs.cc | 7 +- src/algorithms/observables/libs/obs_conf.cc | 6 + .../resampler/adapters/CMakeLists.txt | 9 +- .../adapters/direct_resampler_conditioner.cc | 6 +- .../adapters/mmse_resampler_conditioner.cc | 7 +- .../signal_generator/adapters/CMakeLists.txt | 9 +- .../adapters/signal_generator.cc | 6 +- .../signal_source/adapters/CMakeLists.txt | 8 +- .../adapters/ad9361_fpga_signal_source.cc | 6 +- .../adapters/ad936x_custom_signal_source.cc | 7 +- .../adapters/custom_udp_signal_source.cc | 6 +- .../adapters/fifo_signal_source.cc | 6 +- .../adapters/file_signal_source.cc | 5 + .../adapters/file_source_base.cc | 19 +- .../adapters/file_timestamp_signal_source.cc | 16 +- .../adapters/flexiband_signal_source.cc | 7 +- .../adapters/fmcomms2_signal_source.cc | 7 +- .../four_bit_cpx_file_signal_source.cc | 14 +- .../adapters/gen_signal_source.cc | 6 +- .../adapters/labsat_signal_source.cc | 7 +- .../adapters/limesdr_signal_source.cc | 7 +- .../multichannel_file_signal_source.cc | 7 +- .../adapters/nsr_file_signal_source.cc | 5 + .../adapters/osmosdr_signal_source.cc | 7 +- .../adapters/plutosdr_signal_source.cc | 6 +- .../adapters/raw_array_signal_source.cc | 6 +- .../adapters/rtl_tcp_signal_source.cc | 7 +- .../adapters/spir_file_signal_source.cc | 7 +- .../spir_gss6450_file_signal_source.cc | 8 +- .../two_bit_cpx_file_signal_source.cc | 5 + .../two_bit_packed_file_signal_source.cc | 7 +- .../adapters/uhd_signal_source.cc | 7 +- .../adapters/zmq_signal_source.cc | 5 + .../gnuradio_blocks/CMakeLists.txt | 9 +- .../gnuradio_blocks/fifo_reader.cc | 5 + .../rtl_tcp_signal_source_c.cc | 6 +- .../signal_source/libs/CMakeLists.txt | 9 +- .../signal_source/libs/ad9361_manager.cc | 7 +- .../signal_source/libs/ad936x_iio_custom.cc | 7 +- .../signal_source/libs/fpga_buffer_monitor.cc | 7 +- .../libs/fpga_dynamic_bit_selection.cc | 7 +- .../signal_source/libs/fpga_switch.cc | 7 +- .../signal_source/libs/gnss_sdr_valve.cc | 7 +- .../telemetry_decoder/adapters/CMakeLists.txt | 9 +- .../adapters/beidou_b1i_telemetry_decoder.cc | 5 + .../adapters/beidou_b3i_telemetry_decoder.cc | 5 + .../adapters/galileo_e1b_telemetry_decoder.cc | 5 + .../adapters/galileo_e5a_telemetry_decoder.cc | 5 + .../adapters/galileo_e5b_telemetry_decoder.cc | 5 + .../adapters/galileo_e6_telemetry_decoder.cc | 5 + .../glonass_l1_ca_telemetry_decoder.cc | 5 + .../glonass_l2_ca_telemetry_decoder.cc | 5 + .../adapters/gps_l1_ca_telemetry_decoder.cc | 5 + .../adapters/gps_l2c_telemetry_decoder.cc | 5 + .../adapters/gps_l5_telemetry_decoder.cc | 5 + .../adapters/sbas_l1_telemetry_decoder.cc | 6 +- .../gnuradio_blocks/CMakeLists.txt | 9 +- .../beidou_b1i_telemetry_decoder_gs.cc | 7 +- .../beidou_b3i_telemetry_decoder_gs.cc | 7 +- .../galileo_telemetry_decoder_gs.cc | 7 +- .../glonass_l1_ca_telemetry_decoder_gs.cc | 7 +- .../glonass_l2_ca_telemetry_decoder_gs.cc | 7 +- .../gps_l1_ca_telemetry_decoder_gs.cc | 7 +- .../gps_l2c_telemetry_decoder_gs.cc | 6 +- .../gps_l5_telemetry_decoder_gs.cc | 7 +- .../sbas_l1_telemetry_decoder_gs.cc | 7 +- .../telemetry_decoder/libs/CMakeLists.txt | 9 +- .../telemetry_decoder/libs/tlm_crc_stats.cc | 6 +- .../libs/viterbi_decoder_sbas.cc | 7 +- .../tracking/adapters/CMakeLists.txt | 8 +- .../adapters/beidou_b1i_dll_pll_tracking.cc | 6 +- .../adapters/beidou_b3i_dll_pll_tracking.cc | 7 +- .../galileo_e1_dll_pll_veml_tracking.cc | 7 +- .../galileo_e1_dll_pll_veml_tracking_fpga.cc | 7 +- .../galileo_e1_tcp_connector_tracking.cc | 21 +- .../adapters/galileo_e5a_dll_pll_tracking.cc | 7 +- .../galileo_e5a_dll_pll_tracking_fpga.cc | 7 +- .../adapters/galileo_e5b_dll_pll_tracking.cc | 7 +- .../adapters/galileo_e6_dll_pll_tracking.cc | 7 +- .../glonass_l1_ca_dll_pll_c_aid_tracking.cc | 20 + .../glonass_l1_ca_dll_pll_tracking.cc | 20 + .../glonass_l2_ca_dll_pll_c_aid_tracking.cc | 20 + .../glonass_l2_ca_dll_pll_tracking.cc | 19 + .../adapters/gps_l1_ca_dll_pll_tracking.cc | 7 +- .../gps_l1_ca_dll_pll_tracking_fpga.cc | 7 +- .../gps_l1_ca_dll_pll_tracking_gpu.cc | 14 + .../adapters/gps_l1_ca_gaussian_tracking.cc | 12 + .../adapters/gps_l1_ca_kf_tracking.cc | 7 +- .../gps_l1_ca_tcp_connector_tracking.cc | 7 +- .../adapters/gps_l2_m_dll_pll_tracking.cc | 7 +- .../gps_l2_m_dll_pll_tracking_fpga.cc | 7 +- .../adapters/gps_l5_dll_pll_tracking.cc | 7 +- .../adapters/gps_l5_dll_pll_tracking_fpga.cc | 7 +- .../tracking/gnuradio_blocks/CMakeLists.txt | 8 +- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 7 +- .../dll_pll_veml_tracking_fpga.cc | 7 +- .../galileo_e1_tcp_connector_tracking_cc.cc | 35 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 28 +- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 28 +- .../glonass_l1_ca_dll_pll_tracking_cc.cc | 24 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 26 +- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 24 +- .../glonass_l2_ca_dll_pll_tracking_cc.cc | 24 +- .../gps_l1_ca_dll_pll_tracking_gpu_cc.cc | 34 +- .../gps_l1_ca_gaussian_tracking_cc.cc | 33 +- .../gps_l1_ca_tcp_connector_tracking_cc.cc | 33 +- .../tracking/gnuradio_blocks/kf_tracking.cc | 7 +- src/algorithms/tracking/libs/CMakeLists.txt | 8 +- src/algorithms/tracking/libs/dll_pll_conf.cc | 29 +- .../tracking/libs/dll_pll_conf_fpga.cc | 28 +- .../tracking/libs/fpga_multicorrelator.cc | 7 +- src/algorithms/tracking/libs/kf_conf.cc | 20 +- .../tracking/libs/tracking_loop_filter.cc | 7 +- src/core/interfaces/signal_source_interface.h | 5 + src/core/libs/CMakeLists.txt | 9 +- src/core/libs/channel_status_msg_receiver.cc | 7 +- src/core/libs/galileo_e6_has_msg_receiver.cc | 7 +- src/core/libs/galileo_tow_map.cc | 13 +- src/core/libs/gnss_sdr_fpga_sample_counter.cc | 6 +- src/core/libs/gnss_sdr_supl_client.cc | 7 +- src/core/libs/nav_message_monitor.cc | 7 +- src/core/receiver/CMakeLists.txt | 10 +- src/core/receiver/control_thread.cc | 29 +- src/core/receiver/file_configuration.cc | 6 +- src/core/receiver/gnss_block_factory.cc | 7 +- src/core/receiver/gnss_flowgraph.cc | 17 +- src/core/system_parameters/CMakeLists.txt | 10 +- .../system_parameters/galileo_cnav_message.cc | 9 +- .../system_parameters/galileo_fnav_message.cc | 7 +- .../system_parameters/galileo_inav_message.cc | 6 +- .../glonass_gnav_navigation_message.cc | 7 +- src/core/system_parameters/gnss_satellite.cc | 7 +- src/main/CMakeLists.txt | 24 +- src/main/main.cc | 98 +- src/tests/CMakeLists.txt | 96 +- src/tests/common-files/gnuplot_i.h | 7 +- .../common-files/observable_tests_flags.h | 17 +- .../common-files/signal_generator_flags.h | 24 +- src/tests/common-files/test_flags.h | 18 +- src/tests/common-files/tracking_tests_flags.h | 61 +- src/tests/single_test_main.cc | 63 +- src/tests/system-tests/libs/CMakeLists.txt | 8 +- .../system-tests/libs/position_test_flags.h | 26 +- src/tests/system-tests/position_test.cc | 237 ++++- src/tests/system-tests/ttff.cc | 105 ++- src/tests/test_main.cc | 59 +- .../arithmetic/complex_carrier_test.cc | 73 +- .../unit-tests/arithmetic/conjugate_test.cc | 73 +- .../unit-tests/arithmetic/fft_length_test.cc | 42 +- .../unit-tests/arithmetic/fft_speed_test.cc | 20 + .../arithmetic/magnitude_squared_test.cc | 76 +- .../unit-tests/arithmetic/multiply_test.cc | 126 ++- .../control-plane/control_thread_test.cc | 8 +- .../acquisition/acq_performance_test.cc | 278 +++++- .../beidou_b1i_pcps_acquisition_test.cc | 9 +- .../beidou_b3i_pcps_acquisition_test.cc | 9 +- ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 21 +- ...e1_pcps_ambiguous_acquisition_test_fpga.cc | 7 +- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 45 +- .../gps_l1_ca_pcps_acquisition_test.cc | 32 +- .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 7 +- ...cps_quicksync_acquisition_gsoc2014_test.cc | 44 +- .../gps_l2_m_pcps_acquisition_test.cc | 20 + .../filter/fir_filter_test.cc | 12 +- .../filter/notch_filter_lite_test.cc | 13 +- .../filter/notch_filter_test.cc | 12 +- .../filter/pulse_blanking_filter_test.cc | 12 +- .../libs/CMakeLists.txt | 9 +- .../libs/acquisition_msg_rx.cc | 11 +- .../observables/hybrid_observables_test.cc | 226 ++++- .../hybrid_observables_test_fpga.cc | 184 +++- .../gps_l1_ca_telemetry_decoder_test.cc | 40 +- .../cpu_multicorrelator_real_codes_test.cc | 31 +- .../tracking/cpu_multicorrelator_test.cc | 27 +- .../galileo_e1_dll_pll_veml_tracking_test.cc | 2 +- .../gps_l1_ca_dll_pll_tracking_test.cc | 225 ++++- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 46 +- .../gps_l1_ca_gaussian_tracking_test.cc | 85 +- .../tracking/gpu_multicorrelator_test.cc | 19 +- .../tracking/tracking_pull-in_test.cc | 278 +++++- .../tracking/tracking_pull-in_test_fpga.cc | 239 ++++- .../system-parameters/has_decoding_test.cc | 18 +- src/utils/front-end-cal/CMakeLists.txt | 17 +- src/utils/front-end-cal/front_end_cal.cc | 7 +- src/utils/front-end-cal/main.cc | 102 +- src/utils/rinex-tools/CMakeLists.txt | 14 +- src/utils/rinex-tools/obsdiff.cc | 116 ++- src/utils/rinex-tools/obsdiff_flags.h | 20 + src/utils/rinex2assist/CMakeLists.txt | 8 +- src/utils/rinex2assist/main.cc | 39 +- 289 files changed, 5930 insertions(+), 952 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 0ef91e2ec..3ddbd1a51 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -120,7 +120,6 @@ Checks: '-*, readability-uppercase-literal-suffix' WarningsAsErrors: '' HeaderFilterRegex: '' -AnalyzeTemporaryDtors: false FormatStyle: 'file' CheckOptions: - key: performance-unnecessary-copy-initialization.ExcludedContainerTypes diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 060517643..8323fdea8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -57,8 +57,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf + brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure run: cd build && cmake -GNinja .. @@ -90,8 +89,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure run: cd build && cmake -GXcode .. @@ -142,16 +140,15 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja pkg-config hdf5 automake armadillo lapack libmatio \ - gflags glog gnuradio log4cpp openssl pugixml protobuf llvm - pip3 install mako + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf llvm + pip3 install mako ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.14.0 core_monitor core_libs pvt_libs - name: run clang-tidy - run: cd build && /usr/local/opt/llvm/bin/run-clang-tidy -fix + run: cd build && /opt/homebrew/opt/llvm/bin/run-clang-tidy -fix - name: check run: | git diff > clang_tidy.patch @@ -243,8 +240,13 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - name: install dependencies - run: pip3 install mako + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mako - name: configure run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - name: build @@ -256,8 +258,13 @@ jobs: runs-on: macos-latest steps: - uses: actions/checkout@v4 - - name: install dependencies - run: pip3 install mako + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mako - name: configure run: cd build && cmake -GXcode ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr - name: build diff --git a/CMakeLists.txt b/CMakeLists.txt index b780e3144..aa4eafe9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,9 +74,20 @@ option(ENABLE_PACKAGING "Enable software packaging" OFF) option(ENABLE_OWN_GLOG "Download glog and link it to gflags" OFF) +option(ENABLE_GLOG_AND_GFLAGS "Force using Google glog and Gflags instead of Abseil" OFF) + +option(ENABLE_OWN_ABSEIL "Forces downloading and building of Abseil" OFF) +if(CMAKE_VERSION VERSION_LESS 3.24) + set(ENABLE_OWN_ABSEIL OFF) +endif() +if(ENABLE_OWN_ABSEIL) + set(ENABLE_OWN_GLOG OFF) + set(ENABLE_GLOG_AND_GFLAGS OFF) +endif() + option(ENABLE_OWN_ARMADILLO "Download and build Armadillo locally" OFF) -option(ENABLE_LOG "Enable logging" ON) +option(ENABLE_LOG "Enable internal logging" ON) option(ENABLE_ARMA_NO_DEBUG OFF) @@ -329,6 +340,7 @@ set(GNSSSDR_MATIO_MIN_VERSION "1.5.3") set(GNSSSDR_PROTOBUF_MIN_VERSION "3.0.0") set(GNSSSDR_PYTHON_MIN_VERSION "2.7") set(GNSSSDR_PYTHON3_MIN_VERSION "3.4") +set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") @@ -1157,7 +1169,7 @@ if(NOT VOLKGNSSSDR_FOUND) if(CMAKE_GENERATOR STREQUAL Xcode) set(VOLK_GNSSSDR_BUILD_COMMAND "xcodebuild" - "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> + "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>:RelWithDebInfo>$<$:Debug> ) endif() @@ -1392,316 +1404,427 @@ endif() ################################################################################ -# gflags - https://github.com/gflags/gflags +# Abseil C++ - https://abseil.io/docs/cpp/ ################################################################################ -set(LOCAL_GFLAGS FALSE) -if(ENABLE_OWN_GLOG) - unset(Glog::glog CACHE) - unset(GLOG_FOUND CACHE) - unset(Gflags::gflags CACHE) - unset(GLAGS_FOUND CACHE) - set(GFLAGS_GREATER_20 TRUE) -else() - unset(Glog::glog CACHE) - unset(GLOG_FOUND CACHE) - find_package(GLOG) - if(GLOG_FOUND) - unset(GFLAGS_GREATER_20 CACHE) - find_package(GFLAGS) - endif() -endif() -set_package_properties(GFLAGS PROPERTIES - PURPOSE "Used for commandline flags management." - TYPE REQUIRED -) -if(NOT GFLAGS_FOUND) - set(ENABLE_OWN_GLOG ON) - if(GFLAGS_VERSION) - message(STATUS " A version of the gflags library equal or higher than v${GNSSSDR_GFLAGS_MIN_VERSION} has not been found.") - else() - message(STATUS " The gflags library has not been found.") - endif() - message(STATUS " gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") - message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") - set(GFLAGS_BUILD_COMMAND ${CMAKE_COMMAND} - "--build" "${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}" - "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - ) - if(CMAKE_GENERATOR STREQUAL Xcode) - set(GFLAGS_BUILD_COMMAND "xcodebuild" "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>) - endif() - if(CMAKE_TOOLCHAIN_FILE) - set(GFLAGS_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - endif() +if(CMAKE_VERSION VERSION_GREATER 3.13 + AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 14) + AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.1) + AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) + AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) + AND NOT ENABLE_OWN_GLOG + AND NOT ENABLE_GLOG_AND_GFLAGS) + # See https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md - if(CMAKE_VERSION VERSION_LESS 3.2) - ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/gflags/gflags.git - GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - -DBUILD_STATIC_LIBS=ON - -DBUILD_gflags_LIB=ON - -DBUILD_gflags_nothreads_LIB=ON - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ${GFLAGS_TOOLCHAIN_FILE} - -DGFLAGS_NAMESPACE=google - -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - BUILD_COMMAND ${GFLAGS_BUILD_COMMAND} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" + if(ENABLE_OWN_ABSEIL) + include(FetchContent) + set(ABSEIL_BUILD_COMMAND ${CMAKE_COMMAND} + "--build" "${GNSSSDR_BINARY_DIR}/abseil-cpp" + "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + "--target" "install" ) - else() - set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX}) - if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR - (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator - set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX}) + if(CMAKE_GENERATOR STREQUAL Xcode) + set(ABSEIL_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>) endif() - if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) - set(PARALLEL_BUILD "--parallel 2") + if(CMAKE_TOOLCHAIN_FILE) + set(ABSEIL_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) endif() - ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/gflags/gflags.git - GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} - CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - -DBUILD_STATIC_LIBS=ON - -DBUILD_gflags_LIB=ON - -DBUILD_gflags_nothreads_LIB=ON - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - ${GFLAGS_TOOLCHAIN_FILE} - -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - BUILD_COMMAND "${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}" - BUILD_BYPRODUCTS ${GFLAGS_BUILD_BYPRODUCTS} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" + set(ABSL_PROPAGATE_CXX_STD ON) + FetchContent_Declare( + absl + GIT_REPOSITORY https://github.com/abseil/abseil-cpp + GIT_TAG master # live at head + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/abseil-cpp + CMAKE_ARGS -DABSL_PROPAGATE_CXX_STD=ON -ABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/abseil-cpp ${ABSEIL_TOOLCHAIN_FILE} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/abseil-cpp + BUILD_COMMAND ${ABSEIL_BUILD_COMMAND} + OVERRIDE_FIND_PACKAGE # Requires CMake 3.24 ) - endif() - # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch - - set(GFlags_INCLUDE_DIRS - ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" - ) - - if(CMAKE_VERSION VERSION_LESS "3.0.2") - set(GFlags_LIBS - ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + FetchContent_MakeAvailable(absl) + set(absl_FOUND TRUE) + set(ENABLE_GLOG_AND_GFLAGS OFF) + else() + find_package(absl) + set_package_properties(absl PROPERTIES + URL "https://github.com/abseil/abseil-cpp" + PURPOSE "Making use of Abseil's log and flags libraries." + TYPE OPTIONAL ) - endif() - - if(NOT TARGET Gflags::gflags) - file(MAKE_DIRECTORY ${GFlags_INCLUDE_DIRS}) - add_library(Gflags::gflags STATIC IMPORTED) - add_dependencies(Gflags::gflags gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - set_target_properties(Gflags::gflags PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" - MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug - MAP_IMPORTED_CONFIG_COVERAGE Debug - MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES ${GFlags_INCLUDE_DIRS} - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) - if(MSVC) - set(MSVC_POSTFIX _static) - endif() - set_target_properties(Gflags::gflags PROPERTIES - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}_debug${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + if(absl_FOUND) + set_package_properties(absl PROPERTIES + DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library (found: v${absl_VERSION})" + ) + else() + set_package_properties(absl PROPERTIES + DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library" + ) + endif() + if("${absl_VERSION}" VERSION_LESS ${GNSSSDR_ABSEIL_MIN_VERSION}) + unset(absl_FOUND CACHE) + set(absl_FOUND FALSE) + set(ENABLE_GLOG_AND_GFLAGS ON) + set_package_properties(absl PROPERTIES + DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library (found: v${absl_VERSION}, but it is too old and it will not be used)" ) endif() endif() +endif() - if(MSVC) - target_link_libraries(Gflags::gflags INTERFACE shlwapi.lib) + +if(NOT absl_FOUND) + set(ENABLE_GLOG_AND_GFLAGS ON) + ################################################################################ + # gflags - https://github.com/gflags/gflags + ################################################################################ + set(LOCAL_GFLAGS FALSE) + if(ENABLE_OWN_GLOG) + unset(Glog::glog CACHE) + unset(GLOG_FOUND CACHE) + unset(Gflags::gflags CACHE) + unset(GLAGS_FOUND CACHE) + set(GFLAGS_GREATER_20 TRUE) + else() + unset(Glog::glog CACHE) + unset(GLOG_FOUND CACHE) + find_package(GLOG) + if(GLOG_FOUND) + unset(GFLAGS_GREATER_20 CACHE) + find_package(GFLAGS) + endif() endif() - - set(LOCAL_GFLAGS TRUE CACHE STRING "GFlags downloaded, built, and statically linked automatically" FORCE) set_package_properties(GFLAGS PROPERTIES - PURPOSE "Gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} and Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." + PURPOSE "Used for commandline flags management." + TYPE REQUIRED ) - if(CMAKE_VERSION VERSION_LESS 3.2) - set_property(TARGET Gflags::gflags APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS GFLAGS_OLD_NAMESPACE=1 - ) - endif() -endif() - - - -################################################################################ -# glog - https://github.com/google/glog -################################################################################ -set_package_properties(GLOG PROPERTIES - PURPOSE "Used for runtime internal logging." - TYPE REQUIRED -) -if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) - message(STATUS " glog library has not been found") if(NOT GFLAGS_FOUND) - message(STATUS " or it is likely not linked to gflags.") - endif() - message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") - message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") - find_package(LIBUNWIND) - set_package_properties(LIBUNWIND PROPERTIES - PURPOSE "Needed by glog." - TYPE OPTIONAL - ) - if(NOT ${LOCAL_GFLAGS}) - if(NOT TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED) + set(ENABLE_OWN_GLOG ON) + if(GFLAGS_VERSION) + message(STATUS " A version of the gflags library equal or higher than v${GNSSSDR_GFLAGS_MIN_VERSION} has not been found.") + else() + message(STATUS " The gflags library has not been found.") endif() - set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}") - string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS}) - else() - set(GFLAGS_PREFIX_PATH ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - endif() - set(TARGET_GFLAGS gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) - set(GLOG_MAKE_PROGRAM ${CMAKE_COMMAND} - "--build" "${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}" - "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - ) - if(CMAKE_GENERATOR STREQUAL Xcode) - set(GLOG_MAKE_PROGRAM "xcodebuild" "-configuration" - $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> + message(STATUS " gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") + message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") + set(GFLAGS_BUILD_COMMAND ${CMAKE_COMMAND} + "--build" "${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}" + "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> ) - endif() - if(CMAKE_TOOLCHAIN_FILE) - set(GLOG_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) - endif() + if(CMAKE_GENERATOR STREQUAL Xcode) + set(GFLAGS_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>) + endif() + if(CMAKE_TOOLCHAIN_FILE) + set(GFLAGS_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() - if(CMAKE_VERSION VERSION_LESS 3.3) - if(CMAKE_VERSION VERSION_LESS 3.0) - set(GLOG_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) - set(GFLAGS_LIBRARIES_TO_LINK ${GFlags_LIBS}) - if(${LOCAL_GFLAGS}) - set(GFLAGS_LIBRARY_DIR_TO_LINK ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib) - else() - set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS}) - endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(GFLAGS_LIBRARIES_TO_LINK "${GFLAGS_LIBRARIES_TO_LINK} -lc++") - set(GLOG_EXPORT_CXX_LIBRARIES "export CXXFLAGS=\"-stdlib=libc++\"") - endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set(GLOG_EXPORT_C_COMPILER "export CC=clang") - set(GLOG_EXPORT_CXX_COMPILER "export CXX=clang++") - endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(GLOG_EXPORT_C_COMPILER "export CC=gcc") - set(GLOG_EXPORT_CXX_COMPILER "export CXX=g++") - endif() - file(WRITE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags -"#!/bin/sh -export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} -export LDFLAGS=-L${GFLAGS_LIBRARY_DIR_TO_LINK} -export LIBS=\"${GFLAGS_LIBRARIES_TO_LINK}\" -${GLOG_EXPORT_CXX_LIBRARIES} -${GLOG_EXPORT_C_COMPILER} -${GLOG_EXPORT_CXX_COMPILER} -cd ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/ -aclocal -automake --add-missing -autoreconf -vfi -cd ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} -${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure --enable-shared=no" - ) - - file(COPY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags - DESTINATION ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ - GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) - - set(GLOG_CONFIGURE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) - - # Ensure that aclocal and libtool are present - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") - if(EXISTS "/usr/bin/libtoolize") - if(EXISTS "/usr/bin/aclocal" OR - EXISTS "/usr/bin/aclocal-1.16" OR - EXISTS "/usr/bin/aclocal-1.15" OR - EXISTS "/usr/bin/aclocal-1.14" OR - EXISTS "/usr/bin/aclocal-1.13" OR - EXISTS "/usr/bin/aclocal-1.11" OR - EXISTS "/usr/bin/aclocal-1.10") - # Everything ok, we can move on - else() - message(" aclocal has not been found.") - message(" You can try to install it by typing:") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" sudo yum groupinstall 'Development Tools'") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(" sudo zypper install automake") - else() - message(" sudo apt-get install automake") - endif() - message(FATAL_ERROR "aclocal is required to build glog from source") - endif() - else() - message(" libtool has not been found.") - message(" You can try to install it by typing:") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" sudo yum groupinstall 'Development Tools'") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(" sudo zypper install libtoool") - else() - message(" sudo apt-get install libtool") - endif() - message(FATAL_ERROR "libtool is required to build glog from source") - endif() - endif() - - if(GLOG_MAKE_PROGRAM MATCHES "ninja") - find_program(GLOG_MAKE_EXECUTABLE make - PATHS - /usr/bin - /usr/local/bin - ) - if(NOT GLOG_MAKE_EXECUTABLE) - message(FATAL_ERROR "make is required to build Glog from source.") - endif() - set(GLOG_MAKE_PROGRAM ${GLOG_MAKE_EXECUTABLE}) - endif() - ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} - DEPENDS ${TARGET_GFLAGS} - PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/google/glog/ - GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= - BUILD_COMMAND "${GLOG_MAKE_PROGRAM}" + if(CMAKE_VERSION VERSION_LESS 3.2) + ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/gflags/gflags.git + GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + -DBUILD_STATIC_LIBS=ON + -DBUILD_gflags_LIB=ON + -DBUILD_gflags_nothreads_LIB=ON + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ${GFLAGS_TOOLCHAIN_FILE} + -DGFLAGS_NAMESPACE=google + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND ${GFLAGS_BUILD_COMMAND} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" ) - set(GLOG_LIBRARIES - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + else() + set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX}) + if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR + (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator + set(GFLAGS_BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX}) + endif() + if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) + set(PARALLEL_BUILD "--parallel 2") + endif() + ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/gflags/gflags.git + GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + -DBUILD_STATIC_LIBS=ON + -DBUILD_gflags_LIB=ON + -DBUILD_gflags_nothreads_LIB=ON + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ${GFLAGS_TOOLCHAIN_FILE} + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND "${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}" + BUILD_BYPRODUCTS ${GFLAGS_BUILD_BYPRODUCTS} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" ) - set(GLOG_INCLUDE_DIRS - ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + endif() + # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch + + set(GFlags_INCLUDE_DIRS + ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" + ) + + if(CMAKE_VERSION VERSION_LESS "3.0.2") + set(GFlags_LIBS + ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} ) - else() # CMake > 3.0 but < 3.3 + endif() + + if(NOT TARGET Gflags::gflags) + file(MAKE_DIRECTORY ${GFlags_INCLUDE_DIRS}) + add_library(Gflags::gflags STATIC IMPORTED) + add_dependencies(Gflags::gflags gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + set_target_properties(Gflags::gflags PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" + MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug + MAP_IMPORTED_CONFIG_COVERAGE Debug + MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_ASAN Debug + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags_debug${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_INCLUDE_DIRECTORIES ${GFlags_INCLUDE_DIRS} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}gflags$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) + if(MSVC) + set(MSVC_POSTFIX _static) + endif() + set_target_properties(Gflags::gflags PROPERTIES + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}_debug${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/Release/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}gflags${MSVC_POSTFIX}$<$:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + endif() + endif() + + if(MSVC) + target_link_libraries(Gflags::gflags INTERFACE shlwapi.lib) + endif() + + set(LOCAL_GFLAGS TRUE CACHE STRING "GFlags downloaded, built, and statically linked automatically" FORCE) + set_package_properties(GFLAGS PROPERTIES + PURPOSE "Gflags v${GNSSSDR_GFLAGS_LOCAL_VERSION} and Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." + ) + if(CMAKE_VERSION VERSION_LESS 3.2) + set_property(TARGET Gflags::gflags APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS GFLAGS_OLD_NAMESPACE=1 + ) + endif() + endif() + + + + ################################################################################ + # glog - https://github.com/google/glog + ################################################################################ + set_package_properties(GLOG PROPERTIES + PURPOSE "Used for runtime internal logging." + TYPE REQUIRED + ) + if(NOT GLOG_FOUND OR ${LOCAL_GFLAGS}) + message(STATUS " glog library has not been found") + if(NOT GFLAGS_FOUND) + message(STATUS " or it is likely not linked to gflags.") + endif() + message(STATUS " glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked automatically") + message(STATUS " when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'.") + find_package(LIBUNWIND) + set_package_properties(LIBUNWIND PROPERTIES + PURPOSE "Needed by glog." + TYPE OPTIONAL + ) + if(NOT ${LOCAL_GFLAGS}) + if(NOT TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + add_library(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} UNKNOWN IMPORTED) + endif() + set_property(TARGET gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PROPERTY IMPORTED_LOCATION "${GFlags_LIBS}") + string(REPLACE /include "" GFLAGS_PREFIX_PATH ${GFlags_INCLUDE_DIRS}) + else() + set(GFLAGS_PREFIX_PATH ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + endif() + set(TARGET_GFLAGS gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + set(GLOG_MAKE_PROGRAM ${CMAKE_COMMAND} + "--build" "${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}" + "--config" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + ) + if(CMAKE_GENERATOR STREQUAL Xcode) + set(GLOG_MAKE_PROGRAM "xcodebuild" "-configuration" + $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug> + ) + endif() + if(CMAKE_TOOLCHAIN_FILE) + set(GLOG_TOOLCHAIN_FILE -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) + endif() + + if(CMAKE_VERSION VERSION_LESS 3.3) + if(CMAKE_VERSION VERSION_LESS 3.0) + set(GLOG_MAKE_PROGRAM ${CMAKE_MAKE_PROGRAM}) + set(GFLAGS_LIBRARIES_TO_LINK ${GFlags_LIBS}) + if(${LOCAL_GFLAGS}) + set(GFLAGS_LIBRARY_DIR_TO_LINK ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/lib) + else() + set(GFLAGS_LIBRARY_DIR_TO_LINK ${GFlags_LIBRARY_DIRS}) + endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(GFLAGS_LIBRARIES_TO_LINK "${GFLAGS_LIBRARIES_TO_LINK} -lc++") + set(GLOG_EXPORT_CXX_LIBRARIES "export CXXFLAGS=\"-stdlib=libc++\"") + endif() + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(GLOG_EXPORT_C_COMPILER "export CC=clang") + set(GLOG_EXPORT_CXX_COMPILER "export CXX=clang++") + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(GLOG_EXPORT_C_COMPILER "export CC=gcc") + set(GLOG_EXPORT_CXX_COMPILER "export CXX=g++") + endif() + file(WRITE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags + "#!/bin/sh + export CPPFLAGS=-I${GFlags_INCLUDE_DIRS} + export LDFLAGS=-L${GFLAGS_LIBRARY_DIR_TO_LINK} + export LIBS=\"${GFLAGS_LIBRARIES_TO_LINK}\" + ${GLOG_EXPORT_CXX_LIBRARIES} + ${GLOG_EXPORT_C_COMPILER} + ${GLOG_EXPORT_CXX_COMPILER} + cd ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/ + aclocal + automake --add-missing + autoreconf -vfi + cd ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure --enable-shared=no" + ) + + file(COPY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/tmp/configure_with_gflags + DESTINATION ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + + set(GLOG_CONFIGURE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configure_with_gflags) + + # Ensure that aclocal and libtool are present + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") + if(EXISTS "/usr/bin/libtoolize") + if(EXISTS "/usr/bin/aclocal" OR + EXISTS "/usr/bin/aclocal-1.16" OR + EXISTS "/usr/bin/aclocal-1.15" OR + EXISTS "/usr/bin/aclocal-1.14" OR + EXISTS "/usr/bin/aclocal-1.13" OR + EXISTS "/usr/bin/aclocal-1.11" OR + EXISTS "/usr/bin/aclocal-1.10") + # Everything ok, we can move on + else() + message(" aclocal has not been found.") + message(" You can try to install it by typing:") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" sudo yum groupinstall 'Development Tools'") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(" sudo zypper install automake") + else() + message(" sudo apt-get install automake") + endif() + message(FATAL_ERROR "aclocal is required to build glog from source") + endif() + else() + message(" libtool has not been found.") + message(" You can try to install it by typing:") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" sudo yum groupinstall 'Development Tools'") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(" sudo zypper install libtoool") + else() + message(" sudo apt-get install libtool") + endif() + message(FATAL_ERROR "libtool is required to build glog from source") + endif() + endif() + + if(GLOG_MAKE_PROGRAM MATCHES "ninja") + find_program(GLOG_MAKE_EXECUTABLE make + PATHS + /usr/bin + /usr/local/bin + ) + if(NOT GLOG_MAKE_EXECUTABLE) + message(FATAL_ERROR "make is required to build Glog from source.") + endif() + set(GLOG_MAKE_PROGRAM ${GLOG_MAKE_EXECUTABLE}) + endif() + ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} + DEPENDS ${TARGET_GFLAGS} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/google/glog/ + GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + CONFIGURE_COMMAND ${GLOG_CONFIGURE} --prefix= + BUILD_COMMAND "${GLOG_MAKE_PROGRAM}" + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) + set(GLOG_LIBRARIES + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/.libs/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + set(GLOG_INCLUDE_DIRS + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ) + else() # CMake > 3.0 but < 3.3 + ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} + DEPENDS ${TARGET_GFLAGS} + PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/google/glog/ + GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} + -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} + ${GLOG_TOOLCHAIN_FILE} + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND ${GLOG_MAKE_PROGRAM} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) + set(GLOG_INCLUDE_DIRS + ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} + ${GFlags_INCLUDE_DIRS} + ) + endif() + else() # CMake > 3.3 + set(GLOG_BUILD_BYPRODUCTS + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR + (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator + set(GLOG_BUILD_BYPRODUCTS + ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + endif() + if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode) AND NOT CMAKE_CROSSCOMPILING) + set(PARALLEL_BUILD "--parallel 2") + endif() + if(GNSSSDR_GLOG_LOCAL_VERSION VERSION_GREATER 0.5.0) + set(GLOG_GTEST -DWITH_GTEST=FALSE) + endif() + if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) + set(GNSSSDR_GLOG_LOCAL_GFLAGS -DCMAKE_REQUIRED_INCLUDES=${GFlags_INCLUDE_DIRS}) + endif() ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} DEPENDS ${TARGET_GFLAGS} PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} @@ -1710,11 +1833,15 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} ${GLOG_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - BUILD_COMMAND ${GLOG_MAKE_PROGRAM} + -DBUILD_SHARED_LIBS=OFF + ${GLOG_GTEST} + -DBUILD_TESTING=OFF + "${GNSSSDR_GLOG_LOCAL_GFLAGS}" + BUILD_COMMAND "${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}" + BUILD_BYPRODUCTS ${GLOG_BUILD_BYPRODUCTS} UPDATE_COMMAND "" PATCH_COMMAND "" INSTALL_COMMAND "" @@ -1725,120 +1852,64 @@ ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/configu ${GFlags_INCLUDE_DIRS} ) endif() - else() # CMake > 3.3 - set(GLOG_BUILD_BYPRODUCTS - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - if((CMAKE_BUILD_TYPE STREQUAL Debug) OR (CMAKE_BUILD_TYPE STREQUAL NoOptWithASM) OR - (CMAKE_BUILD_TYPE STREQUAL Coverage) OR (CMAKE_BUILD_TYPE STREQUAL ASAN)) # Workaround for Ninja generator - set(GLOG_BUILD_BYPRODUCTS - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - endif() - if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode) AND NOT CMAKE_CROSSCOMPILING) - set(PARALLEL_BUILD "--parallel 2") - endif() - if(GNSSSDR_GLOG_LOCAL_VERSION VERSION_GREATER 0.5.0) - set(GLOG_GTEST -DWITH_GTEST=FALSE) - endif() - if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) - set(GNSSSDR_GLOG_LOCAL_GFLAGS -DCMAKE_REQUIRED_INCLUDES=${GFlags_INCLUDE_DIRS}) - endif() - ExternalProject_Add(glog-${GNSSSDR_GLOG_LOCAL_VERSION} - DEPENDS ${TARGET_GFLAGS} - PREFIX ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - GIT_REPOSITORY https://github.com/google/glog/ - GIT_TAG v${GNSSSDR_GLOG_LOCAL_VERSION} - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_PREFIX_PATH=${GFLAGS_PREFIX_PATH} - ${GLOG_TOOLCHAIN_FILE} - -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> - -DBUILD_SHARED_LIBS=OFF - ${GLOG_GTEST} - -DBUILD_TESTING=OFF - "${GNSSSDR_GLOG_LOCAL_GFLAGS}" - BUILD_COMMAND "${GLOG_MAKE_PROGRAM} ${PARALLEL_BUILD}" - BUILD_BYPRODUCTS ${GLOG_BUILD_BYPRODUCTS} - UPDATE_COMMAND "" - PATCH_COMMAND "" - INSTALL_COMMAND "" - ) - set(GLOG_INCLUDE_DIRS - ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src - ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION} - ${GFlags_INCLUDE_DIRS} - ) - endif() - add_dependencies(glog-${GNSSSDR_GLOG_LOCAL_VERSION} Gflags::gflags) + add_dependencies(glog-${GNSSSDR_GLOG_LOCAL_VERSION} Gflags::gflags) - # Create Glog::glog target - if(NOT TARGET Glog::glog) - file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src) - file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}) - add_library(Glog::glog STATIC IMPORTED) - add_dependencies(Glog::glog glog-${GNSSSDR_GLOG_LOCAL_VERSION}) - if(CMAKE_VERSION VERSION_LESS 3.0) - set_target_properties(Glog::glog PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GLOG_LIBRARIES}" - INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${GLOG_LIBRARIES}" - ) - else() - set_target_properties(Glog::glog PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" - MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug - MAP_IMPORTED_CONFIG_COVERAGE Debug - MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo - MAP_IMPORTED_CONFIG_ASAN Debug - IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} - ) - if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) + # Create Glog::glog target + if(NOT TARGET Glog::glog) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/glog/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/src) + file(MAKE_DIRECTORY ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}) + add_library(Glog::glog STATIC IMPORTED) + add_dependencies(Glog::glog glog-${GNSSSDR_GLOG_LOCAL_VERSION}) + if(CMAKE_VERSION VERSION_LESS 3.0) set_target_properties(Glog::glog PROPERTIES - IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} - INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GLOG_LIBRARIES}" + INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" + INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${GLOG_LIBRARIES}" ) + else() + set_target_properties(Glog::glog PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_CONFIGURATIONS "None;Debug;Release;RelWithDebInfo;MinSizeRel" + MAP_IMPORTED_CONFIG_NOOPTWITHASM Debug + MAP_IMPORTED_CONFIG_COVERAGE Debug + MAP_IMPORTED_CONFIG_O2WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_O3WITHASM RelWithDebInfo + MAP_IMPORTED_CONFIG_ASAN Debug + IMPORTED_LOCATION_NONE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + if((CMAKE_GENERATOR STREQUAL Xcode) OR MSVC) + set_target_properties(Glog::glog PROPERTIES + IMPORTED_LOCATION_DEBUG ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}glogd${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELEASE ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/Release/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_RELWITHDEBINFO ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + IMPORTED_LOCATION_MINSIZEREL ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}glog${CMAKE_STATIC_LIBRARY_SUFFIX} + INTERFACE_LINK_LIBRARIES ${GNSSSDR_BINARY_DIR}/glog-${GNSSSDR_GLOG_LOCAL_VERSION}/$<$:Debug/>$<$:Release/>$<$:RelWithDebInfo/>$<$:MinSizeRel/>${CMAKE_FIND_LIBRARY_PREFIXES}glog$<$:d>${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + endif() endif() endif() - endif() - if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) - set_target_properties(Glog::glog PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT;GLOG_USE_GFLAGS" - INTERFACE_COMPILE_FEATURES "cxx_std_14") - endif() + if(NOT (CMAKE_VERSION VERSION_LESS "3.22")) + set_target_properties(Glog::glog PROPERTIES + INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT;GLOG_USE_GFLAGS" + INTERFACE_COMPILE_FEATURES "cxx_std_14") + endif() - if(LIBUNWIND_FOUND) - target_link_libraries(Glog::glog INTERFACE Libunwind::libunwind) - endif() - set(LOCAL_GLOG TRUE CACHE STRING "Glog downloaded, built, and statically linked automatically" FORCE) + if(LIBUNWIND_FOUND) + target_link_libraries(Glog::glog INTERFACE Libunwind::libunwind) + endif() + set(LOCAL_GLOG TRUE CACHE STRING "Glog downloaded, built, and statically linked automatically" FORCE) - set_package_properties(GLOG PROPERTIES - PURPOSE "Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." - ) -endif() - -if(NOT ENABLE_LOG) - message(STATUS "Internal logging is not enabled") - if(CMAKE_VERSION VERSION_GREATER 3.11.0) - target_compile_definitions(Glog::glog INTERFACE -DGOOGLE_STRIP_LOG=1) - else() - set_property(TARGET Glog::glog APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS GOOGLE_STRIP_LOG=1 + set_package_properties(GLOG PROPERTIES + PURPOSE "Glog v${GNSSSDR_GLOG_LOCAL_VERSION} will be downloaded, built, and statically linked when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'." ) endif() endif() @@ -2656,12 +2727,6 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI endif() else() if(CMAKE_VERSION VERSION_GREATER "3.13") - find_package(absl) - set_package_properties(absl PROPERTIES - URL "https://github.com/abseil/abseil-cpp" - PURPOSE "Abseil-cpp >= 20230117 required to be installed before building Protocol Buffers >22.x on the fly." - TYPE OPTIONAL - ) if(absl_FOUND) if(absl_VERSION) if(${absl_VERSION} VERSION_LESS "20230117") @@ -3481,8 +3546,10 @@ add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks add_feature_info(ENABLE_ARMA_NO_DEBUG ENABLE_ARMA_NO_DEBUG "Enables passing the ARMA_NO_DEBUG macro to Armadillo, hence disabling bound checking.") add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.") add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.") +add_feature_info(ENABLE_GLOG_AND_GFLAGS ENABLE_GLOG_AND_GFLAGS "Forces the usage of Google glog and Gflags instead of Abseil") +add_feature_info(ENABLE_OWN_ABSEIL ENABLE_OWN_ABSEIL "Forces downloading and building Abseil. Supersedes ENABLE_OWN_GLOG") add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.") -add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging with Google glog.") +add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging.") add_feature_info(ENABLE_ORC ENABLE_ORC "Use the Optimized Inner Loop Runtime Compiler (ORC) for building volk_gnsssdr.") add_feature_info(ENABLE_STRIP ENABLE_STRIP "Enables the generation of stripped binaries (without debugging symbols).") add_feature_info(ENABLE_UNIT_TESTING ENABLE_UNIT_TESTING "Enables building of Unit Tests.") diff --git a/README.md b/README.md index 0413da74a..357e06637 100644 --- a/README.md +++ b/README.md @@ -222,9 +222,9 @@ Once you have installed these packages, you can jump directly to If you are using Arch Linux: ``` -$ pacman -S gcc make cmake pkgconf git boost boost-libs log4cpp libvolk gnuradio \ - blas lapack gflags google-glog openssl pugixml libmatio protobuf \ - python-mako libpcap gtest +$ pacman -S gcc make cmake pkgconf git boost boost-libs libvolk gnuradio \ + blas lapack hdf5 openssl pugixml libmatio protobuf libpcap gtest \ + python-mako ``` Once you have installed these packages, you can jump directly to @@ -430,6 +430,10 @@ $ sudo make install $ sudo ldconfig ``` +Please note that GFlags is replaced by the +[Abseil Flags Library](https://abseil.io/docs/cpp/guides/flags) if Abseil >= +v20240116 is available in your system. + #### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging ``` @@ -443,6 +447,10 @@ $ sudo make install $ sudo ldconfig ``` +Please note that Glog is replaced by the +[Abseil Logging Library](https://abseil.io/docs/cpp/guides/logging) if Abseil >= +v20240116 is available in your system. + #### Install the GnuTLS or OpenSSL libraries ``` @@ -832,7 +840,7 @@ $ sudo port selfupdate $ sudo port upgrade outdated $ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml gnutls $ sudo port install gnuradio +uhd +grc +zeromq -$ sudo port install boost matio libad9361-iio libiio google-glog +gflags +$ sudo port install boost matio libad9361-iio libiio $ sudo port install py311-mako $ sudo port install doxygen +docs ``` @@ -871,8 +879,7 @@ Install the required dependencies: ``` $ brew update && brew upgrade -$ brew install armadillo cmake hdf5 gflags glog gnuradio libmatio log4cpp \ - openssl pkg-config protobuf pugixml +$ brew install armadillo cmake hdf5 gnuradio libmatio openssl pkg-config protobuf pugixml $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ¢ pip3 install mako diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3d797d433..473f7742b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -16,8 +16,37 @@ All notable changes to GNSS-SDR will be documented in this file. ### Improvements in Portability: -- Fix building against google-glog 0.7.0 +- Fix building against google-glog 0.7.0. - Find dependencies in the loongarch64 architecture. +- Soft transition from [GFlags](https://github.com/gflags/gflags) and + [Google Logging (glog)](https://github.com/google/glog) to Abseil + [Logging](https://abseil.io/docs/cpp/guides/logging) and + [Flags](https://abseil.io/docs/cpp/guides/flags) libraries. While gflags and + glog have dutifully served GNSS-SDR for over a decade, they are now showing + signs of aging. The latest version of gflags dates back six years now, with + its last commit in the master branch occurring two years ago. Glog remains + well maintained, with its latest version v0.7.0 released in February 2024, but + with no active development of new features and stuck at C++14. Abseil, on the + other hand, represents a contemporary evolution in software development, + supports C++17 and C++20, and has absorbed the functionalities of flags and + logging from its predecessors. Furthermore, as Abseil has become a + prerequisite for the latest versions of Protocol Buffers, its eventual + inclusion in GNSS-SDR's indirect dependencies is inevitable. Leveraging Abseil + allows for eliminating the need for gflags and glog, thereby reducing the + number of mandatory dependencies for GNSS-SDR in forthcoming GNU/Linux + distributions. For seamless integration, GNSS-SDR requires a quite recent + minimum version of Abseil, v20240116. If an older version is detected, the + library will not be utilized, and GNSS-SDR will fall back to using gflags and + glog, which still can be used and are fully supported. A new CMake + configuration option `-DENABLE_GLOG_AND_GFLAGS=ON` is available to force the + usage of glog and gflags instead of Abseil, even if a valid version of that + library is present. If the Abseil version installed in your system is too old + but you still want to try it, you can also force the downloading and building + of a recent version with the new CMake configuration flag + `-DENABLE_OWN_ABSEIL=ON` (requires CMake >= 3.24, otherwise it has no effect). + This change has a downside in maintainability, since the source code becomes + plagued with preprocessor directives required to maintain compatibility both + with gflags and glog, and with Abseil. ### Improvements in Usability: diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 658e493ac..415fb13d4 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -23,10 +23,16 @@ target_link_libraries(pvt_adapters pvt_gr_blocks PRIVATE gnss_sdr_flags - Glog::glog pvt_libs ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(pvt_adapters PRIVATE Glog::glog) + target_compile_definitions(pvt_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(pvt_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(pvt_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 93166877d..bdd1f97c6 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -26,8 +26,12 @@ #include "gps_ephemeris.h" // for Gps_Ephemeris #include "pvt_conf.h" // for Pvt_Conf #include "rtklib_rtkpos.h" // for rtkfree, rtkinit -#include // for LOG #include // for std::cout +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if USE_STD_COMMON_FACTOR #include namespace bc = std; @@ -88,6 +92,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // RINEX version pvt_output_parameters.rinex_version = configuration->property(role + ".rinex_version", 3); +#if USE_GLOG_AND_GFLAGS if (FLAGS_RINEX_version == "3.01" || FLAGS_RINEX_version == "3.02" || FLAGS_RINEX_version == "3") { pvt_output_parameters.rinex_version = 3; @@ -96,13 +101,29 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, { pvt_output_parameters.rinex_version = 2; } +#else + if (absl::GetFlag(FLAGS_RINEX_version) == "3.01" || absl::GetFlag(FLAGS_RINEX_version) == "3.02" || absl::GetFlag(FLAGS_RINEX_version) == "3") + { + pvt_output_parameters.rinex_version = 3; + } + else if (absl::GetFlag(FLAGS_RINEX_version) == "2.10" || absl::GetFlag(FLAGS_RINEX_version) == "2.11" || absl::GetFlag(FLAGS_RINEX_version) == "2") + { + pvt_output_parameters.rinex_version = 2; + } +#endif pvt_output_parameters.rinexobs_rate_ms = bc::lcm(configuration->property(role + ".rinexobs_rate_ms", 1000), pvt_output_parameters.output_rate_ms); pvt_output_parameters.rinex_name = configuration->property(role + ".rinex_name", std::string("-")); +#if USE_GLOG_AND_GFLAGS if (FLAGS_RINEX_name != "-") { pvt_output_parameters.rinex_name = FLAGS_RINEX_name; } - +#else + if (absl::GetFlag(FLAGS_RINEX_name) != "-") + { + pvt_output_parameters.rinex_name = absl::GetFlag(FLAGS_RINEX_name); + } +#endif // RTCM Printer settings pvt_output_parameters.flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false); pvt_output_parameters.rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname); diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index ae1b728bf..1964d1533 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -27,11 +27,16 @@ target_link_libraries(pvt_gr_blocks PRIVATE algorithms_libs pvt_libs - Gflags::gflags - Glog::glog Boost::serialization ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(pvt_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(pvt_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(pvt_gr_blocks PRIVATE absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(pvt_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 80b41440a..b2dfbfaa5 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -64,7 +64,6 @@ #include #include #include // for nvp, make_nvp -#include // for LOG #include // for io_signature #include // for mp #include // for sort, unique @@ -82,6 +81,12 @@ #include // for std::type_info, typeid #include // for pair +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 07e905a2c..69283a081 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -92,11 +92,18 @@ target_link_libraries(pvt_libs algorithms_libs_rtklib PRIVATE algorithms_libs - Gflags::gflags - Glog::glog + gnss_sdr_flags Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(pvt_libs PUBLIC Glog::glog) + + target_compile_definitions(pvt_libs PUBLIC -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(pvt_libs PUBLIC absl::log) +endif() + get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY) # for concurrent_queue.h diff --git a/src/algorithms/PVT/libs/an_packet_printer.cc b/src/algorithms/PVT/libs/an_packet_printer.cc index 6618d6982..22d31371b 100644 --- a/src/algorithms/PVT/libs/an_packet_printer.cc +++ b/src/algorithms/PVT/libs/an_packet_printer.cc @@ -20,7 +20,6 @@ #include "an_packet_printer.h" #include "rtklib_solver.h" // for Rtklib_Solver -#include // for DLOG #include // for M_PI #include // for memcpy #include // for fcntl @@ -29,6 +28,12 @@ #include // values for termios #include // for write(), read(), close() +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + An_Packet_Printer::An_Packet_Printer(const std::string& an_dump_devname) : d_start(std::chrono::system_clock::now()), diff --git a/src/algorithms/PVT/libs/geohash.cc b/src/algorithms/PVT/libs/geohash.cc index ecc1f6f3a..44a06adda 100644 --- a/src/algorithms/PVT/libs/geohash.cc +++ b/src/algorithms/PVT/libs/geohash.cc @@ -135,7 +135,7 @@ std::array Geohash::decode(std::string geohash) const std::array Geohash::bounds(std::string geohash) const { - if (geohash.length() == 0) + if (geohash.empty()) { throw std::runtime_error("Invalid geohash"); } diff --git a/src/algorithms/PVT/libs/geojson_printer.cc b/src/algorithms/PVT/libs/geojson_printer.cc index f57e9d582..62c53e82c 100644 --- a/src/algorithms/PVT/libs/geojson_printer.cc +++ b/src/algorithms/PVT/libs/geojson_printer.cc @@ -20,13 +20,18 @@ #include "gnss_sdr_filesystem.h" #include "pvt_solution.h" #include -#include #include // for tm #include // for exception #include // for operator<< #include // for cout, cerr #include // for stringstream +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GeoJSON_Printer::GeoJSON_Printer(const std::string& base_path) : geojson_base_path(base_path), first_pos(true) diff --git a/src/algorithms/PVT/libs/gpx_printer.cc b/src/algorithms/PVT/libs/gpx_printer.cc index 699f92db5..c2a16bee4 100644 --- a/src/algorithms/PVT/libs/gpx_printer.cc +++ b/src/algorithms/PVT/libs/gpx_printer.cc @@ -20,13 +20,17 @@ #include "gnss_sdr_filesystem.h" #include "pvt_solution.h" #include -#include #include // for tm #include // for exception #include // for operator<< #include // for cout, cerr #include // for stringstream +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Gpx_Printer::Gpx_Printer(const std::string& base_path) : indent(" "), gpx_base_path(base_path), diff --git a/src/algorithms/PVT/libs/has_simple_printer.cc b/src/algorithms/PVT/libs/has_simple_printer.cc index e29df9809..e05c55f1f 100644 --- a/src/algorithms/PVT/libs/has_simple_printer.cc +++ b/src/algorithms/PVT/libs/has_simple_printer.cc @@ -21,7 +21,6 @@ #include "galileo_has_data.h" #include "gnss_sdr_filesystem.h" #include -#include #include // for std::find, std::count #include // for std::bitset #include // for uint8_t, ... @@ -32,6 +31,12 @@ #include // for std::cout, std::cerr #include // for std::stringstream +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Has_Simple_Printer::Has_Simple_Printer(const std::string& base_path, const std::string& filename, diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index 72ea272d9..8a520aec3 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -20,7 +20,6 @@ #include "gnss_sdr_filesystem.h" #include "pvt_solution.h" #include -#include #include // for mkstemp #include // for tm #include // for exception @@ -30,6 +29,11 @@ #include // for S_IXUSR | S_IRWXG | S_IRWXO #include // for mode_t +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Kml_Printer::Kml_Printer(const std::string& base_path) : kml_base_path(base_path), indent(" "), diff --git a/src/algorithms/PVT/libs/nmea_printer.cc b/src/algorithms/PVT/libs/nmea_printer.cc index 20c876059..d41eb7146 100644 --- a/src/algorithms/PVT/libs/nmea_printer.cc +++ b/src/algorithms/PVT/libs/nmea_printer.cc @@ -23,7 +23,6 @@ #include "gnss_sdr_filesystem.h" #include "rtklib_solution.h" #include "rtklib_solver.h" -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_file, diff --git a/src/algorithms/PVT/libs/pvt_kf.cc b/src/algorithms/PVT/libs/pvt_kf.cc index 805a53a57..b75e5e17f 100644 --- a/src/algorithms/PVT/libs/pvt_kf.cc +++ b/src/algorithms/PVT/libs/pvt_kf.cc @@ -16,8 +16,12 @@ */ #include "pvt_kf.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif void Pvt_Kf::init_Kf(const arma::vec& p, const arma::vec& v, diff --git a/src/algorithms/PVT/libs/pvt_solution.cc b/src/algorithms/PVT/libs/pvt_solution.cc index c97a12d70..da14f8be4 100644 --- a/src/algorithms/PVT/libs/pvt_solution.cc +++ b/src/algorithms/PVT/libs/pvt_solution.cc @@ -17,10 +17,14 @@ #include "pvt_solution.h" #include "MATH_CONSTANTS.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif int Pvt_Solution::cart2geo(double X, double Y, double Z, int elipsoid_selection) { diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 6c2d322d5..0e4367ea2 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -42,7 +42,6 @@ #include #include #include -#include #include // for min and max #include #include // for floor @@ -55,6 +54,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Rinex_Printer::Rinex_Printer(int32_t conf_version, const std::string& base_path, diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index c7011eec3..e4d933863 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -29,7 +29,6 @@ #include "gps_ephemeris.h" #include #include -#include #include // for std::max, std::min, std::copy_n #include #include @@ -47,6 +46,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + /** \addtogroup PVT * \{ */ /** \addtogroup PVT_libs diff --git a/src/algorithms/PVT/libs/rtcm_printer.cc b/src/algorithms/PVT/libs/rtcm_printer.cc index cb07b9eea..f6e382259 100644 --- a/src/algorithms/PVT/libs/rtcm_printer.cc +++ b/src/algorithms/PVT/libs/rtcm_printer.cc @@ -30,7 +30,6 @@ #include "rtcm.h" #include "rtklib_solver.h" #include -#include #include // for tm #include // for exception #include // for O_RDWR @@ -39,6 +38,11 @@ #include // for close, write #include // for std::vector +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Rtcm_Printer::Rtcm_Printer(const std::string& filename, bool flag_rtcm_file_dump, diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index ef3e46647..35e4d3a9c 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -35,7 +35,6 @@ #include "gnss_sdr_filesystem.h" #include "rtklib_rtkpos.h" #include "rtklib_solution.h" -#include #include #include #include @@ -43,6 +42,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Rtklib_Solver::Rtklib_Solver(const rtk_t &rtk, const Pvt_Conf &conf, diff --git a/src/algorithms/acquisition/adapters/CMakeLists.txt b/src/algorithms/acquisition/adapters/CMakeLists.txt index 41cfe8a8a..85eb8672e 100644 --- a/src/algorithms/acquisition/adapters/CMakeLists.txt +++ b/src/algorithms/acquisition/adapters/CMakeLists.txt @@ -104,9 +104,15 @@ target_link_libraries(acquisition_adapters PRIVATE gnss_sdr_flags Boost::headers - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acquisition_adapters PRIVATE Glog::glog) + target_compile_definitions(acquisition_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(acquisition_adapters PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(acquisition_adapters PUBLIC -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc index 180a95795..2e293af43 100644 --- a/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b1i_pcps_acquisition.cc @@ -23,10 +23,15 @@ #include "beidou_b1i_signal_replica.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -52,10 +57,17 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc index a8204a24e..a5e41a125 100644 --- a/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/beidou_b3i_pcps_acquisition.cc @@ -21,9 +21,14 @@ #include "beidou_b3i_signal_replica.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -48,10 +53,17 @@ BeidouB3iPcpsAcquisition::BeidouB3iPcpsAcquisition( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 4ba572b17..903a3748c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -21,9 +21,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif if (sampled_ms_ % 4 != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc index f4097b600..cace01b94 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition.cc @@ -22,9 +22,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE1PcpsAmbiguousAcquisition::GalileoE1PcpsAmbiguousAcquisition( acq_parameters_.ms_per_code = 4; acq_parameters_.SetFromConfiguration(configuration_, role_, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_OPT_ACQ_FS_SPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 87e4c2d06..900e7ac91 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -21,7 +21,6 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include #include // for fft_complex #include // for gr_complex #include // for volk_32fc_conjugate_32fc @@ -30,6 +29,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -46,10 +51,17 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index c7af648aa..700644227 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -21,8 +21,12 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition( const ConfigurationInterface* configuration, @@ -50,10 +54,17 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif if (sampled_ms_ % 4 != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 2632418a7..cafbcf33b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -21,9 +21,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif /* --- Find number of samples per spreading code (4 ms) -----------------*/ code_length_ = static_cast(round( diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 59bd0e2a0..fca12dbfe 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -21,9 +21,14 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -71,10 +76,17 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( << sampled_ms_ << " ms will be used."; } +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index b51d12a73..5fcb2658c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -27,9 +27,14 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -67,10 +72,17 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif DLOG(INFO) << "role " << role_; if (sampled_ms_ > 3) diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc index 3d9eee1fa..c18aa48c2 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition.cc @@ -21,10 +21,15 @@ #include "configuration_interface.h" #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE5aPcpsAcquisition::GalileoE5aPcpsAcquisition( acq_parameters_.ms_per_code = 1; acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_OPT_ACQ_FS_SPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index f3c041952..98e8bcf3c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -21,7 +21,6 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include @@ -29,6 +28,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -45,10 +50,17 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc index 5f8af8baf..11ecebcdd 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition.cc @@ -22,10 +22,15 @@ #include "configuration_interface.h" #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE5bPcpsAcquisition::GalileoE5bPcpsAcquisition(const ConfigurationInterfac acq_parameters_.ms_per_code = 1; acq_parameters_.SetFromConfiguration(configuration, role_, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_OPT_ACQ_FS_SPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index 83996b5c8..f7a303f2d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -22,13 +22,18 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include // for copy_n #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, @@ -44,10 +49,17 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration acq_iq_(configuration->property(role + ".acquire_iq", false)) { acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc index eda68fb66..dd76d0d98 100644 --- a/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e6_pcps_acquisition.cc @@ -21,9 +21,14 @@ #include "configuration_interface.h" #include "galileo_e6_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GalileoE6PcpsAcquisition::GalileoE6PcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc index c63eb5ec7..628c96d25 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.cc @@ -23,9 +23,14 @@ #include "configuration_interface.h" #include "glonass_l1_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +56,17 @@ GlonassL1CaPcpsAcquisition::GlonassL1CaPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc index 180f50747..46b6790a4 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.cc @@ -22,9 +22,14 @@ #include "configuration_interface.h" #include "glonass_l2_signal_replica.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -50,10 +55,17 @@ GlonassL2CaPcpsAcquisition::GlonassL2CaPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc index 72994eebc..6992b7260 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition.cc @@ -25,9 +25,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -54,10 +59,17 @@ GpsL1CaPcpsAcquisition::GpsL1CaPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index ffe4ca5d2..f119a60c4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -24,8 +24,12 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( const ConfigurationInterface* configuration, @@ -57,10 +61,17 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( acq_parameters.dump = dump_; dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); acq_parameters.dump_filename = dump_filename_; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif acq_parameters.doppler_max = doppler_max_; acq_parameters.sampled_ms = sampled_ms_; acq_parameters.max_dwells = max_dwells_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index cc2713d24..0242062b0 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -24,13 +24,18 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include // for copy_n #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -47,10 +52,17 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 98fb0b9c6..0bd82c2dc 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -23,8 +23,12 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( const ConfigurationInterface* configuration, @@ -51,10 +55,17 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_min_ = configuration->property(role_ + ".doppler_min", -doppler_max_); bool enable_monitor_output = configuration->property("AcquisitionMonitor.enable_monitor", false); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc index 05d26212c..e0352f9b2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.cc @@ -21,9 +21,14 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GpsL1CaPcpsOpenClAcquisition::GpsL1CaPcpsOpenClAcquisition( fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_ = configuration->property(role + ".dump", false); doppler_max_ = configuration->property(role + ".doppler_max", 5000); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif sampled_ms_ = configuration->property(role + ".coherent_integration_time_ms", 1); bit_transition_flag_ = configuration->property("Acquisition.bit_transition_flag", false); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index db6451541..9fd146be2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -22,9 +22,14 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -58,10 +63,17 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif // -- Find number of samples per spreading code ------------------------- code_length_ = static_cast(round(fs_in_ / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index 7dca40c3a..63efcab00 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -21,9 +21,14 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -63,10 +68,17 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { doppler_max_ = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + doppler_max_ = absl::GetFlag(FLAGS_doppler_max); + } +#endif bool enable_monitor_output = configuration_->property("AcquisitionMonitor.enable_monitor", false); // -- Find number of samples per spreading code ------------------------- diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc index f2e491690..0b61172b1 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition.cc @@ -23,9 +23,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_l2c_signal_replica.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -52,10 +57,17 @@ GpsL2MPcpsAcquisition::GpsL2MPcpsAcquisition( DLOG(INFO) << "Role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); item_type_ = acq_parameters_.item_type; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index ecce4df4c..e78b1b174 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -23,7 +23,6 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_l2c_signal_replica.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include @@ -31,6 +30,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -47,10 +52,17 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc index 35b889994..b901c2db3 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition.cc @@ -23,8 +23,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" -#include #include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_STD_SPAN #include namespace own = std; @@ -51,10 +57,17 @@ GpsL5iPcpsAcquisition::GpsL5iPcpsAcquisition( DLOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index a96bf531d..0e379d034 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -24,7 +24,6 @@ #include "gnss_sdr_fft.h" #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" -#include #include // for gr_complex #include // for volk_32fc_conjugate_32fc #include @@ -32,6 +31,12 @@ #include // for abs, pow, floor #include // for complex +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( const ConfigurationInterface* configuration, const std::string& role, @@ -48,10 +53,17 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( LOG(INFO) << "role " << role; +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { acq_parameters_.doppler_max = FLAGS_doppler_max; } +#else + if (absl::GetFlag(FLAGS_doppler_max) != 0) + { + acq_parameters_.doppler_max = absl::GetFlag(FLAGS_doppler_max); + } +#endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); fs_in_ = acq_parameters_.fs_in; diff --git a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt index fdeb3981e..de689f5b3 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/acquisition/gnuradio_blocks/CMakeLists.txt @@ -65,11 +65,16 @@ target_link_libraries(acquisition_gr_blocks Volk::volk Volkgnsssdr::volkgnsssdr PRIVATE - Gflags::gflags - Glog::glog Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acquisition_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(acquisition_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(acquisition_gr_blocks PRIVATE absl::flags absl::log) +endif() + target_include_directories(acquisition_gr_blocks PRIVATE ${GNSSSDR_SOURCE_DIR}/src/core/receiver 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 7851aff79..ed095a757 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 @@ -23,7 +23,6 @@ #include "galileo_e5a_noncoherent_iq_acquisition_caf_cc.h" #include "MATH_CONSTANTS.h" -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + galileo_e5a_noncoherentIQ_acquisition_caf_cc_sptr galileo_e5a_noncoherentIQ_make_acquisition_caf_cc( unsigned int sampled_ms, 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 7dad27c45..8bc915769 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 @@ -17,7 +17,6 @@ #include "galileo_pcps_8ms_acquisition_cc.h" #include "MATH_CONSTANTS.h" -#include #include #include #include @@ -26,6 +25,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif galileo_pcps_8ms_acquisition_cc_sptr galileo_pcps_8ms_make_acquisition_cc( uint32_t sampled_ms, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 5aa106bf3..5249cd115 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -39,6 +39,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_acquisition_sptr pcps_make_acquisition(const Acq_Conf& conf_) { @@ -896,6 +902,18 @@ void pcps_acquisition::calculate_threshold() } +void pcps_acquisition::set_doppler_center(int32_t doppler_center) +{ + gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler + if (doppler_center != d_doppler_center) + { + DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; + d_doppler_center = doppler_center; + update_grid_doppler_wipeoffs(); + } +} + + int pcps_acquisition::general_work(int noutput_items __attribute__((unused)), gr_vector_int& ninput_items, gr_vector_const_void_star& input_items, diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h index 74fb8c114..673267f75 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.h @@ -46,7 +46,6 @@ #include "channel_fsm.h" #include "gnss_sdr_fft.h" #include -#include #include #include // for gr_complex #include // for scoped_lock @@ -60,6 +59,7 @@ #include #include + #if HAS_STD_SPAN #include namespace own = std; @@ -196,16 +196,7 @@ public: * \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid. * \param doppler_center - Frequency center of the search grid [Hz]. */ - inline void set_doppler_center(int32_t doppler_center) - { - gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler - if (doppler_center != d_doppler_center) - { - DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; - d_doppler_center = doppler_center; - update_grid_doppler_wipeoffs(); - } - } + void set_doppler_center(int32_t doppler_center); /*! * \brief Parallel Code Phase Search Acquisition signal processing. 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 28624f346..e51f9711b 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 @@ -21,7 +21,6 @@ #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" #include "gps_sdr_signal_replica.h" -#include #include #include #include @@ -30,6 +29,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_acquisition_fine_doppler_cc_sptr pcps_make_acquisition_fine_doppler_cc(const Acq_Conf &conf_) { diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index 0414a2d79..eff195cb1 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -21,12 +21,17 @@ #include "pcps_acquisition_fpga.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" -#include #include // for ceil #include // for operator<< #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_) { return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); @@ -288,6 +293,16 @@ void pcps_acquisition_fpga::set_active(bool active) } +void pcps_acquisition_fpga::set_doppler_center(int32_t doppler_center) +{ + if (doppler_center != d_doppler_center) + { + DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; + d_doppler_center = doppler_center; + } +} + + void pcps_acquisition_fpga::reset_acquisition() { // this function triggers a HW reset of the FPGA PL. diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index 92ec51781..ded4ba660 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -29,7 +29,6 @@ #include "acq_conf_fpga.h" #include "channel_fsm.h" #include "fpga_acquisition.h" -#include #include // for uint32_t #include // for shared_ptr #include // for string @@ -156,14 +155,7 @@ public: * \brief Set Doppler center frequency for the grid search. It will refresh the Doppler grid. * \param doppler_center - Frequency center of the search grid [Hz]. */ - inline void set_doppler_center(int32_t doppler_center) - { - if (doppler_center != d_doppler_center) - { - DLOG(INFO) << " Doppler assistance for Channel: " << d_channel << " => Doppler: " << doppler_center << "[Hz]"; - d_doppler_center = doppler_center; - } - } + void set_doppler_center(int32_t doppler_center); /*! * \brief This function triggers a HW reset of the FPGA PL. 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 3d919f87f..34eb3d189 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -20,7 +20,6 @@ #include "MATH_CONSTANTS.h" #include "concurrent_map.h" #include "gps_acq_assist.h" -#include #include #include #include @@ -30,6 +29,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif extern Concurrent_Map global_gps_acq_assist_map; 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 e16d184a3..ed4ed9ddb 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -22,7 +22,6 @@ #include "pcps_cccwsr_acquisition_cc.h" #include "MATH_CONSTANTS.h" // TWO_PI -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_cccwsr_acquisition_cc_sptr pcps_cccwsr_make_acquisition_cc( uint32_t sampled_ms, 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 2f0e3662a..5f2fa348c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -38,7 +38,6 @@ #include "MATH_CONSTANTS.h" // TWO_PI #include "opencl/fft_base_kernels.h" #include "opencl/fft_internal.h" -#include #include #include #include @@ -50,6 +49,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc( uint32_t sampled_ms, uint32_t max_dwells, 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 39bac577c..fdd6d918a 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -16,7 +16,6 @@ #include "pcps_quicksync_acquisition_cc.h" #include "MATH_CONSTANTS.h" -#include #include #include #include @@ -25,6 +24,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_quicksync_acquisition_cc_sptr pcps_quicksync_make_acquisition_cc( uint32_t folding_factor, 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 f072dcd6a..42c131337 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -36,7 +36,6 @@ #include "pcps_tong_acquisition_cc.h" #include "MATH_CONSTANTS.h" // for TWO_PI -#include #include #include #include @@ -45,6 +44,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + pcps_tong_acquisition_cc_sptr pcps_tong_make_acquisition_cc( uint32_t sampled_ms, diff --git a/src/algorithms/acquisition/libs/CMakeLists.txt b/src/algorithms/acquisition/libs/CMakeLists.txt index 65437c649..a2eb01230 100644 --- a/src/algorithms/acquisition/libs/CMakeLists.txt +++ b/src/algorithms/acquisition/libs/CMakeLists.txt @@ -38,12 +38,17 @@ target_link_libraries(acquisition_libs INTERFACE Gnuradio::runtime PRIVATE - Gflags::gflags - Glog::glog algorithms_libs core_system_parameters ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acquisition_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(acquisition_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(acquisition_libs PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(acquisition_libs diff --git a/src/algorithms/acquisition/libs/acq_conf.cc b/src/algorithms/acquisition/libs/acq_conf.cc index 715b07f62..e0ad5d490 100644 --- a/src/algorithms/acquisition/libs/acq_conf.cc +++ b/src/algorithms/acquisition/libs/acq_conf.cc @@ -17,9 +17,14 @@ #include "acq_conf.h" #include "item_type_helpers.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + void Acq_Conf::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, double chip_rate, double opt_freq) diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc index 838ab3ae6..00e47b153 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.cc +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -18,11 +18,16 @@ #include "acq_conf_fpga.h" #include "item_type_helpers.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, uint32_t sel_queue_fpga, uint32_t blk_exp, uint32_t downsampling_factor_default, double chip_rate, double code_length_chips) { diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index 667533c08..def42d9d8 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -21,7 +21,6 @@ #include "fpga_acquisition.h" #include "MATH_CONSTANTS.h" // for TWO_PI -#include // for LOG #include // for log2 #include // libraries used by the GIPO #include // for operator<< @@ -29,6 +28,11 @@ #include // for write, close, read, ssize_t #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(exp) \ diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index 7d9ddcf83..4d1fda6ba 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -26,9 +26,15 @@ target_link_libraries(channel_adapters channel_libs PRIVATE gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(channel_adapters PRIVATE Glog::glog) + target_compile_definitions(channel_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(channel_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(channel_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index 444eef958..f69743398 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -22,10 +22,14 @@ #include "gnss_sdr_flags.h" #include "telemetry_decoder_interface.h" #include "tracking_interface.h" -#include #include // for std::invalid_argument #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Channel::Channel(const ConfigurationInterface* configuration, uint32_t channel, @@ -77,10 +81,17 @@ Channel::Channel(const ConfigurationInterface* configuration, { doppler_step = configuration->property("Acquisition_" + signal_str + ".doppler_step", 500); } +#if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_step != 0) { doppler_step = static_cast(FLAGS_doppler_step); } +#else + if (absl::GetFlag(FLAGS_doppler_step) != 0) + { + doppler_step = static_cast(absl::GetFlag(FLAGS_doppler_step)); + } +#endif DLOG(INFO) << "Channel " << channel_ << " Doppler_step = " << doppler_step; acq_->set_doppler_step(doppler_step); diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 63e0d72d8..dc5715abb 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -39,10 +39,15 @@ target_link_libraries(channel_libs PRIVATE core_libs Boost::headers - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(channel_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(channel_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(channel_libs PRIVATE absl::flags absl::log) +endif() + target_include_directories(channel_libs PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/channel/libs/channel_fsm.cc b/src/algorithms/channel/libs/channel_fsm.cc index 48f001238..c092c77a8 100644 --- a/src/algorithms/channel/libs/channel_fsm.cc +++ b/src/algorithms/channel/libs/channel_fsm.cc @@ -18,9 +18,14 @@ #include "channel_fsm.h" #include "channel_event.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + ChannelFsm::ChannelFsm() : queue_(nullptr), channel_(0U), diff --git a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc index 4d2e5616b..3a9607b5a 100644 --- a/src/algorithms/channel/libs/channel_msg_receiver_cc.cc +++ b/src/algorithms/channel/libs/channel_msg_receiver_cc.cc @@ -17,12 +17,17 @@ #include "channel_msg_receiver_cc.h" -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if PMT_USES_BOOST_ANY #include namespace wht = boost; diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index 7c24d008e..59432f3e9 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -37,11 +37,15 @@ endif() target_link_libraries(conditioner_adapters PUBLIC Gnuradio::runtime - PRIVATE - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(conditioner_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(conditioner_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(conditioner_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(conditioner_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/conditioner/adapters/array_signal_conditioner.cc b/src/algorithms/conditioner/adapters/array_signal_conditioner.cc index 02471e8a5..85256ee13 100644 --- a/src/algorithms/conditioner/adapters/array_signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/array_signal_conditioner.cc @@ -17,9 +17,13 @@ #include "array_signal_conditioner.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif // Constructor ArraySignalConditioner::ArraySignalConditioner(std::shared_ptr data_type_adapt, diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.cc b/src/algorithms/conditioner/adapters/signal_conditioner.cc index 871ed0a51..421871708 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/signal_conditioner.cc @@ -16,10 +16,14 @@ */ #include "signal_conditioner.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif // Constructor SignalConditioner::SignalConditioner(std::shared_ptr data_type_adapt, diff --git a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt index f3829b5ab..253624190 100644 --- a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt @@ -53,11 +53,16 @@ target_link_libraries(data_type_adapters Gnuradio::blocks data_type_gr_blocks PRIVATE - Gflags::gflags - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(data_type_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(data_type_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(data_type_adapters PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(data_type_adapters diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index 43e9d119b..afb062772 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -16,9 +16,14 @@ #include "byte_to_short.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + ByteToShort::ByteToShort(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index dc825015d..835ec2021 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -17,9 +17,14 @@ #include "ibyte_to_cbyte.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index 13be7798c..a79458e5b 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -16,7 +16,12 @@ #include "ibyte_to_complex.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index a146ef474..2420bcd0f 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -17,9 +17,13 @@ #include "ibyte_to_cshort.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 0e67db072..18d8df571 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -16,8 +16,12 @@ #include "ishort_to_complex.h" #include "configuration_interface.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index b51232869..80e1c680a 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -17,9 +17,13 @@ #include "ishort_to_cshort.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/CMakeLists.txt b/src/algorithms/input_filter/adapters/CMakeLists.txt index a4f052ade..6af64cff8 100644 --- a/src/algorithms/input_filter/adapters/CMakeLists.txt +++ b/src/algorithms/input_filter/adapters/CMakeLists.txt @@ -47,11 +47,16 @@ target_link_libraries(input_filter_adapters algorithms_libs input_filter_gr_blocks PRIVATE - Gflags::gflags - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(input_filter_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(input_filter_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(input_filter_adapters PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_IS_38_OR_GREATER) target_compile_definitions(input_filter_adapters PUBLIC -DGR_GREATER_38=1) endif() diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index 4a96bf85b..daa8b1ec5 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -17,9 +17,13 @@ #include "beamformer_filter.h" #include "beamformer.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif BeamformerFilter::BeamformerFilter( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index ad76b5f6a..12cef24ca 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -17,11 +17,15 @@ #include "fir_filter.h" #include "configuration_interface.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif FirFilter::FirFilter(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index 1d4e2f386..1378931c8 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -17,13 +17,17 @@ #include "freq_xlating_fir_filter.h" #include "configuration_interface.h" -#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index 1ca31c5f3..8e8b93392 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -19,8 +19,12 @@ #include "configuration_interface.h" #include "notch_cc.h" #include -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif NotchFilter::NotchFilter(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 8dc161688..42afd1713 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -19,9 +19,13 @@ #include "configuration_interface.h" #include "notch_lite_cc.h" #include -#include #include // for max +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index b28c13d47..8971d2c9d 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -19,12 +19,16 @@ #include "pulse_blanking_filter.h" #include "configuration_interface.h" #include -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configuration, std::string role, diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index 1e31cf4c3..3f0b050a6 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -109,10 +109,15 @@ target_link_libraries(algorithms_libs core_system_parameters Volk::volk Volkgnsssdr::volkgnsssdr - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(algorithms_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(algorithms_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(algorithms_libs PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(algorithms_libs PUBLIC -DGNURADIO_USES_STD_POINTERS=1 @@ -208,13 +213,14 @@ else() target_link_libraries(gnss_sdr_flags PRIVATE Boost::filesystem Boost::system) endif() -target_link_libraries(gnss_sdr_flags - PUBLIC - Gflags::gflags -) - -if(GFLAGS_GREATER_20 OR ${LOCAL_GFLAGS}) - target_compile_definitions(gnss_sdr_flags PRIVATE -DGFLAGS_GREATER_2_0=1) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss_sdr_flags PUBLIC Gflags::gflags) + target_compile_definitions(gnss_sdr_flags PUBLIC -DUSE_GLOG_AND_GFLAGS=1) + if(GFLAGS_GREATER_20 OR "${LOCAL_GFLAGS}") + target_compile_definitions(gnss_sdr_flags PRIVATE -DGFLAGS_GREATER_2_0=1) + endif() +else() + target_link_libraries(gnss_sdr_flags PUBLIC absl::flags) endif() target_compile_definitions(gnss_sdr_flags diff --git a/src/algorithms/libs/gnss_sdr_flags.cc b/src/algorithms/libs/gnss_sdr_flags.cc index 4961c01aa..26ae20da6 100644 --- a/src/algorithms/libs/gnss_sdr_flags.cc +++ b/src/algorithms/libs/gnss_sdr_flags.cc @@ -1,7 +1,7 @@ /*! * \file gnss_sdr_flags.cc * \brief Helper file for gnss-sdr commandline flags - * \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es + * \author Carles Fernandez-Prades, 2018-2024. cfernandez(at)cttc.es * * * ----------------------------------------------------------------------------- @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -19,9 +19,8 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_filesystem.h" #include -#include - +#if USE_GLOG_AND_GFLAGS DEFINE_string(c, "-", "Path to the configuration file (if set, overrides --config_file)."); DEFINE_string(config_file, std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"), @@ -235,3 +234,26 @@ DEFINE_validator(pll_bw_hz, &ValidatePllBw); DEFINE_validator(carrier_smoothing_factor, &ValidateCarrierSmoothingFactor); #endif + +#else +ABSL_FLAG(std::string, c, "-", "Path to the configuration file (if set, overrides --config_file)."); +ABSL_FLAG(std::string, config_file, std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"), "Path to the configuration file."); +ABSL_FLAG(std::string, log_dir, "", "Directory for log files"); +ABSL_FLAG(std::string, s, "-", "If defined, path to the file containing the signal samples (overrides the configuration file and --signal_source)."); +ABSL_FLAG(std::string, signal_source, "-", "If defined, path to the file containing the signal samples (overrides the configuration file)."); +ABSL_FLAG(std::string, timestamp_source, "-", "If defined, path to the file containing the signal timestamp data (overrides the configuration file)."); +ABSL_FLAG(bool, rf_shutdown, true, "If set to false, AD9361 RF channels are not shut down when exiting the program. Useful to leave the AD9361 configured and running."); +ABSL_FLAG(int32_t, doppler_max, 0, "If defined, sets the maximum Doppler value in the search grid, in Hz (overrides the configuration file)."); +ABSL_FLAG(int32_t, doppler_step, 0, "If defined, sets the frequency step in the search grid, in Hz (overrides the configuration file)."); +ABSL_FLAG(int32_t, cn0_samples, 20, "Number of correlator outputs used for CN0 estimation."); +ABSL_FLAG(int32_t, cn0_min, 25, "Minimum valid CN0 (in dB-Hz)."); +ABSL_FLAG(int32_t, max_carrier_lock_fail, 5000, "Maximum number of carrier lock failures before dropping a satellite."); +ABSL_FLAG(int32_t, max_lock_fail, 50, "Maximum number of code lock failures before dropping a satellite."); +ABSL_FLAG(double, carrier_lock_th, 0.7, "Carrier lock threshold (in rad)."); +ABSL_FLAG(double, dll_bw_hz, 0.0, "If defined, bandwidth of the DLL low pass filter, in Hz (overrides the configuration file)."); +ABSL_FLAG(double, pll_bw_hz, 0.0, "If defined, bandwidth of the PLL low pass filter, in Hz (overrides the configuration file)."); +ABSL_FLAG(int32_t, carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, "Sets carrier smoothing factor M (overrides the configuration file)"); +ABSL_FLAG(std::string, RINEX_version, "-", "If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file."); +ABSL_FLAG(std::string, RINEX_name, "-", "If defined, specifies the RINEX files base name"); +ABSL_FLAG(bool, keyboard, true, "If set to false, it disables the keyboard listener (so the receiver cannot be stopped with q+[Enter])"); +#endif diff --git a/src/algorithms/libs/gnss_sdr_flags.h b/src/algorithms/libs/gnss_sdr_flags.h index 361195a49..3dd02fd3d 100644 --- a/src/algorithms/libs/gnss_sdr_flags.h +++ b/src/algorithms/libs/gnss_sdr_flags.h @@ -1,7 +1,7 @@ /*! * \file gnss_sdr_flags.h * \brief Helper file for gnss-sdr commandline flags - * \author Carles Fernandez-Prades, 2018. cfernandez(at)cttc.es + * \author Carles Fernandez-Prades, 2018-2024. cfernandez(at)cttc.es * * * ----------------------------------------------------------------------------- @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -18,9 +18,20 @@ #ifndef GNSS_SDR_GNSS_SDR_FLAGS_H #define GNSS_SDR_GNSS_SDR_FLAGS_H - -#include #include +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#include +#include +#include +#include +#endif + /** \addtogroup Algorithms_Library * \{ */ @@ -28,7 +39,7 @@ * Library for command-line handling. * \{ */ - +#if USE_GLOG_AND_GFLAGS DECLARE_string(c); //!< Path to the configuration file. DECLARE_string(config_file); //!< Path to the configuration file. @@ -62,6 +73,113 @@ DECLARE_string(RINEX_version); //!< If defined, specifies the RINEX version (2. DECLARE_string(RINEX_name); //!< If defined, specifies the RINEX files base name DECLARE_bool(keyboard); //!< If set to false, disables the keyboard listener. Only for debug purposes (e.g. ASAN mode termination) +#else +ABSL_DECLARE_FLAG(std::string, c); //!< Path to the configuration file. +ABSL_DECLARE_FLAG(std::string, config_file); //!< Path to the configuration file. + +ABSL_DECLARE_FLAG(std::string, log_dir); //!< Path to the folder in which logging will be stored. + +// Declare flags for signal sources +ABSL_DECLARE_FLAG(std::string, s); //!< Path to the file containing the signal samples. +ABSL_DECLARE_FLAG(std::string, signal_source); //!< Path to the file containing the signal samples. +ABSL_DECLARE_FLAG(std::string, timestamp_source); //!< Path to the file containing the signal samples. +ABSL_DECLARE_FLAG(bool, rf_shutdown); //!< Shutdown RF when program exits. + +// Declare flags for acquisition blocks +ABSL_DECLARE_FLAG(int32_t, doppler_max); //!< If defined, maximum Doppler value in the search grid, in Hz (overrides the configuration file). +ABSL_DECLARE_FLAG(int32_t, doppler_step); //!< If defined, sets the frequency step in the search grid, in Hz, in Hz (overrides the configuration file). + +// Declare flags for tracking blocks +ABSL_DECLARE_FLAG(int32_t, cn0_samples); //!< Number of correlator outputs used for CN0 estimation. +ABSL_DECLARE_FLAG(int32_t, cn0_min); //!< Minimum valid CN0 (in dB-Hz). +ABSL_DECLARE_FLAG(int32_t, max_lock_fail); //!< Maximum number of code lock failures before dropping a satellite. +ABSL_DECLARE_FLAG(int32_t, max_carrier_lock_fail); //!< Maximum number of carrier lock failures before dropping a satellite. +ABSL_DECLARE_FLAG(double, carrier_lock_th); //!< Carrier lock threshold (in rad). +ABSL_DECLARE_FLAG(double, dll_bw_hz); //!< Bandwidth of the DLL low pass filter, in Hz (overrides the configuration file). +ABSL_DECLARE_FLAG(double, pll_bw_hz); //!< Bandwidth of the PLL low pass filter, in Hz (overrides the configuration file). + +// Declare flags for observables block +ABSL_DECLARE_FLAG(int32_t, carrier_smoothing_factor); //!< Sets carrier smoothing factor M (overrides the configuration file). +const int32_t DEFAULT_CARRIER_SMOOTHING_FACTOR = 200; + +// Declare flags for PVT +ABSL_DECLARE_FLAG(std::string, RINEX_version); //!< If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file. +ABSL_DECLARE_FLAG(std::string, RINEX_name); //!< If defined, specifies the RINEX files base name +ABSL_DECLARE_FLAG(bool, keyboard); //!< If set to false, disables the keyboard listener. Only for debug purposes (e.g. ASAN mode termination) + +static inline void GetTempDirectories(std::vector& list) +{ + list.clear(); + // Directories, in order of preference. If we find a dir that + // exists, we stop adding other less-preferred dirs + const char* candidates[] = { + // Non-null only during unittest/regtest + std::getenv("TEST_TMPDIR"), + + // Explicitly-supplied temp dirs + std::getenv("TMPDIR"), + std::getenv("TMP"), + + // If all else fails + "/tmp", + }; + for (auto d : candidates) + { + if (!d) continue; // Empty env var + + // Make sure we don't surprise anyone who's expecting a '/' + std::string dstr = d; + if (dstr[dstr.size() - 1] != '/') + { + dstr += "/"; + } + list.push_back(dstr); + + struct stat statbuf; + if (!stat(d, &statbuf) && S_ISDIR(statbuf.st_mode)) + { + // We found a dir that exists - we're done. + return; + } + } +} + + +static inline void GetExistingTempDirectories(std::vector& list) +{ + GetTempDirectories(list); + auto i_dir = list.begin(); + while (i_dir != list.end()) + { + if (access(i_dir->c_str(), 0)) + { + i_dir = list.erase(i_dir); + } + else + { + ++i_dir; + } + }; +} + + +static inline std::string GetTempDir() +{ + std::vector temp_directories_list; + GetExistingTempDirectories(temp_directories_list); + + if (temp_directories_list.empty()) + { + std::cerr << "No temporary directory found\n"; + exit(EXIT_FAILURE); + } + + // Use first directory from list of existing temporary directories. + return temp_directories_list.front(); +} +#endif + + /** \} */ /** \} */ #endif // GNSS_SDR_GNSS_SDR_FLAGS_H diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index bc54ae61a..714b5cd27 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -18,12 +18,16 @@ #include "pass_through.h" #include "configuration_interface.h" -#include #include #include #include // for int8_t #include // for operator<< +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Pass_Through::Pass_Through(const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/libs/rtklib/CMakeLists.txt b/src/algorithms/libs/rtklib/CMakeLists.txt index c23d55119..e308f102c 100644 --- a/src/algorithms/libs/rtklib/CMakeLists.txt +++ b/src/algorithms/libs/rtklib/CMakeLists.txt @@ -70,12 +70,17 @@ target_link_libraries(algorithms_libs_rtklib core_system_parameters algorithms_libs Armadillo::armadillo - Gflags::gflags - Glog::glog LAPACK::LAPACK BLAS::BLAS ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(algorithms_libs_rtklib PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(algorithms_libs_rtklib PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(algorithms_libs_rtklib PRIVATE absl::flags absl::log) +endif() + if(ENABLE_ARMA_NO_DEBUG) target_compile_definitions(algorithms_libs_rtklib PRIVATE -DARMA_NO_BOUND_CHECKING=1 diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 12e3fed4d..736928e51 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -30,7 +30,6 @@ *----------------------------------------------------------------------------*/ #include "rtklib_rtkcmn.h" -#include #include #include #include @@ -43,6 +42,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + const double GPST0[] = {1980, 1, 6, 0, 0, 0}; /* gps time reference */ const double GST0[] = {1999, 8, 22, 0, 0, 0}; /* galileo system time reference */ const double BDT0[] = {2006, 1, 1, 0, 0, 0}; /* beidou time reference */ diff --git a/src/algorithms/observables/adapters/CMakeLists.txt b/src/algorithms/observables/adapters/CMakeLists.txt index a4097a4dd..8417c1532 100644 --- a/src/algorithms/observables/adapters/CMakeLists.txt +++ b/src/algorithms/observables/adapters/CMakeLists.txt @@ -29,9 +29,15 @@ target_link_libraries(obs_adapters core_system_parameters PRIVATE gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(obs_adapters PRIVATE Glog::glog) + target_compile_definitions(obs_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(obs_adapters PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(obs_adapters diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index fbb6ba2a3..7a434f5df 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -19,9 +19,14 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "obs_conf.h" -#include #include // for operator<< +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + HybridObservables::HybridObservables(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, @@ -45,7 +50,11 @@ HybridObservables::HybridObservables(const ConfigurationInterface* configuration conf.always_output_gs = configuration->property("PVT.an_output_enabled", conf.always_output_gs) || configuration->property(role + ".always_output_gs", conf.always_output_gs); conf.enable_E6 = configuration->property("PVT.use_e6_for_pvt", conf.enable_E6); +#if USE_GLOG_AND_GFLAGS if (FLAGS_carrier_smoothing_factor == DEFAULT_CARRIER_SMOOTHING_FACTOR) +#else + if (absl::GetFlag(FLAGS_carrier_smoothing_factor) == DEFAULT_CARRIER_SMOOTHING_FACTOR) +#endif { conf.smoothing_factor = configuration->property(role + ".smoothing_factor", conf.smoothing_factor); } diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 225518612..a8964f90c 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -31,12 +31,17 @@ target_link_libraries(obs_gr_blocks PRIVATE algorithms_libs core_system_parameters - Gflags::gflags - Glog::glog Matio::matio Gnuradio::pmt ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(obs_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(obs_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(obs_gr_blocks PRIVATE absl::flags absl::log) +endif() + target_include_directories(obs_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index a9bc19407..48a1b1c14 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -23,7 +23,6 @@ #include "gnss_sdr_filesystem.h" #include "gnss_sdr_make_unique.h" #include "gnss_synchro.h" -#include #include #include #include @@ -36,6 +35,12 @@ #include // for numeric_limits #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if PMT_USES_BOOST_ANY #include namespace wht = boost; diff --git a/src/algorithms/observables/libs/obs_conf.cc b/src/algorithms/observables/libs/obs_conf.cc index 9c11be794..f89ae1be7 100644 --- a/src/algorithms/observables/libs/obs_conf.cc +++ b/src/algorithms/observables/libs/obs_conf.cc @@ -18,6 +18,12 @@ #include "obs_conf.h" #include "gnss_sdr_flags.h" +#if USE_GLOG_AND_GFLAGS Obs_Conf::Obs_Conf() : smoothing_factor(FLAGS_carrier_smoothing_factor) { } +#else +Obs_Conf::Obs_Conf() : smoothing_factor(absl::GetFlag(FLAGS_carrier_smoothing_factor)) +{ +} +#endif \ No newline at end of file diff --git a/src/algorithms/resampler/adapters/CMakeLists.txt b/src/algorithms/resampler/adapters/CMakeLists.txt index ac4eca082..0cda783f8 100644 --- a/src/algorithms/resampler/adapters/CMakeLists.txt +++ b/src/algorithms/resampler/adapters/CMakeLists.txt @@ -38,11 +38,16 @@ target_link_libraries(resampler_adapters PUBLIC resampler_gr_blocks PRIVATE - Gflags::gflags - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(resampler_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(resampler_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(resampler_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(resampler_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index bffa67680..57c875742 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -20,13 +20,17 @@ #include "direct_resampler_conditioner_cb.h" #include "direct_resampler_conditioner_cc.h" #include "direct_resampler_conditioner_cs.h" -#include #include #include // for lv_8sc_t #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif DirectResamplerConditioner::DirectResamplerConditioner( const ConfigurationInterface* configuration, diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index 7ee86662f..07f0e2b67 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -17,12 +17,17 @@ #include "mmse_resampler_conditioner.h" #include "configuration_interface.h" -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + MmseResamplerConditioner::MmseResamplerConditioner( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/signal_generator/adapters/CMakeLists.txt b/src/algorithms/signal_generator/adapters/CMakeLists.txt index c430af3c2..b7f8c1537 100644 --- a/src/algorithms/signal_generator/adapters/CMakeLists.txt +++ b/src/algorithms/signal_generator/adapters/CMakeLists.txt @@ -27,11 +27,16 @@ target_link_libraries(signal_generator_adapters Gnuradio::pmt signal_generator_gr_blocks PRIVATE - Gflags::gflags - Glog::glog core_system_parameters ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_generator_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_generator_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_generator_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_generator_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index 841cbfe3f..c5d745689 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -25,10 +25,14 @@ #include "Galileo_E5b.h" #include "Galileo_E6.h" #include "configuration_interface.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif SignalGenerator::SignalGenerator(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_stream, diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index afbf36296..e4ead311b 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -169,10 +169,16 @@ target_link_libraries(signal_source_adapters algorithms_libs gnss_sdr_flags core_system_parameters - Glog::glog Volk::volk ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_source_adapters PRIVATE Glog::glog) + target_compile_definitions(signal_source_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_source_adapters PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(signal_source_adapters PUBLIC -DGNURADIO_USES_STD_POINTERS=1 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 488c80ead..225f67782 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -31,7 +31,6 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "uio_fpga.h" -#include #include #include // for std::max #include // for std::chrono @@ -44,6 +43,11 @@ #include // for write #include // fr std::vector +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc index 796126e03..b93dc9344 100644 --- a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc @@ -21,10 +21,15 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* configuration, 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 85299cc27..8a96c375d 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -18,9 +18,13 @@ #include "custom_udp_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 7ffac8e5b..c4f0fd08b 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -19,10 +19,14 @@ #include "configuration_interface.h" #include "fifo_reader.h" #include "gnss_sdr_string_literals.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/file_signal_source.cc b/src/algorithms/signal_source/adapters/file_signal_source.cc index d1267949e..c4fbd25a2 100644 --- a/src/algorithms/signal_source/adapters/file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_signal_source.cc @@ -18,7 +18,12 @@ #include "file_signal_source.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/file_source_base.cc b/src/algorithms/signal_source/adapters/file_source_base.cc index 6efa7cdbc..7b9efcbc2 100644 --- a/src/algorithms/signal_source/adapters/file_source_base.cc +++ b/src/algorithms/signal_source/adapters/file_source_base.cc @@ -29,12 +29,16 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include // for std::max #include // for ceil, floor #include // for std::cout, std:cerr #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; @@ -93,7 +97,8 @@ FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std: } } - // override value with commandline flag, if present +// override value with commandline flag, if present +#if USE_GLOG_AND_GFLAGS if (FLAGS_signal_source != "-") { filename_ = FLAGS_signal_source; @@ -102,6 +107,16 @@ FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std: { filename_ = FLAGS_s; } +#else + if (absl::GetFlag(FLAGS_signal_source) != "-") + { + filename_ = absl::GetFlag(FLAGS_signal_source); + } + if (absl::GetFlag(FLAGS_s) != "-") + { + filename_ = absl::GetFlag(FLAGS_s); + } +#endif if (sampling_frequency_ == 0) { std::cerr << "Warning: parameter " << role_ << ".sampling_frequency is not set, this could lead to wrong results.\n" diff --git a/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc b/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc index 8a7c2958f..92788ee02 100644 --- a/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc @@ -18,9 +18,14 @@ #include "file_timestamp_signal_source.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; FileTimestampSignalSource::FileTimestampSignalSource(const ConfigurationInterface* configuration, @@ -41,11 +46,18 @@ FileTimestampSignalSource::FileTimestampSignalSource(const ConfigurationInterfac LOG(ERROR) << "This implementation only supports one output stream"; } - // override value with commandline flag, if present + // override value with commandline flag, if present +#if USE_GLOG_AND_GFLAGS if (FLAGS_timestamp_source != "-") { timestamp_file_ = FLAGS_timestamp_source; } +#else + if (absl::GetFlag(FLAGS_timestamp_source) != "-") + { + timestamp_file_ = absl::GetFlag(FLAGS_timestamp_source); + } +#endif } diff --git a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc index 66683bf7f..1848b3da5 100644 --- a/src/algorithms/signal_source/adapters/flexiband_signal_source.cc +++ b/src/algorithms/signal_source/adapters/flexiband_signal_source.cc @@ -19,11 +19,16 @@ #include "flexiband_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index c68ce03aa..1bd15ce35 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -24,12 +24,17 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include // for max #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configuration, diff --git a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc index 7052f0a4c..2de8b994b 100644 --- a/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/four_bit_cpx_file_signal_source.cc @@ -19,7 +19,12 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; @@ -58,11 +63,18 @@ FourBitCpxFileSignalSource::FourBitCpxFileSignalSource( LOG(ERROR) << "This implementation only supports one output stream"; } - // override value with commandline flag, if present + // override value with commandline flag, if present +#if USE_GLOG_AND_GFLAGS if (FLAGS_timestamp_source != "-") { timestamp_file_ = FLAGS_timestamp_source; } +#else + if (absl::GetFlag(FLAGS_timestamp_source) != "-") + { + timestamp_file_ = absl::GetFlag(FLAGS_timestamp_source); + } +#endif } diff --git a/src/algorithms/signal_source/adapters/gen_signal_source.cc b/src/algorithms/signal_source/adapters/gen_signal_source.cc index a87f77b12..388131815 100644 --- a/src/algorithms/signal_source/adapters/gen_signal_source.cc +++ b/src/algorithms/signal_source/adapters/gen_signal_source.cc @@ -18,12 +18,16 @@ #include "gen_signal_source.h" #include -#include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif // Constructor GenSignalSource::GenSignalSource(std::shared_ptr signal_generator, diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 30760ce97..227e0a246 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -18,10 +18,15 @@ #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" #include "labsat23_source.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configuration, diff --git a/src/algorithms/signal_source/adapters/limesdr_signal_source.cc b/src/algorithms/signal_source/adapters/limesdr_signal_source.cc index a8168bd82..28f3a3a68 100644 --- a/src/algorithms/signal_source/adapters/limesdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/limesdr_signal_source.cc @@ -20,10 +20,15 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; LimesdrSignalSource::LimesdrSignalSource(const ConfigurationInterface* configuration, 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 fd7973d90..84271beea 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc @@ -20,13 +20,18 @@ #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include #include #include #include // for std::cerr #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif using namespace std::string_literals; 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 c86c11e76..1945f5f85 100644 --- a/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/nsr_file_signal_source.cc @@ -18,7 +18,12 @@ #include "nsr_file_signal_source.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index f7ab32057..b2f5a6c1f 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -21,10 +21,15 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc index fd69989f7..f4b782400 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.cc @@ -20,9 +20,13 @@ #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; 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 b282aad24..18d563235 100644 --- a/src/algorithms/signal_source/adapters/raw_array_signal_source.cc +++ b/src/algorithms/signal_source/adapters/raw_array_signal_source.cc @@ -18,11 +18,15 @@ #include "concurrent_queue.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using namespace std::string_literals; 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 86da2608d..2e5849eb5 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -22,11 +22,16 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; RtlTcpSignalSource::RtlTcpSignalSource(const ConfigurationInterface* configuration, 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 23d74e93b..63b89e54d 100644 --- a/src/algorithms/signal_source/adapters/spir_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/spir_file_signal_source.cc @@ -17,8 +17,13 @@ #include "spir_file_signal_source.h" #include "gnss_sdr_string_literals.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif using namespace std::string_literals; 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 dead525be..a9b503c14 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 @@ -19,13 +19,19 @@ #include "spir_gss6450_file_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + using namespace std::string_literals; SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInterface* configuration, 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 1350bded2..3c85bf02d 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 @@ -17,7 +17,12 @@ #include "two_bit_cpx_file_signal_source.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; 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 57e6e7768..81f55cf81 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 @@ -19,9 +19,14 @@ #include "two_bit_packed_file_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; TwoBitPackedFileSignalSource::TwoBitPackedFileSignalSource( diff --git a/src/algorithms/signal_source/adapters/uhd_signal_source.cc b/src/algorithms/signal_source/adapters/uhd_signal_source.cc index efaae370b..7e9010aa5 100644 --- a/src/algorithms/signal_source/adapters/uhd_signal_source.cc +++ b/src/algorithms/signal_source/adapters/uhd_signal_source.cc @@ -21,13 +21,18 @@ #include "gnss_sdr_filesystem.h" #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" -#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; diff --git a/src/algorithms/signal_source/adapters/zmq_signal_source.cc b/src/algorithms/signal_source/adapters/zmq_signal_source.cc index bc8616ccd..924262617 100644 --- a/src/algorithms/signal_source/adapters/zmq_signal_source.cc +++ b/src/algorithms/signal_source/adapters/zmq_signal_source.cc @@ -17,7 +17,12 @@ #include "zmq_signal_source.h" #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif using namespace std::string_literals; diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 0a89dffd6..24f067be6 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -75,10 +75,15 @@ target_link_libraries(signal_source_gr_blocks PRIVATE algorithms_libs core_libs - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_source_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_source_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_source_gr_blocks PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_source_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc index 583fe6810..2617cc9fd 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/fifo_reader.cc @@ -16,7 +16,12 @@ */ #include "fifo_reader.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif // initial construction; pass to private constructor FifoReader::sptr FifoReader::make(const std::string &file_name, const std::string &sample_type) diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index 1b490b4f3..58f58d766 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -20,9 +20,13 @@ #include "rtl_tcp_commands.h" #include #include -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif namespace ip = boost::asio::ip; diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index a5d582116..2b0eb6a86 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -74,11 +74,16 @@ target_link_libraries(signal_source_libs Boost::headers Gnuradio::runtime PRIVATE - Gflags::gflags - Glog::glog core_libs ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_source_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_source_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_source_libs PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_source_libs PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/receiver diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 7e7e3fa74..913488287 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -16,7 +16,6 @@ * ----------------------------------------------------------------------------- */ #include "ad9361_manager.h" -#include #include #include #include // for ifstream @@ -25,6 +24,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + /* check return value of attr_write function */ void errchk(int v, const char *what) { diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index ce25e7897..2869081f2 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -15,7 +15,6 @@ #include "ad936x_iio_custom.h" #include #include -#include #include #include #include @@ -24,6 +23,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) { receive_samples = false; diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 449579441..0b250d131 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -25,7 +25,6 @@ #include "fpga_buffer_monitor.h" #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" -#include #include // for time, localtime #include // for open, O_RDWR, O_SYNC #include // for string, ofstream @@ -34,6 +33,12 @@ #include // for close #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, uint32_t num_freq_bands, diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc index 8cec947ef..f3352b715 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc @@ -21,12 +21,17 @@ #include "fpga_dynamic_bit_selection.h" #include "uio_fpga.h" -#include #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap #include // for close +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Fpga_dynamic_bit_selection::Fpga_dynamic_bit_selection(bool enable_rx1_band, bool enable_rx2_band) : d_map_base_freq_band_1(nullptr), d_map_base_freq_band_2(nullptr), diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index b56f63bf5..f2d51c2fb 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -21,12 +21,17 @@ */ #include "fpga_switch.h" -#include #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap #include // for close +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Fpga_Switch::Fpga_Switch(const std::string &device_name) { if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) diff --git a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc index 6054af6dd..a62917745 100644 --- a/src/algorithms/signal_source/libs/gnss_sdr_valve.cc +++ b/src/algorithms/signal_source/libs/gnss_sdr_valve.cc @@ -19,11 +19,16 @@ #include "gnss_sdr_valve.h" #include "command_event.h" -#include // for LOG #include // for io_signature #include // for min #include // for memcpy +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Gnss_Sdr_Valve::Gnss_Sdr_Valve(size_t sizeof_stream_item, uint64_t nitems, Concurrent_Queue* queue, diff --git a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt index 9c0ae28ee..a804a1a86 100644 --- a/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/adapters/CMakeLists.txt @@ -59,11 +59,16 @@ target_link_libraries(telemetry_decoder_adapters telemetry_decoder_gr_blocks telemetry_decoder_libs PRIVATE - Gflags::gflags - Glog::glog Gnuradio::runtime ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(telemetry_decoder_adapters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(telemetry_decoder_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(telemetry_decoder_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(telemetry_decoder_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc index 433ad8643..8f7229954 100644 --- a/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/beidou_b1i_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "beidou_b1i_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif BeidouB1iTelemetryDecoder::BeidouB1iTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc index 6b35a9c07..502479613 100644 --- a/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/beidou_b3i_telemetry_decoder.cc @@ -17,7 +17,12 @@ #include "beidou_b3i_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif BeidouB3iTelemetryDecoder::BeidouB3iTelemetryDecoder( const ConfigurationInterface *configuration, diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc index cadc48503..e6c302437 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e1b_telemetry_decoder.cc @@ -19,7 +19,12 @@ #include "galileo_e1b_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE1BTelemetryDecoder::GalileoE1BTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc index 73bf36b88..cf0c3828c 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5a_telemetry_decoder.cc @@ -22,7 +22,12 @@ #include "galileo_e5a_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE5aTelemetryDecoder::GalileoE5aTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc index 94181a94c..d6c66b20c 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e5b_telemetry_decoder.cc @@ -20,7 +20,12 @@ #include "galileo_e5b_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE5bTelemetryDecoder::GalileoE5bTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc index 4f4517ef7..5fd6342ea 100644 --- a/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/galileo_e6_telemetry_decoder.cc @@ -19,7 +19,12 @@ #include "galileo_e6_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GalileoE6TelemetryDecoder::GalileoE6TelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc index 037f20454..c6de2b98f 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l1_ca_telemetry_decoder.cc @@ -19,7 +19,12 @@ #include "glonass_l1_ca_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL1CaTelemetryDecoder::GlonassL1CaTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc index cfa172edd..77dfb5528 100644 --- a/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/glonass_l2_ca_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "glonass_l2_ca_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL2CaTelemetryDecoder::GlonassL2CaTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc index 9ee5f3db1..7f9a243bd 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "gps_l1_ca_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL1CaTelemetryDecoder::GpsL1CaTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc index f662627d7..6db0843bb 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l2c_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "gps_l2c_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL2CTelemetryDecoder::GpsL2CTelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc index a302c479f..e5dadfa90 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/gps_l5_telemetry_decoder.cc @@ -18,7 +18,12 @@ #include "gps_l5_telemetry_decoder.h" #include "configuration_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL5TelemetryDecoder::GpsL5TelemetryDecoder( diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 82b639f70..334e934ea 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -18,8 +18,12 @@ #include "sbas_l1_telemetry_decoder.h" #include "configuration_interface.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif SbasL1TelemetryDecoder::SbasL1TelemetryDecoder( const ConfigurationInterface* configuration, diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index c71184aa8..7c9ff7b83 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -58,11 +58,16 @@ target_link_libraries(telemetry_decoder_gr_blocks Gnuradio::runtime Boost::headers PRIVATE - Gflags::gflags - Glog::glog Gnuradio::pmt ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(telemetry_decoder_gr_blocks PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(telemetry_decoder_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(telemetry_decoder_gr_blocks PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(telemetry_decoder_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 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 0edbfee36..c7ecd7da4 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 @@ -26,7 +26,6 @@ #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -38,6 +37,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 8 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 a1fd40555..d27afa592 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 @@ -25,7 +25,6 @@ #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "gnss_synchro.h" #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -37,6 +36,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 8 beidou_b3i_telemetry_decoder_gs_sptr 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 690715725..a2d6b40cf 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 @@ -34,7 +34,6 @@ #include "tlm_crc_stats.h" // for Tlm_CRC_Stats #include "tlm_utils.h" // for save_tlm_matfile, tlm_remove_file #include "viterbi_decoder.h" // for Viterbi_Decoder -#include // for LOG, DLOG #include // for gr::io_signature::make #include // for pmt::mp #include // for std::array @@ -49,6 +48,12 @@ #include // for typeid #include // for std::pair +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include 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 b2cc50cf8..b19c5eb02 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 @@ -22,7 +22,6 @@ #include "glonass_gnav_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -35,6 +34,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 6 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 473e5eb73..9de17d33c 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 @@ -22,7 +22,6 @@ #include "glonass_gnav_utc_model.h" #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -35,6 +34,12 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CRC_ERROR_LIMIT 6 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 bd72d4cde..62bbf6bfa 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 @@ -24,7 +24,6 @@ #include "gps_iono.h" // for Gps_Iono #include "gps_utc_model.h" // for Gps_Utc_Model #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -39,6 +38,12 @@ #include // for std::move #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef COMPILER_HAS_ROTL #include namespace my_rotl = std; 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 b745738da..ea4f15585 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 @@ -24,7 +24,6 @@ #include "gps_cnav_iono.h" // for Gps_CNAV_Iono #include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -37,6 +36,11 @@ #include // for shared_ptr, make_shared #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif gps_l2c_telemetry_decoder_gs_sptr gps_l2c_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf) 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 d664551ea..f6d95d2a5 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 @@ -23,7 +23,6 @@ #include "gps_cnav_iono.h" #include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model #include "tlm_utils.h" -#include #include #include // for make_any #include // for mp @@ -35,6 +34,12 @@ #include // for std::cout #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + gps_l5_telemetry_decoder_gs_sptr gps_l5_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf) { diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc index 9a15fd2b6..303adbf2b 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc @@ -17,7 +17,6 @@ #include "sbas_l1_telemetry_decoder_gs.h" #include "gnss_synchro.h" #include "viterbi_decoder_sbas.h" -#include #include #include // for mp #include // for copy @@ -27,6 +26,12 @@ #include // for operator<<, setw #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + // logging levels #define EVENT 2 // logs important events which don't occur every block #define FLOW 3 // logs the function calls of block processing functions diff --git a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt index befb48ddf..ed35d0111 100644 --- a/src/algorithms/telemetry_decoder/libs/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/libs/CMakeLists.txt @@ -47,11 +47,16 @@ target_link_libraries(telemetry_decoder_libs PRIVATE Volkgnsssdr::volkgnsssdr algorithms_libs - Gflags::gflags - Glog::glog Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(telemetry_decoder_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(telemetry_decoder_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(telemetry_decoder_libs PRIVATE absl::flags absl::log) +endif() + target_include_directories(telemetry_decoder_libs PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc index 4d6b9d9e6..a5d69c96f 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_crc_stats.cc @@ -17,11 +17,15 @@ #include "tlm_crc_stats.h" #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" -#include #include // for std::setw() #include // for cerr, cout #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif void Tlm_CRC_Stats::initialize(std::string dump_crc_stats_filename) { diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc b/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc index 7972e708c..0eafce0f8 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc @@ -16,10 +16,15 @@ */ #include "viterbi_decoder_sbas.h" -#include #include // for fill_n #include // for operator<<, basic_ostream, char_traits +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + // logging #define EVENT 2 // logs important events which don't occur every block #define FLOW 3 // logs the function calls of block processing functions diff --git a/src/algorithms/tracking/adapters/CMakeLists.txt b/src/algorithms/tracking/adapters/CMakeLists.txt index f37824a3e..b72ae96df 100644 --- a/src/algorithms/tracking/adapters/CMakeLists.txt +++ b/src/algorithms/tracking/adapters/CMakeLists.txt @@ -100,9 +100,15 @@ target_link_libraries(tracking_adapters tracking_gr_blocks PRIVATE gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(tracking_adapters PRIVATE Glog::glog) + target_compile_definitions(tracking_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(tracking_adapters PRIVATE absl::flags absl::log) +endif() + target_include_directories(tracking_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc index 31ffb9fe8..748d81967 100644 --- a/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b1i_dll_pll_tracking.cc @@ -26,10 +26,14 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif BeidouB1iDllPllTracking::BeidouB1iDllPllTracking( const ConfigurationInterface* configuration, diff --git a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc index 633b87689..8408e1861 100644 --- a/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/beidou_b3i_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + BeidouB3iDllPllTracking::BeidouB3iDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc index 4483afa1b..16c021217 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE1DllPllVemlTracking::GalileoE1DllPllVemlTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc index b0571c13d..52c41c3d2 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.cc @@ -28,11 +28,16 @@ #include "galileo_e1_signal_replica.h" #include "gnss_sdr_flags.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE1DllPllVemlTrackingFpga::GalileoE1DllPllVemlTrackingFpga( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index 9236e0862..fc79e02ab 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -25,9 +25,13 @@ #include "Galileo_E1.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( const ConfigurationInterface* configuration, @@ -47,15 +51,30 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.15)); float very_early_late_space_chips = configuration->property(role_ + ".very_early_late_space_chips", static_cast(0.5)); size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc index f54f904e6..876ff34c7 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5aDllPllTracking::GalileoE5aDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index e6dcca1ac..dd1c8ca85 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -23,11 +23,16 @@ #include "galileo_e5_signal_replica.h" #include "gnss_sdr_flags.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( const ConfigurationInterface *configuration, const std::string &role, diff --git a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc index 61df5df98..6e7191958 100644 --- a/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e5b_dll_pll_tracking.cc @@ -27,10 +27,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE5bDllPllTracking::GalileoE5bDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc index ca01034d4..1d1c81e09 100644 --- a/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e6_dll_pll_tracking.cc @@ -22,10 +22,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GalileoE6DllPllTracking::GalileoE6DllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index 460a6f2df..c31149afb 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -27,7 +27,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( @@ -48,15 +53,30 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float pll_bw_narrow_hz = configuration->property(role_ + ".pll_bw_narrow_hz", static_cast(20.0)); float dll_bw_narrow_hz = configuration->property(role_ + ".dll_bw_narrow_hz", static_cast(2.0)); int extend_correlation_ms = configuration->property(role_ + ".extend_correlation_ms", 1); diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 769c15dd0..6a8faf31b 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -26,7 +26,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( @@ -47,15 +52,30 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 3da79c423..19350ce18 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -25,7 +25,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( @@ -46,15 +51,30 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float pll_bw_narrow_hz = configuration->property(role_ + ".pll_bw_narrow_hz", static_cast(20.0)); float dll_bw_narrow_hz = configuration->property(role_ + ".dll_bw_narrow_hz", static_cast(2.0)); int extend_correlation_ms = configuration->property(role_ + ".extend_correlation_ms", 1); diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index 283f10ed1..f5b6f2325 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -24,7 +24,12 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( @@ -45,15 +50,29 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float pll_bw_hz = configuration->property(role_ + ".pll_bw_hz", static_cast(50.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc index 00cccbe97..5d0f9973a 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking.cc @@ -27,10 +27,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaDllPllTracking::GpsL1CaDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc index c0db6265d..6d9981ed5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.cc @@ -28,11 +28,16 @@ #include "gnss_sdr_flags.h" #include "gps_sdr_signal_replica.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc index 5477511d6..c52d546a9 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_gpu.cc @@ -25,7 +25,12 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( @@ -49,9 +54,18 @@ GpsL1CaDllPllTrackingGPU::GpsL1CaDllPllTrackingGPU( fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump = configuration->property(role + ".dump", false); pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast(FLAGS_pll_bw_hz); +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); +#endif dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast(FLAGS_dll_bw_hz); +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); +#endif + early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); const std::string default_dump_filename("./track_ch"); dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc index b5439d319..3b501dcbc 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc @@ -28,7 +28,12 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( @@ -50,10 +55,17 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float dll_bw_hz = configuration->property(role_ + ".dll_bw_hz", static_cast(2.0)); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc index d1fbae84d..ad4dd1647 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_kf_tracking.cc @@ -27,10 +27,15 @@ #include "display.h" #include "gnss_sdr_flags.h" #include "kf_conf.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaKfTracking::GpsL1CaKfTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index fa09c8dcb..887dbdbc5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -24,9 +24,14 @@ #include "gps_l1_ca_tcp_connector_tracking.h" #include "GPS_L1_CA.h" #include "configuration_interface.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( const ConfigurationInterface* configuration, diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc index 98692f544..c048686c9 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL2MDllPllTracking::GpsL2MDllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc index da652be87..0d0fa843a 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.cc @@ -30,13 +30,18 @@ #include "gnss_synchro.h" #include "gps_l2c_signal_replica.h" #include "uio_fpga.h" -#include #include #include #include #include // for round #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL2MDllPllTrackingFpga::GpsL2MDllPllTrackingFpga( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc index d77303820..fddc9d8c2 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking.cc @@ -26,10 +26,15 @@ #include "display.h" #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL5DllPllTracking::GpsL5DllPllTracking( const ConfigurationInterface* configuration, const std::string& role, diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc index 485afd7c3..2020ef042 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.cc @@ -30,11 +30,16 @@ #include "gnss_sdr_flags.h" #include "gps_l5_signal_replica.h" #include "uio_fpga.h" -#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + GpsL5DllPllTrackingFpga::GpsL5DllPllTrackingFpga( const ConfigurationInterface *configuration, const std::string &role, diff --git a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt index cad24584d..4f72b86d0 100644 --- a/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/tracking/gnuradio_blocks/CMakeLists.txt @@ -85,9 +85,15 @@ target_link_libraries(tracking_gr_blocks algorithms_libs Matio::matio gnss_sdr_flags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(tracking_gr_blocks PRIVATE Glog::glog) + target_compile_definitions(tracking_gr_blocks PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(tracking_gr_blocks PRIVATE absl::flags absl::log) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(tracking_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 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 5ac5f6d62..4bba76fba 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -45,7 +45,6 @@ #include "gps_sdr_signal_replica.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include // for io_signature #include // for scoped_lock #include // for Mat_VarCreate @@ -61,6 +60,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include 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 0d450d469..ba556f46c 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 @@ -35,7 +35,6 @@ #include "gps_sdr_signal_replica.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include // for io_signature #include // for scoped_lock #include // for Mat_VarCreate @@ -49,6 +48,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include 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 d40c99783..e4af28caf 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 @@ -32,7 +32,6 @@ #include "tcp_communication.h" #include "tcp_packet_data.h" #include "tracking_discriminators.h" -#include #include #include #include // for fill_n @@ -42,6 +41,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + galileo_e1_tcp_connector_tracking_cc_sptr galileo_e1_tcp_connector_make_tracking_cc( int64_t fs_in, @@ -111,7 +116,11 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(static_cast(FLAGS_carrier_lock_th)), +#else + d_carrier_lock_threshold(static_cast(absl::GetFlag(FLAGS_carrier_lock_th))), +#endif d_carrier_lock_fail_counter(0), d_enable_tracking(false), d_pull_in(false), @@ -126,8 +135,11 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc( // Telemetry message port input this->message_port_register_in(pmt::mp("telemetry_to_trk")); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif // Initialization of local code replica // Get space for a vector with the sinboc(1,1) replica sampled 2x/chip d_ca_code = volk_gnsssdr::vector(2 * GALILEO_E1_B_CODE_LENGTH_CHIPS, gr_complex(0.0, 0.0)); @@ -365,10 +377,13 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri T_prn_samples = T_prn_seconds * static_cast(d_fs_in); K_blk_samples = T_prn_samples + d_rem_code_phase_samples + code_error_filt_secs * static_cast(d_fs_in); d_current_prn_length_samples = round(K_blk_samples); // round to a discrete number of samples - // d_rem_code_phase_samples = K_blk_samples - d_current_prn_length_samples; //rounding error < 1 sample // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::GetFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; @@ -379,6 +394,8 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri d_cn0_estimation_counter = 0; // Code lock indicator + +#if USE_GLOG_AND_GFLAGS d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GALILEO_E1_CODE_PERIOD_S); // Carrier lock indicator @@ -386,6 +403,14 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri // Loss of lock detection if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GALILEO_E1_CODE_PERIOD_S); + + // Carrier lock indicator + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -396,7 +421,11 @@ int Galileo_E1_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attri d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 32e0a2e2f..5a1eed229 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -46,6 +45,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -146,7 +151,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_extended_integration(false), d_preamble_synchronized(false), @@ -189,8 +198,12 @@ glonass_l1_ca_dll_pll_c_aid_tracking_cc::glonass_l1_ca_dll_pll_c_aid_tracking_cc d_local_code_shift_chips[2] = d_early_late_spc_chips; multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); - +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif + systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 this->set_relative_rate(1, static_cast(d_vector_length)); @@ -747,8 +760,13 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES, GLONASS_L1_CA_CODE_PERIOD_S); // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); - // Loss of lock detection + // Loss of lock detectionç + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -759,7 +777,11 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 99108ee19..c67786201 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,13 @@ #include #include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -144,7 +150,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_extended_integration(false), d_preamble_synchronized(false), @@ -185,9 +195,11 @@ glonass_l1_ca_dll_pll_c_aid_tracking_sc::glonass_l1_ca_dll_pll_c_aid_tracking_sc d_local_code_shift_chips[2] = d_early_late_spc_chips; multicorrelator_cpu_16sc.init(2 * d_correlation_length_samples, d_n_correlator_taps); - +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 @@ -750,7 +762,12 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -761,7 +778,12 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc index 61e9e9feb..3829539c9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CN0_ESTIMATION_SAMPLES 10 glonass_l1_ca_dll_pll_tracking_cc_sptr glonass_l1_ca_dll_pll_make_tracking_cc( @@ -106,7 +111,11 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( d_acq_sample_stamp(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_cn0_estimation_counter(0), d_enable_tracking(false), @@ -134,7 +143,11 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc( multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 @@ -594,7 +607,12 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -605,7 +623,11 @@ int Glonass_L1_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 6274a0b26..5c433346e 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -28,7 +28,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -43,6 +42,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -143,7 +148,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_extended_integration(false), d_preamble_synchronized(false), @@ -185,8 +194,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_cc::glonass_l2_ca_dll_pll_c_aid_tracking_cc multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); #if GNURADIO_GREATER_THAN_38 @@ -747,7 +759,12 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -758,7 +775,12 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index f88f217c4..6c8b65c20 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -28,7 +28,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -42,6 +41,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -141,7 +146,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc d_acq_sample_stamp(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_cn0_estimation_counter(0), d_enable_extended_integration(false), @@ -183,7 +192,11 @@ glonass_l2_ca_dll_pll_c_aid_tracking_sc::glonass_l2_ca_dll_pll_c_aid_tracking_sc multicorrelator_cpu_16sc.init(2 * d_correlation_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); @@ -747,7 +760,12 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -758,7 +776,11 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc index 56b892474..9950a77e8 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gnss_sdr_flags.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #define CN0_ESTIMATION_SAMPLES 10 @@ -107,7 +112,11 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( d_acq_sample_stamp(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_cn0_estimation_counter(0), d_carrier_lock_fail_counter(0), d_enable_tracking(false), @@ -135,7 +144,11 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc( multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["R"] = std::string("Glonass"); @@ -596,7 +609,12 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), CN0_ESTIMATION_SAMPLES); // Loss of lock detection + +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -607,7 +625,11 @@ int Glonass_L2_Ca_Dll_Pll_Tracking_cc::general_work(int noutput_items __attribut d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc index 9898ad178..2930c5278 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_dll_pll_tracking_gpu_cc.cc @@ -22,7 +22,6 @@ #include "lock_detectors.h" #include "tracking_discriminators.h" #include -#include #include #include #include @@ -32,6 +31,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + gps_l1_ca_dll_pll_tracking_gpu_cc_sptr gps_l1_ca_dll_pll_make_tracking_gpu_cc( @@ -127,12 +132,21 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc( // CN0 estimation and lock detector buffers d_cn0_estimation_counter = 0; +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = std::vector(FLAGS_cn0_samples); +#else + d_Prompt_buffer = std::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif + + d_carrier_lock_test = 1; d_CN0_SNV_dB_Hz = 0; d_carrier_lock_fail_counter = 0; +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold = FLAGS_carrier_lock_th; - +#else + d_carrier_lock_threshold = absl::GetFlag(FLAGS_carrier_lock_th); +#endif systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); @@ -421,7 +435,12 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut d_rem_code_phase_chips = d_rem_code_phase_samples * (d_code_freq_chips / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ####################################### + +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::getFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt @@ -431,11 +450,18 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut { d_cn0_estimation_counter = 0; // Code lock indicator + +#if USE_GLOG_AND_GFLAGS d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GPS_L1_CA_CODE_PERIOD_S); // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), FLAGS_cn0_samples); // Loss of lock detection if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GPS_L1_CA_CODE_PERIOD_S); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -443,7 +469,11 @@ int Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::general_work(int noutput_items __attribut { if (d_carrier_lock_fail_counter > 0) d_carrier_lock_fail_counter--; } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc index 0b8c3bb84..0d90a799f 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_gaussian_tracking_cc.cc @@ -30,7 +30,6 @@ #include "gps_sdr_signal_replica.h" #include "lock_detectors.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -44,6 +43,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif gps_l1_ca_gaussian_tracking_cc_sptr gps_l1_ca_gaussian_make_tracking_cc( uint32_t order, @@ -126,7 +130,11 @@ Gps_L1_Ca_Gaussian_Tracking_cc::Gps_L1_Ca_Gaussian_Tracking_cc( d_cn0_estimation_counter(0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(FLAGS_carrier_lock_th), +#else + d_carrier_lock_threshold(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif d_carrier_lock_fail_counter(0), d_enable_tracking(false), d_pull_in(false), @@ -154,8 +162,11 @@ Gps_L1_Ca_Gaussian_Tracking_cc::Gps_L1_Ca_Gaussian_Tracking_cc( multicorrelator_cpu.init(2 * d_current_prn_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["G"] = std::string("GPS"); systemName["S"] = std::string("SBAS"); @@ -746,7 +757,12 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ d_rem_code_phase_chips = d_code_freq_chips * (d_rem_code_phase_samples / static_cast(d_fs_in)); // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### + +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::GetFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = d_correlator_outs[1]; // prompt @@ -755,12 +771,21 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ else { d_cn0_estimation_counter = 0; +#if USE_GLOG_AND_GFLAGS // Code lock indicator d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GPS_L1_CA_CODE_PERIOD_S); // Carrier lock indicator d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), FLAGS_cn0_samples); // Loss of lock detection if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + // Code lock indicator + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GPS_L1_CA_CODE_PERIOD_S); + // Carrier lock indicator + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + // Loss of lock detection + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { // if (d_channel == 1) // std::cout << "Carrier Lock Test Fail in channel " << d_channel << ": " << d_carrier_lock_test << " < " << d_carrier_lock_threshold << "," << nfail++ << '\n'; @@ -774,7 +799,11 @@ int Gps_L1_Ca_Gaussian_Tracking_cc::general_work(int noutput_items __attribute__ d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc index fb94fc2de..7862a2256 100644 --- a/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/gps_l1_ca_tcp_connector_tracking_cc.cc @@ -30,7 +30,6 @@ #include "tcp_communication.h" #include "tcp_packet_data.h" #include "tracking_discriminators.h" -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + gps_l1_ca_tcp_connector_tracking_cc_sptr gps_l1_ca_tcp_connector_make_tracking_cc( int64_t fs_in, @@ -102,7 +107,11 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( d_acq_carrier_doppler_hz(0.0), d_carrier_lock_test(1), d_CN0_SNV_dB_Hz(0), +#if USE_GLOG_AND_GFLAGS d_carrier_lock_threshold(static_cast(FLAGS_carrier_lock_th)), +#else + d_carrier_lock_threshold(static_cast(absl::GetFlag(FLAGS_carrier_lock_th))), +#endif d_control_id(0), d_enable_tracking(false), d_pull_in(false), @@ -130,8 +139,11 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc( multicorrelator_cpu.init(2 * d_correlation_length_samples, d_n_correlator_taps); +#if USE_GLOG_AND_GFLAGS d_Prompt_buffer = volk_gnsssdr::vector(FLAGS_cn0_samples); - +#else + d_Prompt_buffer = volk_gnsssdr::vector(absl::GetFlag(FLAGS_cn0_samples)); +#endif systemName["G"] = std::string("GPS"); systemName["R"] = std::string("GLONASS"); systemName["S"] = std::string("SBAS"); @@ -400,7 +412,12 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib * \todo Improve the lock detection algorithm! */ // ####### CN0 ESTIMATION AND LOCK DETECTORS ###### + +#if USE_GLOG_AND_GFLAGS if (d_cn0_estimation_counter < FLAGS_cn0_samples) +#else + if (d_cn0_estimation_counter < absl::GetFlag(FLAGS_cn0_samples)) +#endif { // fill buffer with prompt correlator output values d_Prompt_buffer[d_cn0_estimation_counter] = *d_Prompt; @@ -409,11 +426,19 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib else { d_cn0_estimation_counter = 0; +#if USE_GLOG_AND_GFLAGS d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), FLAGS_cn0_samples, GPS_L1_CA_CODE_PERIOD_S); d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), FLAGS_cn0_samples); // ###### TRACKING UNLOCK NOTIFICATION ##### if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < FLAGS_cn0_min) +#else + d_CN0_SNV_dB_Hz = cn0_m2m4_estimator(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples), GPS_L1_CA_CODE_PERIOD_S); + d_carrier_lock_test = carrier_lock_detector(d_Prompt_buffer.data(), absl::GetFlag(FLAGS_cn0_samples)); + + // ###### TRACKING UNLOCK NOTIFICATION ##### + if (d_carrier_lock_test < d_carrier_lock_threshold or d_CN0_SNV_dB_Hz < absl::GetFlag(FLAGS_cn0_min)) +#endif { d_carrier_lock_fail_counter++; } @@ -424,7 +449,11 @@ int Gps_L1_Ca_Tcp_Connector_Tracking_cc::general_work(int noutput_items __attrib d_carrier_lock_fail_counter--; } } +#if USE_GLOG_AND_GFLAGS if (d_carrier_lock_fail_counter > FLAGS_max_lock_fail) +#else + if (d_carrier_lock_fail_counter > absl::GetFlag(FLAGS_max_lock_fail)) +#endif { std::cout << "Loss of lock in channel " << d_channel << "!\n"; LOG(INFO) << "Loss of lock in channel " << d_channel << "!"; diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index dd50b4547..838dbab85 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -43,7 +43,6 @@ #include "lock_detectors.h" #include "tracking_discriminators.h" #include "trackingcmd.h" -#include #include // for io_signature #include // for scoped_lock #include // for Mat_VarCreate @@ -58,6 +57,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/algorithms/tracking/libs/CMakeLists.txt b/src/algorithms/tracking/libs/CMakeLists.txt index 5b9520c0a..d207a7cc9 100644 --- a/src/algorithms/tracking/libs/CMakeLists.txt +++ b/src/algorithms/tracking/libs/CMakeLists.txt @@ -88,10 +88,16 @@ target_link_libraries(tracking_libs algorithms_libs PRIVATE gnss_sdr_flags - Glog::glog Gnuradio::runtime ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(tracking_libs PRIVATE Glog::glog) + target_compile_definitions(tracking_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(tracking_libs PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CUDA) if(CMAKE_VERSION VERSION_GREATER 3.11) target_include_directories(tracking_libs diff --git a/src/algorithms/tracking/libs/dll_pll_conf.cc b/src/algorithms/tracking/libs/dll_pll_conf.cc index 0ffa5a395..c41229d7e 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf.cc @@ -18,14 +18,26 @@ #include "dll_pll_conf.h" #include "gnss_sdr_flags.h" #include "item_type_helpers.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif - +#if USE_GLOG_AND_GFLAGS Dll_Pll_Conf::Dll_Pll_Conf() : carrier_lock_th(FLAGS_carrier_lock_th), cn0_samples(FLAGS_cn0_samples), cn0_min(FLAGS_cn0_min), max_code_lock_fail(FLAGS_max_lock_fail), max_carrier_lock_fail(FLAGS_max_carrier_lock_fail) +#else +Dll_Pll_Conf::Dll_Pll_Conf() : carrier_lock_th(absl::GetFlag(FLAGS_carrier_lock_th)), + cn0_samples(absl::GetFlag(FLAGS_cn0_samples)), + cn0_min(absl::GetFlag(FLAGS_cn0_min)), + max_code_lock_fail(absl::GetFlag(FLAGS_max_lock_fail)), + max_carrier_lock_fail(absl::GetFlag(FLAGS_max_carrier_lock_fail)) +#endif { signal[0] = '1'; signal[1] = 'C'; @@ -50,18 +62,31 @@ void Dll_Pll_Conf::SetFromConfiguration(const ConfigurationInterface *configurat dump_filename = configuration->property(role + ".dump_filename", dump_filename); dump_mat = configuration->property(role + ".dump_mat", dump_mat); pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", pll_bw_narrow_hz); dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", dll_bw_narrow_hz); dll_bw_hz = configuration->property(role + ".dll_bw_hz", dll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } - +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif dll_filter_order = configuration->property(role + ".dll_filter_order", dll_filter_order); pll_filter_order = configuration->property(role + ".pll_filter_order", pll_filter_order); if (dll_filter_order < 1) diff --git a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc index f2c3ea73a..d784a204b 100644 --- a/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc +++ b/src/algorithms/tracking/libs/dll_pll_conf_fpga.cc @@ -19,14 +19,26 @@ #include "dll_pll_conf_fpga.h" #include "gnss_sdr_flags.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif - +#if USE_GLOG_AND_GFLAGS Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() : carrier_lock_th(FLAGS_carrier_lock_th), cn0_samples(FLAGS_cn0_samples), cn0_min(FLAGS_cn0_min), max_code_lock_fail(FLAGS_max_lock_fail), max_carrier_lock_fail(FLAGS_max_carrier_lock_fail) +#else +Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga() : carrier_lock_th(absl::GetFlag(FLAGS_carrier_lock_th)), + cn0_samples(absl::GetFlag(FLAGS_cn0_samples)), + cn0_min(absl::GetFlag(FLAGS_cn0_min)), + max_code_lock_fail(absl::GetFlag(FLAGS_max_lock_fail)), + max_carrier_lock_fail(absl::GetFlag(FLAGS_max_carrier_lock_fail)) +#endif { signal[0] = '1'; signal[1] = 'C'; @@ -88,15 +100,29 @@ void Dll_Pll_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *confi pll_pull_in_bw_hz = 50.0; dll_pull_in_bw_hz = 3.0; pll_bw_hz = configuration->property(role + ".pll_bw_hz", pll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_pll_bw_hz != 0.0) { pll_bw_hz = static_cast(FLAGS_pll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_pll_bw_hz) != 0.0) + { + pll_bw_hz = static_cast(absl::GetFlag(FLAGS_pll_bw_hz)); + } +#endif dll_bw_hz = configuration->property(role + ".dll_bw_hz", dll_bw_hz); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { dll_bw_hz = static_cast(FLAGS_dll_bw_hz); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + dll_bw_hz = static_cast(absl::GetFlag(FLAGS_dll_bw_hz)); + } +#endif pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", pll_bw_narrow_hz); dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", dll_bw_narrow_hz); early_late_space_chips = configuration->property(role + ".early_late_space_chips", early_late_space_chips); diff --git a/src/algorithms/tracking/libs/fpga_multicorrelator.cc b/src/algorithms/tracking/libs/fpga_multicorrelator.cc index 99f5f778c..3b2ed122d 100644 --- a/src/algorithms/tracking/libs/fpga_multicorrelator.cc +++ b/src/algorithms/tracking/libs/fpga_multicorrelator.cc @@ -21,7 +21,6 @@ */ #include "fpga_multicorrelator.h" -#include #include #include #include // for O_RDWR, O_RSYNC @@ -29,6 +28,12 @@ #include // for PROT_READ, PROT_WRITE, MAP_SHARED #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(exp) \ ({ \ diff --git a/src/algorithms/tracking/libs/kf_conf.cc b/src/algorithms/tracking/libs/kf_conf.cc index 80b049c38..db4818261 100644 --- a/src/algorithms/tracking/libs/kf_conf.cc +++ b/src/algorithms/tracking/libs/kf_conf.cc @@ -21,13 +21,21 @@ #include "kf_conf.h" #include "gnss_sdr_flags.h" #include "item_type_helpers.h" -#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif Kf_Conf::Kf_Conf() : item_type("gr_complex"), dump_filename("./Kf_dump.dat"), fs_in(2000000.0), +#if USE_GLOG_AND_GFLAGS carrier_lock_th(FLAGS_carrier_lock_th), +#else + carrier_lock_th(absl::GetFlag(FLAGS_carrier_lock_th)), +#endif code_disc_sd_chips(0.2), carrier_disc_sd_rads(0.3), code_phase_sd_chips(0.15), @@ -52,12 +60,22 @@ Kf_Conf::Kf_Conf() : item_type("gr_complex"), vector_length(0U), smoother_length(10), extend_correlation_symbols(1), +#if USE_GLOG_AND_GFLAGS cn0_samples(FLAGS_cn0_samples), +#else + cn0_samples(absl::GetFlag(FLAGS_cn0_samples)), +#endif cn0_smoother_samples(200), carrier_lock_test_smoother_samples(25), +#if USE_GLOG_AND_GFLAGS cn0_min(FLAGS_cn0_min), max_code_lock_fail(FLAGS_max_lock_fail), max_carrier_lock_fail(FLAGS_max_carrier_lock_fail), +#else + cn0_min(absl::GetFlag(FLAGS_cn0_min)), + max_code_lock_fail(absl::GetFlag(FLAGS_max_lock_fail)), + max_carrier_lock_fail(absl::GetFlag(FLAGS_max_carrier_lock_fail)), +#endif system('G'), track_pilot(true), enable_doppler_correction(false), diff --git a/src/algorithms/tracking/libs/tracking_loop_filter.cc b/src/algorithms/tracking/libs/tracking_loop_filter.cc index a722f6ffa..8fd66a946 100644 --- a/src/algorithms/tracking/libs/tracking_loop_filter.cc +++ b/src/algorithms/tracking/libs/tracking_loop_filter.cc @@ -19,10 +19,15 @@ #include "tracking_loop_filter.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + const int MAX_LOOP_ORDER = 3; const int MAX_LOOP_HISTORY_LENGTH = 4; diff --git a/src/core/interfaces/signal_source_interface.h b/src/core/interfaces/signal_source_interface.h index df4a7baf4..759169c90 100644 --- a/src/core/interfaces/signal_source_interface.h +++ b/src/core/interfaces/signal_source_interface.h @@ -27,7 +27,12 @@ #define GNSS_SDR_SIGNAL_SOURCE_INTERFACE_H #include "gnss_block_interface.h" + +#if USE_GLOG_AND_GFLAGS #include +#else +#include +#endif /** \addtogroup Core * \{ */ diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 994501ecf..7b4f4f703 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -95,11 +95,16 @@ target_link_libraries(core_libs PRIVATE algorithms_libs Boost::serialization - Gflags::gflags - Glog::glog Pugixml::pugixml ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(core_libs PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(core_libs PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(core_libs PRIVATE absl::flags absl::log) +endif() + if(USE_GENERIC_LAMBDAS AND NOT GNURADIO_USES_STD_POINTERS) target_link_libraries(core_libs PUBLIC Boost::headers) else() diff --git a/src/core/libs/channel_status_msg_receiver.cc b/src/core/libs/channel_status_msg_receiver.cc index 4b11abd7e..c96bb51a8 100644 --- a/src/core/libs/channel_status_msg_receiver.cc +++ b/src/core/libs/channel_status_msg_receiver.cc @@ -17,7 +17,6 @@ #include "channel_status_msg_receiver.h" -#include #include #include #include @@ -25,6 +24,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/libs/galileo_e6_has_msg_receiver.cc b/src/core/libs/galileo_e6_has_msg_receiver.cc index 22e1cd524..db0dc3fd7 100644 --- a/src/core/libs/galileo_e6_has_msg_receiver.cc +++ b/src/core/libs/galileo_e6_has_msg_receiver.cc @@ -23,7 +23,6 @@ #include "galileo_has_page.h" // for Galileo_HAS_page #include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 #include "reed_solomon.h" // for ReedSolomon -#include // for DLOG #include // for gr::io_signature::make #include // for std::find, std::count #include // for std::remainder @@ -34,6 +33,12 @@ #include // for std::out_of_range #include // for typeid +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/libs/galileo_tow_map.cc b/src/core/libs/galileo_tow_map.cc index 6b4da0fb5..831dff044 100644 --- a/src/core/libs/galileo_tow_map.cc +++ b/src/core/libs/galileo_tow_map.cc @@ -16,10 +16,15 @@ #include "galileo_tow_map.h" -#include // for LOG -#include // for std::numeric_limits -#include // for std::shared -#include // for typeid +#include // for std::numeric_limits +#include // for std::shared +#include // for typeid + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if HAS_GENERIC_LAMBDA #else diff --git a/src/core/libs/gnss_sdr_fpga_sample_counter.cc b/src/core/libs/gnss_sdr_fpga_sample_counter.cc index d67ea3b37..5ba9b0f0b 100644 --- a/src/core/libs/gnss_sdr_fpga_sample_counter.cc +++ b/src/core/libs/gnss_sdr_fpga_sample_counter.cc @@ -19,7 +19,6 @@ #include "gnss_sdr_fpga_sample_counter.h" #include "gnss_synchro.h" #include "uio_fpga.h" -#include #include #include // for from_double #include // for mp @@ -29,6 +28,11 @@ #include // libraries used by the GIPO #include // for write, close, read, ssize_t +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #ifndef TEMP_FAILURE_RETRY #define TEMP_FAILURE_RETRY(exp) \ diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 6e4ec6d1d..86ec16658 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -23,7 +23,6 @@ #include #include #include -#include #include #include // for pow #include // for exception @@ -31,6 +30,12 @@ #include // for pair #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Gnss_Sdr_Supl_Client::Gnss_Sdr_Supl_Client() : server_port(0), request(0), mcc(0), mns(0), lac(0), ci(0) { diff --git a/src/core/libs/nav_message_monitor.cc b/src/core/libs/nav_message_monitor.cc index 105234b81..954f760fd 100644 --- a/src/core/libs/nav_message_monitor.cc +++ b/src/core/libs/nav_message_monitor.cc @@ -17,11 +17,16 @@ #include "nav_message_monitor.h" #include "gnss_sdr_make_unique.h" -#include #include #include // size_t #include // typeid +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 418ee72ab..0dfc09a84 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -172,12 +172,18 @@ target_link_libraries(core_receiver telemetry_decoder_adapters obs_adapters pvt_adapters + gnss_sdr_flags Boost::headers - Gflags::gflags - Glog::glog Armadillo::armadillo ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(core_receiver PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(core_receiver PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(core_receiver PRIVATE absl::flags absl::log) +endif() + if(ENABLE_ARMA_NO_DEBUG) target_compile_definitions(core_receiver PRIVATE -DARMA_NO_BOUND_CHECKING=1 diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index a6791fd52..52b0b344d 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -50,7 +50,6 @@ #include "rtklib_rtkcmn.h" // for utc2gpst #include // for interaction with geofunctions #include // for bad_lexical_cast -#include // for LOG #include // for make_any #include // for find, min #include // for milliseconds @@ -66,6 +65,12 @@ #include // for IPC_CREAT #include // for msgctl, msgget +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef ENABLE_FPGA #include // for steady_clock #endif @@ -89,7 +94,7 @@ ControlThread::ControlThread() signal(SIGINT, ControlThread::handle_signal); signal(SIGTERM, ControlThread::handle_signal); signal(SIGHUP, ControlThread::handle_signal); - +#if USE_GLOG_AND_GFLAGS if (FLAGS_c == "-") { configuration_ = std::make_shared(FLAGS_config_file); @@ -98,6 +103,16 @@ ControlThread::ControlThread() { configuration_ = std::make_shared(FLAGS_c); } +#else + if (absl::GetFlag(FLAGS_c) == "-") + { + configuration_ = std::make_shared(absl::GetFlag(FLAGS_config_file)); + } + else + { + configuration_ = std::make_shared(absl::GetFlag(FLAGS_c)); + } +#endif // Basic configuration checks auto aux = std::dynamic_pointer_cast(configuration_); conf_file_has_section_ = aux->has_section(); @@ -405,8 +420,12 @@ int ControlThread::run() // launch GNSS assistance process AFTER the flowgraph is running because the GNU Radio asynchronous queues must be already running to transport msgs assist_GNSS(); - // start the keyboard_listener thread +// start the keyboard_listener thread +#if USE_GLOG_AND_GFLAGS if (FLAGS_keyboard) +#else + if (absl::GetFlag(FLAGS_keyboard)) +#endif { keyboard_thread_ = std::thread(&ControlThread::keyboard_listener, this); } @@ -445,7 +464,11 @@ int ControlThread::run() #endif // Terminate keyboard thread +#if USE_GLOG_AND_GFLAGS if (FLAGS_keyboard && keyboard_thread_.joinable()) +#else + if (absl::GetFlag(FLAGS_keyboard) && keyboard_thread_.joinable()) +#endif { pthread_t id = keyboard_thread_.native_handle(); keyboard_thread_.detach(); diff --git a/src/core/receiver/file_configuration.cc b/src/core/receiver/file_configuration.cc index 5e8fff282..4bee6ae75 100644 --- a/src/core/receiver/file_configuration.cc +++ b/src/core/receiver/file_configuration.cc @@ -21,10 +21,14 @@ #include "file_configuration.h" #include "gnss_sdr_make_unique.h" -#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif FileConfiguration::FileConfiguration(std::string filename) : filename_(std::move(filename)) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 5742bca83..1a48e0a7f 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -113,11 +113,16 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" -#include #include // for exception #include // for cerr #include // for move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if RAW_UDP #include "custom_udp_signal_source.h" #endif diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 47e35bfbd..a4b177acc 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -40,7 +40,6 @@ #include "signal_source_interface.h" #include // for boost::lexical_cast #include // for boost::tokenizer -#include // for LOG #include // for basic_block #include // for gr::filter::firdes #include // for io_signature @@ -59,6 +58,12 @@ #include // for std::thread #include // for std::move +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef GR_GREATER_38 #include #else @@ -2181,7 +2186,7 @@ void GNSSFlowgraph::set_signals_list() std::string sv_list = configuration_->property("Galileo.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2221,7 +2226,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("GPS.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2261,7 +2266,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("SBAS.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2301,7 +2306,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("Glonass.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; @@ -2341,7 +2346,7 @@ void GNSSFlowgraph::set_signals_list() sv_list = configuration_->property("Beidou.prns", std::string("")); - if (sv_list.length() > 0) + if (!sv_list.empty()) { // Reset the available prns: std::set tmp_set; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 3e25387ed..fa0fa9983 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -114,11 +114,15 @@ target_link_libraries(core_system_parameters PUBLIC Boost::date_time Boost::serialization - PRIVATE - Gflags::gflags - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(core_system_parameters PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(core_system_parameters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(core_system_parameters PRIVATE absl::flags absl::log) +endif() + # for gnss_sdr_make_unique.h target_include_directories(core_system_parameters PUBLIC diff --git a/src/core/system_parameters/galileo_cnav_message.cc b/src/core/system_parameters/galileo_cnav_message.cc index e514b00b7..488d8f49f 100644 --- a/src/core/system_parameters/galileo_cnav_message.cc +++ b/src/core/system_parameters/galileo_cnav_message.cc @@ -19,11 +19,16 @@ #include "galileo_cnav_message.h" #include // for boost::crc_basic, boost::crc_optimal #include // for boost::dynamic_bitset -#include -#include // for reverse +#include // for reverse #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using CRC_Galileo_CNAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; diff --git a/src/core/system_parameters/galileo_fnav_message.cc b/src/core/system_parameters/galileo_fnav_message.cc index 5dea81898..0ea44e6a7 100644 --- a/src/core/system_parameters/galileo_fnav_message.cc +++ b/src/core/system_parameters/galileo_fnav_message.cc @@ -23,11 +23,16 @@ #include "galileo_fnav_message.h" #include // for boost::crc_basic, boost::crc_optimal #include -#include #include // for reverse #include // for string, operator<< #include // for back_insert_iterator +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using CRC_Galileo_FNAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 81c47c3bb..d97ca6a90 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -21,12 +21,16 @@ #include "reed_solomon.h" #include // for boost::crc_basic, boost::crc_optimal #include // for boost::dynamic_bitset -#include // for DLOG #include // for reverse #include // for operator<< #include // for std::numeric_limits #include // for std::accumulate +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif using CRC_Galileo_INAV_type = boost::crc_optimal<24, 0x1864CFBU, 0x0, 0x0, false, false>; diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index 9428875c4..b655850fe 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -19,10 +19,15 @@ #include "glonass_gnav_navigation_message.h" #include "MATH_CONSTANTS.h" // for TWO_N20, TWO_N30, TWO_N14, TWO_N15, TWO_N18 #include "gnss_satellite.h" -#include #include // for size_t #include // for operator<< +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Glonass_Gnav_Navigation_Message::Glonass_Gnav_Navigation_Message() { diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index 2a974cc0a..d05c880b3 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -15,9 +15,14 @@ */ #include "gnss_satellite.h" -#include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + Gnss_Satellite::Gnss_Satellite(const std::string& system_, uint32_t PRN_) { diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 9f7ead3c7..8d3fd6759 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -16,13 +16,29 @@ target_link_libraries(gnss-sdr PRIVATE algorithms_libs core_receiver + gnss_sdr_flags Boost::headers Boost::thread - Gflags::gflags - Glog::glog Threads::Threads ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss-sdr PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnss-sdr PUBLIC -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + if(NOT ENABLE_LOG) + message(STATUS "Internal logging is not enabled") + if(CMAKE_VERSION VERSION_GREATER 3.11.0) + target_compile_definitions(gnss-sdr INTERFACE -DABSL_MIN_LOG_LEVEL=3) + else() + set_property(TARGET gnss-sdr APPEND PROPERTY + INTERFACE_COMPILE_DEFINITIONS ABSL_MIN_LOG_LEVEL=3 + ) + endif() + endif() +endif() + target_compile_definitions(gnss-sdr PRIVATE -DGNSS_SDR_VERSION="${VERSION}") if(ENABLE_CUDA) @@ -55,6 +71,10 @@ if(ENABLE_GPERFTOOLS) endif() endif() +if(NOT ENABLE_LOG) + target_compile_definitions(gnss-sdr PRIVATE -DABSL_MIN_LOG_LEVEL=3) +endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_link_libraries(gnss-sdr PRIVATE "-lc++") diff --git a/src/main/main.cc b/src/main/main.cc index e4715a5c3..472f44148 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -29,30 +29,71 @@ #include "concurrent_queue.h" #include "control_thread.h" #include "gnss_sdr_filesystem.h" +#include "gnss_sdr_flags.h" #include "gnss_sdr_make_unique.h" #include "gps_acq_assist.h" #include // for diagnostic_information #include // for exception #include // for thread_resource_error -#include // for ShutDownCommandLineFlags -#include // for FLAGS_log_dir #include // for time_point #include // for exception +#include // for ofstream #include // for operator<< #include // for unique_ptr +#include // fro std::flush #include // for string -#if CUDA_GPU_ACCEL -// For the CUDA runtime routines (prefixed with "cuda_") -#include -#endif - +#if USE_GLOG_AND_GFLAGS +#include // for ShutDownCommandLineFlags +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include +std::string GnssSdrVersionString() { return std::string("gnss-sdr version ") + std::string(GNSS_SDR_VERSION) + "\n"; } +class GnssSdrLogSink : public absl::LogSink +{ +public: + GnssSdrLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + filename = absl::GetFlag(FLAGS_log_dir) + "/gnss-sdr.log"; + } + else + { + filename = GetTempDir() + "/gnss-sdr.log"; + } + logfile.open(filename); + } + void Send(const absl::LogEntry& entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; + std::string filename; +}; +#endif + +#if CUDA_GPU_ACCEL +// For the CUDA runtime routines (prefixed with "cuda_") +#include +#endif + /* * Concurrent queues that communicates the Telemetry Decoder @@ -69,14 +110,21 @@ int main(int argc, char** argv) { const std::string intro_help( std::string("\nGNSS-SDR is an Open Source GNSS Software Defined Receiver\n") + - "Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)\n" + + "Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors)\n" + "This program comes with ABSOLUTELY NO WARRANTY;\n" + "See COPYING file to see a copy of the General Public License\n \n"); - const std::string gnss_sdr_version(GNSS_SDR_VERSION); +#if USE_GLOG_AND_GFLAGS gflags::SetUsageMessage(intro_help); gflags::SetVersionString(gnss_sdr_version); gflags::ParseCommandLineFlags(&argc, &argv, true); +#else + absl::FlagsUsageConfig empty_config; + empty_config.version_string = &GnssSdrVersionString; + absl::SetFlagsUsageConfig(empty_config); + absl::SetProgramUsageMessage(intro_help); + absl::ParseCommandLine(argc, argv); +#endif std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait.\n"; } catch (const std::exception& e) @@ -99,8 +147,16 @@ int main(int argc, char** argv) if (GOOGLE_STRIP_LOG == 0) { + // google::InitGoogleLogging(argv[0]); +#if USE_GLOG_AND_GFLAGS google::InitGoogleLogging(argv[0]); if (FLAGS_log_dir.empty()) +#else + absl::LogSink* theSink = new GnssSdrLogSink; + absl::AddLogSink(theSink); + absl::InitializeLog(); + if (absl::GetFlag(FLAGS_log_dir).empty()) +#endif { std::cout << "Logging will be written at " << fs::temp_directory_path() @@ -111,27 +167,47 @@ int main(int argc, char** argv) { try { +#if USE_GLOG_AND_GFLAGS const fs::path p(FLAGS_log_dir); +#else + const fs::path p(absl::GetFlag(FLAGS_log_dir)); +#endif if (!fs::exists(p)) { std::cout << "The path " +#if USE_GLOG_AND_GFLAGS << FLAGS_log_dir +#else + << absl::GetFlag(FLAGS_log_dir) +#endif << " does not exist, attempting to create it.\n"; errorlib::error_code ec; if (!fs::create_directory(p, ec)) { +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. GNSS-SDR program ended.\n"; +#endif return 1; } } +#if USE_GLOG_AND_GFLAGS std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; +#else + std::cout << "Logging will be written at " << absl::GetFlag(FLAGS_log_dir) << '\n'; +#endif } catch (const std::exception& e) { std::cerr << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. GNSS-SDR program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. GNSS-SDR program ended.\n"; +#endif return 1; } } @@ -201,7 +277,11 @@ int main(int argc, char** argv) << elapsed_seconds.count() << " [seconds]\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif std::cout << "GNSS-SDR program ended.\n"; return return_code; } diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index bd0a8e92c..2785c5b8c 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -37,7 +37,7 @@ if(NOT GOOGLETEST_FOUND) set(GTEST_BUILD_COMMAND ${GTEST_BUILD_COMMAND} "--parallel 1") endif() if(CMAKE_GENERATOR STREQUAL Xcode) - set(GTEST_BUILD_COMMAND "xcodebuild" "-configuration" $<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel> "-target" "gtest_main") + set(GTEST_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug> "-target" "gtest_main") endif() if(GNSSSDR_GTEST_LOCAL_VERSION VERSION_LESS 1.12.0) set(DEBUG_DECORATION "d") @@ -305,7 +305,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) else() set(GNSS_SIM_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") if(CMAKE_GENERATOR STREQUAL Xcode) - set(GNSS_SIM_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}" "-target" "gnss_sim") + set(GNSS_SIM_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug> "-target" "gnss_sim") endif() if(TOOLCHAIN_ARG) set(TOOLCHAIN_ARG_GNSS_SIM "-DCMAKE_NO_SYSTEM_FROM_IMPORTED=ON") @@ -355,7 +355,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) endif() set(GNSSTK_BUILD_COMMAND "${CMAKE_MAKE_PROGRAM}") if(CMAKE_GENERATOR STREQUAL Xcode) - set(GNSSTK_BUILD_COMMAND "xcodebuild" "-configuration" "${CMAKE_BUILD_TYPE}") + set(GNSSTK_BUILD_COMMAND "xcodebuild" "-configuration" $<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>) endif() include(GNUInstallDirs) find_program(Patch_EXECUTABLE NAME patch PATHS ENV PATH) @@ -591,8 +591,6 @@ if(ENABLE_UNIT_TESTING) PRIVATE Boost::thread Armadillo::armadillo - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -621,6 +619,12 @@ if(ENABLE_UNIT_TESTING) system_testing_lib core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(run_tests PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(run_tests PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(run_tests INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -752,8 +756,6 @@ if(ENABLE_FPGA) PRIVATE Armadillo::armadillo Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks GTest::GTest @@ -767,9 +769,16 @@ if(ENABLE_FPGA) algorithms_libs core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) + xcode_remove_warning_duplicates(gps_l1_ca_dll_pll_tracking_test_fpga) install(TARGETS gps_l1_ca_dll_pll_tracking_test_fpga RUNTIME DESTINATION bin COMPONENT "fpga-test" @@ -854,12 +863,18 @@ if(ENABLE_SYSTEM_TESTING) #### TTFF set(OPT_LIBS_ Boost::thread Boost::date_time - Threads::Threads Gflags::gflags Glog::glog + Threads::Threads Gnuradio::runtime GTest::GTest GTest::Main Gnuradio::blocks Gnuradio::filter Gnuradio::analog algorithms_libs core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) + add_definitions(-DUSE_GLOG=1) + else() + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + endif() if(NOT ENABLE_PACKAGING) add_system_test(ttff) endif() @@ -869,11 +884,17 @@ if(ENABLE_SYSTEM_TESTING) set(OPT_LIBS_ algorithms_libs core_receiver core_system_parameters gnss_sdr_flags system_testing_lib signal_processing_testing_lib - Boost::thread Threads::Threads Gflags::gflags Glog::glog + Boost::thread Threads::Threads GTest::GTest GTest::Main Gnuradio::runtime Gnuradio::blocks Gnuradio::filter Gnuradio::analog Matio::matio Volkgnsssdr::volkgnsssdr ) + if(ENABLE_GLOG_AND_GFLAGS) + set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) + add_definitions(-DUSE_GLOG=1) + else() + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + endif() add_system_test(position_test) if(ENABLE_GPERFTOOLS) if(GPERFTOOLS_FOUND) @@ -926,8 +947,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(flowgraph_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime GTest::GTest GTest::Main @@ -938,6 +957,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver algorithms_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(flowgraph_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(flowgraph_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(flowgraph_test PRIVATE @@ -975,8 +1000,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnss_block_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -991,6 +1014,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver algorithms_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss_block_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnss_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(gnss_block_test PRIVATE ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs @@ -1025,8 +1054,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnuradio_block_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -1039,6 +1066,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) core_receiver algorithms_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnuradio_block_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnuradio_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() xcode_remove_warning_duplicates(gnuradio_block_test) @@ -1063,14 +1096,19 @@ endif() target_link_libraries(matio_test PRIVATE algorithms_libs - Gflags::gflags - Glog::glog GTest::GTest GTest::Main Matio::matio core_receiver ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(matio_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(matio_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) +endif() + target_include_directories(matio_test INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -1099,8 +1137,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(acq_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -1116,6 +1152,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) signal_processing_testing_lib core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(acq_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(acq_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() target_include_directories(acq_test INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -1182,8 +1224,6 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(trk_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog Gnuradio::runtime Gnuradio::blocks Gnuradio::filter @@ -1198,6 +1238,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) signal_generator_gr_blocks core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(trk_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(trk_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) @@ -1249,14 +1295,18 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(control_thread_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog GTest::GTest GTest::Main signal_source_adapters algorithms_libs core_receiver ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(control_thread_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(control_thread_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + endif() xcode_remove_warning_duplicates(control_thread_test) diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 5566f59cc..04b7e3458 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -34,7 +34,6 @@ #ifndef GNSS_SDR_GNUPLOT_I_H #define GNSS_SDR_GNUPLOT_I_H -#include #include #include // for getenv() #include // for strncpy @@ -47,7 +46,13 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include DEFINE_bool(show_plots, true, "Show plots on screen. Disable for non-interactive testing."); +#else +#include +ABSL_FLAG(bool, show_plots, true, "Show plots on screen. Disable for non-interactive testing."); +#endif #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) // defined for 32 and 64-bit environments diff --git a/src/tests/common-files/observable_tests_flags.h b/src/tests/common-files/observable_tests_flags.h index 444211337..a0ab470b6 100644 --- a/src/tests/common-files/observable_tests_flags.h +++ b/src/tests/common-files/observable_tests_flags.h @@ -17,12 +17,27 @@ #ifndef GNSS_SDR_OBSERVABLE_TESTS_FLAGS_H #define GNSS_SDR_OBSERVABLE_TESTS_FLAGS_H -#include #include +#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_double(skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); DEFINE_bool(compute_single_diffs, false, "Compute also the single difference errors for Accumulated Carrier Phase and Carrier Doppler (requires LO synchronization between receivers)"); DEFINE_bool(compare_with_5X, false, "Compare the E5a Doppler and Carrier Phases with the E5 full bw in RINEX (expect discrepancy due to the center frequencies differences"); DEFINE_bool(duplicated_satellites_test, false, "Enable special observable test mode where the scenario contains duplicated satellite orbits"); DEFINE_string(duplicated_satellites_prns, "1,2,3,4", "List of duplicated satellites PRN pairs (i.e. 1,2,3,4 indicates that the PRNs 1,2 share the same orbit. The same applies for PRNs 3,4)"); +#else +ABSL_FLAG(double, skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); +ABSL_FLAG(bool, compute_single_diffs, false, "Compute also the single difference errors for Accumulated Carrier Phase and Carrier Doppler (requires LO synchronization between receivers)"); +ABSL_FLAG(bool, compare_with_5X, false, "Compare the E5a Doppler and Carrier Phases with the E5 full bw in RINEX (expect discrepancy due to the center frequencies differences"); +ABSL_FLAG(bool, duplicated_satellites_test, false, "Enable special observable test mode where the scenario contains duplicated satellite orbits"); +ABSL_FLAG(std::string, duplicated_satellites_prns, "1,2,3,4", "List of duplicated satellites PRN pairs (i.e. 1,2,3,4 indicates that the PRNs 1,2 share the same orbit. The same applies for PRNs 3,4)"); +#endif + #endif diff --git a/src/tests/common-files/signal_generator_flags.h b/src/tests/common-files/signal_generator_flags.h index c43763fd3..be2ae03ac 100644 --- a/src/tests/common-files/signal_generator_flags.h +++ b/src/tests/common-files/signal_generator_flags.h @@ -17,10 +17,17 @@ #ifndef GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H #define GNSS_SDR_SIGNAL_GENERATOR_FLAGS_H -#include +#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_bool(disable_generator, false, "Disable the signal generator (a external signal file must be available for the test)"); DEFINE_string(generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); DEFINE_string(rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); @@ -34,5 +41,20 @@ DEFINE_int32(test_satellite_PRN, 1, "PRN of the satellite under test (must be vi DEFINE_int32(test_satellite_PRN2, 2, "PRN of the satellite under test (must be visible during the observation time)"); DEFINE_string(test_satellite_PRN_list, "1,2,3,6,9,10,12,17,20,23,28", "List of PRN of the satellites under test (must be visible during the observation time)"); DEFINE_double(CN0_dBHz, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 [dB-Hz]"); +#else +ABSL_FLAG(bool, disable_generator, false, "Disable the signal generator (a external signal file must be available for the test)"); +ABSL_FLAG(std::string, generator_binary, std::string(SW_GENERATOR_BIN), "Path of software-defined signal generator binary"); +ABSL_FLAG(std::string, rinex_nav_file, std::string(DEFAULT_RINEX_NAV), "Input RINEX navigation file"); +ABSL_FLAG(int32_t, duration, 100, "Duration of the experiment [in seconds, max = 300]"); +ABSL_FLAG(std::string, static_position, "30.286502,120.032669,100", "Static receiver position [latitude,longitude,height]"); +ABSL_FLAG(std::string, dynamic_position, "", "Observer positions file, in .csv or .nmea format"); +ABSL_FLAG(std::string, filename_rinex_obs, "sim.16o", "Filename of output RINEX navigation file"); +ABSL_FLAG(std::string, filename_raw_data, "signal_out.bin", "Filename of output raw data file"); +ABSL_FLAG(int32_t, fs_gen_sps, 2600000, "Sampling frequency [sps]"); +ABSL_FLAG(int32_t, test_satellite_PRN, 1, "PRN of the satellite under test (must be visible during the observation time)"); +ABSL_FLAG(int32_t, test_satellite_PRN2, 2, "PRN of the satellite under test (must be visible during the observation time)"); +ABSL_FLAG(std::string, test_satellite_PRN_list, "1,2,3,6,9,10,12,17,20,23,28", "List of PRN of the satellites under test (must be visible during the observation time)"); +ABSL_FLAG(double, CN0_dBHz, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 [dB-Hz]"); +#endif #endif diff --git a/src/tests/common-files/test_flags.h b/src/tests/common-files/test_flags.h index 814cf69e6..937ad4418 100644 --- a/src/tests/common-files/test_flags.h +++ b/src/tests/common-files/test_flags.h @@ -17,16 +17,28 @@ #ifndef GNSS_SDR_TEST_FLAGS_H #define GNSS_SDR_TEST_FLAGS_H -#include + +#include #include + +#if USE_GLOG_AND_GFLAGS +#include #if defined GNUPLOT_EXECUTABLE DEFINE_string(gnuplot_executable, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path"); #elif !defined GNUPLOT_EXECUTABLE DEFINE_string(gnuplot_executable, "", "Gnuplot binary path"); #endif - DEFINE_bool(plot_acq_grid, false, "Plots acquisition grid with gnuplot"); DEFINE_int32(plot_decimate, 1, "Decimate plots"); - +#else +#include +#if defined GNUPLOT_EXECUTABLE +ABSL_FLAG(std::string, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path"); +#elif !defined GNUPLOT_EXECUTABLE +ABSL_FLAG(std::string, gnuplot_executable, "", "Gnuplot binary path"); +#endif +ABSL_FLAG(bool, plot_acq_grid, false, "Plots acquisition grid with gnuplot"); +ABSL_FLAG(int32_t, plot_decimate, 1, "Decimate plots"); +#endif #endif diff --git a/src/tests/common-files/tracking_tests_flags.h b/src/tests/common-files/tracking_tests_flags.h index 8bbc4701c..0027fb862 100644 --- a/src/tests/common-files/tracking_tests_flags.h +++ b/src/tests/common-files/tracking_tests_flags.h @@ -17,10 +17,12 @@ #ifndef GNSS_SDR_TRACKING_TESTS_FLAGS_H #define GNSS_SDR_TRACKING_TESTS_FLAGS_H -#include +#include #include #include +#if USE_GLOG_AND_GFLAGS +#include DEFINE_string(trk_test_implementation, std::string("GPS_L1_CA_DLL_PLL_Tracking"), "Tracking block implementation under test, defaults to GPS_L1_CA_DLL_PLL_Tracking"); // Input signal configuration @@ -77,6 +79,63 @@ DEFINE_bool(high_dyn, false, "Activates the code resampler and NCO generator for // Test output configuration DEFINE_bool(plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot"); +#else +#include +ABSL_FLAG(std::string, trk_test_implementation, std::string("GPS_L1_CA_DLL_PLL_Tracking"), "Tracking block implementation under test, defaults to GPS_L1_CA_DLL_PLL_Tracking"); +// Input signal configuration +ABSL_FLAG(bool, enable_external_signal_file, false, "Use an external signal file capture instead of the software-defined signal generator"); +ABSL_FLAG(double, external_signal_acquisition_threshold, 2.5, "Threshold for satellite acquisition when external file is used"); +ABSL_FLAG(int32_t, external_signal_acquisition_dwells, 5, "Maximum dwells count for satellite acquisition when external file is used"); +ABSL_FLAG(double, external_signal_acquisition_doppler_max_hz, 5000.0, "Doppler max for satellite acquisition when external file is used"); +ABSL_FLAG(double, external_signal_acquisition_doppler_step_hz, 125.0, "Doppler step for satellite acquisition when external file is used"); +ABSL_FLAG(bool, use_acquisition_resampler, false, "Reduce the sampling rate of the input signal for the acquisition in order to optimize the SNR and decrease the processor load"); +ABSL_FLAG(std::string, signal_file, std::string("signal_out.bin"), "Path of the external signal capture file"); +ABSL_FLAG(double, CN0_dBHz_start, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 start sweep value [dB-Hz]"); +ABSL_FLAG(double, CN0_dBHz_stop, std::numeric_limits::infinity(), "Enable noise generator and set the CN0 stop sweep value [dB-Hz]"); +ABSL_FLAG(double, CN0_dB_step, 3.0, "Noise generator CN0 sweep step value [dB]"); + +ABSL_FLAG(double, PLL_bw_hz_start, 20.0, "PLL Wide configuration start sweep value [Hz]"); +ABSL_FLAG(double, PLL_bw_hz_stop, 20.0, "PLL Wide configuration stop sweep value [Hz]"); +ABSL_FLAG(double, PLL_bw_hz_step, 5.0, "PLL Wide configuration sweep step value [Hz]"); + +ABSL_FLAG(double, DLL_bw_hz_start, 1.0, "DLL Wide configuration start sweep value [Hz]"); +ABSL_FLAG(double, DLL_bw_hz_stop, 1.0, "DLL Wide configuration stop sweep value [Hz]"); +ABSL_FLAG(double, DLL_bw_hz_step, 0.25, "DLL Wide configuration sweep step value [Hz]"); + +ABSL_FLAG(double, fll_bw_hz, 4.0, "FLL filter bandwidth [Hz]"); +ABSL_FLAG(bool, enable_fll_pull_in, false, "Enable FLL in pull-in phase"); +ABSL_FLAG(bool, enable_fll_steady_state, false, "Enable FLL in steady-state phase"); + +ABSL_FLAG(double, PLL_narrow_bw_hz, 5.0, "PLL Narrow configuration value [Hz]"); +ABSL_FLAG(double, DLL_narrow_bw_hz, 0.75, "DLL Narrow configuration value [Hz]"); + +ABSL_FLAG(double, acq_Doppler_error_hz_start, 1000.0, "Acquisition Doppler error start sweep value [Hz]"); +ABSL_FLAG(double, acq_Doppler_error_hz_stop, -1000.0, "Acquisition Doppler error stop sweep value [Hz]"); +ABSL_FLAG(double, acq_Doppler_error_hz_step, -50.0, "Acquisition Doppler error sweep step value [Hz]"); + +ABSL_FLAG(double, acq_Delay_error_chips_start, 2.0, "Acquisition Code Delay error start sweep value [Chips]"); +ABSL_FLAG(double, acq_Delay_error_chips_stop, -2.0, "Acquisition Code Delay error stop sweep value [Chips]"); +ABSL_FLAG(double, acq_Delay_error_chips_step, -0.1, "Acquisition Code Delay error sweep step value [Chips]"); + +ABSL_FLAG(double, acq_to_trk_delay_s, 0.0, "Acquisition to Tracking delay value [s]"); + + +ABSL_FLAG(int64_t, skip_samples, 0, "Skip an initial transitory in the processed signal file capture [samples]"); + +ABSL_FLAG(int32_t, plot_detail_level, 0, "Specify the desired plot detail (0,1,2): 0 - Minimum plots (default) 2 - Plot all tracking parameters"); + +ABSL_FLAG(double, skip_trk_transitory_s, 1.0, "Skip the initial tracking output signal to avoid transitory results [s]"); + +// Emulated acquisition configuration + +// Tracking configuration +ABSL_FLAG(int32_t, extend_correlation_symbols, 1, "Set the tracking coherent correlation to N symbols (up to 20 for GPS L1 C/A)"); +ABSL_FLAG(int32_t, smoother_length, 10, "Set the moving average size for the carrier phase and code phase in case of high dynamics"); +ABSL_FLAG(bool, high_dyn, false, "Activates the code resampler and NCO generator for high dynamics"); + +// Test output configuration +ABSL_FLAG(bool, plot_gps_l1_tracking_test, false, "Plots results of GpsL1CADllPllTrackingTest with gnuplot"); #endif +#endif diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 5f8d52aab..669bc91c8 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -19,26 +19,64 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" +#include +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS #include #include -#include -#include - #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } +DECLARE_string(log_dir); #endif +#else +#include "gnss_sdr_flags.h" +#include +#include +#include +#include +#include +#include + +class TestLogSink : public absl::LogSink +{ +public: + TestLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + logfile.open(absl::GetFlag(FLAGS_log_dir) + "/test.log"); + } + else + { + logfile.open(GetTempDir() + "/test.log"); + } + } + void Send(const absl::LogEntry &entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; +}; +#endif + Concurrent_Queue global_gps_acq_assist_queue; Concurrent_Map global_gps_acq_assist_map; -DECLARE_string(log_dir); int main(int argc, char **argv) { +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); try { @@ -48,6 +86,19 @@ int main(int argc, char **argv) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + try + { + testing::InitGoogleTest(&argc, argv); + } + catch (...) + { + } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest + absl::LogSink *testLogSink = new TestLogSink; + absl::AddLogSink(testLogSink); + absl::InitializeLog(); +#endif int res = 0; try { @@ -57,6 +108,10 @@ int main(int argc, char **argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/system-tests/libs/CMakeLists.txt b/src/tests/system-tests/libs/CMakeLists.txt index eb936a24f..01a5bfdeb 100644 --- a/src/tests/system-tests/libs/CMakeLists.txt +++ b/src/tests/system-tests/libs/CMakeLists.txt @@ -32,12 +32,18 @@ endif() target_link_libraries(system_testing_lib PUBLIC Armadillo::armadillo - Gflags::gflags PRIVATE Boost::headers Matio::matio ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(system_testing_lib PUBLIC Gflags::gflags) + target_compile_definitions(system_testing_lib PUBLIC -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(system_testing_lib PUBLIC absl::flags) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(system_testing_lib diff --git a/src/tests/system-tests/libs/position_test_flags.h b/src/tests/system-tests/libs/position_test_flags.h index 57cc1e5dd..abff0f4a6 100644 --- a/src/tests/system-tests/libs/position_test_flags.h +++ b/src/tests/system-tests/libs/position_test_flags.h @@ -17,10 +17,18 @@ #ifndef GNSS_SDR_POSITION_TEST_FLAGS_H #define GNSS_SDR_POSITION_TEST_FLAGS_H -#include + +#include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test."); DEFINE_bool(plot_position_test, false, "Plots results of with gnuplot"); DEFINE_bool(static_scenario, true, "Compute figures of merit for static user position (DRMS, CEP, etc..)"); @@ -35,5 +43,21 @@ DEFINE_double(precision_SEP, 15.0, "Static scenario 3D (East, North, Up) precisi DEFINE_double(dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]"); DEFINE_double(dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) velocity accuracy RMSE threshold [meters/second]"); DEFINE_bool(enable_carrier_smoothing, false, "Activates carrier smoothing of pseudoranges"); +#else +ABSL_FLAG(std::string, config_file_ptest, std::string(""), "File containing the configuration parameters for the position test."); +ABSL_FLAG(bool, plot_position_test, false, "Plots results of with gnuplot"); +ABSL_FLAG(bool, static_scenario, true, "Compute figures of merit for static user position (DRMS, CEP, etc..)"); +ABSL_FLAG(bool, use_ref_motion_file, false, "Enable or disable the use of a reference file containing the true receiver position, velocity and acceleration."); +ABSL_FLAG(int32_t, ref_motion_file_type, 1, "Type of reference motion file: 1- Spirent CSV motion file"); +ABSL_FLAG(std::string, ref_motion_filename, std::string("motion.csv"), "Path and filename for the reference motion file"); +ABSL_FLAG(std::string, pvt_solver_dump_filename, std::string("PVT.dat"), "Path and filename for the PVT solver binary dump file"); +ABSL_FLAG(double, static_2D_error_m, 2.0, "Static scenario 2D (East, North) positioning error threshold [meters]"); +ABSL_FLAG(double, static_3D_error_m, 5.0, "Static scenario 3D (East, North, Up) positioning error threshold [meters]"); +ABSL_FLAG(double, accuracy_CEP, 3.0, "Static scenario 2D (East, North) accuracy Circular Error Position (CEP) threshold [meters]"); +ABSL_FLAG(double, precision_SEP, 15.0, "Static scenario 3D (East, North, Up) precision Spherical Error Position (SEP) threshold [meters]"); +ABSL_FLAG(double, dynamic_3D_position_RMSE, 10.0, "Dynamic scenario 3D (ECEF) accuracy RMSE threshold [meters]"); +ABSL_FLAG(double, dynamic_3D_velocity_RMSE, 5.0, "Dynamic scenario 3D (ECEF) velocity accuracy RMSE threshold [meters/second]"); +ABSL_FLAG(bool, enable_carrier_smoothing, false, "Activates carrier smoothing of pseudoranges"); +#endif #endif diff --git a/src/tests/system-tests/position_test.cc b/src/tests/system-tests/position_test.cc index 5802aa9ca..f15fdf6aa 100644 --- a/src/tests/system-tests/position_test.cc +++ b/src/tests/system-tests/position_test.cc @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -48,16 +47,53 @@ #include #include #include +#include #include +#if USE_GLOG_AND_GFLAGS +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#include +#include +#include +#endif +#if USE_GLOG_AND_GFLAGS DEFINE_int32(num_channels, 11, "Number of channels"); +#else +ABSL_FLAG(int32_t, num_channels, 11, "Number of channels"); +class PositionTestLogSink : public absl::LogSink +{ +public: + PositionTestLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + logfile.open(absl::GetFlag(FLAGS_log_dir) + "/position_test.log"); + } + else + { + logfile.open(GetTempDir() + "/position_test.log"); + } + } + void Send(const absl::LogEntry& entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; +}; +#endif // For GPS NAVIGATION (L1) Concurrent_Queue global_gps_acq_assist_queue; @@ -84,11 +120,15 @@ private: std::string p5; std::string p6; +#if USE_GLOG_AND_GFLAGS const double baseband_sampling_freq = static_cast(FLAGS_fs_gen_sps); - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - +#else + const double baseband_sampling_freq = static_cast(absl::GetFlag(FLAGS_fs_gen_sps)); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif void print_results(const arma::mat& R_eb_enu) const; std::shared_ptr config; std::shared_ptr config_f; @@ -101,6 +141,7 @@ private: int PositionSystemTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -128,6 +169,35 @@ int PositionSystemTest::configure_generator() { p6 = std::string("-CN0_dBHz=") + std::to_string(FLAGS_CN0_dBHz); } +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(std::min(absl::GetFlag(FLAGS_duration) * 10, 3000)); + if (absl::GetFlag(FLAGS_duration) > 300) + { + std::cout << "WARNING: Duration has been set to its maximum value of 300 s\n"; + } + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + if (absl::GetFlag(FLAGS_CN0_dBHz) > 100.0) + { + p6 = std::string("-CN0_dBHz=45"); + } + else + { + p6 = std::string("-CN0_dBHz=") + std::to_string(absl::GetFlag(FLAGS_CN0_dBHz)); + } +#endif return 0; } @@ -162,7 +232,11 @@ int PositionSystemTest::generate_signal() int PositionSystemTest::configure_receiver() { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { config = std::make_shared(); const int sampling_rate_internal = baseband_sampling_freq; @@ -182,7 +256,11 @@ int PositionSystemTest::configure_receiver() const int grid_density = 16; const float zero = 0.0; +#if USE_GLOG_AND_GFLAGS const int number_of_channels = FLAGS_num_channels; +#else + const int number_of_channels = absl::GetFlag(FLAGS_num_channels); +#endif const int in_acquisition = 1; const float threshold = 2.5; @@ -199,14 +277,22 @@ int PositionSystemTest::configure_receiver() const float early_late_space_narrow_chips = 0.1; const float pll_bw_narrow_hz = 15.0; const float dll_bw_narrow_hz = 1.5; +#if USE_GLOG_AND_GFLAGS const int extend_correlation_symbols = FLAGS_extend_correlation_symbols; // defaults to 1 - +#else + const int extend_correlation_symbols = absl::GetFlag(FLAGS_extend_correlation_symbols); // defaults to 1 +#endif const int display_rate_ms = 500; const int output_rate_ms = 100; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_rate_internal)); // Enable automatic resampler for the acquisition, if required + +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); } @@ -305,8 +391,13 @@ int PositionSystemTest::configure_receiver() // Set Observables config->set_property("Observables.implementation", "Hybrid_Observables"); +#if USE_GLOG_AND_GFLAGS config->set_property("Observables.enable_carrier_smoothing", FLAGS_enable_carrier_smoothing ? "true" : "false"); config->set_property("Observables.smoothing_factor", std::to_string(FLAGS_carrier_smoothing_factor)); +#else + config->set_property("Observables.enable_carrier_smoothing", absl::GetFlag(FLAGS_enable_carrier_smoothing) ? "true" : "false"); + config->set_property("Observables.smoothing_factor", std::to_string(absl::GetFlag(FLAGS_carrier_smoothing_factor))); +#endif config->set_property("Observables.dump", "false"); config->set_property("Observables.dump_filename", "./observables.dat"); @@ -334,7 +425,11 @@ int PositionSystemTest::configure_receiver() } else { +#if USE_GLOG_AND_GFLAGS config_f = std::make_shared(FLAGS_config_file_ptest); +#else + config_f = std::make_shared(absl::GetFlag(FLAGS_config_file_ptest)); +#endif config = nullptr; } return 0; @@ -344,7 +439,11 @@ int PositionSystemTest::configure_receiver() int PositionSystemTest::run_receiver() { std::shared_ptr control_thread; +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { control_thread = std::make_shared(config); } @@ -472,7 +571,11 @@ void PositionSystemTest::check_results() arma::mat ref_LLH; // Geodetic coordinates (latitude, longitude, height) reference in WGS84 datum arma::vec ref_time_s; +#if USE_GLOG_AND_GFLAGS std::istringstream iss2(FLAGS_static_position); +#else + std::istringstream iss2(absl::GetFlag(FLAGS_static_position)); +#endif std::string str_aux; std::getline(iss2, str_aux, ','); double ref_lat = std::stod(str_aux); @@ -491,7 +594,11 @@ void PositionSystemTest::check_results() cart2utm(true_r_eb_e, utm_zone, ref_r_enu); Rtklib_Solver_Dump_Reader pvt_reader; +#if USE_GLOG_AND_GFLAGS pvt_reader.open_obs_file(FLAGS_pvt_solver_dump_filename); +#else + pvt_reader.open_obs_file(absl::GetFlag(FLAGS_pvt_solver_dump_filename)); +#endif int64_t n_epochs_pvt = pvt_reader.num_epochs(); R_eb_e = arma::zeros(3, n_epochs_pvt); V_eb_e = arma::zeros(3, n_epochs_pvt); @@ -525,7 +632,11 @@ void PositionSystemTest::check_results() ASSERT_FALSE(current_epoch == 0) << "PVT dump is empty"; // compute results +#if USE_GLOG_AND_GFLAGS if (FLAGS_static_scenario) +#else + if (absl::GetFlag(FLAGS_static_scenario)) +#endif { double sigma_E_2_precision = arma::var(R_eb_enu.row(0)); double sigma_N_2_precision = arma::var(R_eb_enu.row(1)); @@ -566,11 +677,17 @@ void PositionSystemTest::check_results() std::stringstream stm; std::ofstream position_test_file; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_config_file_ptest.empty()) { stm << "Configuration file: " << FLAGS_config_file_ptest << '\n'; } - +#else + if (!absl::GetFlag(FLAGS_config_file_ptest).empty()) + { + stm << "Configuration file: " << absl::GetFlag(FLAGS_config_file_ptest) << '\n'; + } +#endif stm << "---- STATIC ACCURACY ----\n"; stm << "2DRMS = " << 2 * sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]\n"; stm << "DRMS = " << sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]\n"; @@ -607,7 +724,7 @@ void PositionSystemTest::check_results() // Sanity Check double accuracy_CEP = 0.62 * sqrt(sigma_N_2_accuracy) + 0.56 * sqrt(sigma_E_2_accuracy); double precision_SEP = 0.51 * (sigma_E_2_precision + sigma_N_2_precision + sigma_U_2_precision); - +#if USE_GLOG_AND_GFLAGS EXPECT_LT(static_2D_error_m, FLAGS_static_2D_error_m); EXPECT_LT(static_3D_error_m, FLAGS_static_3D_error_m); ASSERT_LT(accuracy_CEP, FLAGS_accuracy_CEP); @@ -617,12 +734,27 @@ void PositionSystemTest::check_results() { print_results(R_eb_enu); } +#else + EXPECT_LT(static_2D_error_m, absl::GetFlag(FLAGS_static_2D_error_m)); + EXPECT_LT(static_3D_error_m, absl::GetFlag(FLAGS_static_3D_error_m)); + ASSERT_LT(accuracy_CEP, absl::GetFlag(FLAGS_accuracy_CEP)); + ASSERT_LT(precision_SEP, absl::GetFlag(FLAGS_precision_SEP)); + + if (absl::GetFlag(FLAGS_plot_position_test) == true) + { + print_results(R_eb_enu); + } +#endif } else { // dynamic position Spirent_Motion_Csv_Dump_Reader ref_reader; +#if USE_GLOG_AND_GFLAGS ref_reader.open_obs_file(FLAGS_ref_motion_filename); +#else + ref_reader.open_obs_file(absl::GetFlag(FLAGS_ref_motion_filename)); +#endif int64_t n_epochs_ref = ref_reader.num_epochs(); ref_R_eb_e = arma::zeros(3, n_epochs_ref); ref_V_eb_e = arma::zeros(3, n_epochs_ref); @@ -692,10 +824,17 @@ void PositionSystemTest::check_results() // report std::cout << "----- Position and Velocity 3D ECEF error statistics -----\n"; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_config_file_ptest.empty()) { std::cout << "---- Configuration file: " << FLAGS_config_file_ptest << '\n'; } +#else + if (!absl::GetFlag(FLAGS_config_file_ptest).empty()) + { + std::cout << "---- Configuration file: " << absl::GetFlag(FLAGS_config_file_ptest) << '\n'; + } +#endif std::streamsize ss = std::cout.precision(); std::cout << std::setprecision(10) << "---- 3D ECEF Position RMSE = " << rmse_R_eb_e << ", mean = " << error_mean_R_eb_e @@ -711,14 +850,24 @@ void PositionSystemTest::check_results() << " [m/s]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_position_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_position_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (!gnuplot_executable.empty()) { Gnuplot g1("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -740,7 +889,11 @@ void PositionSystemTest::check_results() g1.cmd("set key box opaque"); g1.plot_xyz(X, Y, Z, "ECEF 3D error"); g1.set_legend(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g1.savetops("ECEF_3d_error"); } @@ -750,7 +903,11 @@ void PositionSystemTest::check_results() } arma::vec time_vector_from_start_s = receiver_time_s - receiver_time_s(0); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g3.showonscreen(); // window output } @@ -771,7 +928,11 @@ void PositionSystemTest::check_results() g3.set_style("lines"); g3.plot_xy(time_vector_from_start_s, error_mean, "Mean"); g3.set_legend(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g3.savetops("Position_3d_error"); } @@ -781,7 +942,11 @@ void PositionSystemTest::check_results() } Gnuplot g4("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -802,7 +967,11 @@ void PositionSystemTest::check_results() g4.set_style("lines"); g4.plot_xy(time_vector_from_start_s, error_mean_v, "Mean"); g4.set_legend(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g4.savetops("Velocity_3d_error"); } @@ -813,17 +982,27 @@ void PositionSystemTest::check_results() } } - // ERROR CHECK - // todo: reduce the error tolerance or enable the option to pass the error tolerance by parameter + // ERROR CHECK + // todo: reduce the error tolerance or enable the option to pass the error tolerance by parameter + +#if USE_GLOG_AND_GFLAGS EXPECT_LT(rmse_R_eb_e, FLAGS_dynamic_3D_position_RMSE); // 3D RMS positioning error less than 10 meters EXPECT_LT(rmse_V_eb_e, FLAGS_dynamic_3D_velocity_RMSE); // 3D RMS speed error less than 5 meters/s (18 km/h) +#else + EXPECT_LT(rmse_R_eb_e, absl::GetFlag(FLAGS_dynamic_3D_position_RMSE)); // 3D RMS positioning error less than 10 meters + EXPECT_LT(rmse_V_eb_e, absl::GetFlag(FLAGS_dynamic_3D_velocity_RMSE)); // 3D RMS speed error less than 5 meters/s (18 km/h) +#endif } } void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const { +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_position_test has been set to TRUE,\n"; @@ -874,7 +1053,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -895,7 +1078,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const g1.cmd("set grid front"); g1.cmd("replot"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g1.savetops("Position_test_2D"); g1.savetopdf("Position_test_2D", 18); @@ -907,7 +1094,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const } Gnuplot g2("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -930,7 +1121,11 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const std::to_string(ninty_sas) + "\n fx(v,u) = r*cos(v)*cos(u)\n fy(v,u) = r*cos(v)*sin(u)\n fz(v) = r*sin(v) \n splot fx(v,u),fy(v,u),fz(v) title \"90%-SAS\" lt rgb \"gray\"\n"); g2.plot_xyz(east, north, up, "3D Position Fixes"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { g2.savetops("Position_test_3D"); g2.savetopdf("Position_test_3D"); @@ -951,20 +1146,33 @@ void PositionSystemTest::print_results(const arma::mat& R_eb_enu) const TEST_F(PositionSystemTest /*unused*/, Position_system_test /*unused*/) { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { // Configure the signal generator configure_generator(); // Generate signal raw signal samples and observations RINEX file + +#if USE_GLOG_AND_GFLAGS if (!FLAGS_disable_generator) +#else + if (!absl::GetFlag(FLAGS_disable_generator)) +#endif { generate_signal(); } } else { +#if USE_GLOG_AND_GFLAGS config_filename_no_extension = FLAGS_config_file_ptest.substr(FLAGS_config_file_ptest.find_last_of("/\\") + 1); +#else + config_filename_no_extension = absl::GetFlag(FLAGS_config_file_ptest).substr(absl::GetFlag(FLAGS_config_file_ptest).find_last_of("/\\") + 1); +#endif config_filename_no_extension = config_filename_no_extension.erase(config_filename_no_extension.length() - 5); } @@ -991,8 +1199,15 @@ int main(int argc, char** argv) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + absl::LogSink* logSink = new PositionTestLogSink; + absl::AddLogSink(logSink); + absl::InitializeLog(); +#endif // Run the Tests try @@ -1003,6 +1218,10 @@ int main(int argc, char** argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/system-tests/ttff.cc b/src/tests/system-tests/ttff.cc index 55f0698cf..ebaebee55 100644 --- a/src/tests/system-tests/ttff.cc +++ b/src/tests/system-tests/ttff.cc @@ -26,12 +26,11 @@ #include #include #include -#include -#include #include #include #include #include +#include #include #include #include @@ -41,19 +40,37 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#endif + +#if USE_GLOG_AND_GFLAGS DEFINE_int32(fs_in, 4000000, "Sampling rate, in Samples/s"); DEFINE_int32(max_measurement_duration, 90, "Maximum time waiting for a position fix, in seconds"); DEFINE_int32(num_measurements, 2, "Number of measurements"); DEFINE_string(device_address, "192.168.40.2", "USRP device IP address"); DEFINE_string(subdevice, "A:0", "USRP subdevice"); DEFINE_string(config_file_ttff, std::string(""), "File containing the configuration parameters for the TTFF test."); +#else +ABSL_FLAG(int32_t, fs_in, 4000000, "Sampling rate, in Samples/s"); +ABSL_FLAG(int32_t, max_measurement_duration, 90, "Maximum time waiting for a position fix, in seconds"); +ABSL_FLAG(int32_t, num_measurements, 2, "Number of measurements"); +ABSL_FLAG(std::string, device_address, "192.168.40.2", "USRP device IP address"); +ABSL_FLAG(std::string, subdevice, "A:0", "USRP subdevice"); +ABSL_FLAG(std::string, config_file_ttff, std::string(""), "File containing the configuration parameters for the TTFF test."); +#endif // For GPS NAVIGATION (L1) Concurrent_Queue global_gps_acq_assist_queue; @@ -121,8 +138,11 @@ void TtffTest::config_1() { config = std::make_shared(); +#if USE_GLOG_AND_GFLAGS config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(FLAGS_fs_in)); +#else +#endif // Set the assistance system parameters config->set_property("GNSS-SDR.SUPL_gps_ephemeris_server", "supl.google.com"); config->set_property("GNSS-SDR.SUPL_gps_ephemeris_port", std::to_string(7275)); @@ -137,11 +157,15 @@ void TtffTest::config_1() config->set_property("SignalSource.item_type", "cshort"); config->set_property("SignalSource.implementation", "UHD_Signal_Source"); config->set_property("SignalSource.freq", std::to_string(central_freq)); - config->set_property("SignalSource.sampling_frequency", std::to_string(FLAGS_fs_in)); config->set_property("SignalSource.gain", std::to_string(gain_dB)); +#if USE_GLOG_AND_GFLAGS + config->set_property("SignalSource.sampling_frequency", std::to_string(FLAGS_fs_in)); config->set_property("SignalSource.subdevice", FLAGS_subdevice); config->set_property("SignalSource.samples", std::to_string(FLAGS_fs_in * FLAGS_max_measurement_duration)); config->set_property("SignalSource.device_address", FLAGS_device_address); +#else + +#endif // Set the Signal Conditioner config->set_property("SignalConditioner.implementation", "Signal_Conditioner"); @@ -166,13 +190,21 @@ void TtffTest::config_1() config->set_property("InputFilter.band2_error", std::to_string(band2_error)); config->set_property("InputFilter.filter_type", "bandpass"); config->set_property("InputFilter.grid_density", std::to_string(grid_density)); +#if USE_GLOG_AND_GFLAGS config->set_property("InputFilter.sampling_frequency", std::to_string(FLAGS_fs_in)); +#else + +#endif config->set_property("InputFilter.IF", std::to_string(zero)); config->set_property("Resampler.implementation", "Pass_Through"); config->set_property("Resampler.dump", "false"); config->set_property("Resampler.item_type", "gr_complex"); +#if USE_GLOG_AND_GFLAGS config->set_property("Resampler.sample_freq_in", std::to_string(FLAGS_fs_in)); config->set_property("Resampler.sample_freq_out", std::to_string(FLAGS_fs_in)); +#else + +#endif // Set the number of Channels config->set_property("Channels_1C.count", std::to_string(number_of_channels)); @@ -228,6 +260,7 @@ void TtffTest::config_1() void TtffTest::config_2() { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) { std::string path = std::string(TEST_PATH); @@ -242,6 +275,9 @@ void TtffTest::config_2() int d_sampling_rate; d_sampling_rate = config2->property("GNSS-SDR.internal_fs_sps", FLAGS_fs_in); config2->set_property("SignalSource.samples", std::to_string(d_sampling_rate * FLAGS_max_measurement_duration)); +#else + +#endif } @@ -377,7 +413,12 @@ void TtffTest::print_TTFF_report(const std::vector &ttff_v, const std::s { stm << "Disabled.\n"; } +#if USE_GLOG_AND_GFLAGS stm << "Valid measurements (" << ttff.size() << "/" << FLAGS_num_measurements << "): "; +#else + stm << "Valid measurements (" << ttff.size() << "/" << absl::GetFlag(FLAGS_num_measurements) << "): "; +#endif + for (double ttff_ : ttff) { stm << ttff_ << " "; @@ -427,12 +468,19 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) config2->set_property("GNSS-SDR.SUPL_gps_enabled", "false"); config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false"); config2->set_property("PVT.flag_rtcm_server", "false"); - +#if USE_GLOG_AND_GFLAGS for (int n = 0; n < FLAGS_num_measurements; n++) +#else + for (int n = 0; n < absl::GetFlag(FLAGS_num_measurements); n++) +#endif { // Create a new ControlThread object with a smart pointer std::shared_ptr control_thread; +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { control_thread = std::make_shared(config); } @@ -441,8 +489,13 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) control_thread = std::make_shared(config2); } - // record startup time + // record startup time +#if USE_GLOG_AND_GFLAGS std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << '\n'; +#else + std::cout << "Starting measurement " << num_measurements + 1 << " / " << absl::GetFlag(FLAGS_num_measurements) << '\n'; + +#endif std::chrono::time_point start; std::chrono::time_point end; start = std::chrono::system_clock::now(); @@ -470,7 +523,11 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) num_measurements = num_measurements + 1; std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds.\n"; +#if USE_GLOG_AND_GFLAGS if (n < FLAGS_num_measurements - 1) +#else + if (n < absl::GetFlag(FLAGS_num_measurements) - 1) +#endif { std::random_device r; std::default_random_engine e1(r()); @@ -484,8 +541,13 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) } } - // Print TTFF report + // Print TTFF report + +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { print_TTFF_report(TTFF_v, config); } @@ -513,11 +575,19 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) config2->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "true"); config2->set_property("PVT.flag_rtcm_server", "false"); +#if USE_GLOG_AND_GFLAGS for (int n = 0; n < FLAGS_num_measurements; n++) +#else + for (int n = 0; n < absl::GetFlag(FLAGS_num_measurements); n++) +#endif { // Create a new ControlThread object with a smart pointer std::shared_ptr control_thread; +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { control_thread = std::make_shared(config); } @@ -525,8 +595,12 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) { control_thread = std::make_shared(config2); } - // record startup time + // record startup time +#if USE_GLOG_AND_GFLAGS std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << '\n'; +#else + std::cout << "Starting measurement " << num_measurements + 1 << " / " << absl::GetFlag(FLAGS_num_measurements) << '\n'; +#endif std::chrono::time_point start; std::chrono::time_point end; start = std::chrono::system_clock::now(); @@ -555,7 +629,11 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) num_measurements = num_measurements + 1; std::cout << "Just finished measurement " << num_measurements << ", which took " << ttff << " seconds.\n"; +#if USE_GLOG_AND_GFLAGS if (n < FLAGS_num_measurements - 1) +#else + if (n < absl::GetFlag(FLAGS_num_measurements) - 1) +#endif { std::random_device r; std::default_random_engine e1(r()); @@ -569,8 +647,13 @@ TEST_F(TtffTest /*unused*/, HotStart /*unused*/) } } - // Print TTFF report + // Print TTFF report + +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ttff.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) +#endif { print_TTFF_report(TTFF_v, config); } @@ -594,8 +677,12 @@ int main(int argc, char **argv) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); +#endif // Start queue thread std::thread receive_msg_thread(receive_msg); @@ -629,6 +716,8 @@ int main(int argc, char **argv) receive_msg_thread.join(); msgctl(sysv_msqid, IPC_RMID, nullptr); +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return res; } diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 3769756aa..991495070 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -18,19 +18,58 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" +#include +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS #include #include -#include -#include - #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } +DECLARE_string(log_dir); +#endif +#else +#include "gnss_sdr_flags.h" +#include +#include +#include +#include +#include +#include +#include + +class TestingLogSink : public absl::LogSink +{ +public: + TestingLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + filename = std::string(absl::GetFlag(FLAGS_log_dir) + "/run_tests.log"); + } + else + { + filename = std::string(GetTempDir() + "/run_tests.log"); + } + logfile.open(filename); + } + void Send(const absl::LogEntry &entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; + std::string filename; +}; #endif -DECLARE_string(log_dir); #if UNIT_TESTING_MINIMAL #include "unit-tests/arithmetic/matio_test.cc" @@ -174,8 +213,16 @@ int main(int argc, char **argv) catch (...) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + absl::LogSink *testLogSink = new TestingLogSink; + absl::AddLogSink(testLogSink); + // absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity); + absl::InitializeLog(); +#endif try { res = RUN_ALL_TESTS(); @@ -184,6 +231,10 @@ int main(int argc, char **argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc index 19a4ba37c..0504b543b 100644 --- a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc +++ b/src/tests/unit-tests/arithmetic/complex_carrier_test.cc @@ -20,16 +20,23 @@ #include #include #include +#include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); - +#else +ABSL_FLAG(int32_t, size_carrier_test, 100000, "Size of the arrays used for complex carrier testing"); +#endif TEST(ComplexCarrierTest, StandardComplexImplementation) { - // Dynamic allocation creates new usable space on the program STACK - // (an area of RAM specifically allocated to the program) +// Dynamic allocation creates new usable space on the program STACK +// (an area of RAM specifically allocated to the program) +#if USE_GLOG_AND_GFLAGS auto* output = new std::complex[FLAGS_size_carrier_test]; +#else + auto* output = new std::complex[absl::GetFlag(FLAGS_size_carrier_test)]; +#endif const double _f = 2000.0; const double _fs = 2000000.0; const auto phase_step = (TWO_PI * _f) / _fs; @@ -37,8 +44,11 @@ TEST(ComplexCarrierTest, StandardComplexImplementation) std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { output[i] = std::complex(cos(phase), sin(phase)); phase += phase_step; @@ -46,18 +56,32 @@ TEST(ComplexCarrierTest, StandardComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "A " << FLAGS_size_carrier_test +#else + std::cout << "A " << absl::GetFlag(FLAGS_size_carrier_test) +#endif << "-length complex carrier in standard C++ (dynamic allocation) generated in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; std::complex expected(1, 0); +#if USE_GLOG_AND_GFLAGS std::vector> mag(FLAGS_size_carrier_test); for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + std::vector> mag(absl::GetFlag(FLAGS_size_carrier_test)); + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { mag[i] = output[i] * std::conj(output[i]); } delete[] output; +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i])); } @@ -69,7 +93,12 @@ TEST(ComplexCarrierTest, StandardComplexImplementation) TEST(ComplexCarrierTest, C11ComplexImplementation) { // declaration: load data onto the program data segment + +#if USE_GLOG_AND_GFLAGS std::vector> output(FLAGS_size_carrier_test); +#else + std::vector> output(absl::GetFlag(FLAGS_size_carrier_test)); +#endif const double _f = 2000.0; const double _fs = 2000000.0; const auto phase_step = (TWO_PI * _f) / _fs; @@ -78,20 +107,34 @@ TEST(ComplexCarrierTest, C11ComplexImplementation) std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { output[i] = std::complex(cos(phase), sin(phase)); phase += phase_step; } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "A " << FLAGS_size_carrier_test +#else + std::cout << "A " << absl::GetFlag(FLAGS_size_carrier_test) +#endif << "-length complex carrier in standard C++ (declaration) generated in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); std::complex expected(1, 0); +#if USE_GLOG_AND_GFLAGS std::vector> mag(FLAGS_size_carrier_test); for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + std::vector> mag(absl::GetFlag(FLAGS_size_carrier_test)); + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { mag[i] = output[i] * std::conj(output[i]); ASSERT_FLOAT_EQ(std::norm(expected), std::norm(mag[i])); @@ -101,8 +144,11 @@ TEST(ComplexCarrierTest, C11ComplexImplementation) TEST(ComplexCarrierTest, OwnComplexImplementation) { +#if USE_GLOG_AND_GFLAGS std::vector> output(FLAGS_size_carrier_test); - +#else + std::vector> output(absl::GetFlag(FLAGS_size_carrier_test)); +#endif double _f = 2000.0; double _fs = 2000000.0; std::chrono::time_point start, end; @@ -112,18 +158,31 @@ TEST(ComplexCarrierTest, OwnComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "A " << FLAGS_size_carrier_test +#else + std::cout << "A " << absl::GetFlag(FLAGS_size_carrier_test) +#endif << "-length complex carrier using fixed point generated in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; std::complex expected(1, 0); + +#if USE_GLOG_AND_GFLAGS std::vector> mag(FLAGS_size_carrier_test); for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + std::vector> mag(absl::GetFlag(FLAGS_size_carrier_test)); + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { mag[i] = output[i] * std::conj(output[i]); } - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_carrier_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_carrier_test); i++) +#endif { ASSERT_NEAR(std::norm(expected), std::norm(mag[i]), 0.0001); } diff --git a/src/tests/unit-tests/arithmetic/conjugate_test.cc b/src/tests/unit-tests/arithmetic/conjugate_test.cc index 1fadedfed..2a72656f1 100644 --- a/src/tests/unit-tests/arithmetic/conjugate_test.cc +++ b/src/tests/unit-tests/arithmetic/conjugate_test.cc @@ -23,26 +23,42 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_conjugate_test, 100000, "Size of the arrays used for conjugate testing"); +#else +ABSL_FLAG(int32_t, size_conjugate_test, 100000, "Size of the arrays used for conjugate testing"); +#endif TEST(ConjugateTest, StandardCComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new std::complex[FLAGS_size_conjugate_test]; auto* output = new std::complex[FLAGS_size_conjugate_test]; std::fill_n(input, FLAGS_size_conjugate_test, std::complex(0.0, 0.0)); - +#else + auto* input = new std::complex[absl::GetFlag(FLAGS_size_conjugate_test)]; + auto* output = new std::complex[absl::GetFlag(FLAGS_size_conjugate_test)]; + std::fill_n(input, absl::GetFlag(FLAGS_size_conjugate_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_conjugate_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_conjugate_test); i++) +#endif { output[i] = std::conj(input[i]); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float vector in standard C finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; @@ -54,8 +70,13 @@ TEST(ConjugateTest, StandardCComplexImplementation) TEST(ConjugateTest, C11ComplexImplementation) { +#if USE_GLOG_AND_GFLAGS const std::vector> input(FLAGS_size_conjugate_test); std::vector> output(FLAGS_size_conjugate_test); +#else + const std::vector> input(absl::GetFlag(FLAGS_size_conjugate_test)); + std::vector> output(absl::GetFlag(FLAGS_size_conjugate_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); int pos = 0; @@ -65,7 +86,11 @@ TEST(ConjugateTest, C11ComplexImplementation) } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << " complex vector (C++11-style) finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -82,9 +107,13 @@ TEST(ConjugateTest, C11ComplexImplementation) TEST(ConjugateTest, ArmadilloComplexImplementation) { +#if USE_GLOG_AND_GFLAGS arma::cx_fvec input(FLAGS_size_conjugate_test, arma::fill::zeros); arma::cx_fvec output(FLAGS_size_conjugate_test); - +#else + arma::cx_fvec input(absl::GetFlag(FLAGS_size_conjugate_test), arma::fill::zeros); + arma::cx_fvec output(absl::GetFlag(FLAGS_size_conjugate_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -92,7 +121,12 @@ TEST(ConjugateTest, ArmadilloComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float Armadillo vector finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -101,18 +135,29 @@ TEST(ConjugateTest, ArmadilloComplexImplementation) TEST(ConjugateTest, VolkComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_conjugate_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); auto* output = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_conjugate_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); std::fill_n(input, FLAGS_size_conjugate_test, std::complex(0.0, 0.0)); - +#else + auto* input = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_conjugate_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + auto* output = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_conjugate_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + std::fill_n(input, absl::GetFlag(FLAGS_size_conjugate_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS volk_32fc_conjugate_32fc(output, input, FLAGS_size_conjugate_test); - +#else + volk_32fc_conjugate_32fc(output, input, absl::GetFlag(FLAGS_size_conjugate_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float vector using VOLK finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -123,17 +168,27 @@ TEST(ConjugateTest, VolkComplexImplementation) TEST(ConjugateTest, VolkComplexImplementationAlloc) { +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector> input(FLAGS_size_conjugate_test, std::complex(0.0, 0.0)); volk_gnsssdr::vector> output(FLAGS_size_conjugate_test); - +#else + volk_gnsssdr::vector> input(absl::GetFlag(FLAGS_size_conjugate_test), std::complex(0.0, 0.0)); + volk_gnsssdr::vector> output(absl::GetFlag(FLAGS_size_conjugate_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS volk_32fc_conjugate_32fc(output.data(), input.data(), FLAGS_size_conjugate_test); - +#else + volk_32fc_conjugate_32fc(output.data(), input.data(), absl::GetFlag(FLAGS_size_conjugate_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Conjugate of a " << FLAGS_size_conjugate_test +#else + std::cout << "Conjugate of a " << absl::GetFlag(FLAGS_size_conjugate_test) +#endif << "-length complex float vector using VOLK ALLOC finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/src/tests/unit-tests/arithmetic/fft_length_test.cc index 8ad39a141..fb937de89 100644 --- a/src/tests/unit-tests/arithmetic/fft_length_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_length_test.cc @@ -24,9 +24,13 @@ #include #include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test"); DEFINE_bool(plot_fft_length_test, false, "Plots results of FFTLengthTest with gnuplot"); +#else +ABSL_FLAG(int32_t, fft_iterations_test, 1000, "Number of averaged iterations in FFT length timing test"); +ABSL_FLAG(bool, plot_fft_length_test, false, "Plots results of FFTLengthTest with gnuplot"); +#endif // Note from FFTW documentation: the standard FFTW distribution works most efficiently for arrays whose // size can be factored into small primes (2, 3, 5, and 7), and otherwise it uses a slower general-purpose routine. @@ -63,13 +67,21 @@ TEST(FFTLengthTest, MeasureExecutionTime) std::generate_n(d_fft->get_inbuf(), d_fft_size, gen); start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_fft_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_fft_iterations_test); k++) +#endif { d_fft->execute(); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS double exec_time = elapsed_seconds.count() / static_cast(FLAGS_fft_iterations_test); +#else + double exec_time = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_fft_iterations_test)); +#endif execution_times.push_back(exec_time * 1e3); std::cout << "FFT execution time for length=" << d_fft_size << " : " << exec_time << " [s]\n"; @@ -79,10 +91,15 @@ TEST(FFTLengthTest, MeasureExecutionTime) execution_times_powers_of_two.push_back(exec_time / 1e-3); } }); - +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_fft_length_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_fft_length_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_fft_length_test has been set to TRUE,\n"; @@ -99,7 +116,11 @@ TEST(FFTLengthTest, MeasureExecutionTime) Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -111,13 +132,21 @@ TEST(FFTLengthTest, MeasureExecutionTime) g1.set_grid(); g1.set_xlabel("FFT length"); g1.set_ylabel("Execution time [ms]"); +#if USE_GLOG_AND_GFLAGS g1.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)"); +#else + g1.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(absl::GetFlag(FLAGS_fft_iterations_test)) + " iterations)"); +#endif g1.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g1.savetops("FFT_execution_times_extended"); g1.savetopdf("FFT_execution_times_extended", 18); Gnuplot g2("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -130,11 +159,20 @@ TEST(FFTLengthTest, MeasureExecutionTime) g2.set_xlabel("FFT length"); g2.set_ylabel("Execution time [ms]"); g2.set_xrange(0, 16384); +#if USE_GLOG_AND_GFLAGS g2.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(FLAGS_fft_iterations_test) + " iterations)"); +#else + g2.plot_xy(fft_sizes_v, execution_times, "FFT execution time (averaged over " + std::to_string(absl::GetFlag(FLAGS_fft_iterations_test)) + " iterations)"); +#endif + g2.set_style("points").plot_xy(powers_of_two, execution_times_powers_of_two, "Power of 2"); g2.savetops("FFT_execution_times"); g2.savetopdf("FFT_execution_times", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } diff --git a/src/tests/unit-tests/arithmetic/fft_speed_test.cc b/src/tests/unit-tests/arithmetic/fft_speed_test.cc index 2fa477b81..6c3d28690 100644 --- a/src/tests/unit-tests/arithmetic/fft_speed_test.cc +++ b/src/tests/unit-tests/arithmetic/fft_speed_test.cc @@ -22,7 +22,11 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(fft_speed_iterations_test, 100, "Number of averaged iterations in FFT length timing test"); +#else +ABSL_FLAG(int32_t, fft_speed_iterations_test, 100, "Number of averaged iterations in FFT length timing test"); +#endif TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) { @@ -43,23 +47,39 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) std::copy_n(d_arma_fft.memptr(), d_fft_size, d_gr_fft->get_inbuf()); start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_fft_speed_iterations_test); k++) +#endif { d_gr_fft->execute(); } end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS d_execution_time = elapsed_seconds.count() / static_cast(FLAGS_fft_speed_iterations_test); +#else + d_execution_time = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_fft_speed_iterations_test)); +#endif std::cout << "GNU Radio FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]\n"; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_fft_speed_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_fft_speed_iterations_test); k++) +#endif { d_arma_fft_result = arma::fft(d_arma_fft); } end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS d_execution_time = elapsed_seconds.count() / static_cast(FLAGS_fft_speed_iterations_test); +#else + d_execution_time = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_fft_speed_iterations_test)); +#endif std::cout << "Armadillo FFT execution time for length = " << d_fft_size << " : " << d_execution_time * 1e6 << " [us]\n"; }); } diff --git a/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc b/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc index 3611733f3..3287b51e2 100644 --- a/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc +++ b/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc @@ -24,29 +24,49 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_magnitude_test, 100000, "Size of the arrays used for magnitude testing"); - +#else +ABSL_FLAG(int32_t, size_magnitude_test, 100000, "Size of the arrays used for magnitude testing"); +#endif TEST(MagnitudeSquaredTest, StandardCComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new std::complex[FLAGS_size_magnitude_test]; auto* output = new float[FLAGS_size_magnitude_test]; +#else + auto* input = new std::complex[absl::GetFlag(FLAGS_size_magnitude_test)]; + auto* output = new float[absl::GetFlag(FLAGS_size_magnitude_test)]; +#endif unsigned int number = 0; +#if USE_GLOG_AND_GFLAGS for (number = 0; number < static_cast(FLAGS_size_magnitude_test); number++) +#else + for (number = 0; number < static_cast(absl::GetFlag(FLAGS_size_magnitude_test)); number++) +#endif { input[number] = std::complex(0.0, 0.0); } std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (number = 0; number < static_cast(FLAGS_size_magnitude_test); number++) +#else + for (number = 0; number < static_cast(absl::GetFlag(FLAGS_size_magnitude_test)); number++) +#endif { output[number] = (input[number].real() * input[number].real()) + (input[number].imag() * input[number].imag()); } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length complex vector in standard C computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; delete[] input; @@ -57,8 +77,13 @@ TEST(MagnitudeSquaredTest, StandardCComplexImplementation) TEST(MagnitudeSquaredTest, C11ComplexImplementation) { +#if USE_GLOG_AND_GFLAGS const std::vector> input(FLAGS_size_magnitude_test); std::vector output(FLAGS_size_magnitude_test); +#else + const std::vector> input(absl::GetFlag(FLAGS_size_magnitude_test)); + std::vector output(absl::GetFlag(FLAGS_size_magnitude_test)); +#endif int pos = 0; std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -70,7 +95,12 @@ TEST(MagnitudeSquaredTest, C11ComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << " complex vector (C++11-style) finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -87,8 +117,13 @@ TEST(MagnitudeSquaredTest, C11ComplexImplementation) TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation) { +#if USE_GLOG_AND_GFLAGS arma::cx_fvec input(FLAGS_size_magnitude_test, arma::fill::zeros); arma::fvec output(FLAGS_size_magnitude_test); +#else + arma::cx_fvec input(absl::GetFlag(FLAGS_size_magnitude_test), arma::fill::zeros); + arma::fvec output(absl::GetFlag(FLAGS_size_magnitude_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -96,7 +131,12 @@ TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length vector using Armadillo computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -105,17 +145,31 @@ TEST(MagnitudeSquaredTest, ArmadilloComplexImplementation) TEST(MagnitudeSquaredTest, VolkComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_magnitude_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); std::fill_n(input, FLAGS_size_magnitude_test, std::complex(0.0, 0.0)); auto* output = static_cast(volk_gnsssdr_malloc(FLAGS_size_magnitude_test * sizeof(float), volk_gnsssdr_get_alignment())); +#else + auto* input = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_magnitude_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + std::fill_n(input, absl::GetFlag(FLAGS_size_magnitude_test), std::complex(0.0, 0.0)); + auto* output = static_cast(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_magnitude_test) * sizeof(float), volk_gnsssdr_get_alignment())); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS volk_32fc_magnitude_squared_32f(output, input, static_cast(FLAGS_size_magnitude_test)); - +#else + volk_32fc_magnitude_squared_32f(output, input, static_cast(absl::GetFlag(FLAGS_size_magnitude_test))); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length vector using VOLK computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; volk_gnsssdr_free(input); @@ -126,18 +180,30 @@ TEST(MagnitudeSquaredTest, VolkComplexImplementation) TEST(MagnitudeSquaredTest, VolkComplexImplementationAlloc) { +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector> input(FLAGS_size_magnitude_test); // or: input(FLAGS_size_magnitude_test, std::complex(0.0, 0.0)); std::fill_n(input.begin(), FLAGS_size_magnitude_test, std::complex(0.0, 0.0)); volk_gnsssdr::vector output(FLAGS_size_magnitude_test); +#else + volk_gnsssdr::vector> input(absl::GetFlag(FLAGS_size_magnitude_test)); + std::fill_n(input.begin(), absl::GetFlag(FLAGS_size_magnitude_test), std::complex(0.0, 0.0)); + volk_gnsssdr::vector output(absl::GetFlag(FLAGS_size_magnitude_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS volk_32fc_magnitude_squared_32f(output.data(), input.data(), static_cast(FLAGS_size_magnitude_test)); - +#else + volk_32fc_magnitude_squared_32f(output.data(), input.data(), static_cast(absl::GetFlag(FLAGS_size_magnitude_test))); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "The squared magnitude of a " << FLAGS_size_magnitude_test +#else + std::cout << "The squared magnitude of a " << absl::GetFlag(FLAGS_size_magnitude_test) +#endif << "-length vector using VOLK ALLOC computed in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); diff --git a/src/tests/unit-tests/arithmetic/multiply_test.cc b/src/tests/unit-tests/arithmetic/multiply_test.cc index bb47dac58..cc0f7acd6 100644 --- a/src/tests/unit-tests/arithmetic/multiply_test.cc +++ b/src/tests/unit-tests/arithmetic/multiply_test.cc @@ -24,31 +24,51 @@ #include #include +#if USE_GLOG_AND_GFLAGS DEFINE_int32(size_multiply_test, 100000, "Size of the arrays used for multiply testing"); - +#else +ABSL_FLAG(int32_t, size_multiply_test, 100000, "Size of the arrays used for multiply testing"); +#endif TEST(MultiplyTest, StandardCDoubleImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new double[FLAGS_size_multiply_test]; auto* output = new double[FLAGS_size_multiply_test]; std::fill_n(input, FLAGS_size_multiply_test, 0.0); +#else + auto* input = new double[absl::GetFlag(FLAGS_size_multiply_test)]; + auto* output = new double[absl::GetFlag(FLAGS_size_multiply_test)]; + std::fill_n(input, absl::GetFlag(FLAGS_size_multiply_test), 0.0); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); - +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { output[i] = input[i] * input[i]; } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << " doubles in standard C finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; double acc = 0.0; double expected = 0.0; +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { acc += output[i]; } @@ -61,9 +81,13 @@ TEST(MultiplyTest, StandardCDoubleImplementation) TEST(MultiplyTest, ArmadilloImplementation) { +#if USE_GLOG_AND_GFLAGS arma::vec input(FLAGS_size_multiply_test, arma::fill::zeros); arma::vec output(FLAGS_size_multiply_test); - +#else + arma::vec input(absl::GetFlag(FLAGS_size_multiply_test), arma::fill::zeros); + arma::vec output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -71,7 +95,11 @@ TEST(MultiplyTest, ArmadilloImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length double Armadillo vectors finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -81,26 +109,44 @@ TEST(MultiplyTest, ArmadilloImplementation) TEST(MultiplyTest, StandardCComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = new std::complex[FLAGS_size_multiply_test]; auto* output = new std::complex[FLAGS_size_multiply_test]; std::fill_n(input, FLAGS_size_multiply_test, std::complex(0.0, 0.0)); +#else + auto* input = new std::complex[absl::GetFlag(FLAGS_size_multiply_test)]; + auto* output = new std::complex[absl::GetFlag(FLAGS_size_multiply_test)]; + std::fill_n(input, absl::GetFlag(FLAGS_size_multiply_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { output[i] = input[i] * input[i]; } end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << " complex in standard C finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; std::complex expected(0.0, 0.0); std::complex result(0.0, 0.0); +#if USE_GLOG_AND_GFLAGS for (int i = 0; i < FLAGS_size_multiply_test; i++) +#else + for (int i = 0; i < absl::GetFlag(FLAGS_size_multiply_test); i++) +#endif { result += output[i]; } @@ -113,8 +159,13 @@ TEST(MultiplyTest, StandardCComplexImplementation) TEST(MultiplyTest, C11ComplexImplementation) { +#if USE_GLOG_AND_GFLAGS const std::vector> input(FLAGS_size_multiply_test); std::vector> output(FLAGS_size_multiply_test); +#else + const std::vector> input(absl::GetFlag(FLAGS_size_multiply_test)); + std::vector> output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif int pos = 0; std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -127,7 +178,11 @@ TEST(MultiplyTest, C11ComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << " complex vector (C++11-style) finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -140,8 +195,13 @@ TEST(MultiplyTest, C11ComplexImplementation) TEST(MultiplyTest, ArmadilloComplexImplementation) { +#if USE_GLOG_AND_GFLAGS arma::cx_fvec input(FLAGS_size_multiply_test, arma::fill::zeros); arma::cx_fvec output(FLAGS_size_multiply_test); +#else + arma::cx_fvec input(absl::GetFlag(FLAGS_size_multiply_test), arma::fill::zeros); + arma::cx_fvec output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); @@ -150,7 +210,12 @@ TEST(MultiplyTest, ArmadilloComplexImplementation) end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length complex float Armadillo vectors finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); @@ -160,30 +225,55 @@ TEST(MultiplyTest, ArmadilloComplexImplementation) TEST(MultiplyTest, VolkComplexImplementation) { +#if USE_GLOG_AND_GFLAGS auto* input = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); auto* output = static_cast*>(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(std::complex), volk_gnsssdr_get_alignment())); std::fill_n(input, FLAGS_size_multiply_test, std::complex(0.0, 0.0)); +#else + auto* input = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_multiply_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + auto* output = static_cast*>(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_multiply_test) * sizeof(std::complex), volk_gnsssdr_get_alignment())); + std::fill_n(input, absl::GetFlag(FLAGS_size_multiply_test), std::complex(0.0, 0.0)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS volk_32fc_x2_multiply_32fc(output, input, input, FLAGS_size_multiply_test); +#else + volk_32fc_x2_multiply_32fc(output, input, input, absl::GetFlag(FLAGS_size_multiply_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length complex float vector using VOLK finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); +#if USE_GLOG_AND_GFLAGS auto* mag = static_cast(volk_gnsssdr_malloc(FLAGS_size_multiply_test * sizeof(float), volk_gnsssdr_get_alignment())); volk_32fc_magnitude_32f(mag, output, FLAGS_size_multiply_test); +#else + auto* mag = static_cast(volk_gnsssdr_malloc(absl::GetFlag(FLAGS_size_multiply_test) * sizeof(float), volk_gnsssdr_get_alignment())); + volk_32fc_magnitude_32f(mag, output, absl::GetFlag(FLAGS_size_multiply_test)); +#endif auto* result = new float(0.0); + +#if USE_GLOG_AND_GFLAGS volk_32f_accumulator_s32f(result, mag, FLAGS_size_multiply_test); +#else + volk_32f_accumulator_s32f(result, mag, absl::GetFlag(FLAGS_size_multiply_test)); +#endif + // Comparing floating-point numbers is tricky. // Due to round-off errors, it is very unlikely that two floating-points will match exactly. - // See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#floating-point-comparison + // See https://google.github.io/googletest/reference/assertions.html#floating-point float expected = 0.0; ASSERT_FLOAT_EQ(expected, result[0]); volk_gnsssdr_free(input); @@ -194,28 +284,52 @@ TEST(MultiplyTest, VolkComplexImplementation) TEST(MultiplyTest, VolkComplexImplementationAlloc) { +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector> input(FLAGS_size_multiply_test, std::complex(0.0, 0.0)); volk_gnsssdr::vector> output(FLAGS_size_multiply_test); - +#else + volk_gnsssdr::vector> input(absl::GetFlag(FLAGS_size_multiply_test), std::complex(0.0, 0.0)); + volk_gnsssdr::vector> output(absl::GetFlag(FLAGS_size_multiply_test)); +#endif std::chrono::time_point start, end; start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS volk_32fc_x2_multiply_32fc(output.data(), input.data(), input.data(), FLAGS_size_multiply_test); +#else + volk_32fc_x2_multiply_32fc(output.data(), input.data(), input.data(), absl::GetFlag(FLAGS_size_multiply_test)); +#endif end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = end - start; + +#if USE_GLOG_AND_GFLAGS std::cout << "Element-wise multiplication of " << FLAGS_size_multiply_test +#else + std::cout << "Element-wise multiplication of " << absl::GetFlag(FLAGS_size_multiply_test) +#endif << "-length complex float vector using VOLK ALLOC finished in " << elapsed_seconds.count() * 1e6 << " microseconds\n"; ASSERT_LE(0, elapsed_seconds.count() * 1e6); + +#if USE_GLOG_AND_GFLAGS volk_gnsssdr::vector mag(FLAGS_size_multiply_test); volk_32fc_magnitude_32f(mag.data(), output.data(), FLAGS_size_multiply_test); +#else + volk_gnsssdr::vector mag(absl::GetFlag(FLAGS_size_multiply_test)); + volk_32fc_magnitude_32f(mag.data(), output.data(), absl::GetFlag(FLAGS_size_multiply_test)); +#endif auto* result = new float(0.0); + +#if USE_GLOG_AND_GFLAGS volk_32f_accumulator_s32f(result, mag.data(), FLAGS_size_multiply_test); +#else + volk_32f_accumulator_s32f(result, mag.data(), absl::GetFlag(FLAGS_size_multiply_test)); +#endif // Comparing floating-point numbers is tricky. // Due to round-off errors, it is very unlikely that two floating-points will match exactly. - // See https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#floating-point-comparison + // See https://google.github.io/googletest/reference/assertions.html#floating-point float expected = 0.0; ASSERT_FLOAT_EQ(expected, result[0]); } 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 c43756128..9aa6d3620 100644 --- a/src/tests/unit-tests/control-plane/control_thread_test.cc +++ b/src/tests/unit-tests/control-plane/control_thread_test.cc @@ -26,8 +26,6 @@ #include #include #include -#include -#include #include #include #include @@ -39,6 +37,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#endif class ControlThreadTest : public ::testing::Test { 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 327ffade0..7dddc77f6 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 @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include #include @@ -55,6 +57,7 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_string(config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); DEFINE_string(acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); DEFINE_string(acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test. Alternatives: GPS_L1_CA_PCPS_Acquisition, GPS_L1_CA_PCPS_Acquisition_Fine_Doppler, Galileo_E1_PCPS_Ambiguous_Acquisition, GLONASS_L1_CA_PCPS_Acquisition, GLONASS_L2_CA_PCPS_Acquisition, GPS_L2_M_PCPS_Acquisition, Galileo_E5a_Pcps_Acquisition, GPS_L5i_PCPS_Acquisition"); @@ -86,6 +89,39 @@ DEFINE_int32(acq_test_fake_PRN, 33, "PRN number of a non-present satellite"); DEFINE_int32(acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); DEFINE_bool(plot_acq_test, false, "Plots results with gnuplot, if available"); DEFINE_int32(acq_test_skiphead, 0, "Number of samples to skip in the input file"); +#else +ABSL_FLAG(std::string, config_file_ptest, std::string(""), "File containing alternative configuration parameters for the acquisition performance test."); +ABSL_FLAG(std::string, acq_test_input_file, std::string(""), "File containing raw signal data, must be in int8_t format. The signal generator will not be used."); +ABSL_FLAG(std::string, acq_test_implementation, std::string("GPS_L1_CA_PCPS_Acquisition"), "Acquisition block implementation under test. Alternatives: GPS_L1_CA_PCPS_Acquisition, GPS_L1_CA_PCPS_Acquisition_Fine_Doppler, Galileo_E1_PCPS_Ambiguous_Acquisition, GLONASS_L1_CA_PCPS_Acquisition, GLONASS_L2_CA_PCPS_Acquisition, GPS_L2_M_PCPS_Acquisition, Galileo_E5a_Pcps_Acquisition, GPS_L5i_PCPS_Acquisition"); + +ABSL_FLAG(int32_t, acq_test_doppler_max, 5000, "Maximum Doppler, in Hz"); +ABSL_FLAG(int32_t, acq_test_doppler_step, 125, "Doppler step, in Hz."); +ABSL_FLAG(int32_t, acq_test_coherent_time_ms, 1, "Acquisition coherent time, in ms"); +ABSL_FLAG(int32_t, acq_test_max_dwells, 1, "Number of non-coherent integrations."); +ABSL_FLAG(bool, acq_test_bit_transition_flag, false, "Bit transition flag."); +ABSL_FLAG(bool, acq_test_make_two_steps, false, "Perform second step in a thinner grid."); +ABSL_FLAG(int32_t, acq_test_second_nbins, 4, "If --acq_test_make_two_steps is set to true, this parameter sets the number of bins done in the acquisition refinement stage."); +ABSL_FLAG(int32_t, acq_test_second_doppler_step, 10, "If --acq_test_make_two_steps is set to true, this parameter sets the Doppler step applied in the acquisition refinement stage, in Hz."); + +ABSL_FLAG(int32_t, acq_test_signal_duration_s, 2, "Generated signal duration, in s"); +ABSL_FLAG(int32_t, acq_test_num_meas, 0, "Number of measurements per run. 0 means the complete file."); +ABSL_FLAG(double, acq_test_cn0_init, 30.0, "Initial CN0, in dBHz."); +ABSL_FLAG(double, acq_test_cn0_final, 45.0, "Final CN0, in dBHz."); +ABSL_FLAG(double, acq_test_cn0_step, 3.0, "CN0 step, in dB."); + +ABSL_FLAG(double, acq_test_threshold_init, 3.0, "Initial acquisition threshold"); +ABSL_FLAG(double, acq_test_threshold_final, 4.0, "Final acquisition threshold"); +ABSL_FLAG(double, acq_test_threshold_step, 0.5, "Acquisition threshold step"); + +ABSL_FLAG(double, acq_test_pfa_init, 1e-5, "Set initial threshold via probability of false alarm. Disable with -1.0"); + +ABSL_FLAG(int32_t, acq_test_PRN, 1, "PRN number of a present satellite"); +ABSL_FLAG(int32_t, acq_test_fake_PRN, 33, "PRN number of a non-present satellite"); + +ABSL_FLAG(int32_t, acq_test_iterations, 1, "Number of iterations (same signal, different noise realization)"); +ABSL_FLAG(bool, plot_acq_test, false, "Plots results with gnuplot, if available"); +ABSL_FLAG(int32_t, acq_test_skiphead, 0, "Number of samples to skip in the input file"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class AcqPerfTest_msg_rx; @@ -160,9 +196,15 @@ protected: config = std::make_shared(); item_size = sizeof(gr_complex); gnss_synchro = Gnss_Synchro(); +#if USE_GLOG_AND_GFLAGS doppler_max = static_cast(FLAGS_acq_test_doppler_max); doppler_step = static_cast(FLAGS_acq_test_doppler_step); +#else + doppler_max = static_cast(absl::GetFlag(FLAGS_acq_test_doppler_max)); + doppler_step = static_cast(absl::GetFlag(FLAGS_acq_test_doppler_step)); +#endif stop = false; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) { cn0_vector.push_back(FLAGS_acq_test_cn0_init); @@ -173,6 +215,18 @@ protected: aux = aux + FLAGS_acq_test_cn0_step; } } +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) + { + cn0_vector.push_back(absl::GetFlag(FLAGS_acq_test_cn0_init)); + double aux = absl::GetFlag(FLAGS_acq_test_cn0_init) + absl::GetFlag(FLAGS_acq_test_cn0_step); + while (aux <= absl::GetFlag(FLAGS_acq_test_cn0_final)) + { + cn0_vector.push_back(aux); + aux = aux + absl::GetFlag(FLAGS_acq_test_cn0_step); + } + } +#endif else { cn0_vector = {0.0}; @@ -182,14 +236,22 @@ protected: { signal_id = "1C"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fine_Doppler") { signal_id = "1C"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition") @@ -197,40 +259,65 @@ protected: signal_id = "1B"; system_id = 'E'; min_integration_ms = 4; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_coherent_time_ms == 1) +#else + if (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) == 1) +#endif { coherent_integration_time_ms = 4; } else { +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif } } else if (implementation == "GLONASS_L1_CA_PCPS_Acquisition") { signal_id = "1G"; system_id = 'R'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GLONASS_L2_CA_PCPS_Acquisition") { signal_id = "2G"; system_id = 'R'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GPS_L2_M_PCPS_Acquisition") { signal_id = "2S"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_coherent_time_ms == 1) +#else + if (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) == 1) +#endif + { coherent_integration_time_ms = 20; } else { +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif } min_integration_ms = 20; } @@ -238,25 +325,37 @@ protected: { signal_id = "5X"; system_id = 'E'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } else if (implementation == "GPS_L5i_PCPS_Acquisition") { signal_id = "L5"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif } else { signal_id = "1C"; system_id = 'G'; +#if USE_GLOG_AND_GFLAGS coherent_integration_time_ms = FLAGS_acq_test_coherent_time_ms; +#else + coherent_integration_time_ms = absl::GetFlag(FLAGS_acq_test_coherent_time_ms); +#endif min_integration_ms = 1; } init(); - +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_pfa_init > 0.0) { pfa_vector.push_back(FLAGS_acq_test_pfa_init); @@ -279,11 +378,36 @@ protected: aux = aux + static_cast(FLAGS_acq_test_threshold_step); } } +#else + if (absl::GetFlag(FLAGS_acq_test_pfa_init) > 0.0) + { + pfa_vector.push_back(absl::GetFlag(FLAGS_acq_test_pfa_init)); + float aux = 1.0; + while ((absl::GetFlag(FLAGS_acq_test_pfa_init) * std::pow(10, aux)) < 1) + { + pfa_vector.push_back(absl::GetFlag(FLAGS_acq_test_pfa_init) * std::pow(10, aux)); + aux = aux + 1.0; + } + pfa_vector.push_back(0.999); + } + else + { + auto aux = static_cast(absl::GetFlag(FLAGS_acq_test_threshold_init)); + pfa_vector.push_back(aux); + aux = aux + static_cast(absl::GetFlag(FLAGS_acq_test_threshold_step)); + while (aux <= static_cast(absl::GetFlag(FLAGS_acq_test_threshold_final))) + { + pfa_vector.push_back(aux); + aux = aux + static_cast(absl::GetFlag(FLAGS_acq_test_threshold_step)); + } + } +#endif num_thresholds = pfa_vector.size(); // the gnss simulator does not dump the trk observables for the last 100 ms of generated signal int aux2; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_bit_transition_flag) { aux2 = floor((generated_signal_duration_s * ms_per_s - 100) / (FLAGS_acq_test_coherent_time_ms * 2.0) - 1); @@ -300,7 +424,24 @@ protected: { num_of_measurements = static_cast(aux2); } - +#else + if (absl::GetFlag(FLAGS_acq_test_bit_transition_flag)) + { + aux2 = floor((generated_signal_duration_s * ms_per_s - 100) / (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) * 2.0) - 1); + } + else + { + aux2 = floor((generated_signal_duration_s * ms_per_s - 100) / (absl::GetFlag(FLAGS_acq_test_coherent_time_ms) * absl::GetFlag(FLAGS_acq_test_max_dwells)) - 1); + } + if ((absl::GetFlag(FLAGS_acq_test_num_meas) > 0) && (absl::GetFlag(FLAGS_acq_test_num_meas) < aux2)) + { + num_of_measurements = static_cast(absl::GetFlag(FLAGS_acq_test_num_meas)); + } + else + { + num_of_measurements = static_cast(aux2); + } +#endif Pd.resize(cn0_vector.size()); for (int i = 0; i < static_cast(cn0_vector.size()); i++) { @@ -323,7 +464,12 @@ protected: std::vector cn0_vector; std::vector pfa_vector; +#if USE_GLOG_AND_GFLAGS int N_iterations = FLAGS_acq_test_iterations; +#else + int N_iterations = absl::GetFlag(FLAGS_acq_test_iterations); +#endif + void init(); int configure_generator(double cn0); @@ -353,19 +499,31 @@ protected: int message; std::thread ch_thread; - +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_acq_test_implementation; - const double baseband_sampling_freq = static_cast(FLAGS_fs_gen_sps); +#else + std::string implementation = absl::GetFlag(FLAGS_acq_test_implementation); + const double baseband_sampling_freq = static_cast(absl::GetFlag(FLAGS_fs_gen_sps)); +#endif + int coherent_integration_time_ms; const int in_acquisition = 1; const int dump_channel = 0; +#if USE_GLOG_AND_GFLAGS int generated_signal_duration_s = FLAGS_acq_test_signal_duration_s; +#else + int generated_signal_duration_s = absl::GetFlag(FLAGS_acq_test_signal_duration_s); +#endif unsigned int num_of_measurements; unsigned int measurement_counter = 0; +#if USE_GLOG_AND_GFLAGS unsigned int observed_satellite = FLAGS_acq_test_PRN; +#else + unsigned int observed_satellite = absl::GetFlag(FLAGS_acq_test_PRN); +#endif std::string path_str = "./acq-perf-test"; int num_thresholds; @@ -388,8 +546,13 @@ private: std::string p5; std::string p6; +#if USE_GLOG_AND_GFLAGS std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif char system_id; double compute_stdev_precision(const std::vector& vec); @@ -449,6 +612,7 @@ void AcquisitionPerformanceTest::stop_queue() int AcquisitionPerformanceTest::configure_generator(double cn0) { // Configure signal generator +#if USE_GLOG_AND_GFLAGS generator_binary = FLAGS_generator_binary; p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; @@ -464,6 +628,24 @@ int AcquisitionPerformanceTest::configure_generator(double cn0) p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(cn0); +#else + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(std::min(generated_signal_duration_s * 10, 3000)); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(cn0); +#endif + return 0; } @@ -498,7 +680,11 @@ int AcquisitionPerformanceTest::generate_signal() int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsigned int iter) { +#if USE_GLOG_AND_GFLAGS if (FLAGS_config_file_ptest.empty()) +#else + if (absl::GetFlag(FLAGS_config_file_ptest).empty()) +#endif { config = std::make_shared(); const int sampling_rate_internal = baseband_sampling_freq; @@ -514,13 +700,23 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign config->set_property("Acquisition.threshold", std::to_string(pfa)); // if (FLAGS_acq_test_pfa_init > 0.0) config->supersede_property("Acquisition.pfa", std::to_string(pfa)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_pfa_init > 0.0) +#else + if (absl::GetFlag(FLAGS_acq_test_pfa_init) > 0.0) +#endif { config->supersede_property("Acquisition.pfa", std::to_string(pfa)); } config->set_property("Acquisition.coherent_integration_time_ms", std::to_string(coherent_integration_time_ms)); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_bit_transition_flag) +#else + if (absl::GetFlag(FLAGS_acq_test_bit_transition_flag)) +#endif { config->set_property("Acquisition.bit_transition_flag", "true"); } @@ -528,18 +724,30 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign { config->set_property("Acquisition.bit_transition_flag", "false"); } - +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_acq_test_max_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_acq_test_max_dwells))); +#endif config->set_property("Acquisition.repeat_satellite", "true"); config->set_property("Acquisition.blocking", "true"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_make_two_steps) { config->set_property("Acquisition.make_two_steps", "true"); config->set_property("Acquisition.second_nbins", std::to_string(FLAGS_acq_test_second_nbins)); config->set_property("Acquisition.second_doppler_step", std::to_string(FLAGS_acq_test_second_doppler_step)); } +#else + if (absl::GetFlag(FLAGS_acq_test_make_two_steps)) + { + config->set_property("Acquisition.make_two_steps", "true"); + config->set_property("Acquisition.second_nbins", std::to_string(absl::GetFlag(FLAGS_acq_test_second_nbins))); + config->set_property("Acquisition.second_doppler_step", std::to_string(absl::GetFlag(FLAGS_acq_test_second_doppler_step))); + } +#endif else { config->set_property("Acquisition.make_two_steps", "false"); @@ -557,7 +765,11 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign } else { +#if USE_GLOG_AND_GFLAGS config_f = std::make_shared(FLAGS_config_file_ptest); +#else + config_f = std::make_shared(absl::GetFlag(FLAGS_config_file_ptest)); +#endif config = nullptr; } return 0; @@ -567,13 +779,21 @@ int AcquisitionPerformanceTest::configure_receiver(double cn0, float pfa, unsign int AcquisitionPerformanceTest::run_receiver() { std::string file; +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { file = "./" + filename_raw_data; } else { +#if USE_GLOG_AND_GFLAGS file = FLAGS_acq_test_input_file; +#else + file = absl::GetFlag(FLAGS_acq_test_input_file); +#endif } const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); @@ -582,7 +802,11 @@ int AcquisitionPerformanceTest::run_receiver() top_block = gr::make_top_block("Acquisition test"); auto msg_rx = AcqPerfTest_msg_rx_make(channel_internal_queue); +#if USE_GLOG_AND_GFLAGS gr::blocks::skiphead::sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), FLAGS_acq_test_skiphead); +#else + gr::blocks::skiphead::sptr skiphead = gr::blocks::skiphead::make(sizeof(gr_complex), absl::GetFlag(FLAGS_acq_test_skiphead)); +#endif queue = std::make_shared>(); gnss_synchro = Gnss_Synchro(); @@ -681,9 +905,15 @@ int AcquisitionPerformanceTest::count_executions(const std::string& basename, un void AcquisitionPerformanceTest::plot_results() { +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_acq_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE,\n"; @@ -700,7 +930,11 @@ void AcquisitionPerformanceTest::plot_results() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -736,7 +970,11 @@ void AcquisitionPerformanceTest::plot_results() g1.savetopdf("ROC", 18); Gnuplot g2("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -798,8 +1036,11 @@ TEST_F(AcquisitionPerformanceTest, ROC) std::vector meas_Pd_; std::vector meas_Pd_correct_; std::vector meas_Pfa_; - +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { std::cout << "Execution for CN0 = " << it << " dB-Hz\n"; } @@ -807,7 +1048,11 @@ TEST_F(AcquisitionPerformanceTest, ROC) // Do N_iterations of the experiment for (int pfa_iter = 0; pfa_iter < static_cast(pfa_vector.size()); pfa_iter++) { +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_pfa_init > 0.0) +#else + if (absl::GetFlag(FLAGS_acq_test_pfa_init) > 0.0) +#endif { std::cout << "Setting threshold for Pfa = " << pfa_vector[pfa_iter] << '\n'; } @@ -816,16 +1061,25 @@ TEST_F(AcquisitionPerformanceTest, ROC) std::cout << "Setting threshold to " << pfa_vector[pfa_iter] << '\n'; } - // Configure the signal generator + // Configure the signal generator + +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { configure_generator(it); } for (int iter = 0; iter < N_iterations; iter++) { - // Generate signal raw signal samples and observations RINEX file +// Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_acq_test_input_file.empty()) +#else + if (absl::GetFlag(FLAGS_acq_test_input_file).empty()) +#endif { generate_signal(); } @@ -834,11 +1088,19 @@ TEST_F(AcquisitionPerformanceTest, ROC) { if (k == 0) { +#if USE_GLOG_AND_GFLAGS observed_satellite = FLAGS_acq_test_PRN; +#else + observed_satellite = absl::GetFlag(FLAGS_acq_test_PRN); +#endif } else { +#if USE_GLOG_AND_GFLAGS observed_satellite = FLAGS_acq_test_fake_PRN; +#else + observed_satellite = absl::GetFlag(FLAGS_acq_test_fake_PRN); +#endif } 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 9e577e096..563b41294 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 @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -139,7 +144,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; unsigned int doppler_max; unsigned int doppler_step; 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 bb99b7f07..17cd4010a 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 @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -138,7 +143,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; unsigned int doppler_max; unsigned int doppler_step; 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 0d964e826..9be206e3f 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,7 +31,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -162,7 +161,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init() config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); config->set_property("Acquisition_1B.item_type", "gr_complex"); config->set_property("Acquisition_1B.coherent_integration_time_ms", "4"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { config->set_property("Acquisition_1B.dump", "true"); } @@ -198,7 +201,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() std::vector* samples = &acq_dump.samples; std::vector>* mag = &acq_dump.mag; +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE,\n"; @@ -216,7 +223,11 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::plot_grid() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("lines"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -291,7 +302,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { std::string data_str = "./tmp-acq-gal1"; if (fs::exists(data_str)) @@ -368,7 +383,11 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips"; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { plot_grid(); } diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc index 714810fd7..816dbfe1a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include @@ -38,6 +37,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef GR_GREATER_38 #include #else 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 5204b859b..0a893e41c 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 @@ -27,18 +27,23 @@ #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" -#include #include #include #include #include #include #include +#include #include #include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if HAS_GENERIC_LAMBDA #else #include @@ -54,9 +59,13 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_double(e1_value_threshold, 0.3, "Value of the threshold for the acquisition"); DEFINE_int32(e1_value_CN0_dB_0, 50, "Value for the CN0_dB_0 in channel 0"); - +#else +ABSL_FLAG(double, e1_value_threshold, 0.3, "Value of the threshold for the acquisition"); +ABSL_FLAG(int32_t, e1_value_CN0_dB_0, 50, "Value for the CN0_dB_0 in channel 0"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx; @@ -313,7 +322,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2() config->set_property("SignalSource.system_0", "E"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_e1_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_e1_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", @@ -366,7 +379,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2() std::to_string(integration_time_ms)); config->set_property("Acquisition_1B.max_dwells", "1"); config->set_property("Acquisition_1B.bit_transition_flag", "false"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition_1B.threshold", std::to_string(FLAGS_e1_value_threshold)); +#else + config->set_property("Acquisition_1B.threshold", std::to_string(absl::GetFlag(FLAGS_e1_value_threshold))); +#endif config->set_property("Acquisition_1B.doppler_max", "10000"); config->set_property("Acquisition_1B.doppler_step", "125"); config->set_property("Acquisition_1B.folding_factor", "2"); @@ -403,7 +420,11 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_3() config->set_property("SignalSource.system_0", "E"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_e1_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_e1_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", @@ -863,10 +884,18 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul filenamepd.str(""); filenamepd << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv"; - +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_e1_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepd.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_e1_value_threshold << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_e1_value_threshold) << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#endif pdpfafile.close(); } } @@ -881,10 +910,18 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul filenamepf.str(""); filenamepf << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv"; - +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_e1_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepf.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_e1_value_threshold << "," << Pfa_a << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_e1_value_threshold) << "," << Pfa_a << '\n'; +#endif pdpfafile.close(); } } 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 76056cb3b..4aac0c104 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 @@ -28,7 +28,6 @@ #include "gps_l1_ca_pcps_acquisition.h" #include "in_memory_configuration.h" #include "test_flags.h" -#include #include #include #include @@ -39,6 +38,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -132,7 +137,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; unsigned int doppler_max{5000}; unsigned int doppler_step{100}; @@ -150,7 +155,12 @@ void GpsL1CaPcpsAcquisitionTest::init() config->set_property("Acquisition_1C.implementation", "GPS_L1_CA_PCPS_Acquisition"); config->set_property("Acquisition_1C.item_type", "gr_complex"); config->set_property("Acquisition_1C.coherent_integration_time_ms", "1"); + +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { config->set_property("Acquisition_1C.dump", "true"); } @@ -185,8 +195,12 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() const std::vector *doppler = &acq_dump.doppler; std::vector *samples = &acq_dump.samples; std::vector > *mag = &acq_dump.mag; - +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif + if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE,\n"; @@ -204,7 +218,11 @@ void GpsL1CaPcpsAcquisitionTest::plot_grid() const Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("lines"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -286,7 +304,11 @@ TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ValidationOfResults /*unused*/) init(); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { std::string data_str = "./tmp-acq-gps1"; if (fs::exists(data_str)) @@ -354,7 +376,11 @@ TEST_F(GpsL1CaPcpsAcquisitionTest /*unused*/, ValidationOfResults /*unused*/) EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { plot_grid(); } 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 60db2ec9b..ee06f57ce 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 @@ -29,7 +29,6 @@ #include "in_memory_configuration.h" #include "test_flags.h" #include -#include #include #include #include // for abs, pow, floor @@ -37,6 +36,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + #ifdef GR_GREATER_38 #include #else 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 92a8e19ff..1dce2a6f8 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 @@ -25,7 +25,6 @@ #include "in_memory_configuration.h" #include "signal_generator.h" #include "signal_generator_c.h" -#include #include #include #include @@ -33,9 +32,15 @@ #include #include #include +#include #include #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif #if HAS_GENERIC_LAMBDA #else #include @@ -51,9 +56,13 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_double(value_threshold, 1, "Value of the threshold for the acquisition"); DEFINE_int32(value_CN0_dB_0, 44, "Value for the CN0_dB_0 in channel 0"); - +#else +ABSL_FLAG(double, value_threshold, 1, "Value of the threshold for the acquisition"); +ABSL_FLAG(int32_t, value_CN0_dB_0, 44, "Value for the CN0_dB_0 in channel 0"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx; @@ -304,7 +313,11 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2() config->set_property("SignalSource.system_0", "G"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", std::to_string(expected_delay_chips)); @@ -354,7 +367,11 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_2() config->set_property("Acquisition_1C.coherent_integration_time_ms", std::to_string(integration_time_ms)); config->set_property("Acquisition_1C.max_dwells", "1"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition_1C.threshold", std::to_string(FLAGS_value_threshold)); +#else + config->set_property("Acquisition_1C.threshold", std::to_string(absl::GetFlag(FLAGS_value_threshold))); +#endif config->set_property("Acquisition_1C.doppler_max", "10000"); config->set_property("Acquisition_1C.doppler_step", "100"); config->set_property("Acquisition_1C.bit_transition_flag", "false"); @@ -395,7 +412,11 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3() config->set_property("SignalSource.system_0", "G"); config->set_property("SignalSource.PRN_0", "10"); +#if USE_GLOG_AND_GFLAGS config->set_property("SignalSource.CN0_dB_0", std::to_string(FLAGS_value_CN0_dB_0)); +#else + config->set_property("SignalSource.CN0_dB_0", std::to_string(absl::GetFlag(FLAGS_value_CN0_dB_0))); +#endif config->set_property("SignalSource.doppler_Hz_0", std::to_string(expected_doppler_hz)); config->set_property("SignalSource.delay_chips_0", std::to_string(expected_delay_chips)); @@ -830,10 +851,19 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili filenamepd.str(""); filenamepd << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv"; +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepd.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_value_threshold << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_value_threshold) << "," << Pd << "," << Pfa_p << "," << Pmd << '\n'; +#endif pdpfafile.close(); } } @@ -848,10 +878,18 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili filenamepf.str(""); filenamepf << "../data/test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" +#if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv"; - +#else + << gnss_synchro.PRN << "CN0_dB_0_" << absl::GetFlag(FLAGS_value_CN0_dB_0) << "_dBHz.csv"; +#endif pdpfafile.open(filenamepf.str().c_str(), std::ios::app | std::ios::out); + +#if USE_GLOG_AND_GFLAGS pdpfafile << FLAGS_value_threshold << "," << Pfa_a << '\n'; +#else + pdpfafile << absl::GetFlag(FLAGS_value_threshold) << "," << Pfa_a << '\n'; +#endif pdpfafile.close(); } } 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 a2d87201d..bb65ec8c5 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 @@ -160,7 +160,11 @@ void GpsL2MPcpsAcquisitionTest::init() config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(sampling_frequency_hz)); config->set_property("Acquisition_2S.implementation", "GPS_L2_M_PCPS_Acquisition"); config->set_property("Acquisition_2S.item_type", "gr_complex"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { config->set_property("Acquisition_2S.dump", "true"); } @@ -195,7 +199,11 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() std::vector *samples = &acq_dump.samples; std::vector> *mag = &acq_dump.mag; +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_acq_grid has been set to TRUE,\n"; @@ -213,7 +221,11 @@ void GpsL2MPcpsAcquisitionTest::plot_grid() Gnuplot::set_GNUPlotPath(gnuplot_path); Gnuplot g1("impulses"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -290,7 +302,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) double expected_delay_samples = 1; // 2004; double expected_doppler_hz = 1200; // 3000; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { std::string data_str = "./tmp-acq-gps2"; if (fs::exists(data_str)) @@ -372,7 +388,11 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults) EXPECT_LE(doppler_error_hz, 200) << "Doppler error exceeds the expected value: 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_acq_grid == true) +#else + if (absl::GetFlag(FLAGS_plot_acq_grid) == true) +#endif { plot_grid(); } 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 97b27f51c..9bebac3a9 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 @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -40,13 +39,24 @@ #include +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif + class FirFilterTest : public ::testing::Test { protected: FirFilterTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_filter_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_filter_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); 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 1c77dc929..79cc01136 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 @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -38,14 +37,24 @@ #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(notch_filter_lite_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, notch_filter_lite_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif + class NotchFilterLiteTest : public ::testing::Test { protected: NotchFilterLiteTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_notch_filter_lite_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_notch_filter_lite_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); 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 cf4cde035..17be01cc4 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 @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -38,14 +37,23 @@ #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(notch_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, notch_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif class NotchFilterTest : public ::testing::Test { protected: NotchFilterTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_notch_filter_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_notch_filter_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); 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 4cb3c5c43..b99e17655 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 @@ -14,7 +14,6 @@ * ----------------------------------------------------------------------------- */ -#include #include #include #include @@ -38,14 +37,23 @@ #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(pb_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#else +#include +ABSL_FLAG(int32_t, pb_filter_test_nsamples, 1000000, "Number of samples to filter in the tests (max: 2147483647)"); +#endif class PulseBlankingFilterTest : public ::testing::Test { protected: PulseBlankingFilterTest() : item_size(sizeof(gr_complex)), +#if USE_GLOG_AND_GFLAGS nsamples(FLAGS_pb_filter_test_nsamples) +#else + nsamples(absl::GetFlag(FLAGS_pb_filter_test_nsamples)) +#endif { queue = std::make_shared>(); config = std::make_shared(); diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 53545ef44..32a81ee01 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -37,15 +37,20 @@ endif() target_link_libraries(signal_processing_testing_lib PUBLIC Armadillo::armadillo - Gflags::gflags Gnuradio::runtime Gnuradio::pmt PRIVATE Boost::headers Matio::matio - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(signal_processing_testing_lib PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(signal_processing_testing_lib PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(signal_processing_testing_lib PRIVATE absl::flags absl::log) +endif() + target_include_directories(signal_processing_testing_lib PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc index c8701e41d..fb8697898 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc +++ b/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc @@ -17,10 +17,17 @@ */ #include "acquisition_msg_rx.h" -#include -#include #include #include + +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include 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 9cb2337d4..f7540e0c0 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 @@ -252,12 +252,18 @@ public: std::string p3; std::string p4; std::string p5; + +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); @@ -340,6 +346,7 @@ public: int HybridObservablesTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -355,6 +362,24 @@ int HybridObservablesTest::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -395,8 +420,12 @@ bool HybridObservablesTest::acquire_signal() tmp_gnss_synchro.Channel_ID = 0; config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); - // Enable automatic resampler for the acquisition, if required +// Enable automatic resampler for the acquisition, if required +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); } @@ -418,8 +447,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L1 CA"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); - // acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking") @@ -430,7 +462,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E1B"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") @@ -441,7 +477,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L2CM"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_b") @@ -453,7 +493,11 @@ bool HybridObservablesTest::acquire_signal() tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; config->set_property("Acquisition_5X.coherent_integration_time_ms", "1"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif 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"); @@ -468,7 +512,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L5_DLL_PLL_Tracking") @@ -479,7 +527,11 @@ bool HybridObservablesTest::acquire_signal() std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L5I"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else @@ -490,27 +542,43 @@ bool HybridObservablesTest::acquire_signal() acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif acquisition->init(); acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->connect(top_block_acq); gr::blocks::file_source::sptr file_source; +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif const char* file_name = file.c_str(); file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); - // gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); - // top_block_acq->connect(head_samples, 0, acquisition->get_left_block(), 0); - top_block_acq->connect(file_source, 0, gr_interleaved_char_to_complex, 0); // Enable automatic resampler for the acquisition, if required + +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { // create acquisition resamplers if required double resampler_ratio = 1.0; @@ -636,7 +704,11 @@ bool HybridObservablesTest::acquire_signal() top_block_acq->run(); if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -655,7 +727,11 @@ bool HybridObservablesTest::acquire_signal() std::cout << " . "; } top_block_acq->stop(); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif std::cout.flush(); } std::cout << "]\n"; @@ -712,9 +788,15 @@ void HybridObservablesTest::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS config->set_property("Tracking.fll_bw_hz", std::to_string(FLAGS_fll_bw_hz)); config->set_property("Tracking.enable_fll_pull_in", FLAGS_enable_fll_pull_in ? "true" : "false"); config->set_property("Tracking.enable_fll_steady_state", FLAGS_enable_fll_steady_state ? "true" : "false"); +#else + config->set_property("Tracking.fll_bw_hz", std::to_string(absl::GetFlag(FLAGS_fll_bw_hz))); + config->set_property("Tracking.enable_fll_pull_in", absl::GetFlag(FLAGS_enable_fll_pull_in) ? "true" : "false"); + config->set_property("Tracking.enable_fll_steady_state", absl::GetFlag(FLAGS_enable_fll_steady_state) ? "true" : "false"); +#endif config->set_property("Tracking.smoother_length", std::to_string(smoother_length)); config->set_property("Tracking.dump", "true"); config->set_property("Tracking.dump_filename", "./tracking_ch_"); @@ -877,7 +959,12 @@ void HybridObservablesTest::check_results_carrier_phase( std::cout.precision(ss); // plots + +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Accumulated Carrier phase error [cycles]"); @@ -968,7 +1055,12 @@ void HybridObservablesTest::check_results_carrier_phase_double_diff( std::cout.precision(ss); // plots + +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); @@ -1061,8 +1153,12 @@ void HybridObservablesTest::check_results_carrier_doppler_double_diff( << " [Hz]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); @@ -1147,7 +1243,11 @@ void HybridObservablesTest::check_results_carrier_doppler( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1282,7 +1382,11 @@ void HybridObservablesTest::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1341,8 +1445,12 @@ void HybridObservablesTest::check_results_duplicated_satellite( << " [Cycles]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Phase error [Cycles]"); @@ -1401,7 +1509,12 @@ void HybridObservablesTest::check_results_duplicated_satellite( std::cout.precision(ss); // plots + +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Pseudorange error [m]"); @@ -1526,8 +1639,12 @@ void HybridObservablesTest::check_results_code_pseudorange( << " [meters]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Pseudorange error [m]"); @@ -1568,7 +1685,11 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S // Open and read reference RINEX observables file try { +#if USE_GLOG_AND_GFLAGS gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); +#else + gnsstk::Rinex3ObsStream r_ref(absl::GetFlag(FLAGS_filename_rinex_obs)); +#endif r_ref.exceptions(std::ios::failbit); gnsstk::Rinex3ObsData r_ref_data; gnsstk::Rinex3ObsHeader r_ref_header; @@ -1727,7 +1848,12 @@ TEST_F(HybridObservablesTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -1736,7 +1862,12 @@ TEST_F(HybridObservablesTest, ValidationOfResults) std::chrono::duration elapsed_seconds(0); // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(), true); @@ -1747,8 +1878,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) tmp_gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(tmp_gnss_synchro.Signal, 2, 0); - +#if USE_GLOG_AND_GFLAGS std::istringstream ss(FLAGS_test_satellite_PRN_list); +#else + std::istringstream ss(absl::GetFlag(FLAGS_test_satellite_PRN_list)); +#endif std::string token; while (std::getline(ss, token, ',')) @@ -1758,6 +1892,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } } +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, @@ -1765,11 +1900,25 @@ TEST_F(HybridObservablesTest, ValidationOfResults) FLAGS_extend_correlation_symbols, FLAGS_smoother_length, FLAGS_high_dyn); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols), + absl::GetFlag(FLAGS_smoother_length), + absl::GetFlag(FLAGS_high_dyn)); +#endif for (auto& n : gnss_synchro_vec) { // setup the signal synchronization, simulating an acquisition + +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // based on true observables metadata (for custom sdr generator) // open true observables log file written by the simulator or based on provided RINEX obs @@ -1873,6 +2022,7 @@ TEST_F(HybridObservablesTest, ValidationOfResults) ASSERT_NO_THROW({ std::string file; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { file = "./" + filename_raw_data; @@ -1881,6 +2031,16 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { file = FLAGS_signal_file; } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + file = "./" + filename_raw_data; + } + else + { + file = absl::GetFlag(FLAGS_signal_file); + } +#endif const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); @@ -1900,7 +2060,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) // connect sample counter and timmer to the last channel in observables block (extra channel) top_block_tlm->connect(samp_counter, 0, observables->get_left_block(), tracking_ch_vec.size()); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif }) << "Failure connecting the blocks."; for (auto& n : tracking_ch_vec) @@ -1918,8 +2082,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) // check results // Matrices for storing columnwise true GPS time, Range, Doppler and Carrier phase std::vector true_obs_vec; - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // load the true values True_Observables_Reader true_observables; @@ -1963,7 +2130,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { ASSERT_EQ(ReadRinexObs(&true_obs_vec, gnss_synchro_master), true) << "Failure reading RINEX file"; @@ -2018,8 +2189,12 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } } - // Cut measurement initial transitory of the measurements +// Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif for (unsigned int n = 0; n < measured_obs_vec.size(); n++) { index = arma::find(measured_obs_vec.at(n).col(0) >= (measured_obs_vec.at(n)(0, 0) + initial_transitory_s), 1, "first"); @@ -2027,8 +2202,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { measured_obs_vec.at(n).shed_rows(0, index(0)); } - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { index = arma::find(measured_obs_vec.at(n).col(0) >= true_obs_vec.at(n)(0, 0), 1, "first"); if ((!index.empty()) and (index(0) > 0)) @@ -2038,11 +2216,19 @@ TEST_F(HybridObservablesTest, ValidationOfResults) } } +#if USE_GLOG_AND_GFLAGS if (FLAGS_duplicated_satellites_test) +#else + if (absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { // special test mode for duplicated satellites std::vector prn_pairs; +#if USE_GLOG_AND_GFLAGS std::stringstream ss(FLAGS_duplicated_satellites_prns); +#else + std::stringstream ss(absl::GetFlag(FLAGS_duplicated_satellites_prns)); +#endif unsigned int i; while (ss >> i) { @@ -2190,9 +2376,13 @@ 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; +// 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 USE_GLOG_AND_GFLAGS if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or FLAGS_compare_with_5X) +#else + if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or absl::GetFlag(FLAGS_compare_with_5X)) +#endif { check_results_carrier_phase_double_diff(true_obs_vec.at(n), true_obs_vec.at(min_pr_ch_id), @@ -2215,7 +2405,11 @@ TEST_F(HybridObservablesTest, ValidationOfResults) { std::cout << "[CH " << std::to_string(n) << "] PRN " << std::to_string(gnss_synchro_vec.at(n).PRN) << " is the reference satellite\n"; } +#if USE_GLOG_AND_GFLAGS if (FLAGS_compute_single_diffs) +#else + if (absl::GetFlag(FLAGS_compute_single_diffs)) +#endif { check_results_carrier_phase(true_obs_vec.at(n), true_TOW_ch_s, 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 492b5d1fc..9824e1d17 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 @@ -224,12 +224,17 @@ public: std::string p3; std::string p4; std::string p5; +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); @@ -310,6 +315,7 @@ public: int HybridObservablesTestFpga::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -325,6 +331,24 @@ int HybridObservablesTestFpga::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -422,12 +446,15 @@ void* handler_DMA_obs_test(void* arguments) return nullptr; } - // ************************************************************************* - // Open input file - // ************************************************************************* + // ************************************************************************* + // Open input file + // ************************************************************************* +#if USE_GLOG_AND_GFLAGS uint32_t skip_samples = static_cast(FLAGS_skip_samples); - +#else + uint32_t skip_samples = static_cast(absl::GetFlag(FLAGS_skip_samples)); +#endif if (skip_samples + skip_used_samples > 0) { try @@ -601,8 +628,11 @@ bool HybridObservablesTestFpga::acquire_signal() std::string signal; struct DMA_handler_args_obs_test args; struct acquisition_handler_args_obs_test args_acq; - +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif args.file = file; // DMA file configuration // instantiate the FPGA switch and set the @@ -669,11 +699,17 @@ bool HybridObservablesTestFpga::acquire_signal() acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel_fsm(channel_fsm_); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_doppler_center(0); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); - +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_doppler_center(0); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif std::chrono::time_point start, end; std::chrono::duration elapsed_seconds; start = std::chrono::system_clock::now(); @@ -760,7 +796,11 @@ bool HybridObservablesTestFpga::acquire_signal() if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -850,9 +890,15 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS config->set_property("Tracking.fll_bw_hz", std::to_string(FLAGS_fll_bw_hz)); config->set_property("Tracking.enable_fll_pull_in", FLAGS_enable_fll_pull_in ? "true" : "false"); config->set_property("Tracking.enable_fll_steady_state", FLAGS_enable_fll_steady_state ? "true" : "false"); +#else + config->set_property("Tracking.fll_bw_hz", std::to_string(absl::GetFlag(FLAGS_fll_bw_hz))); + config->set_property("Tracking.enable_fll_pull_in", absl::GetFlag(FLAGS_enable_fll_pull_in) ? "true" : "false"); + config->set_property("Tracking.enable_fll_steady_state", absl::GetFlag(FLAGS_enable_fll_steady_state) ? "true" : "false"); +#endif config->set_property("Tracking.smoother_length", std::to_string(smoother_length)); config->set_property("Tracking.dump", "true"); config->set_property("Tracking.dump_filename", "./tracking_ch_"); @@ -995,7 +1041,11 @@ void HybridObservablesTestFpga::check_results_carrier_phase( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Accumulated Carrier phase error [cycles]"); @@ -1084,7 +1134,11 @@ void HybridObservablesTestFpga::check_results_carrier_phase_double_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); @@ -1171,8 +1225,12 @@ void HybridObservablesTestFpga::check_results_carrier_doppler_double_diff( << " [Hz]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); @@ -1250,7 +1308,11 @@ void HybridObservablesTestFpga::check_results_carrier_doppler( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1384,7 +1446,11 @@ void HybridObservablesTestFpga::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Doppler error [Hz]"); @@ -1444,7 +1510,11 @@ void HybridObservablesTestFpga::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Carrier Phase error [Cycles]"); @@ -1503,7 +1573,11 @@ void HybridObservablesTestFpga::check_results_duplicated_satellite( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Pseudorange error [m]"); @@ -1627,8 +1701,12 @@ void HybridObservablesTestFpga::check_results_code_pseudorange( << " [meters]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Pseudorange error [m]"); @@ -1661,7 +1739,11 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn // Open and read reference RINEX observables file try { +#if USE_GLOG_AND_GFLAGS gnsstk::Rinex3ObsStream r_ref(FLAGS_filename_rinex_obs); +#else + gnsstk::Rinex3ObsStream r_ref(absl::GetFlag(FLAGS_filename_rinex_obs)); +#endif r_ref.exceptions(std::ios::failbit); gnsstk::Rinex3ObsData r_ref_data; gnsstk::Rinex3ObsHeader r_ref_header; @@ -1828,7 +1910,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -1836,8 +1922,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); - // use generator or use an external capture file +// use generator or use an external capture file +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(), true); @@ -1849,7 +1939,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) std::string signal = "1C"; signal.copy(tmp_gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS std::istringstream ss(FLAGS_test_satellite_PRN_list); +#else + std::istringstream ss(absl::GetFlag(FLAGS_test_satellite_PRN_list)); +#endif std::string token; while (std::getline(ss, token, ',')) @@ -1858,7 +1952,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) gnss_synchro_vec.push_back(tmp_gnss_synchro); } } - +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, @@ -1866,11 +1960,24 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) FLAGS_extend_correlation_symbols, FLAGS_smoother_length, FLAGS_high_dyn); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols), + absl::GetFlag(FLAGS_smoother_length), + absl::GetFlag(FLAGS_high_dyn)); +#endif for (auto& n : gnss_synchro_vec) { // setup the signal synchronization, simulating an acquisition +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // based on true observables metadata (for custom sdr generator) // open true observables log file written by the simulator or based on provided RINEX obs @@ -2011,6 +2118,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) std::string file; ASSERT_NO_THROW({ +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { file = "./" + filename_raw_data; @@ -2019,6 +2127,16 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) { file = FLAGS_signal_file; } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + file = "./" + filename_raw_data; + } + else + { + file = absl::GetFlag(FLAGS_signal_file); + } +#endif int observable_interval_ms = 20; double fs = static_cast(config->property("GNSS-SDR.internal_fs_sps", 0)); @@ -2051,7 +2169,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) usleep(1000000); args.file = file; +#if USE_GLOG_AND_GFLAGS args.nsamples_tx = baseband_sampling_freq * FLAGS_duration; +#else + args.nsamples_tx = baseband_sampling_freq * absl::GetFlag(FLAGS_duration); +#endif + args.skip_used_samples = 0; if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast(&args)) < 0) @@ -2087,8 +2210,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) // check results // Matrices for storing columnwise true GPS time, Range, Doppler and Carrier phase std::vector true_obs_vec; - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // load the true values True_Observables_Reader true_observables; @@ -2132,7 +2258,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { ASSERT_EQ(ReadRinexObs(&true_obs_vec, gnss_synchro_master), true) << "Failure reading RINEX file"; @@ -2188,8 +2318,12 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) } } - // Cut measurement initial transitory of the measurements +// Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif for (unsigned int n = 0; n < measured_obs_vec.size(); n++) { index = arma::find(measured_obs_vec.at(n).col(0) >= (measured_obs_vec.at(n)(0, 0) + initial_transitory_s), 1, "first"); @@ -2197,8 +2331,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) { measured_obs_vec.at(n).shed_rows(0, index(0)); } - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_duplicated_satellites_test) +#else + if (!absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { index = arma::find(measured_obs_vec.at(n).col(0) >= true_obs_vec.at(n)(0, 0), 1, "first"); if ((!index.empty()) and (index(0) > 0)) @@ -2207,12 +2344,19 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) } } } - +#if USE_GLOG_AND_GFLAGS if (FLAGS_duplicated_satellites_test) +#else + if (absl::GetFlag(FLAGS_duplicated_satellites_test)) +#endif { // special test mode for duplicated satellites std::vector prn_pairs; +#if USE_GLOG_AND_GFLAGS std::stringstream ss(FLAGS_duplicated_satellites_prns); +#else + std::stringstream ss(absl::GetFlag(FLAGS_duplicated_satellites_prns)); +#endif unsigned int i; while (ss >> i) { @@ -2363,7 +2507,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) "[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 USE_GLOG_AND_GFLAGS if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or FLAGS_compare_with_5X) +#else + if (strcmp("5X\0", gnss_synchro_vec.at(n).Signal) != 0 or absl::GetFlag(FLAGS_compare_with_5X)) +#endif { check_results_carrier_phase_double_diff(true_obs_vec.at(n), true_obs_vec.at(min_pr_ch_id), @@ -2386,7 +2534,11 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) { std::cout << "[CH " << std::to_string(n) << "] PRN " << std::to_string(gnss_synchro_vec.at(n).PRN) << " is the reference satellite\n"; } +#if USE_GLOG_AND_GFLAGS if (FLAGS_compute_single_diffs) +#else + if (absl::GetFlag(FLAGS_compute_single_diffs)) +#endif { check_results_carrier_phase(true_obs_vec.at(n), true_TOW_ch_s, diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index 3155a3ab8..f6916b29f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -186,11 +186,15 @@ public: std::string p4; std::string p5; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); void check_results(arma::vec& true_time_s, @@ -218,6 +222,7 @@ public: int GpsL1CATelemetryDecoderTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -233,6 +238,24 @@ int GpsL1CATelemetryDecoderTest::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -268,8 +291,11 @@ void GpsL1CATelemetryDecoderTest::configure_receiver() gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; - +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); // Set Tracking @@ -340,7 +366,11 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -352,7 +382,11 @@ TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults) // open true observables log file written by the simulator Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS int test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + int test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc index 34c4894d7..7b7566f00 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc @@ -18,18 +18,25 @@ #include "GPS_L1_CA.h" #include "cpu_multicorrelator_real_codes.h" #include "gps_sdr_signal_replica.h" -#include #include #include #include #include #include +#include #include #include - +#if USE_GLOG_AND_GFLAGS +#include DEFINE_int32(cpu_multicorrelator_real_codes_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); DEFINE_int32(cpu_multicorrelator_real_codes_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#else +#include +ABSL_FLAG(int32_t, cpu_multicorrelator_real_codes_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); +ABSL_FLAG(int32_t, cpu_multicorrelator_real_codes_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#endif + void run_correlator_cpu_real_codes(Cpu_Multicorrelator_Real_Codes* correlator, float d_rem_carrier_phase_rad, @@ -39,7 +46,11 @@ void run_correlator_cpu_real_codes(Cpu_Multicorrelator_Real_Codes* correlator, float d_rem_code_phase_chips, int correlation_size) { +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_cpu_multicorrelator_real_codes_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_iterations_test); k++) +#endif { correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, @@ -56,7 +67,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime) std::chrono::time_point start; std::chrono::time_point end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_real_codes_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -143,7 +158,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_real_codes_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_iterations_test)); +#endif std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } @@ -166,7 +185,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc) std::chrono::time_point start; std::chrono::time_point end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_real_codes_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -241,7 +264,11 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_real_codes_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_real_codes_iterations_test)); +#endif std::cout << "CPU Multicorrelator (real codes) execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc index 339205f43..7bd54c5a9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc @@ -18,7 +18,6 @@ #include "GPS_L1_CA.h" #include "cpu_multicorrelator.h" #include "gps_sdr_signal_replica.h" -#include #include #include #include @@ -27,9 +26,13 @@ #include #include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(cpu_multicorrelator_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); DEFINE_int32(cpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#else +ABSL_FLAG(int32_t, cpu_multicorrelator_iterations_test, 100, "Number of averaged iterations in CPU multicorrelator test timing test"); +ABSL_FLAG(int32_t, cpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in CPU multicorrelator test timing test"); +#endif void run_correlator_cpu(Cpu_Multicorrelator* correlator, float d_rem_carrier_phase_rad, @@ -38,7 +41,11 @@ void run_correlator_cpu(Cpu_Multicorrelator* correlator, float d_rem_code_phase_chips, int correlation_size) { +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test); k++) +#endif { correlator->Carrier_wipeoff_multicorrelator_resampler(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, @@ -53,7 +60,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -138,7 +149,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test)); +#endif std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } @@ -160,7 +175,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_cpu_multicorrelator_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_cpu_multicorrelator_max_threads_test); +#endif std::vector thread_pool; std::vector correlator_pool(max_threads); unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -236,7 +255,11 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_cpu_multicorrelator_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test)); +#endif std::cout << "CPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } 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 0519b3de3..b5b92999b 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 @@ -53,7 +53,7 @@ protected: gr::top_block_sptr top_block; std::shared_ptr factory; std::shared_ptr config; - Gnss_Synchro gnss_synchro{}; + Gnss_Synchro gnss_synchro; size_t item_size; int message{0}; bool stop{false}; 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 87af5fe45..a7464207c 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 @@ -138,10 +138,15 @@ public: std::string p6; std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking"; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(double CN0_dBHz, int file_idx); int generate_signal(); @@ -193,6 +198,7 @@ public: int GpsL1CADllPllTrackingTest::configure_generator(double CN0_dBHz, int file_idx) { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -209,6 +215,25 @@ int GpsL1CADllPllTrackingTest::configure_generator(double CN0_dBHz, int file_idx p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data) + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#endif + return 0; } @@ -249,7 +274,12 @@ void GpsL1CADllPllTrackingTest::configure_receiver( gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); + +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -464,6 +494,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) // *********************************************************** // ***** STEP 2: Tracking configuration parameters sweep ***** // *********************************************************** +#if USE_GLOG_AND_GFLAGS if (FLAGS_PLL_bw_hz_start == FLAGS_PLL_bw_hz_stop) { if (FLAGS_DLL_bw_hz_start == FLAGS_DLL_bw_hz_stop) @@ -491,25 +522,70 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) DLL_wide_bw_values.push_back(FLAGS_DLL_bw_hz_start); } } +#else + if (absl::GetFlag(FLAGS_PLL_bw_hz_start) == absl::GetFlag(FLAGS_PLL_bw_hz_stop)) + { + if (absl::GetFlag(FLAGS_DLL_bw_hz_start) == absl::GetFlag(FLAGS_DLL_bw_hz_stop)) + { + // NO PLL/DLL BW sweep + PLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_PLL_bw_hz_start)); + DLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_DLL_bw_hz_start)); + } + else + { + // DLL BW Sweep + for (double dll_bw = absl::GetFlag(FLAGS_DLL_bw_hz_start); dll_bw >= absl::GetFlag(FLAGS_DLL_bw_hz_stop); dll_bw = dll_bw - absl::GetFlag(FLAGS_DLL_bw_hz_step)) + { + PLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_PLL_bw_hz_start)); + DLL_wide_bw_values.push_back(dll_bw); + } + } + } + else + { + // PLL BW Sweep + for (double pll_bw = absl::GetFlag(FLAGS_PLL_bw_hz_start); pll_bw >= absl::GetFlag(FLAGS_PLL_bw_hz_stop); pll_bw = pll_bw - absl::GetFlag(FLAGS_PLL_bw_hz_step)) + { + PLL_wide_bw_values.push_back(pll_bw); + DLL_wide_bw_values.push_back(absl::GetFlag(FLAGS_DLL_bw_hz_start)); + } + } +#endif // ********************************************* // ***** STEP 3: Generate the input signal ***** // ********************************************* std::vector cno_vector; +#if USE_GLOG_AND_GFLAGS if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop) { generator_CN0_values.push_back(FLAGS_CN0_dBHz_start); } +#else + if (absl::GetFlag(FLAGS_CN0_dBHz_start) == absl::GetFlag(FLAGS_CN0_dBHz_stop)) + { + generator_CN0_values.push_back(absl::GetFlag(FLAGS_CN0_dBHz_start)); + } +#endif else { +#if USE_GLOG_AND_GFLAGS for (double cn0 = FLAGS_CN0_dBHz_start; cn0 > FLAGS_CN0_dBHz_stop; cn0 = cn0 - FLAGS_CN0_dB_step) +#else + for (double cn0 = absl::GetFlag(FLAGS_CN0_dBHz_start); cn0 > absl::GetFlag(FLAGS_CN0_dBHz_stop); cn0 = cn0 - absl::GetFlag(FLAGS_CN0_dB_step)) +#endif { generator_CN0_values.push_back(cn0); } } - // use generator or use an external capture file + // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { // todo: create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters } @@ -520,7 +596,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) // Configure the signal generator configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } @@ -561,17 +641,29 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) configure_receiver(PLL_wide_bw_values.at(config_idx), DLL_wide_bw_values.at(config_idx), +#if USE_GLOG_AND_GFLAGS FLAGS_PLL_narrow_bw_hz, FLAGS_DLL_narrow_bw_hz, FLAGS_extend_correlation_symbols); +#else + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols)); +#endif for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { // ****************************************************************************************** // ***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** // ****************************************************************************************** +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); @@ -580,7 +672,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::cout << "Initial Doppler [Hz]=" << true_obs_data.doppler_l1_hz << " Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << '\n'; @@ -694,10 +790,14 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) promptQ_sweep.push_back(promptQ); CN0_dBHz_sweep.push_back(CN0_dBHz); - // *********************************************************** - // ***** STEP 6: Compare with true values (if available) ***** - // *********************************************************** +// *********************************************************** +// ***** STEP 6: Compare with true values (if available) ***** +// *********************************************************** +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { std::vector doppler_error_hz; std::vector code_phase_error_chips; @@ -726,8 +826,12 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) true_tow_s(epoch_counter) = true_obs_data.tow; epoch_counter++; } - // Align initial measurements and cut the tracking pull-in transitory +// Align initial measurements and cut the tracking pull-in transitory +#if USE_GLOG_AND_GFLAGS double pull_in_offset_s = FLAGS_skip_trk_transitory_s; +#else + double pull_in_offset_s = absl::GetFlag(FLAGS_skip_trk_transitory_s); +#endif arma::uvec initial_meas_point = arma::find(trk_timestamp_s >= (true_timestamp_s(0) + pull_in_offset_s), 1, "first"); if (!initial_meas_point.empty() and tracking_last_msg != 3) @@ -782,8 +886,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) } } } // CN0 LOOP - +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { mean_doppler_error_sweep.push_back(mean_doppler_error); std_dev_doppler_error_sweep.push_back(std_dev_doppler_error); @@ -801,12 +908,18 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) generator_CN0_values_sweep_copy.push_back(valid_CN0_values); } - // ******************************** - // ***** STEP 7: Plot results ***** - // ******************************** +// ******************************** +// ***** STEP 7: Plot results ***** +// ******************************** +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_gps_l1_tracking_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_gps_l1_tracking_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE,\n"; @@ -821,14 +934,26 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) fs::path dir = p.parent_path(); const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); if (FLAGS_plot_detail_level >= 2) +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); + + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2) +#endif + { for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif + { g1.showonscreen(); // window output } @@ -836,7 +961,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g1.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); g1.set_ylabel("Correlators' output"); @@ -849,7 +978,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g1.savetopdf("Correlators_outputs" + std::to_string(generator_CN0_values.at(current_cn0_idx)), 18); } Gnuplot g2("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } @@ -862,7 +995,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values.size(); current_cn0_idx++) { g2.reset_plot(); +#if USE_GLOG_AND_GFLAGS g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz" + "GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -874,7 +1011,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g2.savetopdf("Constellation", 18); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g3.set_title("GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g3.set_grid(); g3.set_xlabel("Time [s]"); g3.set_ylabel("Reported CN0 [dB-Hz]"); @@ -887,7 +1028,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g3.set_legend(); g3.savetops("CN0_output"); g3.savetopdf("CN0_output", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g3.showonscreen(); // window output } @@ -897,13 +1042,22 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) } } - // PLOT ERROR FIGURES (only if it is used the signal generator) +// PLOT ERROR FIGURES (only if it is used the signal generator) +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { if (FLAGS_plot_detail_level >= 1) { Gnuplot g5("points"); if (FLAGS_show_plots) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + if (absl::GetFlag(FLAGS_plot_detail_level) >= 1) + { + Gnuplot g5("points"); + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g5.showonscreen(); // window output } @@ -911,7 +1065,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g5.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g5.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g5.set_grid(); g5.set_xlabel("Time [s]"); g5.set_ylabel("Code delay error [Chips]"); @@ -937,7 +1095,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g5.savetopdf("Code_error_chips", 18); Gnuplot g5b("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g5b.showonscreen(); // window output } @@ -945,7 +1107,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g5b.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g5b.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g5b.set_title("Code delay error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g5b.set_grid(); g5b.set_xlabel("Time [s]"); g5b.set_ylabel("Code delay error [meters]"); @@ -971,7 +1137,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g5b.savetopdf("Code_error_meters", 18); Gnuplot g6("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g6.showonscreen(); // window output } @@ -979,7 +1149,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g6.disablescreen(); } +#if USE_GLOG_AND_GFLAGS g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g6.set_title("Accumulated carrier phase error, PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g6.set_grid(); g6.set_xlabel("Time [s]"); g6.set_ylabel("Accumulated carrier phase error [Cycles]"); @@ -1005,7 +1179,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g6.savetopdf("Acc_carrier_phase_error_cycles", 18); Gnuplot g4("points"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -1018,7 +1196,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) for (unsigned int current_cn0_idx = 0; current_cn0_idx < generator_CN0_values_sweep_copy.at(config_idx).size(); current_cn0_idx++) { g4.reset_plot(); +#if USE_GLOG_AND_GFLAGS g4.set_title("Dopper error" + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz], PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g4.set_title("Dopper error" + std::to_string(static_cast(round(generator_CN0_values_sweep_copy.at(config_idx).at(current_cn0_idx)))) + "[dB-Hz], PLL/DLL BW: " + std::to_string(PLL_wide_bw_values.at(config_idx)) + "," + std::to_string(DLL_wide_bw_values.at(config_idx)) + " Hz (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g4.set_grid(); // g4.cmd("set key box opaque"); g4.set_xlabel("Time [s]"); @@ -1051,7 +1233,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) } } +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_gps_l1_tracking_test == true) +#else + if (absl::GetFlag(FLAGS_plot_gps_l1_tracking_test) == true) +#endif { std::cout << "Plotting performance metrics...\n"; try @@ -1060,7 +1246,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { // plot metrics Gnuplot g7("linespoints"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g7.showonscreen(); // window output } @@ -1068,7 +1258,12 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) { g7.disablescreen(); } + +#if USE_GLOG_AND_GFLAGS g7.set_title("Doppler error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g7.set_title("Doppler error metrics (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g7.set_grid(); g7.set_xlabel("CN0 [dB-Hz]"); g7.set_ylabel("Doppler error [Hz]"); @@ -1093,7 +1288,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g7.savetopdf("Doppler_error_metrics", 18); Gnuplot g8("linespoints"); +#if USE_GLOG_AND_GFLAGS g8.set_title("Accumulated carrier phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g8.set_title("Accumulated carrier phase error metrics (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g8.set_grid(); g8.set_xlabel("CN0 [dB-Hz]"); g8.set_ylabel("Accumulated Carrier Phase error [Cycles]"); @@ -1117,7 +1316,11 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults) g8.savetopdf("Carrier_error_metrics", 18); Gnuplot g9("linespoints"); +#if USE_GLOG_AND_GFLAGS g9.set_title("Code Phase error metrics (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g9.set_title("Code Phase error metrics (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g9.set_grid(); g9.set_xlabel("CN0 [dB-Hz]"); g9.set_ylabel("Code Phase error [Chips]"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 81ca1df0c..4bd43fc30 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -29,8 +29,6 @@ #include "tracking_true_obs_reader.h" #include #include // to test the FPGA we have to create a simultaneous task to send the samples using the DMA and stop the test -#include -#include #include #include #include @@ -46,6 +44,14 @@ #include #include #include + +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#include +#endif #if HAS_GENERIC_LAMBDA #else #include @@ -232,11 +238,15 @@ public: std::string p4; std::string p5; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; - +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); void check_results_doppler(arma::vec &true_time_s, arma::vec &true_value, @@ -266,7 +276,8 @@ public: int GpsL1CADllPllTrackingTestFpga::configure_generator() { - // Configure signal generator +// Configure signal generator +#if USE_GLOG_AND_GFLAGS generator_binary = FLAGS_generator_binary; p1 = std::string("-rinex_nav_file=") + FLAGS_rinex_nav_file; @@ -281,6 +292,23 @@ int GpsL1CADllPllTrackingTestFpga::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -317,7 +345,11 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver() gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -464,7 +496,11 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) // open true observables log file written by the simulator Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS int test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + int test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc index fbd1b2d0f..8765ac60c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc @@ -60,8 +60,11 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS DEFINE_bool(plot_gps_l1_gaussian_tracking_test, false, "Plots results of GpsL1CAGaussianTrackingTest with gnuplot"); - +#else +ABSL_FLAG(bool, plot_gps_l1_gaussian_tracking_test, false, "Plots results of GpsL1CAGaussianTrackingTest with gnuplot"); +#endif // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GpsL1CAGaussianTrackingTest_msg_rx; @@ -139,10 +142,15 @@ public: std::string implementation = "GPS_L1_CA_Gaussian_Tracking"; +#if USE_GLOG_AND_GFLAGS const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_filename_raw_data; +#else + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_filename_raw_data); +#endif int configure_generator(); int generate_signal(); @@ -181,6 +189,7 @@ public: int GpsL1CAGaussianTrackingTest::configure_generator() { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -196,6 +205,24 @@ int GpsL1CAGaussianTrackingTest::configure_generator() p3 = std::string("-rinex_obs_file=") + FLAGS_filename_rinex_obs; // RINEX 2.10 observation file output p4 = std::string("-sig_out_file=") + FLAGS_filename_raw_data; // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_filename_raw_data); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] +#endif + return 0; } @@ -231,16 +258,27 @@ void GpsL1CAGaussianTrackingTest::configure_receiver() gnss_synchro.System = 'G'; std::string signal = "1C"; signal.copy(gnss_synchro.Signal, 2, 0); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); // Set Tracking config->set_property("Tracking_1C.implementation", implementation); config->set_property("Tracking_1C.item_type", "gr_complex"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_dll_bw_hz != 0.0) { config->set_property("Tracking_1C.dll_bw_hz", std::to_string(FLAGS_dll_bw_hz)); } +#else + if (absl::GetFlag(FLAGS_dll_bw_hz) != 0.0) + { + config->set_property("Tracking_1C.dll_bw_hz", std::to_string(absl::GetFlag(FLAGS_dll_bw_hz))); + } +#endif else { config->set_property("Tracking_1C.dll_bw_hz", "2.0"); @@ -376,18 +414,28 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) configure_generator(); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) { generate_signal(); } - +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) + { + generate_signal(); + } +#endif std::chrono::time_point start, end; configure_receiver(); // open true observables log file written by the simulator Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS int test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + int test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); @@ -404,7 +452,11 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; // restart the epoch counter @@ -522,10 +574,15 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) std::chrono::duration elapsed_seconds = end - start; std::cout << "Signal tracking completed in " << elapsed_seconds.count() << " seconds.\n"; - +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_gps_l1_gaussian_tracking_test == true) { const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + if (absl::GetFlag(FLAGS_plot_gps_l1_gaussian_tracking_test) == true) + { + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag plot_gps_l1_tracking_test has been set to TRUE,\n"; @@ -549,18 +606,30 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) t = t + GPS_L1_CA_CODE_PERIOD_S; } Gnuplot g1("linespoints"); +#if USE_GLOG_AND_GFLAGS g1.set_title("GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g1.set_title("GPS L1 C/A signal tracking correlators' output (satellite PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); g1.set_ylabel("Correlators' output"); g1.cmd("set key box opaque"); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); +#endif g1.plot_xy(timevec, prompt, "Prompt", decimate); g1.plot_xy(timevec, early, "Early", decimate); g1.plot_xy(timevec, late, "Late", decimate); g1.savetops("Correlators_outputs"); g1.savetopdf("Correlators_outputs", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g1.showonscreen(); // window output } @@ -570,7 +639,11 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) } Gnuplot g2("points"); +#if USE_GLOG_AND_GFLAGS g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); +#else + g2.set_title("Constellation diagram (satellite PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -578,7 +651,11 @@ TEST_F(GpsL1CAGaussianTrackingTest, ValidationOfResults) g2.plot_xy(promptI, promptQ); g2.savetops("Constellation"); g2.savetopdf("Constellation", 18); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g2.showonscreen(); // window output } diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc index d8749dc39..db5680d02 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc @@ -20,14 +20,19 @@ #include "gps_sdr_signal_replica.h" #include #include +#include #include #include #include #include - +#if USE_GLOG_AND_GFLAGS DEFINE_int32(gpu_multicorrelator_iterations_test, 1000, "Number of averaged iterations in GPU multicorrelator test timing test"); DEFINE_int32(gpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in GPU multicorrelator test timing test"); +#else +ABSL_FLAG(int32_t, gpu_multicorrelator_iterations_test, 1000, "Number of averaged iterations in GPU multicorrelator test timing test"); +ABSL_FLAG(int32_t, gpu_multicorrelator_max_threads_test, 12, "Number of maximum concurrent correlators in GPU multicorrelator test timing test"); +#endif void run_correlator_gpu(cuda_multicorrelator* correlator, float d_rem_carrier_phase_rad, @@ -37,7 +42,11 @@ void run_correlator_gpu(cuda_multicorrelator* correlator, int correlation_size, int d_n_correlator_taps) { +#if USE_GLOG_AND_GFLAGS for (int k = 0; k < FLAGS_cpu_multicorrelator_iterations_test; k++) +#else + for (int k = 0; k < absl::GetFlag(FLAGS_cpu_multicorrelator_iterations_test); k++) +#endif { correlator->Carrier_wipeoff_multicorrelator_resampler_cuda(d_rem_carrier_phase_rad, d_carrier_phase_step_rad, @@ -53,7 +62,11 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime) { std::chrono::time_point start, end; std::chrono::duration elapsed_seconds(0); +#if USE_GLOG_AND_GFLAGS int max_threads = FLAGS_gpu_multicorrelator_max_threads_test; +#else + int max_threads = absl::GetFlag(FLAGS_gpu_multicorrelator_max_threads_test); +#endif std::vector thread_pool; cuda_multicorrelator* correlator_pool[max_threads]; unsigned int correlation_sizes[3] = {2048, 4096, 8192}; @@ -133,7 +146,11 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime) thread_pool.clear(); end = std::chrono::system_clock::now(); elapsed_seconds = end - start; +#if USE_GLOG_AND_GFLAGS execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(FLAGS_gpu_multicorrelator_iterations_test); +#else + execution_times[correlation_sizes_idx] = elapsed_seconds.count() / static_cast(absl::GetFlag(FLAGS_gpu_multicorrelator_iterations_test)); +#endif std::cout << "GPU Multicorrelator execution time for length=" << correlation_sizes[correlation_sizes_idx] << " : " << execution_times[correlation_sizes_idx] << " [s]\n"; } }); 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 5f1265edd..d5a28ffa9 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 @@ -161,12 +161,18 @@ public: std::string p4; std::string p5; std::string p6; + +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; - std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_signal_file; +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_signal_file); +#endif std::map doppler_measurements_map; std::map code_delay_measurements_map; @@ -229,6 +235,7 @@ public: int TrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx) { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -245,6 +252,24 @@ int TrackingPullInTest::configure_generator(double CN0_dBHz, int file_idx) p4 = std::string("-sig_out_file=") + FLAGS_signal_file + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_signal_file) + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#endif return 0; } @@ -291,7 +316,11 @@ void TrackingPullInTest::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif gnss_synchro.Channel_ID = 0; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -383,8 +412,12 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) config = std::make_shared(); config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); - // Enable automatic resampler for the acquisition, if required +// Enable automatic resampler for the acquisition, if required +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { config->set_property("GNSS-SDR.use_acquisition_resampler", "true"); } @@ -406,7 +439,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L1 CA"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif // acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } @@ -418,7 +455,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E1B"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L2_M_DLL_PLL_Tracking") @@ -429,7 +470,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L2CM"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_b") @@ -441,7 +486,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; config->set_property("Acquisition_5X.coherent_integration_time_ms", "1"); +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif 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"); @@ -456,7 +505,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "Galileo E5a"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else if (implementation == "GPS_L5_DLL_PLL_Tracking") @@ -467,7 +520,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::memcpy(static_cast(tmp_gnss_synchro.Signal), str, 3); // copy string into synchro char array: 2 char + null tmp_gnss_synchro.PRN = SV_ID; System_and_Signal = "GPS L5I"; +#if USE_GLOG_AND_GFLAGS config->set_property("Acquisition.max_dwells", std::to_string(FLAGS_external_signal_acquisition_dwells)); +#else + config->set_property("Acquisition.max_dwells", std::to_string(absl::GetFlag(FLAGS_external_signal_acquisition_dwells))); +#endif acquisition = std::make_shared(config.get(), "Acquisition", 1, 0); } else @@ -478,26 +535,44 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif acquisition->init(); acquisition->set_local_code(); acquisition->set_state(1); // Ensure that acquisition starts at the first sample acquisition->connect(top_block_acq); gr::blocks::file_source::sptr file_source; +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif const char* file_name = file.c_str(); file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), SEEK_SET); // skip head. ibyte, two bytes per complex sample +#endif gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); // gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); top_block_acq->connect(file_source, 0, gr_interleaved_char_to_complex, 0); - // Enable automatic resampler for the acquisition, if required +// Enable automatic resampler for the acquisition, if required +#if USE_GLOG_AND_GFLAGS if (FLAGS_use_acquisition_resampler == true) +#else + if (absl::GetFlag(FLAGS_use_acquisition_resampler) == true) +#endif { // create acquisition resamplers if required double resampler_ratio = 1.0; @@ -625,7 +700,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) top_block_acq->run(); if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -646,7 +725,11 @@ bool TrackingPullInTest::acquire_signal(int SV_ID) std::cout << " . "; } top_block_acq->stop(); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, SEEK_SET); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), SEEK_SET); // skip head. ibyte, two bytes per complex sample +#endif std::cout.flush(); } std::cout << "]\n"; @@ -672,16 +755,23 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // ************************************************* // ***** STEP 1: Prepare the parameters sweep ****** // ************************************************* - std::vector - acq_doppler_error_hz_values; + std::vector acq_doppler_error_hz_values; std::vector> acq_delay_error_chips_values; // vector of vector - +#if USE_GLOG_AND_GFLAGS for (double doppler_hz = FLAGS_acq_Doppler_error_hz_start; doppler_hz >= FLAGS_acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_acq_Doppler_error_hz_step) +#else + for (double doppler_hz = absl::GetFlag(FLAGS_acq_Doppler_error_hz_start); doppler_hz >= absl::GetFlag(FLAGS_acq_Doppler_error_hz_stop); doppler_hz = doppler_hz + absl::GetFlag(FLAGS_acq_Doppler_error_hz_step)) +#endif + { acq_doppler_error_hz_values.push_back(doppler_hz); std::vector tmp_vector; - // Code Delay Sweep +// Code Delay Sweep +#if USE_GLOG_AND_GFLAGS for (double code_delay_chips = FLAGS_acq_Delay_error_chips_start; code_delay_chips >= FLAGS_acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_acq_Delay_error_chips_step) +#else + for (double code_delay_chips = absl::GetFlag(FLAGS_acq_Delay_error_chips_start); code_delay_chips >= absl::GetFlag(FLAGS_acq_Delay_error_chips_stop); code_delay_chips = code_delay_chips + absl::GetFlag(FLAGS_acq_Delay_error_chips_step)) +#endif { tmp_vector.push_back(code_delay_chips); } @@ -692,12 +782,17 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // ***** STEP 2: Generate the input signal (if required) ***** // *********************************************************** std::vector generator_CN0_values; +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available } else { +#if USE_GLOG_AND_GFLAGS if (FLAGS_CN0_dBHz_start == FLAGS_CN0_dBHz_stop) { generator_CN0_values.push_back(FLAGS_CN0_dBHz_start); @@ -709,15 +804,39 @@ TEST_F(TrackingPullInTest, ValidationOfResults) generator_CN0_values.push_back(cn0); } } +#else + if (absl::GetFlag(FLAGS_CN0_dBHz_start) == absl::GetFlag(FLAGS_CN0_dBHz_stop)) + { + generator_CN0_values.push_back(absl::GetFlag(FLAGS_CN0_dBHz_start)); + } + else + { + for (double cn0 = absl::GetFlag(FLAGS_CN0_dBHz_start); cn0 > absl::GetFlag(FLAGS_CN0_dBHz_stop); cn0 = cn0 - absl::GetFlag(FLAGS_CN0_dB_step)) + { + generator_CN0_values.push_back(cn0); + } + } +#endif } - // use generator or use an external capture file + // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { +#if USE_GLOG_AND_GFLAGS // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(FLAGS_test_satellite_PRN), true); bool found_satellite = doppler_measurements_map.find(FLAGS_test_satellite_PRN) != doppler_measurements_map.end(); EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << FLAGS_test_satellite_PRN << " is not acquired"; +#else + ASSERT_EQ(acquire_signal(absl::GetFlag(FLAGS_test_satellite_PRN)), true); + bool found_satellite = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN)) != doppler_measurements_map.end(); + EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << absl::GetFlag(FLAGS_test_satellite_PRN) << " is not acquired"; +#endif if (!found_satellite) { return; @@ -730,18 +849,30 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // Configure the signal generator configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); // Generate signal raw signal samples and observations RINEX file +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } } } +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, FLAGS_DLL_narrow_bw_hz, FLAGS_extend_correlation_symbols); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols)); +#endif // ****************************************************************************************** // ***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** @@ -752,9 +883,15 @@ TEST_F(TrackingPullInTest, ValidationOfResults) uint64_t acq_samplestamp_samples = 0; Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); @@ -763,7 +900,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::cout << "True Initial Doppler " << true_obs_data.doppler_l1_hz << " [Hz], true Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << "[Chips]\n"; @@ -773,17 +914,30 @@ TEST_F(TrackingPullInTest, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS true_acq_doppler_hz = doppler_measurements_map.find(FLAGS_test_satellite_PRN)->second; true_acq_delay_samples = code_delay_measurements_map.find(FLAGS_test_satellite_PRN)->second; +#else + true_acq_doppler_hz = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; + true_acq_delay_samples = code_delay_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; +#endif acq_samplestamp_samples = 0; std::cout << "Estimated Initial Doppler " << true_acq_doppler_hz << " [Hz], estimated Initial code delay " << true_acq_delay_samples << " [Samples]" +#if USE_GLOG_AND_GFLAGS << " Acquisition SampleStamp is " << acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second << '\n'; +#else + << " Acquisition SampleStamp is " << acq_samplestamp_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second << '\n'; +#endif } // create the msg queue for valve queue = std::make_shared>(); +#if USE_GLOG_AND_GFLAGS long long int acq_to_trk_delay_samples = ceil(static_cast(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s); +#else + long long int acq_to_trk_delay_samples = ceil(static_cast(absl::GetFlag(FLAGS_fs_gen_sps)) * absl::GetFlag(FLAGS_acq_to_trk_delay_s)); +#endif auto resetable_valve_ = gnss_sdr_make_valve(sizeof(gr_complex), acq_to_trk_delay_samples, queue.get(), false); // CN0 LOOP @@ -822,19 +976,31 @@ TEST_F(TrackingPullInTest, ValidationOfResults) std::string file; ASSERT_NO_THROW({ +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { file = "./" + filename_raw_data + std::to_string(current_cn0_idx); } else { +#if USE_GLOG_AND_GFLAGS file = FLAGS_signal_file; +#else + file = absl::GetFlag(FLAGS_signal_file); +#endif } const char* file_name = file.c_str(); gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false); gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make(); gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); +#if USE_GLOG_AND_GFLAGS gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * FLAGS_duration); +#else + gr::blocks::head::sptr head_samples = gr::blocks::head::make(sizeof(gr_complex), baseband_sampling_freq * absl::GetFlag(FLAGS_duration)); +#endif top_block_trk->connect(file_source, 0, gr_interleaved_char_to_complex, 0); top_block_trk->connect(gr_interleaved_char_to_complex, 0, head_samples, 0); if (acq_to_trk_delay_samples > 0) @@ -848,7 +1014,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) } top_block_trk->connect(tracking->get_right_block(), 0, sink, 0); top_block_trk->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); +#if USE_GLOG_AND_GFLAGS file_source->seek(2 * FLAGS_skip_samples, 0); // skip head. ibyte, two bytes per complex sample +#else + file_source->seek(2 * absl::GetFlag(FLAGS_skip_samples), 0); // skip head. ibyte, two bytes per complex sample +#endif }) << "Failure connecting the blocks of tracking test."; // ******************************************************************** @@ -860,7 +1030,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { EXPECT_NO_THROW({ start = std::chrono::system_clock::now(); +#if USE_GLOG_AND_GFLAGS std::cout << "--- SIMULATING A PULL-IN DELAY OF " << FLAGS_acq_to_trk_delay_s << " SECONDS ---\n"; +#else + std::cout << "--- SIMULATING A PULL-IN DELAY OF " << absl::GetFlag(FLAGS_acq_to_trk_delay_s) << " SECONDS ---\n"; +#endif top_block_trk->start(); std::cout << " Waiting for valve...\n"; // wait the valve message indicating the circulation of the amount of samples of the delay @@ -889,10 +1063,14 @@ TEST_F(TrackingPullInTest, ValidationOfResults) pull_in_results_v.push_back(msg_rx->rx_message != 3); // save last asynchronous tracking message in order to detect a loss of lock - // ******************************** - // ***** STEP 7: Plot results ***** - // ******************************** +// ******************************** +// ***** STEP 7: Plot results ***** +// ******************************** +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) +#endif { // load the measured values Tracking_Dump_Reader trk_dump; @@ -937,8 +1115,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) Doppler.push_back(trk_dump.carrier_doppler_hz); epoch_counter++; } - +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag show_plots has been set to TRUE,\n"; @@ -953,6 +1134,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) fs::path dir = p.parent_path(); const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) @@ -967,6 +1149,22 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); + + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) + { + Gnuplot g1("linespoints"); + g1.showonscreen(); // window output + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); @@ -985,6 +1183,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) Gnuplot g2("points"); g2.showonscreen(); // window output +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -993,7 +1192,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -1002,6 +1210,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) g2.savetops("Constellation"); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1010,6 +1219,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g3.set_grid(); g3.set_xlabel("Time [s]"); g3.set_ylabel("Reported CN0 [dB-Hz]"); @@ -1024,6 +1243,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) g3.showonscreen(); // window output Gnuplot g4("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1032,6 +1252,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_grid(); g4.set_xlabel("Time [s]"); g4.set_ylabel("Estimated Doppler [Hz]"); @@ -1075,7 +1305,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx); // plot grid Gnuplot g4("points palette pointsize 2 pointtype 7"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -1087,6 +1321,7 @@ TEST_F(TrackingPullInTest, ValidationOfResults) g4.cmd("set key off"); g4.cmd("set view map"); std::string title; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz]."); @@ -1095,7 +1330,16 @@ TEST_F(TrackingPullInTest, ValidationOfResults) { title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz]."); + } + else + { + title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_title(title); g4.set_grid(); g4.set_xlabel("Acquisition Doppler error [Hz]"); @@ -1105,7 +1349,11 @@ TEST_F(TrackingPullInTest, ValidationOfResults) code_delay_error_mesh, pull_in_result_mesh); g4.set_legend(); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx))))); g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))), 12); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index dedfcb658..39f87bdfa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -201,10 +201,15 @@ void* handler_DMA_trk_pull_in_test(void* arguments) return nullptr; } - // ************************************************************************* - // Open input file - // ************************************************************************* + // ************************************************************************* + // Open input file + // ************************************************************************* + +#if USE_GLOG_AND_GFLAGS uint32_t skip_samples = static_cast(FLAGS_skip_samples); +#else + uint32_t skip_samples = static_cast(absl::GetFlag(FLAGS_skip_samples)); +#endif if (skip_samples + skip_used_samples > 0) { @@ -328,12 +333,17 @@ public: std::string p4; std::string p5; std::string p6; +#if USE_GLOG_AND_GFLAGS std::string implementation = FLAGS_trk_test_implementation; - const int baseband_sampling_freq = FLAGS_fs_gen_sps; std::string filename_rinex_obs = FLAGS_filename_rinex_obs; std::string filename_raw_data = FLAGS_signal_file; - +#else + std::string implementation = absl::GetFlag(FLAGS_trk_test_implementation); + const int baseband_sampling_freq = absl::GetFlag(FLAGS_fs_gen_sps); + std::string filename_rinex_obs = absl::GetFlag(FLAGS_filename_rinex_obs); + std::string filename_raw_data = absl::GetFlag(FLAGS_signal_file); +#endif std::map doppler_measurements_map; std::map code_delay_measurements_map; std::map acq_samplestamp_map; @@ -391,6 +401,7 @@ public: int TrackingPullInTestFpga::configure_generator(double CN0_dBHz, int file_idx) { +#if USE_GLOG_AND_GFLAGS // Configure signal generator generator_binary = FLAGS_generator_binary; @@ -407,6 +418,25 @@ int TrackingPullInTestFpga::configure_generator(double CN0_dBHz, int file_idx) p4 = std::string("-sig_out_file=") + FLAGS_signal_file + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#else + // Configure signal generator + generator_binary = absl::GetFlag(FLAGS_generator_binary); + + p1 = std::string("-rinex_nav_file=") + absl::GetFlag(FLAGS_rinex_nav_file); + if (absl::GetFlag(FLAGS_dynamic_position).empty()) + { + p2 = std::string("-static_position=") + absl::GetFlag(FLAGS_static_position) + std::string(",") + std::to_string(absl::GetFlag(FLAGS_duration) * 10); + } + else + { + p2 = std::string("-obs_pos_file=") + std::string(absl::GetFlag(FLAGS_dynamic_position)); + } + p3 = std::string("-rinex_obs_file=") + absl::GetFlag(FLAGS_filename_rinex_obs); // RINEX 2.10 observation file output + p4 = std::string("-sig_out_file=") + absl::GetFlag(FLAGS_signal_file) + std::to_string(file_idx); // Baseband signal output file. Will be stored in int8_t IQ multiplexed samples + p5 = std::string("-sampling_freq=") + std::to_string(baseband_sampling_freq); // Baseband sampling frequency [MSps] + p6 = std::string("-CN0_dBHz=") + std::to_string(CN0_dBHz); // Signal generator CN0 +#endif + return 0; } @@ -497,7 +527,11 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("Tracking.extend_correlation_symbols", std::to_string(extend_correlation_symbols)); config->set_property("Tracking.pll_bw_narrow_hz", std::to_string(PLL_narrow_bw_hz)); config->set_property("Tracking.dll_bw_narrow_hz", std::to_string(DLL_narrow_bw_hz)); +#if USE_GLOG_AND_GFLAGS gnss_synchro.PRN = FLAGS_test_satellite_PRN; +#else + gnss_synchro.PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif gnss_synchro.Channel_ID = 0; config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); @@ -590,7 +624,11 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) struct DMA_handler_args_trk_pull_in_test args; struct acquisition_handler_args_trk_pull_in_test args_acq; +#if USE_GLOG_AND_GFLAGS std::string file = FLAGS_signal_file; +#else + std::string file = absl::GetFlag(FLAGS_signal_file); +#endif args.file = file; // DMA file configuration // instantiate the FPGA switch and set the @@ -657,11 +695,17 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) acquisition->set_gnss_synchro(&tmp_gnss_synchro); acquisition->set_channel_fsm(channel_fsm_); acquisition->set_channel(0); +#if USE_GLOG_AND_GFLAGS acquisition->set_doppler_max(config->property("Acquisition.doppler_max", FLAGS_external_signal_acquisition_doppler_max_hz)); acquisition->set_doppler_step(config->property("Acquisition.doppler_step", FLAGS_external_signal_acquisition_doppler_step_hz)); acquisition->set_doppler_center(0); acquisition->set_threshold(config->property("Acquisition.threshold", FLAGS_external_signal_acquisition_threshold)); - +#else + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_max_hz))); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", absl::GetFlag(FLAGS_external_signal_acquisition_doppler_step_hz))); + acquisition->set_doppler_center(0); + acquisition->set_threshold(config->property("Acquisition.threshold", absl::GetFlag(FLAGS_external_signal_acquisition_threshold))); +#endif std::chrono::time_point start, end; std::chrono::duration elapsed_seconds; start = std::chrono::system_clock::now(); @@ -755,7 +799,11 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) if (start_msg == true) { +#if USE_GLOG_AND_GFLAGS std::cout << "Reading external signal file: " << FLAGS_signal_file << '\n'; +#else + std::cout << "Reading external signal file: " << absl::GetFlag(FLAGS_signal_file) << '\n'; +#endif std::cout << "Searching for " << System_and_Signal << " Satellites...\n"; std::cout << "["; start_msg = false; @@ -824,13 +872,20 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::vector acq_doppler_error_hz_values; std::vector> acq_delay_error_chips_values; // vector of vector - +#if USE_GLOG_AND_GFLAGS for (double doppler_hz = FLAGS_acq_Doppler_error_hz_start; doppler_hz >= FLAGS_acq_Doppler_error_hz_stop; doppler_hz = doppler_hz + FLAGS_acq_Doppler_error_hz_step) +#else + for (double doppler_hz = absl::GetFlag(FLAGS_acq_Doppler_error_hz_start); doppler_hz >= absl::GetFlag(FLAGS_acq_Doppler_error_hz_stop); doppler_hz = doppler_hz + absl::GetFlag(FLAGS_acq_Doppler_error_hz_step)) +#endif { acq_doppler_error_hz_values.push_back(doppler_hz); std::vector tmp_vector; // Code Delay Sweep +#if USE_GLOG_AND_GFLAGS for (double code_delay_chips = FLAGS_acq_Delay_error_chips_start; code_delay_chips >= FLAGS_acq_Delay_error_chips_stop; code_delay_chips = code_delay_chips + FLAGS_acq_Delay_error_chips_step) +#else + for (double code_delay_chips = absl::GetFlag(FLAGS_acq_Delay_error_chips_start); code_delay_chips >= absl::GetFlag(FLAGS_acq_Delay_error_chips_stop); code_delay_chips = code_delay_chips + absl::GetFlag(FLAGS_acq_Delay_error_chips_step)) +#endif { tmp_vector.push_back(code_delay_chips); } @@ -841,6 +896,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // ***** STEP 2: Generate the input signal (if required) ***** // *********************************************************** std::vector generator_CN0_values; +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) { generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available @@ -859,14 +915,44 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) } } } +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) + { + generator_CN0_values.push_back(999); // an external input signal capture is selected, no CN0 information available + } + else + { + if (absl::GetFlag(FLAGS_CN0_dBHz_start) == absl::GetFlag(FLAGS_CN0_dBHz_stop)) + { + generator_CN0_values.push_back(absl::GetFlag(FLAGS_CN0_dBHz_start)); + } + else + { + for (double cn0 = absl::GetFlag(FLAGS_CN0_dBHz_start); cn0 > absl::GetFlag(FLAGS_CN0_dBHz_stop); cn0 = cn0 - absl::GetFlag(FLAGS_CN0_dB_step)) + { + generator_CN0_values.push_back(cn0); + } + } + } +#endif - // use generator or use an external capture file + // use generator or use an external capture file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_enable_external_signal_file) { // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters ASSERT_EQ(acquire_signal(FLAGS_test_satellite_PRN), true); bool found_satellite = doppler_measurements_map.find(FLAGS_test_satellite_PRN) != doppler_measurements_map.end(); EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << FLAGS_test_satellite_PRN << " is not acquired"; +#else + if (absl::GetFlag(FLAGS_enable_external_signal_file)) + { + // create and configure an acquisition block and perform an acquisition to obtain the synchronization parameters + ASSERT_EQ(acquire_signal(absl::GetFlag(FLAGS_test_satellite_PRN)), true); + bool found_satellite = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN)) != doppler_measurements_map.end(); + EXPECT_TRUE(found_satellite) << "Error: satellite SV: " << absl::GetFlag(FLAGS_test_satellite_PRN) << " is not acquired"; +#endif if (!found_satellite) { return; @@ -879,18 +965,30 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // Configure the signal generator configure_generator(generator_CN0_values.at(current_cn0_idx), current_cn0_idx); // Generate signal raw signal samples and observations RINEX file + +#if USE_GLOG_AND_GFLAGS if (FLAGS_disable_generator == false) +#else + if (absl::GetFlag(FLAGS_disable_generator) == false) +#endif { generate_signal(); } } } - +#if USE_GLOG_AND_GFLAGS configure_receiver(FLAGS_PLL_bw_hz_start, FLAGS_DLL_bw_hz_start, FLAGS_PLL_narrow_bw_hz, FLAGS_DLL_narrow_bw_hz, FLAGS_extend_correlation_symbols); +#else + configure_receiver(absl::GetFlag(FLAGS_PLL_bw_hz_start), + absl::GetFlag(FLAGS_DLL_bw_hz_start), + absl::GetFlag(FLAGS_PLL_narrow_bw_hz), + absl::GetFlag(FLAGS_DLL_narrow_bw_hz), + absl::GetFlag(FLAGS_extend_correlation_symbols)); +#endif // ****************************************************************************************** // ***** Obtain the initial signal sinchronization parameters (emulating an acquisition) **** @@ -901,9 +999,15 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) uint64_t acq_samplestamp_samples = 0; Tracking_True_Obs_Reader true_obs_data; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { test_satellite_PRN = FLAGS_test_satellite_PRN; +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + test_satellite_PRN = absl::GetFlag(FLAGS_test_satellite_PRN); +#endif std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(".dat"); @@ -912,7 +1016,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // load acquisition data based on the first epoch of the true observations ASSERT_EQ(true_obs_data.read_binary_obs(), true) << "Failure reading true tracking dump file.\n" +#if USE_GLOG_AND_GFLAGS << "Maybe sat PRN #" + std::to_string(FLAGS_test_satellite_PRN) + +#else + << "Maybe sat PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + +#endif " is not available?"; std::cout << "Testing satellite PRN=" << test_satellite_PRN << '\n'; std::cout << "True Initial Doppler " << true_obs_data.doppler_l1_hz << " [Hz], true Initial code delay [Chips]=" << true_obs_data.prn_delay_chips << "[Chips]\n"; @@ -922,16 +1030,29 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) } else { +#if USE_GLOG_AND_GFLAGS true_acq_doppler_hz = doppler_measurements_map.find(FLAGS_test_satellite_PRN)->second; true_acq_delay_samples = code_delay_measurements_map.find(FLAGS_test_satellite_PRN)->second; acq_samplestamp_samples = acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second; +#else + true_acq_doppler_hz = doppler_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; + true_acq_delay_samples = code_delay_measurements_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; + acq_samplestamp_samples = acq_samplestamp_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second; +#endif std::cout << "Estimated Initial Doppler " << true_acq_doppler_hz << " [Hz], estimated Initial code delay " << true_acq_delay_samples << " [Samples]" +#if USE_GLOG_AND_GFLAGS << " Acquisition SampleStamp is " << acq_samplestamp_map.find(FLAGS_test_satellite_PRN)->second << '\n'; +#else + << " Acquisition SampleStamp is " << acq_samplestamp_map.find(absl::GetFlag(FLAGS_test_satellite_PRN))->second << '\n'; +#endif } - +#if USE_GLOG_AND_GFLAGS int64_t acq_to_trk_delay_samples = ceil(static_cast(FLAGS_fs_gen_sps) * FLAGS_acq_to_trk_delay_s); +#else + int64_t acq_to_trk_delay_samples = ceil(static_cast(absl::GetFlag(FLAGS_fs_gen_sps)) * absl::GetFlag(FLAGS_acq_to_trk_delay_s)); +#endif // set the scaling factor args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR; @@ -1006,13 +1127,21 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::string file; ASSERT_NO_THROW({ +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { file = "./" + filename_raw_data + std::to_string(current_cn0_idx); } else { +#if USE_GLOG_AND_GFLAGS file = FLAGS_signal_file; +#else + file = absl::GetFlag(FLAGS_signal_file); +#endif } gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro)); @@ -1034,8 +1163,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) if (acq_to_trk_delay_samples > 0) { +#if USE_GLOG_AND_GFLAGS std::cout << "--- SIMULATING A PULL-IN DELAY OF " << FLAGS_acq_to_trk_delay_s << " SECONDS ---\n"; - +#else + std::cout << "--- SIMULATING A PULL-IN DELAY OF " << absl::GetFlag(FLAGS_acq_to_trk_delay_s) << " SECONDS ---\n"; +#endif args.file = file; args.nsamples_tx = acq_to_trk_delay_samples; // 150 s for now but will be all file @@ -1053,8 +1185,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::cout << " Waiting flowgraph..\n"; args.file = file; +#if USE_GLOG_AND_GFLAGS args.nsamples_tx = baseband_sampling_freq * FLAGS_duration; - +#else + args.nsamples_tx = baseband_sampling_freq * absl::GetFlag(FLAGS_duration); +#endif args.skip_used_samples = acq_to_trk_delay_samples; if (pthread_create(&thread_DMA, nullptr, handler_DMA_trk_pull_in_test, reinterpret_cast(&args)) < 0) @@ -1082,7 +1217,12 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) // ******************************** // ***** STEP 7: Plot results ***** // ******************************** + +#if USE_GLOG_AND_GFLAGS if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) +#endif { // load the measured values Tracking_Dump_Reader trk_dump; @@ -1127,8 +1267,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) Doppler.push_back(trk_dump.carrier_doppler_hz); epoch_counter++; } - +#if USE_GLOG_AND_GFLAGS const std::string gnuplot_executable(FLAGS_gnuplot_executable); +#else + const std::string gnuplot_executable(absl::GetFlag(FLAGS_gnuplot_executable)); +#endif if (gnuplot_executable.empty()) { std::cout << "WARNING: Although the flag show_plots has been set to TRUE,\n"; @@ -1143,6 +1286,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) fs::path dir = p.parent_path(); const std::string& gnuplot_path = dir.native(); Gnuplot::set_GNUPlotPath(gnuplot_path); +#if USE_GLOG_AND_GFLAGS auto decimate = static_cast(FLAGS_plot_decimate); if (FLAGS_plot_detail_level >= 2 and FLAGS_show_plots) @@ -1157,7 +1301,22 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + auto decimate = static_cast(absl::GetFlag(FLAGS_plot_decimate)); + if (absl::GetFlag(FLAGS_plot_detail_level) >= 2 and absl::GetFlag(FLAGS_show_plots)) + { + Gnuplot g1("linespoints"); + g1.showonscreen(); // window output + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g1.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g1.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g1.set_grid(); g1.set_xlabel("Time [s]"); g1.set_ylabel("Correlators' output"); @@ -1175,6 +1334,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) Gnuplot g2("points"); g2.showonscreen(); // window output +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1183,7 +1343,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g2.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz Constellation " + "PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g2.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g2.set_grid(); g2.set_xlabel("Inphase"); g2.set_ylabel("Quadrature"); @@ -1192,6 +1361,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) g2.savetops("Constellation"); Gnuplot g3("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1200,6 +1370,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g3.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g3.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g3.set_grid(); g3.set_xlabel("Time [s]"); g3.set_ylabel("Reported CN0 [dB-Hz]"); @@ -1214,6 +1394,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) g3.showonscreen(); // window output Gnuplot g4("linespoints"); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); @@ -1222,6 +1403,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + g4.set_title(std::to_string(generator_CN0_values.at(current_cn0_idx)) + " dB-Hz, GPS L1 C/A tracking CN0 output (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } + else + { + g4.set_title("D_e=" + std::to_string(acq_doppler_error_hz_values.at(current_acq_doppler_error_idx)) + " [Hz] " + "T_e= " + std::to_string(acq_delay_error_chips_values.at(current_acq_doppler_error_idx).at(current_acq_code_error_idx)) + " [Chips] PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_grid(); g4.set_xlabel("Time [s]"); g4.set_ylabel("Estimated Doppler [Hz]"); @@ -1265,7 +1456,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) pull_in_result_mesh = pull_in_results_v_v.at(current_cn0_idx); // plot grid Gnuplot g4("points palette pointsize 2 pointtype 7"); +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { g4.showonscreen(); // window output } @@ -1277,6 +1472,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) g4.cmd("set key off"); g4.cmd("set view map"); std::string title; +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) { title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz]."); @@ -1285,7 +1481,16 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) { title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(FLAGS_PLL_bw_hz_start) + "," + std::to_string(FLAGS_DLL_bw_hz_start) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(FLAGS_test_satellite_PRN) + ")"); } - +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) + { + title = std::string("Tracking Pull-in result grid at CN0:" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))) + " [dB-Hz], PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz]."); + } + else + { + title = std::string("Tracking Pull-in result grid, PLL/DLL BW: " + std::to_string(absl::GetFlag(FLAGS_PLL_bw_hz_start)) + "," + std::to_string(absl::GetFlag(FLAGS_DLL_bw_hz_start)) + " [Hz], GPS L1 C/A (PRN #" + std::to_string(absl::GetFlag(FLAGS_test_satellite_PRN)) + ")"); + } +#endif g4.set_title(title); g4.set_grid(); g4.set_xlabel("Acquisition Doppler error [Hz]"); @@ -1295,7 +1500,11 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) code_delay_error_mesh, pull_in_result_mesh); g4.set_legend(); +#if USE_GLOG_AND_GFLAGS if (!FLAGS_enable_external_signal_file) +#else + if (!absl::GetFlag(FLAGS_enable_external_signal_file)) +#endif { g4.savetops("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx))))); g4.savetopdf("trk_pull_in_grid_" + std::to_string(static_cast(round(generator_CN0_values.at(current_cn0_idx)))), 12); diff --git a/src/tests/unit-tests/system-parameters/has_decoding_test.cc b/src/tests/unit-tests/system-parameters/has_decoding_test.cc index 593ce79de..5dc12536f 100644 --- a/src/tests/unit-tests/system-parameters/has_decoding_test.cc +++ b/src/tests/unit-tests/system-parameters/has_decoding_test.cc @@ -20,7 +20,6 @@ #include "galileo_has_page.h" #include "gnss_sdr_make_unique.h" #include "has_simple_printer.h" -#include #include #include #include @@ -35,8 +34,14 @@ // Usage: // ./run_tests --gtest_filter=HAS_Test.Decoder // ./run_tests --gtest_filter=HAS_Test.Decoder --has_data_test_file=../data/HAS_Messages_sample/encoded/Sample_HAS_Pages_Encoded_20210713_08.txt --start_page_test_file=70 + +#if USE_GLOG_AND_GFLAGS DEFINE_string(has_data_test_file, std::string(""), "File containing encoded HAS pages (format: [time sat_id HAS_page_in_hex] in each line)"); DEFINE_int32(start_page_test_file, 0, "Starting page in case of reading HAS pages from a file"); +#else +ABSL_FLAG(std::string, has_data_test_file, std::string(""), "File containing encoded HAS pages (format: [time sat_id HAS_page_in_hex] in each line)"); +ABSL_FLAG(int32_t, start_page_test_file, 0, "Starting page in case of reading HAS pages from a file"); +#endif #if PMT_USES_BOOST_ANY namespace wht = boost; @@ -212,7 +217,11 @@ private: TEST(HAS_Test, Decoder) { Read_Encoded_Pages read_pages{}; +#if USE_GLOG_AND_GFLAGS EXPECT_TRUE(read_pages.read_data(FLAGS_has_data_test_file)); +#else + EXPECT_TRUE(read_pages.read_data(absl::GetFlag(FLAGS_has_data_test_file))); +#endif auto gal_e6_has_rx_ = galileo_e6_has_msg_receiver_make(); auto has_tester = HasDecoderTester_make(); std::unique_ptr has_simple_printer = nullptr; @@ -224,10 +233,17 @@ TEST(HAS_Test, Decoder) if (!known_data) { has_simple_printer = std::make_unique(); +#if USE_GLOG_AND_GFLAGS if (static_cast(FLAGS_start_page_test_file) < read_pages.get_number_pages()) { init = FLAGS_start_page_test_file; } +#else + if (static_cast(absl::GetFlag(FLAGS_start_page_test_file)) < read_pages.get_number_pages()) + { + init = absl::GetFlag(FLAGS_start_page_test_file); + } +#endif else { std::cerr << "The flag --start_page_test_file is set beyond the total number of pages in the file (" << read_pages.get_number_pages() << "), ignoring it.\n"; diff --git a/src/utils/front-end-cal/CMakeLists.txt b/src/utils/front-end-cal/CMakeLists.txt index f8abe59a5..8e328b089 100644 --- a/src/utils/front-end-cal/CMakeLists.txt +++ b/src/utils/front-end-cal/CMakeLists.txt @@ -30,12 +30,17 @@ target_link_libraries(front_end_cal_lib core_libs PRIVATE Boost::headers - Gflags::gflags - Glog::glog Gnuradio::blocks Gnuradio::runtime ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(front_end_cal_lib PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(front_end_cal_lib PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(front_end_cal_lib PRIVATE absl::flags absl::log) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(front_end_cal_lib @@ -59,9 +64,15 @@ target_link_libraries(front-end-cal front_end_cal_lib gnss_sdr_flags Boost::headers - Glog::glog ) +if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(front-end-cal PRIVATE Glog::glog) + target_compile_definitions(front-end-cal PRIVATE -DUSE_GLOG_AND_GFLAGS=1) +else() + target_link_libraries(front-end-cal PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(front-end-cal PRIVATE -DGNURADIO_USES_STD_POINTERS=1 diff --git a/src/utils/front-end-cal/front_end_cal.cc b/src/utils/front-end-cal/front_end_cal.cc index 9c527d10e..dc26ab2a3 100644 --- a/src/utils/front-end-cal/front_end_cal.cc +++ b/src/utils/front-end-cal/front_end_cal.cc @@ -26,7 +26,6 @@ #include "gps_iono.h" #include "gps_utc_model.h" #include -#include #include // for min #include #include // for operator<< @@ -34,6 +33,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + extern Concurrent_Map global_gps_ephemeris_map; extern Concurrent_Map global_gps_iono_map; extern Concurrent_Map global_gps_utc_model_map; diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 972e4a21e..4da2c1730 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -40,8 +40,6 @@ #include // for bad_any_cast #include #include -#include -#include #include // for block #include #include @@ -70,6 +68,23 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#endif + #if HAS_GENERIC_LAMBDA #else #include @@ -81,14 +96,39 @@ namespace wht = boost; namespace wht = std; #endif +#if USE_GLOG_AND_GFLAGS #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif - DECLARE_string(log_dir); +#else +class FrontEndCalLogSink : public absl::LogSink +{ +public: + FrontEndCalLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + logfile.open(absl::GetFlag(FLAGS_log_dir) + "/front_end_cal.log"); + } + else + { + logfile.open(GetTempDir() + "/front_end_cal.log"); + } + } + void Send(const absl::LogEntry& entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; +}; +std::string FrontEndCalVersionString() { return std::string(FRONT_END_CAL_VERSION) + "\n"; } +#endif Concurrent_Map global_gps_ephemeris_map; Concurrent_Map global_gps_iono_map; @@ -100,7 +140,7 @@ Concurrent_Queue global_gps_acq_assist_queue; bool stop; Concurrent_Queue channel_internal_queue; std::vector gnss_sync_vector; -Gnss_Synchro gnss_synchro{}; +Gnss_Synchro gnss_synchro; // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class FrontEndCal_msg_rx; @@ -277,10 +317,17 @@ int main(int argc, char** argv) "This program comes with ABSOLUTELY NO WARRANTY;\n" + "See COPYING file to see a copy of the General Public License\n \n"); +#if USE_GLOG_AND_GFLAGS gflags::SetUsageMessage(intro_help); google::SetVersionString(FRONT_END_CAL_VERSION); gflags::ParseCommandLineFlags(&argc, &argv, true); - +#else + absl::FlagsUsageConfig empty_config; + empty_config.version_string = &FrontEndCalVersionString; + absl::SetFlagsUsageConfig(empty_config); + absl::SetProgramUsageMessage(intro_help); + absl::ParseCommandLine(argc, argv); +#endif std::cout << "Initializing... Please wait.\n"; } catch (const std::exception& e) @@ -289,8 +336,16 @@ int main(int argc, char** argv) std::cout << "front-end-cal program ended.\n"; return 1; } + +#if USE_GLOG_AND_GFLAGS google::InitGoogleLogging(argv[0]); if (FLAGS_log_dir.empty()) +#else + absl::LogSink* fecLogSink = new FrontEndCalLogSink; + absl::AddLogSink(fecLogSink); + absl::InitializeLog(); + if (absl::GetFlag(FLAGS_log_dir).empty()) +#endif { std::cout << "Logging will be done at " << "/tmp" @@ -302,29 +357,49 @@ int main(int argc, char** argv) { try { +#if USE_GLOG_AND_GFLAGS const fs::path p(FLAGS_log_dir); +#else + const fs::path p(absl::GetFlag(FLAGS_log_dir)); +#endif if (!fs::exists(p)) { std::cout << "The path " +#if USE_GLOG_AND_GFLAGS << FLAGS_log_dir +#else + << absl::GetFlag(FLAGS_log_dir) +#endif << " does not exist, attempting to create it" << '\n'; errorlib::error_code ec; if (!fs::create_directory(p, ec)) { +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. Front-end-cal program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. Front-end-cal program ended.\n"; +#endif return 1; } } std::cout << "Logging with be done at " +#if USE_GLOG_AND_GFLAGS << FLAGS_log_dir << '\n'; +#else + << absl::GetFlag(FLAGS_log_dir) << '\n'; +#endif } catch (const std::exception& e) { std::cerr << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS std::cerr << "Could not create the " << FLAGS_log_dir << " folder. Front-end-cal program ended.\n"; gflags::ShutDownCommandLineFlags(); +#else + std::cerr << "Could not create the " << absl::GetFlag(FLAGS_log_dir) << " folder. Front-end-cal program ended.\n"; +#endif return 1; } } @@ -335,7 +410,11 @@ int main(int argc, char** argv) FrontEndCal front_end_cal; // 1. Load configuration parameters from config file +#if USE_GLOG_AND_GFLAGS std::shared_ptr configuration = std::make_shared(FLAGS_config_file); +#else + std::shared_ptr configuration = std::make_shared(absl::GetFlag(FLAGS_config_file)); +#endif front_end_cal.set_configuration(configuration); // 2. Get SUPL information from server: Ephemeris record, assistance info and TOW @@ -541,7 +620,9 @@ int main(int argc, char** argv) else { std::cout << "Unable to get Ephemeris SUPL assistance. TOW is unknown!\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } @@ -549,7 +630,9 @@ int main(int argc, char** argv) catch (const boost::exception& e) { std::cout << "Exception in getting Global ephemeris map\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } @@ -568,7 +651,9 @@ int main(int argc, char** argv) if (doppler_measurements_map.empty()) { std::cout << "Sorry, no GPS satellites detected in the front-end capture, please check the antenna setup...\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } @@ -673,17 +758,22 @@ int main(int argc, char** argv) catch (const std::exception& e) { std::cerr << "Exception: " << e.what(); +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } catch (...) { std::cerr << "Unknown error\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } - +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif std::cout << "GNSS-SDR Front-end calibration program ended.\n"; return 0; } diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 107d4be37..cef3bd057 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -52,8 +52,10 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) add_dependencies(obsdiff armadillo-${armadillo_RELEASE}) endif() - if(NOT GFLAGS_FOUND) - add_dependencies(obsdiff gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + if(ENABLE_GLOG_AND_GFLAGS) + if(NOT GFLAGS_FOUND) + add_dependencies(obsdiff gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}) + endif() endif() if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) add_dependencies(obsdiff gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}) @@ -101,11 +103,17 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND PRIVATE Armadillo::armadillo Threads::Threads - Gflags::gflags Matio::matio Gnsstk::gnsstk ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(obsdiff PRIVATE Gflags::gflags) + target_compile_definitions(obsdiff PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(obsdiff PRIVATE absl::flags absl::flags_parse) + endif() + if(ENABLE_STRIP) set_target_properties(obsdiff PROPERTIES LINK_FLAGS "-s") endif() diff --git a/src/utils/rinex-tools/obsdiff.cc b/src/utils/rinex-tools/obsdiff.cc index 0b156bb86..1b2cd1fc3 100644 --- a/src/utils/rinex-tools/obsdiff.cc +++ b/src/utils/rinex-tools/obsdiff.cc @@ -80,12 +80,16 @@ namespace gnsstk = gpstk; #endif #endif +#if USE_GLOG_AND_GFLAGS #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#endif // Create the lists of GNSS satellites std::set available_gps_prn = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, @@ -422,8 +426,12 @@ void carrier_phase_double_diff( << " [Cycles]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Phase error [Cycles]"); @@ -506,8 +514,12 @@ void carrier_phase_single_diff( << " [Cycles]\n"; std::cout.precision(ss); - // plots +// plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Single diff Carrier Phase error [Cycles]"); @@ -614,7 +626,11 @@ void carrier_doppler_double_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Carrier Doppler error [Hz]"); @@ -697,7 +713,11 @@ void carrier_doppler_single_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Single diff Carrier Doppler error [Hz]"); @@ -805,7 +825,11 @@ void code_pseudorange_double_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Double diff Pseudorange error [m]"); @@ -890,7 +914,11 @@ void code_pseudorange_single_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Single diff Pseudorange error [m]"); @@ -1039,7 +1067,11 @@ void coderate_phaserate_consistence( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Code rate - phase rate [m/s]"); @@ -1123,7 +1155,11 @@ void code_phase_diff( std::cout.precision(ss); // plots +#if USE_GLOG_AND_GFLAGS if (FLAGS_show_plots) +#else + if (absl::GetFlag(FLAGS_show_plots)) +#endif { Gnuplot g3("linespoints"); g3.set_title(data_title + "Code range - Carrier phase range [m]"); @@ -1396,13 +1432,23 @@ void RINEX_doublediff_dupli_sat() { // special test mode for duplicated satellites // read rinex receiver-under-test observations +#if USE_GLOG_AND_GFLAGS std::map rover_obs = ReadRinexObs(FLAGS_rover_rinex_obs, 'G', std::string("1C")); +#else + std::map rover_obs = ReadRinexObs(absl::GetFlag(FLAGS_rover_rinex_obs), 'G', std::string("1C")); +#endif + + if (rover_obs.empty()) { return; } - // Cut measurement initial transitory of the measurements + // Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif std::cout << "Skipping initial transitory of " << initial_transitory_s << " [s]\n"; arma::uvec index; for (auto& rover_ob : rover_obs) @@ -1415,7 +1461,11 @@ void RINEX_doublediff_dupli_sat() } std::vector prn_pairs; +#if USE_GLOG_AND_GFLAGS std::stringstream ss(FLAGS_dupli_sat_prns); +#else + std::stringstream ss(absl::GetFlag(FLAGS_dupli_sat_prns)); +#endif unsigned int i; while (ss >> i) { @@ -1463,11 +1513,17 @@ void RINEX_doublediff_dupli_sat() void RINEX_doublediff(bool remove_rx_clock_error) { +#if USE_GLOG_AND_GFLAGS // read rinex base observations std::map base_obs = ReadRinexObs(FLAGS_base_rinex_obs, FLAGS_system.c_str()[0], FLAGS_signal); // read rinex receiver-under-test (rover) observations std::map rover_obs = ReadRinexObs(FLAGS_rover_rinex_obs, FLAGS_system.c_str()[0], FLAGS_signal); - +#else + // read rinex base observations + std::map base_obs = ReadRinexObs(absl::GetFlag(FLAGS_base_rinex_obs), absl::GetFlag(FLAGS_system).c_str()[0], absl::GetFlag(FLAGS_signal)); + // read rinex receiver-under-test (rover) observations + std::map rover_obs = ReadRinexObs(absl::GetFlag(FLAGS_rover_rinex_obs), absl::GetFlag(FLAGS_system).c_str()[0], absl::GetFlag(FLAGS_signal)); +#endif if (base_obs.empty() or rover_obs.empty()) { return; @@ -1478,14 +1534,24 @@ void RINEX_doublediff(bool remove_rx_clock_error) double rover_rx_clock_error_s = 0.0; if (remove_rx_clock_error == true) { +#if USE_GLOG_AND_GFLAGS base_rx_clock_error_s = compute_rx_clock_error(FLAGS_rinex_nav, FLAGS_base_rinex_obs); rover_rx_clock_error_s = compute_rx_clock_error(FLAGS_rinex_nav, FLAGS_rover_rinex_obs); +#else + base_rx_clock_error_s = compute_rx_clock_error(absl::GetFlag(FLAGS_rinex_nav), absl::GetFlag(FLAGS_base_rinex_obs)); + rover_rx_clock_error_s = compute_rx_clock_error(absl::GetFlag(FLAGS_rinex_nav), absl::GetFlag(FLAGS_rover_rinex_obs)); +#endif } double common_clock_error_s = rover_rx_clock_error_s - base_rx_clock_error_s; // Cut measurement initial transitory of the measurements + +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif std::cout << "Skipping initial transitory of " << initial_transitory_s << " [s]\n"; arma::uvec index; for (auto& rover_ob : rover_obs) @@ -1535,7 +1601,11 @@ void RINEX_doublediff(bool remove_rx_clock_error) base_obs_time = base_obs.begin()->second.col(0); rover_obs_time = rover_obs.begin()->second.col(0); +#if USE_GLOG_AND_GFLAGS double skip_ends_s = FLAGS_skip_obs_ends_s; +#else + double skip_ends_s = absl::GetFlag(FLAGS_skip_obs_ends_s); +#endif std::cout << "Skipping last " << skip_ends_s << " [s] of observations\n"; for (auto& rover_ob : rover_obs) { @@ -1653,16 +1723,24 @@ void RINEX_doublediff(bool remove_rx_clock_error) void RINEX_singlediff() { +#if USE_GLOG_AND_GFLAGS // read rinex receiver-under-test observations std::map rover_obs = ReadRinexObs(FLAGS_rover_rinex_obs, FLAGS_system.c_str()[0], FLAGS_signal); - +#else + // read rinex receiver-under-test observations + std::map rover_obs = ReadRinexObs(absl::GetFlag(FLAGS_rover_rinex_obs), absl::GetFlag(FLAGS_system).c_str()[0], absl::GetFlag(FLAGS_signal)); +#endif if (rover_obs.empty()) { return; } - // Cut measurement initial transitory of the measurements + // Cut measurement initial transitory of the measurements +#if USE_GLOG_AND_GFLAGS double initial_transitory_s = FLAGS_skip_obs_transitory_s; +#else + double initial_transitory_s = absl::GetFlag(FLAGS_skip_obs_transitory_s); +#endif std::cout << "Skipping initial transitory of " << initial_transitory_s << " [s]\n"; arma::uvec index; for (auto& rover_ob : rover_obs) @@ -1677,7 +1755,11 @@ void RINEX_singlediff() // also skip last seconds of the observations (some artifacts are present in some RINEX endings) arma::colvec rover_obs_time = rover_obs.begin()->second.col(0); +#if USE_GLOG_AND_GFLAGS double skip_ends_s = FLAGS_skip_obs_ends_s; +#else + double skip_ends_s = absl::GetFlag(FLAGS_skip_obs_ends_s); +#endif std::cout << "Skipping last " << skip_ends_s << " [s] of observations\n"; for (auto& rover_ob : rover_obs) { @@ -1727,12 +1809,22 @@ void RINEX_singlediff() int main(int argc, char** argv) { std::cout << "Running RINEX observables difference tool...\n"; +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); +#else + absl::ParseCommandLine(argc, argv); +#endif try { +#if USE_GLOG_AND_GFLAGS if (FLAGS_single_diff) { if (FLAGS_dupli_sat) +#else + if (absl::GetFlag(FLAGS_single_diff)) + { + if (absl::GetFlag(FLAGS_dupli_sat)) +#endif { RINEX_doublediff_dupli_sat(); } @@ -1743,27 +1835,39 @@ int main(int argc, char** argv) } else { +#if USE_GLOG_AND_GFLAGS RINEX_doublediff(FLAGS_remove_rx_clock_error); +#else + RINEX_doublediff(absl::GetFlag(FLAGS_remove_rx_clock_error)); +#endif } } catch (const gnsstk::Exception& e) { std::cerr << e; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } catch (const std::exception& e) { std::cerr << "Exception: " << e.what(); +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } catch (...) { std::cerr << "Unknown error\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 0; } diff --git a/src/utils/rinex-tools/obsdiff_flags.h b/src/utils/rinex-tools/obsdiff_flags.h index 961ae9536..d3b9a607c 100644 --- a/src/utils/rinex-tools/obsdiff_flags.h +++ b/src/utils/rinex-tools/obsdiff_flags.h @@ -18,6 +18,7 @@ #ifndef GNSS_SDR_OBSDIFF_FLAGS_H #define GNSS_SDR_OBSDIFF_FLAGS_H +#if USE_GLOG_AND_GFLAGS #include DEFINE_double(skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); @@ -33,5 +34,24 @@ DEFINE_string(rover_rinex_obs, "base.obs", "Filename of test RINEX observation f DEFINE_string(system, "G", "GNSS satellite system: G for GPS, E for Galileo"); DEFINE_string(signal, "1C", "GNSS signal: 1C for GPS L1 CA, 1B for Galileo E1"); DEFINE_bool(remove_rx_clock_error, false, "Compute and remove the receivers clock error prior to compute observable differences (requires a valid RINEX nav file for both receivers)"); +#else +#include +#include +#include + +ABSL_FLAG(double, skip_obs_transitory_s, 30.0, "Skip the initial observable outputs to avoid transitory results [s]"); +ABSL_FLAG(double, skip_obs_ends_s, 5.0, "Skip the lasts observable outputs to avoid transitory results [s]"); +ABSL_FLAG(bool, single_diffs, false, "Compute also the single difference errors for Accumulated Carrier Phase and Carrier Doppler (requires LO synchronization between receivers)"); +ABSL_FLAG(bool, compare_with_5X, false, "Compare the E5a Doppler and Carrier Phases with the E5 full bw in RINEX (expect discrepancy due to the center frequencies difference)"); +ABSL_FLAG(bool, dupli_sat, false, "Enable special observable test mode where the scenario contains duplicated satellite orbits"); +ABSL_FLAG(bool, single_diff, false, "Enable special observable test mode using only rover observables"); +ABSL_FLAG(std::string, dupli_sat_prns, "1,2,3,4", "List of duplicated satellites PRN pairs (i.e. 1,2,3,4 indicates that the PRNs 1,2 share the same orbit. The same applies for PRNs 3,4)"); +ABSL_FLAG(std::string, base_rinex_obs, "base.obs", "Filename of reference RINEX observation file"); +ABSL_FLAG(std::string, rinex_nav, "base.nav", "Filename of reference RINEX navigation file"); +ABSL_FLAG(std::string, rover_rinex_obs, "base.obs", "Filename of test RINEX observation file"); +ABSL_FLAG(std::string, system, "G", "GNSS satellite system: G for GPS, E for Galileo"); +ABSL_FLAG(std::string, signal, "1C", "GNSS signal: 1C for GPS L1 CA, 1B for Galileo E1"); +ABSL_FLAG(bool, remove_rx_clock_error, false, "Compute and remove the receivers clock error prior to compute observable differences (requires a valid RINEX nav file for both receivers)"); #endif +#endif diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 4f9e31b88..528beff86 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -79,11 +79,17 @@ if(Boost_FOUND) Boost::iostreams Boost::serialization ${GNSSTK_LIBRARY} - Gflags::gflags Threads::Threads core_system_parameters ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(rinex2assist PRIVATE Gflags::gflags) + target_compile_definitions(rinex2assist PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(rinex2assist PRIVATE absl::flags absl::flags_parse) + endif() + if(GNSSTK_USES_GPSTK_NAMESPACE) target_compile_definitions(rinex2assist PUBLIC -DGNSSTK_USES_GPSTK_NAMESPACE=1) target_include_directories(rinex2assist diff --git a/src/utils/rinex2assist/main.cc b/src/utils/rinex2assist/main.cc index b100ac95d..7ae45a286 100644 --- a/src/utils/rinex2assist/main.cc +++ b/src/utils/rinex2assist/main.cc @@ -27,7 +27,6 @@ #include #include #include -#include #include // for size_t #include #include @@ -44,12 +43,21 @@ namespace gnsstk = gpstk; #include #endif +#if USE_GLOG_AND_GFLAGS +#include #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } #endif +#else +#include +#include +#include +#include +std::string TstVersionString() { return "1.0"; } +#endif int main(int argc, char** argv) { @@ -61,17 +69,26 @@ int main(int argc, char** argv) "Usage: \n" + " rinex2assist "); +#if USE_GLOG_AND_GFLAGS gflags::SetUsageMessage(intro_help); google::SetVersionString("1.0"); gflags::ParseCommandLineFlags(&argc, &argv, true); - +#else + absl::FlagsUsageConfig empty_config; + empty_config.version_string = &TstVersionString; + absl::SetFlagsUsageConfig(empty_config); + absl::SetProgramUsageMessage(intro_help); + absl::ParseCommandLine(argc, argv); +#endif if ((argc != 2)) { std::cerr << "Usage:\n"; std::cerr << " " << argv[0] << " " << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::string xml_filename; @@ -327,14 +344,18 @@ int main(int argc, char** argv) { std::cerr << "Error reading the RINEX file: " << e.what() << '\n'; std::cerr << "No XML file will be created.\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } if (i == 0 and j == 0) { std::cerr << "No navigation data found in the RINEX file. No XML file will be created.\n"; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } @@ -355,7 +376,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -373,7 +396,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -393,7 +418,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -413,7 +440,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -432,7 +461,9 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; @@ -450,11 +481,15 @@ int main(int argc, char** argv) catch (std::exception& e) { std::cerr << "Problem creating the XML file " << xml_filename << ": " << e.what() << '\n'; +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 1; } std::cout << "Generated file: " << xml_filename << '\n'; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#endif return 0; } From 606454f7d34dee59c9ccef5717b3cb36b7a1bf3b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 30 Apr 2024 10:35:37 +0200 Subject: [PATCH 144/499] Fix for Xcode --- src/tests/CMakeLists.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 2785c5b8c..43f8ff97d 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -334,7 +334,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) else() set(SW_GENERATOR_BIN ${GNSSSDR_BINARY_DIR}/gnss-sim/gnss_sim) if(CMAKE_GENERATOR STREQUAL Xcode) - set(SW_GENERATOR_BIN ${GNSSSDR_BINARY_DIR}/gnss-sim/${CMAKE_BUILD_TYPE}/gnss_sim) + set(SW_GENERATOR_BIN ${GNSSSDR_BINARY_DIR}/gnss-sim/$<$:None>$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:NoOptWithASM>$<$:Coverage>$<$:O2WithASM>$<$:O3WithASM>$<$:Debug>/gnss_sim) endif() add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}") add_definitions(-DDEFAULT_RINEX_NAV="${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim/brdc3540.14n") @@ -871,12 +871,16 @@ if(ENABLE_SYSTEM_TESTING) ) if(ENABLE_GLOG_AND_GFLAGS) set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) - add_definitions(-DUSE_GLOG=1) else() set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) endif() if(NOT ENABLE_PACKAGING) - add_system_test(ttff) + add_system_test(ttff + CMAKE_ARGS -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + ) + if(ENABLE_GLOG_AND_GFLAGS) + target_compile_definitions(ttff PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + endif() endif() if(ENABLE_SYSTEM_TESTING_EXTRA) @@ -891,11 +895,15 @@ if(ENABLE_SYSTEM_TESTING) ) if(ENABLE_GLOG_AND_GFLAGS) set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) - add_definitions(-DUSE_GLOG=1) else() set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) endif() - add_system_test(position_test) + add_system_test(position_test + CMAKE_ARGS -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + ) + if(ENABLE_GLOG_AND_GFLAGS) + target_compile_definitions(position_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + endif() if(ENABLE_GPERFTOOLS) if(GPERFTOOLS_FOUND) target_link_libraries(position_test From 7f097af73c5ce556e83bb4b5336d8c12d6e40725 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 30 Apr 2024 10:35:54 +0200 Subject: [PATCH 145/499] Fix typo --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa4eafe9e..8fe809254 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3546,8 +3546,8 @@ add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks add_feature_info(ENABLE_ARMA_NO_DEBUG ENABLE_ARMA_NO_DEBUG "Enables passing the ARMA_NO_DEBUG macro to Armadillo, hence disabling bound checking.") add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.") add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.") -add_feature_info(ENABLE_GLOG_AND_GFLAGS ENABLE_GLOG_AND_GFLAGS "Forces the usage of Google glog and Gflags instead of Abseil") -add_feature_info(ENABLE_OWN_ABSEIL ENABLE_OWN_ABSEIL "Forces downloading and building Abseil. Supersedes ENABLE_OWN_GLOG") +add_feature_info(ENABLE_GLOG_AND_GFLAGS ENABLE_GLOG_AND_GFLAGS "Forces the usage of Google glog and Gflags instead of Abseil.") +add_feature_info(ENABLE_OWN_ABSEIL ENABLE_OWN_ABSEIL "Forces downloading and building Abseil. Supersedes ENABLE_OWN_GLOG.") add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.") add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging.") add_feature_info(ENABLE_ORC ENABLE_ORC "Use the Optimized Inner Loop Runtime Compiler (ORC) for building volk_gnsssdr.") From 4515e67b3f00919b61fcc03d9dde5f19b41356b9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 May 2024 08:39:22 +0200 Subject: [PATCH 146/499] Fixes for the embedded Abseil --- .../adapters/ad9361_fpga_signal_source.cc | 18 ++++++++++++++++-- .../adapters/fmcomms2_signal_source.cc | 4 ++++ src/tests/common-files/test_flags.h | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) 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 225f67782..3a3360bed 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -46,6 +46,7 @@ #if USE_GLOG_AND_GFLAGS #include #else +#include #include #endif @@ -94,7 +95,11 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), enable_ovf_check_buffer_monitor_active_(false), dump_(configuration->property(role + ".dump", false)), +#if USE_GLOG_AND_GFLAGS rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)), +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))), +#endif repeat_(configuration->property(role + ".repeat", false)) { const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", 0.0); @@ -121,7 +126,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con { filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); } - +#if USE_GLOG_AND_GFLAGS // override value with commandline flag, if present if (FLAGS_signal_source != "-") { @@ -131,7 +136,16 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con { filename0_ = FLAGS_s; } - +#else + if (absl::GetFlag(FLAGS_signal_source) != "-") + { + filename0_ = absl::GetFlag(FLAGS_signal_source); + } + if (absl::GetFlag(FLAGS_s) != "-") + { + filename0_ = absl::GetFlag(FLAGS_s); + } +#endif if (filename0_.empty()) { num_input_files_ = 2; diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc index 1bd15ce35..e2a516a36 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.cc @@ -75,7 +75,11 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(const ConfigurationInterface *configu rf_dc_(configuration->property(role + ".rf_dc", true)), bb_dc_(configuration->property(role + ".bb_dc", true)), filter_auto_(configuration->property(role + ".filter_auto", false)), +#if USE_GLOG_AND_GFLAGS rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)), +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))), +#endif dump_(configuration->property(role + ".dump", false)) { if (filter_auto_) diff --git a/src/tests/common-files/test_flags.h b/src/tests/common-files/test_flags.h index 937ad4418..57061e5a7 100644 --- a/src/tests/common-files/test_flags.h +++ b/src/tests/common-files/test_flags.h @@ -34,7 +34,7 @@ DEFINE_int32(plot_decimate, 1, "Decimate plots"); #else #include #if defined GNUPLOT_EXECUTABLE -ABSL_FLAG(std::string, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path"); +ABSL_FLAG(std::string, gnuplot_executable, std::string(GNUPLOT_EXECUTABLE), "Gnuplot binary path"); #elif !defined GNUPLOT_EXECUTABLE ABSL_FLAG(std::string, gnuplot_executable, "", "Gnuplot binary path"); #endif From 3e2c0f2e6aa9bd97be24c5833839fa5af975ea28 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 May 2024 09:00:46 +0200 Subject: [PATCH 147/499] Fixes for the embedded Abseil --- src/utils/rinex-tools/CMakeLists.txt | 6 ++++-- src/utils/rinex2assist/CMakeLists.txt | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index cef3bd057..7dd0352c6 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -34,7 +34,9 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND endif() target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/src/tests/common-files) - set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 + if("${GNSSTK_VERSION}" VERSION_LESS 3.0.1) + set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 + endif() # Do not show warnings raised by GPSTk v3.0.0 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(obsdiff @@ -111,7 +113,7 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND target_link_libraries(obsdiff PRIVATE Gflags::gflags) target_compile_definitions(obsdiff PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(obsdiff PRIVATE absl::flags absl::flags_parse) + target_link_libraries(obsdiff PUBLIC absl::flags absl::flags_parse) endif() if(ENABLE_STRIP) diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 528beff86..f279a7708 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -59,7 +59,10 @@ if(Boost_FOUND) add_executable(rinex2assist ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) endif() - set_property(TARGET rinex2assist PROPERTY CXX_STANDARD 14) # Required by GPSTk + if("${GNSSTK_VERSION}" VERSION_LESS 3.0.1) + set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 + endif() + # Do not show warnings raised by GPSTk v3.0.0 if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(rinex2assist From 33a38f4ec6a6bdf5f1989ba93bf82f85b736d01c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 May 2024 09:52:48 +0200 Subject: [PATCH 148/499] Fix ENABLE_LOG=OFF option --- src/main/CMakeLists.txt | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 8d3fd6759..c48639a07 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -27,16 +27,10 @@ if(ENABLE_GLOG_AND_GFLAGS) target_compile_definitions(gnss-sdr PUBLIC -DUSE_GLOG_AND_GFLAGS=1) else() target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) - if(NOT ENABLE_LOG) - message(STATUS "Internal logging is not enabled") - if(CMAKE_VERSION VERSION_GREATER 3.11.0) - target_compile_definitions(gnss-sdr INTERFACE -DABSL_MIN_LOG_LEVEL=3) - else() - set_property(TARGET gnss-sdr APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS ABSL_MIN_LOG_LEVEL=3 - ) - endif() - endif() +endif() + +if(NOT ENABLE_LOG) + target_compile_definitions(gnss-sdr PRIVATE -DGOOGLE_STRIP_LOG=1) endif() target_compile_definitions(gnss-sdr PRIVATE -DGNSS_SDR_VERSION="${VERSION}") @@ -71,10 +65,6 @@ if(ENABLE_GPERFTOOLS) endif() endif() -if(NOT ENABLE_LOG) - target_compile_definitions(gnss-sdr PRIVATE -DABSL_MIN_LOG_LEVEL=3) -endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") target_link_libraries(gnss-sdr PRIVATE "-lc++") From c8c6325535916a4ac11e08b34c6f6b88aac52409 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 May 2024 12:14:06 +0200 Subject: [PATCH 149/499] Add flags for logging configuration --- src/main/CMakeLists.txt | 2 +- src/main/main.cc | 11 +++++++++-- src/tests/CMakeLists.txt | 22 +++++++++++----------- src/tests/single_test_main.cc | 1 + src/tests/system-tests/ttff.cc | 1 + src/tests/test_main.cc | 2 +- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index c48639a07..04b2a0622 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -26,7 +26,7 @@ if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(gnss-sdr PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gnss-sdr PUBLIC -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize absl::log_sink absl::log_sink_registry) endif() if(NOT ENABLE_LOG) diff --git a/src/main/main.cc b/src/main/main.cc index 472f44148..78009e329 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -57,6 +57,7 @@ using namespace google; #include #include #include +#include #include #include #include @@ -124,6 +125,7 @@ int main(int argc, char** argv) absl::SetFlagsUsageConfig(empty_config); absl::SetProgramUsageMessage(intro_help); absl::ParseCommandLine(argc, argv); + #endif std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait.\n"; } @@ -147,7 +149,6 @@ int main(int argc, char** argv) if (GOOGLE_STRIP_LOG == 0) { - // google::InitGoogleLogging(argv[0]); #if USE_GLOG_AND_GFLAGS google::InitGoogleLogging(argv[0]); if (FLAGS_log_dir.empty()) @@ -212,7 +213,13 @@ int main(int argc, char** argv) } } } - +#if USE_GLOG_AND_GFLAGS +#else + else + { + absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity); // do not log + } +#endif std::chrono::time_point start; std::chrono::time_point end; start = std::chrono::system_clock::now(); diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 43f8ff97d..ebc9e7ab3 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -623,7 +623,7 @@ if(ENABLE_UNIT_TESTING) target_link_libraries(run_tests PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(run_tests PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() target_include_directories(run_tests INTERFACE @@ -773,7 +773,7 @@ if(ENABLE_FPGA) target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -872,7 +872,7 @@ if(ENABLE_SYSTEM_TESTING) if(ENABLE_GLOG_AND_GFLAGS) set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) else() - set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log $ absl::log_initialize absl::log_sink absl::log_sink_registry) endif() if(NOT ENABLE_PACKAGING) add_system_test(ttff @@ -896,7 +896,7 @@ if(ENABLE_SYSTEM_TESTING) if(ENABLE_GLOG_AND_GFLAGS) set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) else() - set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log $ absl::log_initialize absl::log_sink absl::log_sink_registry) endif() add_system_test(position_test CMAKE_ARGS -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> @@ -969,7 +969,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(flowgraph_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(flowgraph_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() target_include_directories(flowgraph_test @@ -1026,7 +1026,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnss_block_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gnss_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() target_include_directories(gnss_block_test @@ -1078,7 +1078,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnuradio_block_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gnuradio_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() xcode_remove_warning_duplicates(gnuradio_block_test) @@ -1114,7 +1114,7 @@ if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(matio_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(matio_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() target_include_directories(matio_test @@ -1164,7 +1164,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(acq_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(acq_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() target_include_directories(acq_test INTERFACE @@ -1250,7 +1250,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(trk_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(trk_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) @@ -1313,7 +1313,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(control_thread_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(control_thread_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) endif() xcode_remove_warning_duplicates(control_thread_test) diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 669bc91c8..5156ee547 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -39,6 +39,7 @@ DECLARE_string(log_dir); #include "gnss_sdr_flags.h" #include #include +#include #include #include #include diff --git a/src/tests/system-tests/ttff.cc b/src/tests/system-tests/ttff.cc index ebaebee55..773a9acd3 100644 --- a/src/tests/system-tests/ttff.cc +++ b/src/tests/system-tests/ttff.cc @@ -52,6 +52,7 @@ using namespace google; #else #include #include +#include #include #endif diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 991495070..bdc565e0d 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -38,6 +38,7 @@ DECLARE_string(log_dir); #include "gnss_sdr_flags.h" #include #include +#include #include #include #include @@ -220,7 +221,6 @@ int main(int argc, char **argv) absl::ParseCommandLine(argc, argv); absl::LogSink *testLogSink = new TestingLogSink; absl::AddLogSink(testLogSink); - // absl::SetMinLogLevel(absl::LogSeverityAtLeast::kInfinity); absl::InitializeLog(); #endif try From 68b875681ddca9fae0203a92dadd21f9c9b4fbab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 May 2024 12:46:43 +0200 Subject: [PATCH 150/499] Improve guards for Abseil --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fe809254..16035246f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1406,8 +1406,8 @@ endif() ################################################################################ # Abseil C++ - https://abseil.io/docs/cpp/ ################################################################################ -if(CMAKE_VERSION VERSION_GREATER 3.13 - AND NOT (CMAKE_CXX_STANDARD VERSION_LESS 14) +if(NOT CMAKE_VERSION VERSION_LESS 3.24 + AND NOT CMAKE_CXX_STANDARD VERSION_LESS 17 AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.1) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0) AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12) From 5004fc386db1fcef42c943a8bf9bf7883bb1f27a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 1 May 2024 13:02:35 +0200 Subject: [PATCH 151/499] Fix target name --- src/utils/rinex2assist/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index f279a7708..39f690be5 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -60,7 +60,7 @@ if(Boost_FOUND) endif() if("${GNSSTK_VERSION}" VERSION_LESS 3.0.1) - set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 + set_property(TARGET rinex2assist PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 endif() # Do not show warnings raised by GPSTk v3.0.0 From fbc216c1a3822d248c76f07fd0ae32c730d4665d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 2 May 2024 00:14:53 +0200 Subject: [PATCH 152/499] Add flag validation when using Abseil --- src/algorithms/libs/gnss_sdr_flags.cc | 116 +++++++++++++++++++++++++- src/algorithms/libs/gnss_sdr_flags.h | 4 +- src/main/main.cc | 5 ++ 3 files changed, 120 insertions(+), 5 deletions(-) diff --git a/src/algorithms/libs/gnss_sdr_flags.cc b/src/algorithms/libs/gnss_sdr_flags.cc index 26ae20da6..8cd9bab54 100644 --- a/src/algorithms/libs/gnss_sdr_flags.cc +++ b/src/algorithms/libs/gnss_sdr_flags.cc @@ -68,7 +68,7 @@ DEFINE_bool(keyboard, true, "If set to false, it disables the keyboard listener static bool ValidateC(const char* flagname, const std::string& value) { - if (fs::exists(value) or value == "-") + if (fs::exists(value) || value == "-") { // value is ok return true; } @@ -79,7 +79,7 @@ static bool ValidateC(const char* flagname, const std::string& value) static bool ValidateConfigFile(const char* flagname, const std::string& value) { - if (fs::exists(value) or value == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf")) + if (fs::exists(value) || value == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf")) { // value is ok return true; } @@ -90,7 +90,7 @@ static bool ValidateConfigFile(const char* flagname, const std::string& value) static bool ValidateS(const char* flagname, const std::string& value) { - if (fs::exists(value) or value == "-") + if (fs::exists(value) || value == "-") { // value is ok return true; } @@ -101,7 +101,7 @@ static bool ValidateS(const char* flagname, const std::string& value) static bool ValidateSignalSource(const char* flagname, const std::string& value) { - if (fs::exists(value) or value == "-") + if (fs::exists(value) || value == "-") { // value is ok return true; } @@ -256,4 +256,112 @@ ABSL_FLAG(int32_t, carrier_smoothing_factor, DEFAULT_CARRIER_SMOOTHING_FACTOR, " ABSL_FLAG(std::string, RINEX_version, "-", "If defined, specifies the RINEX version (2.11 or 3.02). Overrides the configuration file."); ABSL_FLAG(std::string, RINEX_name, "-", "If defined, specifies the RINEX files base name"); ABSL_FLAG(bool, keyboard, true, "If set to false, it disables the keyboard listener (so the receiver cannot be stopped with q+[Enter])"); + +bool ValidateFlags() +{ + bool success = true; + + auto value_c = absl::GetFlag(FLAGS_c); + if (!(fs::exists(value_c) || value_c == "-")) + { + std::cerr << "Invalid value for flag -c. The file '" << value_c << "' does not exist.\n"; + success = false; + } + + auto value_config_file = absl::GetFlag(FLAGS_config_file); + if (!(fs::exists(value_config_file) || value_config_file == std::string(GNSSSDR_INSTALL_DIR "/share/gnss-sdr/conf/default.conf"))) + { + std::cerr << "Invalid value for flag -config_file. The file '" << value_config_file << "' does not exist.\n"; + success = false; + } + + auto value_s = absl::GetFlag(FLAGS_s); + if (!(fs::exists(value_s) || value_s == "-")) + { + std::cerr << "Invalid value for flag -s. The file '" << value_s << "' does not exist.\n"; + success = false; + } + + auto value_signal_source = absl::GetFlag(FLAGS_signal_source); + if (!(fs::exists(value_signal_source) || value_signal_source == "-")) + { + std::cerr << "Invalid value for flag -signal_source. The file '" << value_signal_source << "' does not exist.\n"; + success = false; + } + + auto value_doppler_max = absl::GetFlag(FLAGS_doppler_max); + const int32_t max_doppler_value = 1000000; + if (value_doppler_max < 0 || value_doppler_max > max_doppler_value) + { + std::cerr << "Invalid value for flag -doppler_max. Allowed range is 0 < doppler_max < " << max_doppler_value << " Hz.\n"; + success = false; + } + + auto value_doppler_step = absl::GetFlag(FLAGS_doppler_step); + const int32_t max_value_doppler_step = 10000; + if (value_doppler_step < 0 || value_doppler_step > max_value_doppler_step) + { + std::cerr << "Invalid value for flag -doppler_step: " << value_doppler_step << ". Allowed range is 0 < doppler_step < " << max_value_doppler_step << " Hz.\n"; + success = false; + } + + auto value_cn0_samples = absl::GetFlag(FLAGS_cn0_samples); + const int32_t max_value_cn0_samples = 10000; + if (value_cn0_samples < 0 || value_cn0_samples > max_value_cn0_samples) + { + std::cerr << "Invalid value for flag -cn0_samples: " << value_cn0_samples << ". Allowed range is 0 < cn0_samples < " << max_value_cn0_samples << " Hz.\n"; + success = false; + } + + auto value_cn0_min = absl::GetFlag(FLAGS_cn0_min); + const int32_t max_value_cn0_min = 100; + if (value_cn0_min < 0 || value_cn0_min > max_value_cn0_min) + { + std::cerr << "Invalid value for flag -cn0_min: " << value_cn0_min << ". Allowed range is 0 < cn0_min < " << max_value_cn0_min << " Hz.\n"; + success = false; + } + + auto value_max_lock_fail = absl::GetFlag(FLAGS_max_lock_fail); + const int32_t max_value_max_lock_fail = 10000; + if (value_max_lock_fail < 0 || value_max_lock_fail > max_value_max_lock_fail) + { + std::cerr << "Invalid value for flag -max_lock_fail: " << value_max_lock_fail << ". Allowed range is 0 < max_lock_fail < " << max_value_max_lock_fail << " Hz.\n"; + success = false; + } + + auto value_carrier_lock_th = absl::GetFlag(FLAGS_carrier_lock_th); + const double max_value_carrier_lock_th = 1.508; + if (value_carrier_lock_th < 0.0 || value_carrier_lock_th > max_value_carrier_lock_th) + { + std::cerr << "Invalid value for flag -carrier_lock_th: " << value_carrier_lock_th << ". Allowed range is 0 < carrier_lock_th < " << max_value_carrier_lock_th << " Hz.\n"; + success = false; + } + + auto value_dll_bw_hz = absl::GetFlag(FLAGS_dll_bw_hz); + const double max_value_dll_bw_hz = 10000.0; + if (value_dll_bw_hz < 0.0 || value_dll_bw_hz > max_value_dll_bw_hz) + { + std::cerr << "Invalid value for flag -dll_bw_hz: " << value_dll_bw_hz << ". Allowed range is 0 < dll_bw_hz < " << max_value_dll_bw_hz << " Hz.\n"; + success = false; + } + + auto value_pll_bw_hz = absl::GetFlag(FLAGS_pll_bw_hz); + const double max_value_pll_bw_hz = 10000.0; + if (value_pll_bw_hz < 0.0 || value_pll_bw_hz > max_value_pll_bw_hz) + { + std::cerr << "Invalid value for flag -pll_bw_hz: " << value_pll_bw_hz << ". Allowed range is 0 < pll_bw_hz < " << max_value_pll_bw_hz << " Hz.\n"; + success = false; + } + + auto value_carrier_smoothing_factor = absl::GetFlag(FLAGS_carrier_smoothing_factor); + const int32_t min_value_carrier_smoothing_factor = 1; + if (value_carrier_smoothing_factor < min_value_carrier_smoothing_factor) + { + std::cerr << "Invalid value for flag -carrier_smoothing_factor: " << value_carrier_smoothing_factor << ". Allowed range is 1 <= carrier_smoothing_factor.\n"; + success = false; + } + + return success; +} + #endif diff --git a/src/algorithms/libs/gnss_sdr_flags.h b/src/algorithms/libs/gnss_sdr_flags.h index 3dd02fd3d..4b175d071 100644 --- a/src/algorithms/libs/gnss_sdr_flags.h +++ b/src/algorithms/libs/gnss_sdr_flags.h @@ -177,8 +177,10 @@ static inline std::string GetTempDir() // Use first directory from list of existing temporary directories. return temp_directories_list.front(); } -#endif +bool ValidateFlags(); + +#endif /** \} */ /** \} */ diff --git a/src/main/main.cc b/src/main/main.cc index 78009e329..a058e6029 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -125,6 +125,11 @@ int main(int argc, char** argv) absl::SetFlagsUsageConfig(empty_config); absl::SetProgramUsageMessage(intro_help); absl::ParseCommandLine(argc, argv); + if (!ValidateFlags()) + { + std::cout << "GNSS-SDR program ended.\n"; + return 1; + } #endif std::cout << "Initializing GNSS-SDR v" << gnss_sdr_version << " ... Please wait.\n"; From 359631b534a56a45035dcc9b5c5439273c70119f Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 6 May 2024 17:46:33 +0200 Subject: [PATCH 153/499] Improve logging in OSNMA receiver * substitute std::cout with google log outputs, blend out some couts * add check that the final time matches the Kroot time during tesla key verification * introduce variable 'd_validated_key' --- src/core/libs/osnma_msg_receiver.cc | 196 ++++++++++++++++------------ src/core/libs/osnma_msg_receiver.h | 1 + 2 files changed, 112 insertions(+), 85 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 9b546366e..1c1da25a9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -89,7 +89,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); - std::cout << "Galileo OSNMA: Subframe received starting at " + LOG(INFO) << "Galileo OSNMA: Subframe received starting at " << "WN=" << nma_msg->WN_sf0 << ", TOW=" @@ -126,6 +126,8 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { read_nma_header(osnma_msg->hkroot[0]); + if(d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3 /*&& d_kroot_verified*/) + return; read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 @@ -149,7 +151,6 @@ void osnma_msg_receiver::read_nma_header(uint8_t nma_header) d_osnma_data.d_nma_header.cid = d_dsm_reader->get_cid(nma_header); d_osnma_data.d_nma_header.cpks = d_dsm_reader->get_cpks(nma_header); d_osnma_data.d_nma_header.reserved = d_dsm_reader->get_nma_header_reserved(nma_header); - std::cout<< "NMAS: " << static_cast(d_osnma_data.d_nma_header.nmas) << " CPKS: " << static_cast(d_osnma_data.d_nma_header.cpks) << std::endl; } @@ -162,9 +163,9 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = d_dsm_reader->get_dsm_id(dsm_header); d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID - LOG(WARNING) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); - LOG(WARNING) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); - std::cout << "Galileo OSNMA: Received block " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) + LOG(INFO) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); + LOG(INFO) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); + LOG(INFO)<< "Galileo OSNMA: Received block " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) << " from DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << std::endl; } @@ -174,7 +175,7 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) * */ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_msg) { - // Fill d_dsm_message + // Fill d_dsm_message. dsm_block_id provides the offset within the dsm message. size_t index = 0; for (const auto* it = osnma_msg->hkroot.cbegin() + 2; it != osnma_msg->hkroot.cend(); ++it) { @@ -207,7 +208,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = number_of_blocks; - LOG(WARNING) << "OSNMA: number_of_blocks=" << static_cast(number_of_blocks); + LOG(INFO) << "OSNMA: number_of_blocks=" << static_cast(number_of_blocks); if (number_of_blocks == 0) { // Something is wrong, start over @@ -219,18 +220,18 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; // TODO FIXME Galileo OSNMA: Available blocks for DSM_ID 6: [ - - - - - X - - - - - - - - - - ] in the first received Sf.. size 16? - std::cout << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; - if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) + LOG(INFO) << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; + if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) // block 0 not received yet { for (auto id_received : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) { if (id_received == 0) { - std::cout << "- "; + LOG(INFO) << "- "; } else { - std::cout << "X "; + LOG(INFO) << "X "; } } } @@ -240,15 +241,15 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ { if (d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][k] == 0) { - std::cout << "- "; + LOG(INFO) << "- "; } else { - std::cout << "X "; + LOG(INFO) << "X "; } } } - std::cout << "]" << std::endl; // TODO update documentation + LOG(INFO) << "]" << std::endl; } /** @@ -262,7 +263,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptrWN_sf0 & 0x00000FFF) << 20 | (osnma_msg->TOW_sf0 & 0x000FFFFF); //std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k & 0x000FFFFF)) + 30; // applicable time (GST_Kroot + 30) + d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k * 3600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. if(d_receiver_time != 0) @@ -284,8 +285,8 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; // TODO set flag to false to avoid processing dsm and MACK messages @@ -294,18 +295,18 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; + LOG(WARNING) << "Galileo OSNMA: time constraint allows only slow MACs to be verified\n"; + LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; + LOG(WARNING)<< "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; } else { d_tags_allowed = tags_to_verify::none; d_tags_to_verify = {}; - std::cerr << "Galileo OSNMA: time constraint violation\n"; - std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; - std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; + LOG(ERROR) << "Galileo OSNMA: time constraint violation\n"; + LOG(ERROR) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; + LOG(ERROR) << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; } @@ -353,7 +354,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (d_osnma_data.d_dsm_header.dsm_id < 12) { // Parse Kroot message - LOG(WARNING) << "OSNMA: DSM-KROOT message received."; + LOG(INFO) << "OSNMA: DSM-KROOT message received."; d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg); d_osnma_data.d_dsm_kroot_message.cidkr = d_dsm_reader->get_cidkr(dsm_msg); @@ -397,7 +398,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((l_lk_bytes * 8.0) + l_ds_bits) / 104.0); if (l_dk_bits != check_l_dk) { - std::cout << "Galileo OSNMA: Failed length reading" << std::endl; + LOG(ERROR) << "Galileo OSNMA: Failed length reading" << std::endl; } else { @@ -439,8 +440,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // Check that the padding bits received match the computed values if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { - LOG(WARNING) << "Galileo OSNMA: DSM-KROOT message received ok."; - std::cout << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) + LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received ok."; + LOG(INFO) << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << std::endl; @@ -448,20 +449,22 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_kroot_verified = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); if (d_kroot_verified) { - std::cout << "Galileo OSNMA: KROOT authentication successful !" << std::endl; - std::cout << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + LOG(INFO) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; + LOG(INFO) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; + LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } else { - std::cout << " Galileo OSNMA: KROOT authentication failed. " << std::endl; + LOG(ERROR) << "Galileo OSNMA: KROOT authentication failed. " << std::endl; + LOG(INFO) << "Galileo OSNMA: KROOT authentication failed. " << std::endl; } } else { - std::cout << "Galileo OSNMA: Error computing padding bits." << std::endl; + LOG(ERROR) << "Galileo OSNMA: Error computing padding bits." << std::endl; // TODO - here will have to decide if perform the verification or not. Since this step is not mandatory, one could as well have skipped it. } } @@ -506,7 +509,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t check_l_dp = 104 * std::ceil(static_cast(1040.0 + l_npk * 8.0) / 104.0); if (l_dp != check_l_dp) { - std::cout << "Galileo OSNMA: Failed length reading" << std::endl; + LOG(ERROR) << "Galileo OSNMA: Failed length reading" << std::endl; } else { @@ -516,7 +519,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; } // std::vector mi; // (NPKT + NPKID + NPK) - std::cout << "Galileo OSNMA: DSM-PKR with CID=" << static_cast(d_osnma_data.d_nma_header.cid) + LOG(INFO) << "Galileo OSNMA: DSM-PKR with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 @@ -564,8 +567,11 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr(16); + if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 { // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future read_mack_header(); read_mack_body(); @@ -838,14 +844,15 @@ void osnma_msg_receiver::read_mack_body() */ void osnma_msg_receiver::process_mack_message() { - d_flag_debug = true; - if(d_kroot_verified == false && d_tesla_key_verified == false) { - std::cerr << "Galileo OSNMA: MACK cannot be processed. "<< ", " + LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed. "<< ", " << "No Kroot nor TESLA key available" << std::endl; - if(!d_flag_debug) - return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. + if(!d_flag_debug){ + return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. + } + else + LOG(WARNING) << "But it will be processed for debugging purposes."; } // verify tesla key and add it to the container of verified keys if successful bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.TOW_sf0); @@ -863,6 +870,7 @@ void osnma_msg_receiver::process_mack_message() { Tag t(tag, mack->TOW, mack->PRNa); d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; } mack = d_macks_awaiting_MACSEQ_verification.erase(mack); } @@ -892,7 +900,7 @@ void osnma_msg_receiver::process_mack_message() if(ret) { it.second.status = Tag::SUCCESS; - std::cout << "Galileo OSNMA: Tag verification failure for tag Id= " + LOG(WARNING) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " << it.second.tag_id << ", TOW=" << it.second.TOW @@ -909,7 +917,7 @@ void osnma_msg_receiver::process_mack_message() else { it.second.status = Tag::FAIL; - std::cout << "Galileo OSNMA: Tag verification failure for tag Id= " + LOG(ERROR) << "Galileo OSNMA: Tag verification failure for tag Id= " << it.second.tag_id << ", TOW=" << it.second.TOW @@ -921,7 +929,7 @@ void osnma_msg_receiver::process_mack_message() } } else { - std::cout << "Galileo OSNMA: Tag verification skipped for Tag Id= " + LOG(INFO) << "Galileo OSNMA: Tag verification skipped for Tag Id= " << it.second.tag_id << ", TOW=" << it.second.TOW @@ -929,7 +937,7 @@ void osnma_msg_receiver::process_mack_message() << static_cast(it.second.ADKD) << ", from satellite " << it.second.PRNa - << std::endl; + << " due to missing key or navData. "; } } @@ -973,12 +981,12 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) if(x_4 == d_crypto->getMerkleRoot()) { - std::cout << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; + LOG(INFO) << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; return true; } else { - std::cout << "Galileo OSNMA: DSM-PKR verification unsuccessful !" << std::endl; + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification unsuccessful !" << std::endl; return false; } } @@ -1075,7 +1083,7 @@ void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const } //d_osnma_data[TOW] = crypto; // crypto d_satellite_nav_data[SV_ID][TOW] = data; // nav - std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; + //std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; } void osnma_msg_receiver::display_data() { @@ -1096,42 +1104,40 @@ void osnma_msg_receiver::display_data() bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TOW) { uint32_t num_of_hashes_needed; - uint32_t GST_SFi = d_receiver_time - 30; + uint32_t GST_SFi = d_receiver_time - 30; // GST of target key is to be used. std::vector hash; const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - std::vector validated_key; + //std::vector validated_key; if(d_tesla_key_verified){ // have to go up to last verified key - validated_key = d_tesla_keys.rbegin()->second; + d_validated_key = d_tesla_keys.rbegin()->second; num_of_hashes_needed = (d_receiver_time - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key " << std::endl; + LOG(INFO) << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key " << std::endl; hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); } else{// have to go until Kroot - validated_key = d_osnma_data.d_dsm_kroot_message.kroot; - num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 ICD - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to Kroot " << std::endl; + d_validated_key = d_osnma_data.d_dsm_kroot_message.kroot; + num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 IC + LOG(INFO) << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to Kroot " << std::endl; hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); } - - if(hash.size() != key.size()) + // truncate hash + std::vector computed_key; + computed_key.reserve(key.size()); + for (uint16_t i = 0; i < key.size(); i++) { - std::cout << "Galileo OSNMA: Error during tesla key verification. " << std::endl; - return false; + computed_key.push_back(hash[i]); } - if (hash == validated_key) + if (computed_key == d_validated_key && num_of_hashes_needed > 0) { - std::cout << "Galileo OSNMA: tesla key verified successfully " << std::endl; + LOG(WARNING) << "Galileo OSNMA:: TESLA key verification :: SUCCESS! " << std::endl; d_tesla_keys.insert(std::pair(TOW,key)); d_tesla_key_verified = true; d_last_verified_key_GST = d_receiver_time; - // TODO - propagate result - // TODO - save current tesla key as latest one? propose a map with - // TODO - Tags Sequence Verification: check ADKD[i] follows MACLT sequence } - else{ - std::cerr << "Galileo OSNMA: Error during tesla key verification. " << std::endl; + else if(num_of_hashes_needed > 0){ + LOG(ERROR) << "Galileo OSNMA:: TESLA key verification :: FAILED " << std::endl; if(d_flag_debug){ d_tesla_keys.insert(std::pair(TOW,key)); d_last_verified_key_GST = d_receiver_time; @@ -1152,7 +1158,7 @@ void osnma_msg_receiver::remove_verified_tags() for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end() ; ){ if (it->second.status == Tag::SUCCESS || it->second.status == Tag::FAIL) { - std::cout << "Galileo OSNMA: delete tag for tag Id= " + LOG(INFO) << "Galileo OSNMA: delete tag for tag Id= " << it->second.tag_id << ", PRN_a= " << it->second.PRNa << ", TOW=" << it->second.TOW << ", ADKD= " @@ -1176,6 +1182,7 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() { while(d_tags_awaiting_verify.size() > 60) { + LOG(WARNING) << "Galileo OSNMA: delete tag due to exceeding buffer size. "; d_tags_awaiting_verify.erase(d_tags_awaiting_verify.begin()); } } @@ -1214,11 +1221,11 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } else { - std::cout << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; + LOG(ERROR) << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; } if(mack.tag_and_info.size() != applicable_sequence.size() - 1) { - std::cout << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; + LOG(ERROR) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; return false; } std::vector flxTags {}; @@ -1232,11 +1239,16 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) flxTags.push_back(i); // C: just need to save the index in the sequence } else if(mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) - { std::cout << "Galileo OSNMA: Unsuccessful verification of MACSEQ - received ADKD against MAC Look-up table. " << std::endl; + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table. " << std::endl; return false; // C: suffices one incorrect to abort and not process the rest of the tags } } + if(flxTags.empty()){ + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD matches MAC Look-up table. " << std::endl; + return true; + } // Fixed as well as FLX Tags share first part - Eq. 22 ICD std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag @@ -1272,17 +1284,23 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) mac_msb = (mac[0] << 8) + mac[1]; } uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; - if (computed_macseq == mack.header.macseq && !flxTags.empty()) - return true; - else - return false; + if (computed_macseq == mack.header.macseq){ + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK " << std::endl; + return true; + } + + else{ + LOG(ERROR) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed " << std::endl; + return false; + } + } bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) { auto prn_it = d_satellite_nav_data.find(t.PRNa); if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map - std::cout << "Galileo OSNMA: hasData = true " << std::endl; + LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW); if (tow_it != tow_map.end()) { @@ -1293,7 +1311,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) } } else { // PRN was not found - std::cout << "Galileo OSNMA: hasData = false " << std::endl; + LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; return false; } return false; @@ -1309,7 +1327,7 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t){ auto it = d_tesla_keys.find(t.TOW + 30); if (it != d_tesla_keys.end()) { - std::cout << "Galileo OSNMA: hasKey = true " << std::endl; + LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } @@ -1318,19 +1336,18 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t){ auto it = d_tesla_keys.find(t.TOW + 300); if (it != d_tesla_keys.end()) { - std::cout << "Galileo OSNMA: hasKey = true " << std::endl; + LOG(INFO)<< "Galileo OSNMA: hasKey = true " << std::endl; return true; } } - std::cout << "Galileo OSNMA: hasKey = false " << std::endl; + LOG(INFO) << "Galileo OSNMA: hasKey = false " << std::endl; return false; } std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes) { auto start = std::chrono::high_resolution_clock::now(); - std::vector K_II = {0x2D,0xC3,0xA3,0xCD,0xB1,0x17,0xFA,0xAD,0xB8,0x3B,0x5F,0x0B,0x6F,0xEA,0x88,0xEB};//key; + std::vector K_II = key; std::vector K_I; // result of the recursive hash operations - GST_SFi = 0x4E054600; std::vector msg; // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) for (uint32_t i = 1; i <= num_of_hashes_needed ; i++) @@ -1343,8 +1360,8 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede msg.push_back((GST_SFi & 0x00FF0000) >> 16); msg.push_back((GST_SFi & 0x0000FF00) >> 8); msg.push_back(GST_SFi & 0x000000FF); - // extract alpha - d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; + // extract alpha +// d_osnma_data.d_dsm_kroot_message.alpha = 0xa06221261ad9; for (int k = 5; k >= 0;k--) { // TODO: static extracts the MSB in case from larger to shorter int? @@ -1376,11 +1393,20 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede K_I.clear(); // empty the actual one for a new computation msg.clear(); } - if(GST_SFi + 30 != d_GST_0 - 30 && d_tesla_key_verified == false) - std::cout << "Galileo OSNMA: TESLA verification error. Kroot time mismatch! \n"; // ICD. Eq. 18 + + // check that the final time matches the Kroot time + bool check; + if(!d_tesla_key_verified) + check = GST_SFi + 30 == d_GST_0 - 30; + else + check = GST_SFi + 30 == d_last_verified_key_GST; + if(!check) + LOG(ERROR) << "Galileo OSNMA: TESLA verification error. Kroot time mismatch! \n"; // ICD. Eq. 18 + else + LOG(INFO) << "Galileo OSNMA: TESLA verification. Kroot time matches! \n"; // ICD. Eq. 18 // compare computed current key against received key auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = end - start; - std::cout << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + LOG(INFO) << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; return K_II; } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 9f3c76fec..157c78750 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -113,6 +113,7 @@ private: enum tags_to_verify{all,utc,slow_eph, eph, none}; // TODO is this safe? I hope so tags_to_verify d_tags_allowed{tags_to_verify::all}; std::vector d_tags_to_verify{0,4,12}; + std::vector d_validated_key{}; void remove_verified_tags(); void control_tags_awaiting_verify_size(); bool verify_macseq(const MACK_message& mack); From b687d4cafe82957ceec56bfe9bb8366bc38d1153 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 6 May 2024 17:52:07 +0200 Subject: [PATCH 154/499] Bugfix for Gnss_Crypto::verify_signature The commit introduces conversion from raw signature (r, s values) into DER format for the ossl3 region, after realising that that was making the verification fail. --- src/core/system_parameters/gnss_crypto.cc | 52 ++++++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index f55b5f609..d3cd11380 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -34,6 +34,9 @@ #include #include #include +#include +#include +#include #define OPENSSL_ENGINE nullptr #else #include @@ -490,7 +493,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) gnutls_pubkey_deinit(pubkey); #endif std::cout << "Public key successfully read from file " << pemFilePath << std::endl; - print_pubkey_hex(d_PublicKey); + //print_pubkey_hex(d_PublicKey); } @@ -545,7 +548,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; - print_pubkey_hex(d_PublicKey); + //print_pubkey_hex(d_PublicKey); ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); bool do_operation = true; @@ -553,6 +556,42 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { do_operation = false; } + // convert raw signature into DER format, needed for verify_signature + size_t half_size = signature.size() / 2; + std::vector raw_r(signature.begin(), signature.begin() + half_size); + std::vector raw_s(signature.begin() + half_size, signature.end()); + + // Convert raw R and S to BIGNUMs + BIGNUM* r = BN_bin2bn(raw_r.data(), raw_r.size(), nullptr); + BIGNUM* s = BN_bin2bn(raw_s.data(), raw_s.size(), nullptr); + + ECDSA_SIG* sig = ECDSA_SIG_new(); + if (r == nullptr || s == nullptr || sig == nullptr) + { + std::cerr << "Failed to allocate memory for BIGNUMs or ECDSA_SIG" << std::endl; + return false; + } + + if (ECDSA_SIG_set0(sig, r, s) != 1) + { + std::cerr << "Failed to set R and S values in ECDSA_SIG" << std::endl; + ECDSA_SIG_free(sig); // Free the ECDSA_SIG struct as it's no longer needed + return false; + } + + std::vector derSignature; + unsigned char *derSig = nullptr; + int derSigLength = i2d_ECDSA_SIG(sig, &derSig); + + if (derSigLength <= 0) + { + std::cerr << "Failed to convert ECDSA_SIG to DER format" << std::endl; + return false; + } + + derSignature.assign(derSig, derSig + derSigLength); + + if (EVP_PKEY_verify_init(ctx) <= 0) { do_operation = false; @@ -564,9 +603,11 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st int verification = 0; if (do_operation) { - verification = EVP_PKEY_verify(ctx, signature.data(), signature.size(), digest.data(), digest.size()); + verification = EVP_PKEY_verify(ctx, derSignature.data(), derSignature.size(), digest.data(), digest.size()); } EVP_PKEY_CTX_free(ctx); + OPENSSL_free(derSig); + ECDSA_SIG_free(sig); if (verification == 1) { success = true; @@ -682,7 +723,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) << ". Aborting import" << std::endl; return; } - print_pubkey_hex(pkey); + //print_pubkey_hex(pkey); if(!pubkey_copy(pkey, &d_PublicKey)) return @@ -736,7 +777,6 @@ std::vector Gnss_Crypto::get_public_key() return {}; } - #if USE_OPENSSL_FALLBACK bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) { @@ -809,7 +849,7 @@ void Gnss_Crypto::print_pubkey_hex(EVP_PKEY* pubkey) static_cast(static_cast(mem_ptr->data[i])); } - std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; + //std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; BIO_free(mem_bio); } From dd2f15302392f7800dcb34530c6f41fe081e5686 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 6 May 2024 17:53:13 +0200 Subject: [PATCH 155/499] Bugfix for OSNMA_DSM_Reader::get_alpha This commit fixes a bug in the parsing of the DSM-Kroot alpha parameter. --- src/core/system_parameters/osnma_dsm_reader.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/system_parameters/osnma_dsm_reader.cc b/src/core/system_parameters/osnma_dsm_reader.cc index 8a2a061d9..65caddd51 100644 --- a/src/core/system_parameters/osnma_dsm_reader.cc +++ b/src/core/system_parameters/osnma_dsm_reader.cc @@ -128,12 +128,12 @@ uint8_t OSNMA_DSM_Reader::get_towh_k(const std::vector& dsm_msg) const uint64_t OSNMA_DSM_Reader::get_alpha(const std::vector& dsm_msg) const { - uint64_t alpha = (static_cast(dsm_msg[8]) << 40) + - (static_cast(dsm_msg[9]) << 32) + - (static_cast(dsm_msg[10]) << 24) + - (static_cast(dsm_msg[11]) << 16) + - (static_cast(dsm_msg[12]) << 8) + - (static_cast(dsm_msg[13])); + uint64_t alpha = (static_cast(dsm_msg[7]) << 40) + + (static_cast(dsm_msg[8]) << 32) + + (static_cast(dsm_msg[9]) << 24) + + (static_cast(dsm_msg[10]) << 16) + + (static_cast(dsm_msg[11]) << 8) + + (static_cast(dsm_msg[12])); return alpha; } From 38829adaafff07a10fdbfba9cf4e1d9fc509cef0 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 6 May 2024 17:55:11 +0200 Subject: [PATCH 156/499] GnssCryptoTest :: introduce raw r and s values signature. This was done after bugfix for verify_signature. --- .../osnma/gnss_crypto_test.cc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index b0ecaf2cc..d78c8d688 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -23,10 +23,17 @@ TEST(GnssCryptoTest, VerifySignature) { // own ECDSA-P256 key and message generated and signed and verified successfully with openssl std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) - std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, - 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, - 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK -// std::vector publicKey{// PK associated to the PrK, in der format ---test +// std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, +// 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, +// 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK + // raw r and s values + std::vector signature = { + 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, + 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, + 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, + 0xA5, 0xB9, 0xB2, 0x56 }; + + // std::vector publicKey{// PK associated to the PrK, in der format ---test // 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4A, 0xF3, // 0xEE, 0x3A, 0x94, 0x25, 0x25, 0x3D, 0x55, 0xC2, 0x5A, 0xC2, 0x2D, 0xCF, 0x14, 0x4D, 0x39, 0x0D, 0xB1, 0xFC, 0x7F, 0x31, 0x5A, 0x2A, 0x19, 0xAE, 0x4E, 0xD6, 0xCB, 0xA6, 0x59, // 0xD6, 0x99, 0x7C, 0xE8, 0xBD, 0x1F, 0x43, 0x34, 0x1C, 0x59, 0xD9, 0xD9, 0xCA, 0xC3, 0xEE, 0x58, 0xE5, 0xEA, 0xD3, 0x55, 0x44, 0xEA, 0x89, 0x71, 0x65, 0xD0, 0x92, 0x72, 0xA2, From c9259d87db63e936ae5bcb472ce2c29b043578e9 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 6 May 2024 17:58:56 +0200 Subject: [PATCH 157/499] Refactored and improved OsnmaMsgReceiverTest Changes in the osnma receiver initialisation for time synchronisation with the configuration 1. OsnmaMsgReceiverTest::initializeGoogleLog() implemented recycling code, in the same way as the gnss-sdr receiver upon start. --- .../osnma/osnma_msg_receiver_test.cc | 111 ++++++++++++++---- 1 file changed, 87 insertions(+), 24 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 047832490..65dd98006 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -1,8 +1,10 @@ #include +#include +#include #include +#include #include #include -#include struct TestVector @@ -23,10 +25,13 @@ protected: OSNMA_msg osnma_msg{}; std::array nma_position_filled; uint32_t d_GST_SIS{}; // 16 AUG 2023 05 00 01 - int T {}; uint32_t TOW{}; uint32_t WN{}; + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + const uint32_t LEAP_SECONDS = 0;//13 + 5; void set_time(std::tm& input); + std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; + void initializeGoogleLog(); void SetUp() override { @@ -39,6 +44,9 @@ protected: std::string merkleFilePath = "OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); } + void TearDown() override{ + google::ShutdownGoogleLogging(); + } public: static std::vector parseNavBits(const std::string& hex); @@ -51,19 +59,28 @@ public: TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Arrange osnma->d_tesla_key_verified = false; - osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits - osnma->d_receiver_time = 345630; - osnma->d_GST_0 = 345600; - osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); - std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; + osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; + // local_time_verification would do this operation. TODO - eliminate duplication. + osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + + osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 uint32_t TOW = 345630; + // Act bool result = osnma->verify_tesla_key(key, TOW); + + + + // Assert ASSERT_TRUE(result); // Adjust this according to what you expect @@ -71,6 +88,7 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { + initializeGoogleLog(); // Arrange std::vector testVectors = readTestVectorsFromFile(/*"/home/cgm/CLionProjects/osnma/src/tests/data/*/"16_AUG_2023_GST_05_00_01.csv"); bool end_of_hex_stream{false}; @@ -81,11 +99,9 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; const int DURATION_SUBFRAME{30}; - std::cout << "OsnmaTestVectorsSimulation:" << std::endl; - std::cout << "d_GST_SIS: " << d_GST_SIS << std::endl; - std::cout << "T: " << T << std::endl; - std::cout << "TOW: " << TOW << std::endl; - std::cout << "WN: " << WN << std::endl; + std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; // Act @@ -144,14 +160,11 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) if(!end_of_hex_stream){ offset_byte = byte_index; // update offset for the next subframe d_GST_SIS += DURATION_SUBFRAME; - T = d_GST_SIS % 30; TOW = d_GST_SIS & 0x000FFFFF; WN = (d_GST_SIS & 0xFFF00000) >> 20 ; - std::cout << "OsnmaTestVectorsSimulation:" << std::endl; - std::cout << "d_GST_SIS: " << d_GST_SIS << std::endl; - std::cout << "T: " << T << std::endl; - std::cout << "TOW: " << TOW << std::endl; - std::cout << "WN: " << WN << std::endl; + std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; } @@ -239,12 +252,20 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } +/** + * @brief Sets the time based on the given input. + * + * This function calculates the week number (WN) and time of week (TOW) + * based on the input time and the GST_START_EPOCH. It then stores the + * calculated values in the WN and TOW member variables. Finally, it + * combines the WN and TOW into a single 32-bit value and stores it in + * the d_GST_SIS member variable. + * + * @param input The input time as a tm struct. + */ void OsnmaMsgReceiverTest::set_time(std::tm& input) { - // GST epoch (start of GST time) - std::tm tm_epoch = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; - - auto epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&tm_epoch)); + auto epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&GST_START_EPOCH)); auto input_time_point = std::chrono::system_clock::from_time_t(mktime(&input)); // Get the duration from epoch in seconds @@ -255,11 +276,53 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) uint32_t week_number = duration_sec.count() / sec_in_week; uint32_t time_of_week = duration_sec.count() % sec_in_week; this->WN = week_number; - this->TOW = time_of_week; + this->TOW = time_of_week + LEAP_SECONDS; // Return the week number and time of week as a pair this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); - this->T = d_GST_SIS % 30; } + +void OsnmaMsgReceiverTest::initializeGoogleLog() +{ + google::InitGoogleLogging(log_name.c_str()); + FLAGS_minloglevel = 1; + FLAGS_logtostderr = 0; // add this line + FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; + if (FLAGS_log_dir.empty()) + { + std::cout << "Logging will be written at " + << std::filesystem::temp_directory_path() + << '\n' + << "Use gnss-sdr --log_dir=/path/to/log to change that.\n"; + } + else + { + try + { + const std::filesystem::path p(FLAGS_log_dir); + if (!std::filesystem::exists(p)) + { + std::cout << "The path " + << FLAGS_log_dir + << " does not exist, attempting to create it.\n"; + std::error_code ec; + if (!std::filesystem::create_directory(p, ec)) + { + std::cout << "Could not create the " << FLAGS_log_dir << " folder.\n"; + gflags::ShutDownCommandLineFlags(); + throw std::runtime_error("Could not create folder for logs"); + } + } + std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; + } + catch (const std::exception& e) + { + std::cerr << e.what() << '\n'; + std::cerr << "Could not create the " << FLAGS_log_dir << " folder.\n"; + gflags::ShutDownCommandLineFlags(); + throw; + } + } +} \ No newline at end of file From 079ef0f07dcf20242d90a3752f999e9ee50bba59 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 May 2024 18:58:09 +0200 Subject: [PATCH 158/499] Improve error handling of UDP connections --- docs/CHANGELOG.md | 4 + .../PVT/libs/monitor_ephemeris_udp_sink.cc | 40 +++++----- .../PVT/libs/monitor_pvt_udp_sink.cc | 20 ++--- .../rtl_tcp_signal_source_c.cc | 11 ++- src/core/libs/nav_message_udp_sink.cc | 36 ++++++--- src/core/monitor/gnss_synchro_udp_sink.cc | 24 +++--- src/core/receiver/tcp_cmd_interface.cc | 4 +- src/utils/nav-listener/main.cc | 7 ++ .../nav-listener/nav_msg_udp_listener.cc | 75 ++++++++++++------- src/utils/nav-listener/nav_msg_udp_listener.h | 1 + 10 files changed, 138 insertions(+), 84 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 473f7742b..18ef1d679 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -14,6 +14,10 @@ All notable changes to GNSS-SDR will be documented in this file. ## [Unreleased](https://github.com/gnss-sdr/gnss-sdr/tree/next) +### Improvements in Interoperability: + +- Improved error handling in UDP connections. + ### Improvements in Portability: - Fix building against google-glog 0.7.0. diff --git a/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc b/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc index ca4ac6fbd..f9f48f0bb 100644 --- a/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc @@ -55,22 +55,24 @@ bool Monitor_Ephemeris_Udp_Sink::write_galileo_ephemeris(const std::shared_ptr #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif -Nav_Message_Udp_Sink::Nav_Message_Udp_Sink(const std::vector& addresses, const uint16_t& port) : socket{io_context} +Nav_Message_Udp_Sink::Nav_Message_Udp_Sink(const std::vector& addresses, const uint16_t& port) + : socket{io_context} { for (const auto& address : addresses) { @@ -35,22 +41,30 @@ bool Nav_Message_Udp_Sink::write_nav_message(const std::shared_ptr(endpoint.port()) << ": " << error.message(); + return false; + } + + if (socket.send(boost::asio::buffer(outbound_data)) == 0) // this can throw { return false; } } - catch (boost::system::system_error const& e) - { - return false; - } } + catch (const boost::system::system_error& e) + { + std::cerr << "Error sending navigation data: " << e.what() << '\n'; + return false; + } + return true; } diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index 84d484385..336f834cb 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -53,22 +53,24 @@ bool Gnss_Synchro_Udp_Sink::write_gnss_synchro(const std::vector& { outbound_data = serdes.createProtobuffer(stocks); } - for (const auto& endpoint : endpoints) - { - socket.open(endpoint.protocol(), error); - try + try + { + for (const auto& endpoint : endpoints) { - if (socket.send_to(boost::asio::buffer(outbound_data), endpoint) == 0) + socket.open(endpoint.protocol(), error); // NOLINT(bugprone-unused-return-value) + + if (socket.send_to(boost::asio::buffer(outbound_data), endpoint) == 0) // this can throw { - std::cerr << "Gnss_Synchro_Udp_Sink sent 0 bytes\n"; + return false; } } - catch (boost::system::system_error const& e) - { - std::cerr << e.what() << '\n'; - return false; - } } + catch (const boost::system::system_error& e) + { + std::cerr << "Error sending data: " << e.what() << '\n'; + return false; + } + return true; } diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 1a47fb269..587aa99fb 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -323,10 +323,10 @@ void TcpCmdInterface::run_cmd_server(int tcp_port) std::cout << "TcpCmdInterface: Telecommand TCP interface listening on port " << tcp_port << '\n'; boost::asio::ip::tcp::socket socket(context); - acceptor.accept(socket, not_throw); + acceptor.accept(socket, not_throw); // NOLINT(bugprone-unused-return-value) if (not_throw) { - std::cerr << "TcpCmdInterface: Error when binding the port in the socket\n"; + std::cerr << "TcpCmdInterface: Error when binding the port to the socket: " << not_throw.message() << '\n'; continue; } diff --git a/src/utils/nav-listener/main.cc b/src/utils/nav-listener/main.cc index 6fee013f7..f2b789497 100644 --- a/src/utils/nav-listener/main.cc +++ b/src/utils/nav-listener/main.cc @@ -31,6 +31,7 @@ int main(int argc, char *argv[]) unsigned short port = boost::lexical_cast(argv[1]); Nav_Msg_Udp_Listener udp_listener(port); + std::cout << "Listening on port " << static_cast(port) << ", press Control+C to exit ...\n"; while (true) { @@ -45,9 +46,15 @@ int main(int argc, char *argv[]) } } } + catch (boost::bad_lexical_cast &) + { + std::cerr << "Error: the argument " << argv[1] << " is not a valid port number.\n"; + return 1; + } catch (std::exception &e) { std::cerr << e.what() << '\n'; + return 1; } return 0; diff --git a/src/utils/nav-listener/nav_msg_udp_listener.cc b/src/utils/nav-listener/nav_msg_udp_listener.cc index 7961c8c8d..5a291b8ed 100644 --- a/src/utils/nav-listener/nav_msg_udp_listener.cc +++ b/src/utils/nav-listener/nav_msg_udp_listener.cc @@ -19,46 +19,67 @@ #include Nav_Msg_Udp_Listener::Nav_Msg_Udp_Listener(unsigned short port) - : socket{io_service}, endpoint{boost::asio::ip::udp::v4(), port} + : socket{io_service}, endpoint{boost::asio::ip::udp::v4(), port}, connected_socket(true) { - socket.open(endpoint.protocol(), error); // Open socket. - socket.bind(endpoint, error); // Bind the socket to the given local endpoint. + socket.open(endpoint.protocol(), error); // Open socket + if (error) + { + std::cerr << "Error opening socket: " << error.message() << '\n'; + connected_socket = false; + } + if (connected_socket) + { + socket.bind(endpoint, error); // Bind the socket to the given local endpoint. + if (error) + { + std::cerr << "Error binding socket: " << error.message() << '\n'; + connected_socket = false; + } + } } -/** - * !\brief blocking call to read nav_message from UDP port - * \param[out] message navigation message class to contain parsed output - * \return true if message parsed succesfully, false ow + +/* + * Blocking call to read nav_message from UDP port + * return true if message parsed succesfully, false ow */ bool Nav_Msg_Udp_Listener::receive_and_parse_nav_message(gnss_sdr::navMsg &message) { - char buff[8192]; // Buffer for storing the received data. + if (connected_socket) + { + char buff[8192]; // Buffer for storing the received data. - // This call will block until one or more bytes of data has been received. - int bytes = socket.receive(boost::asio::buffer(buff)); + // This call will block until one or more bytes of data has been received. + int bytes = socket.receive(boost::asio::buffer(buff)); - std::string data(&buff[0], bytes); - // Deserialize a stock of Nav_Msg objects from the binary string. - return message.ParseFromString(data); + std::string data(&buff[0], bytes); + // Deserialize a stock of Nav_Msg objects from the binary string. + return message.ParseFromString(data); + } + return false; } + /* - * !\brief prints navigation message content - * \param[in] message nav message to be printed + * Prints navigation message content + * param[in] message nav message to be printed */ void Nav_Msg_Udp_Listener::print_message(gnss_sdr::navMsg &message) const { - std::string system = message.system(); - std::string signal = message.signal(); - int prn = message.prn(); - int tow_at_current_symbol_ms = message.tow_at_current_symbol_ms(); - std::string nav_message = message.nav_message(); + if (connected_socket) + { + std::string system = message.system(); + std::string signal = message.signal(); + int prn = message.prn(); + int tow_at_current_symbol_ms = message.tow_at_current_symbol_ms(); + std::string nav_message = message.nav_message(); - std::cout << "\nNew Data received:\n"; - std::cout << "System: " << system << '\n'; - std::cout << "Signal: " << signal << '\n'; - std::cout << "PRN: " << prn << '\n'; - std::cout << "TOW of last symbol [ms]: " - << tow_at_current_symbol_ms << '\n'; - std::cout << "Nav message: " << nav_message << "\n\n"; + std::cout << "\nNew data received:\n"; + std::cout << "System: " << system << '\n'; + std::cout << "Signal: " << signal << '\n'; + std::cout << "PRN: " << prn << '\n'; + std::cout << "TOW of last symbol [ms]: " + << tow_at_current_symbol_ms << '\n'; + std::cout << "Nav message: " << nav_message << "\n\n"; + } } diff --git a/src/utils/nav-listener/nav_msg_udp_listener.h b/src/utils/nav-listener/nav_msg_udp_listener.h index c16654f40..6f70a042e 100644 --- a/src/utils/nav-listener/nav_msg_udp_listener.h +++ b/src/utils/nav-listener/nav_msg_udp_listener.h @@ -31,6 +31,7 @@ private: boost::asio::ip::udp::socket socket; boost::system::error_code error; boost::asio::ip::udp::endpoint endpoint; + bool connected_socket; }; #endif From 0a80c09a19188b6658cbb0d6cc999bfd316444df Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 May 2024 19:01:38 +0200 Subject: [PATCH 159/499] Remove blank line in logs --- .../tracking/gnuradio_blocks/dll_pll_veml_tracking.cc | 2 +- .../tracking/gnuradio_blocks/dll_pll_veml_tracking_fpga.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 4bba76fba..803d1e7c6 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -1864,7 +1864,7 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused) if (next_state) { LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << '\n'; + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); std::cout << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << '\n'; } 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 ba556f46c..96b28be18 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 @@ -1682,7 +1682,7 @@ int dll_pll_veml_tracking_fpga::general_work(int noutput_items __attribute__((un if (next_state) { LOG(INFO) << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel - << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << '\n'; + << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN); std::cout << d_systemName << " " << d_signal_pretty_name << " tracking bit synchronization locked in channel " << d_channel << " for satellite " << Gnss_Satellite(d_systemName, d_acquisition_gnss_synchro->PRN) << '\n'; } From 4836785baca6c36b98d74e1998d812e2734e4ce6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 6 May 2024 19:04:19 +0200 Subject: [PATCH 160/499] Update local version of Matio to 1.5.27 --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 16035246f..7fbb57cc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -350,14 +350,15 @@ set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.26") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "26.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") -set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "master") +set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.3") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") +set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) # Downgrade versions if requirements are not met if(CMAKE_VERSION VERSION_LESS "3.22") @@ -1432,7 +1433,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.24 FetchContent_Declare( absl GIT_REPOSITORY https://github.com/abseil/abseil-cpp - GIT_TAG master # live at head + GIT_TAG ${GNSSSDR_ABSL_LOCAL_VERSION} SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/abseil-cpp CMAKE_ARGS -DABSL_PROPAGATE_CXX_STD=ON -ABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/abseil-cpp ${ABSEIL_TOOLCHAIN_FILE} BINARY_DIR ${GNSSSDR_BINARY_DIR}/abseil-cpp From 3b10a3663f214eddf2e32077c3529765e1246a1f Mon Sep 17 00:00:00 2001 From: Vladislav P Date: Thu, 29 Dec 2022 00:29:42 +0300 Subject: [PATCH 161/499] Allow connection of more than 1 signal conditioner to a signal source Signed-off-by: Vladislav P --- src/core/receiver/gnss_flowgraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index a4b177acc..00eb0f37c 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -966,7 +966,7 @@ int GNSSFlowgraph::connect_signal_sources_to_signal_conditioners() } else { - if (j == 0) + if (j == 0 || !src->get_right_block(j)) { // RF_channel 0 backward compatibility with single channel sources LOG(INFO) << "connecting sig_source_ " << i << " stream " << 0 << " to conditioner " << signal_conditioner_ID; From f80c5373b78b5124e70d1e6743654a79145f0721 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 11 May 2024 08:37:03 +0200 Subject: [PATCH 162/499] Remove wrong string in CMake message when cross-compiling --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fbb57cc0..a22d32316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,7 +222,7 @@ endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") include(DetectLinuxDistro) if(CMAKE_CROSSCOMPILING) - message(STATUS "Configuring GNSS-SDR v${VERSION} to be cross-compiled on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR} ${ARCHITECTURE_STRING}") + message(STATUS "Configuring GNSS-SDR v${VERSION} to be cross-compiled on ${LINUX_DISTRIBUTION} ${LINUX_VER} (${CMAKE_HOST_SYSTEM_PROCESSOR}) for ${CMAKE_SYSTEM_PROCESSOR}") else() message(STATUS "Configuring GNSS-SDR v${VERSION} to be built on GNU/Linux ${LINUX_DISTRIBUTION} ${LINUX_VER} ${ARCHITECTURE_STRING}") endif() From f3a204fec69c9c93873772dcd449ce28c796acdf Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 12 May 2024 11:05:20 +0200 Subject: [PATCH 163/499] =?UTF-8?q?[TAS-174]=20retrieve=20NavData=20(W1?= =?UTF-8?q?=E2=86=92W5)=20directly=20from=20osnma=20test=20vector=20file.?= =?UTF-8?q?=20Add=20Osnma=5FHelper=20class.=20remove=20tag.build=5Fmessage?= =?UTF-8?q?.=20Ignore=20W33.=20Reporting=20changes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/libs/osnma_msg_receiver.cc | 87 +++++++++++-------- src/core/libs/osnma_msg_receiver.h | 2 + src/core/system_parameters/CMakeLists.txt | 2 + .../system_parameters/galileo_inav_message.h | 3 +- src/core/system_parameters/osnma_data.cc | 8 +- src/core/system_parameters/osnma_data.h | 13 ++- src/core/system_parameters/osnma_helper.cc | 34 ++++++++ src/core/system_parameters/osnma_helper.h | 33 +++++++ 8 files changed, 136 insertions(+), 46 deletions(-) create mode 100644 src/core/system_parameters/osnma_helper.cc create mode 100644 src/core/system_parameters/osnma_helper.h diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1c1da25a9..29f896f8b 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -22,6 +22,7 @@ #include "gnss_crypto.h" #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader +#include "osnma_helper.h" #include // for DLOG #include // for gr::io_signature::make #include @@ -60,6 +61,7 @@ osnma_msg_receiver::osnma_msg_receiver( { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); + d_helper = std::make_unique(); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -89,14 +91,13 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); - LOG(INFO) << "Galileo OSNMA: Subframe received starting at " + LOG(WARNING) << "Galileo OSNMA: Subframe received starting at " << "WN=" << nma_msg->WN_sf0 << ", TOW=" << nma_msg->TOW_sf0 << ", from satellite " - << sat - << std::endl; + << sat; process_osnma_message(nma_msg); @@ -127,7 +128,10 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& { read_nma_header(osnma_msg->hkroot[0]); if(d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3 /*&& d_kroot_verified*/) - return; + { + LOG(ERROR) << "Galileo OSNMA: NMAS invalid, skipping osnma message\n"; + return; + } read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 @@ -574,6 +578,9 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN; // FIXME this is ugly. + d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; + d_osnma_data.d_mack_message.WN = osnma_msg->WN_sf0; read_mack_body(); process_mack_message(); // TODO - shorten the MACK processing for the cases where no TK verified or no Kroot verified (warm and cold start) @@ -649,8 +656,6 @@ void osnma_msg_receiver::read_mack_header() d_osnma_data.d_mack_message.header.tag0 = first_lt_bits; d_osnma_data.d_mack_message.header.macseq = macseq; d_osnma_data.d_mack_message.header.cop = cop; - d_osnma_data.d_mack_message.PRNa = d_osnma_data.d_nav_data.PRNa; // FIXME this is ugly. - d_osnma_data.d_mack_message.TOW = d_osnma_data.d_nav_data.TOW_sf0; } /** @@ -866,9 +871,10 @@ void osnma_msg_receiver::process_mack_message() if(d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()){ bool ret = verify_macseq(*mack); if (ret || d_flag_debug){ - for(auto& tag:mack->tag_and_info) + for(std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { - Tag t(tag, mack->TOW, mack->PRNa); + auto& tag = mack->tag_and_info[i]; + Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; } @@ -992,7 +998,43 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) } bool osnma_msg_receiver::verify_tag(Tag& tag) { - std::vector m = tag.build_message(); + // build message + std::vector m; + m.push_back(static_cast(tag.PRN_d)); + m.push_back(static_cast(tag.PRNa)); + uint32_t GST = d_helper->compute_gst(tag.TOW, tag.WN); + std::vector GST_uint8 = d_helper->gst_to_uint8(GST); + m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); + m.push_back(tag.CTR); + // Extracts only two bits from d_osnma_data.d_nma_header.nmas + uint8_t two_bits_nmas = d_osnma_data.d_nma_header.nmas & 0b00000011; + two_bits_nmas = two_bits_nmas << 6; + m.push_back(two_bits_nmas); + + // convert std::string to vector + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.TOW][tag.PRNa].ephemeris_iono_vector_2; + std::vector ephemeris_iono_vector_2_bytes(ephemeris_iono_vector_2.begin(), ephemeris_iono_vector_2.end()); + + // Convert and add ephemeris_iono_vector_2 into the vector + for (uint8_t byte : ephemeris_iono_vector_2_bytes) { + m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m + m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m + } + if(m.back() == 0) { + m.pop_back(); // Remove the last element if its value is 0 (only padding was added) + } + else { + // Pad with zeros if the last element wasn't full + for (int bits = 2; bits < 8; bits += 2) { + // Check if the last element in the vector has 2 '00' bits in its LSB position + if((m.back() & 0b00000011) == 0) { + m.back() <<= 2; // Shift the existing bits to make room for new 2 bits + } + else { + break; // If it does not have 2 '00' bits in its LSB position, then the padding is complete + } + } + } std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 @@ -1044,36 +1086,9 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) - { -// if(tag.ADKD == 0 || tag.ADKD == 12) -// { -// std::cout << "Galileo OSNMA: tag verification successful for PRN_a " -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " -// << "Ephemeris, Clock and Ionospheric data" << ". " -// << std::endl; -// } -// else if(tag.ADKD == 4) -// { -// std::cout << "Galileo OSNMA: tag verification successful for PRN_a " -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " -// << "Timing data" << ". " -// << std::endl; -// } return true; - - } else - { -// std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << std::endl; return false; - } } void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 157c78750..8137c9824 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -40,6 +40,7 @@ friend class test_case_name##_##test_name##_Test class OSNMA_DSM_Reader; class Gnss_Crypto; +class Osnma_Helper; class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; @@ -88,6 +89,7 @@ private: std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; + std::unique_ptr d_helper; std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. std::array, 16> d_dsm_id_received{}; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 4c6e9fb20..46c5fb4b7 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -96,6 +96,8 @@ set(SYSTEM_PARAMETERS_HEADERS Galileo_OSNMA.h osnma_data.h osnma_dsm_reader.h + osnma_helper.cc + osnma_helper.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 13db80706..0e9c15b25 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -51,7 +51,8 @@ public: uint32_t PRN{}; uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already uint32_t TOW_sf0{}; - std::vector EphemerisClockAndStatusData {}; + std::vector EphemerisClockAndStatusData {}; // TODO _2 rename and substitute this + std::string EphemerisClockAndStatusData_2{}; std::vector TimingData {}; Galileo_Ephemeris EphemerisData {}; Galileo_Iono IonoData {}; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 65145ae16..25124bb81 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -35,6 +35,9 @@ void NavData::init(const std::shared_ptr &osnma_msg) PRNa = osnma_msg->PRN; WN_sf0 = osnma_msg->WN_sf0; TOW_sf0 = osnma_msg->TOW_sf0; + + // new parsing, directly parsing bits + ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; }; void NavData::generate_eph_iono_vector() { @@ -166,8 +169,3 @@ void NavData::generate_utc_vector() } } -std::vector Tag::build_message() -{ - // TODO - return std::vector(); -} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 121853d2a..6e3439a4c 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -121,7 +121,8 @@ public: MACK_header header; std::vector tag_and_info; std::vector key; - uint32_t TOW; // TODO duplicated variable + uint32_t TOW; // TODO duplicated variable, also in NavData + uint32_t WN; uint32_t PRNa; }; @@ -131,6 +132,7 @@ public: NavData()=default; void init(const std::shared_ptr &osnma_msg); std::vector ephemeris_iono_vector{}; + std::string ephemeris_iono_vector_2{}; std::vector utc_vector{}; uint32_t PRNa{}; uint32_t WN_sf0{}; @@ -168,10 +170,12 @@ public: SUCCESS, FAIL, UNVERIFIED}; - Tag(const MACK_tag_and_info& MTI, uint32_t TOW, uint32_t PRNa) + Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR) : tag_id(id_counter++), - TOW(TOW), + TOW(TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing + WN(WN), PRNa(PRNa), + CTR(CTR), status(UNVERIFIED), received_tag(MTI.tag), computed_tag(0), @@ -184,10 +188,11 @@ public: const uint32_t tag_id; uint32_t TOW; + uint32_t WN; uint32_t PRNa; + uint8_t CTR; e_verification_status status; uint64_t received_tag; - std::vector build_message(); uint32_t static id_counter; uint64_t computed_tag; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc new file mode 100644 index 000000000..462fd5d34 --- /dev/null +++ b/src/core/system_parameters/osnma_helper.cc @@ -0,0 +1,34 @@ +/*! +* \file osnma_helper.h +* \brief Class for auxiliary osnma functions +* \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- + */ + +#include "osnma_helper.h" + +uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const +{ + uint32_t GST = (WN & 0x00000FFF) << 20 | (TOW & 0x000FFFFF); + return GST; +} + +std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const +{ + std::vector res(4); + + res[1] = static_cast((GST & 0xFF000000) >> 24); + res[2] = static_cast((GST & 0x00FF0000) >> 16); + res[3] = static_cast((GST & 0x0000FF00) >> 8); + res[4] = static_cast(GST & 0x000000FF); + return res; +} diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h new file mode 100644 index 000000000..0a1b72270 --- /dev/null +++ b/src/core/system_parameters/osnma_helper.h @@ -0,0 +1,33 @@ +/*! +* \file osnma_helper.h +* \brief Class for auxiliary osnma functions +* \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- +*/ + +#ifndef GNSS_SDR_OSNMA_HELPER_H +#define GNSS_SDR_OSNMA_HELPER_H + + +#include +#include +class Osnma_Helper +{ +public: + Osnma_Helper() = default; + ~Osnma_Helper() = default; + uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; + std::vector gst_to_uint8(uint32_t GST) const; +}; + + +#endif // GNSS_SDR_OSNMA_HELPER_H From a3a5f28e7f27826edea9b83f84e412967915eacc Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 12 May 2024 11:05:20 +0200 Subject: [PATCH 164/499] =?UTF-8?q?[TAS-174]=20retrieve=20NavData=20(W1?= =?UTF-8?q?=E2=86=92W5)=20directly=20from=20osnma=20test=20vector=20file.?= =?UTF-8?q?=20Add=20Osnma=5FHelper=20class.=20remove=20tag.build=5Fmessage?= =?UTF-8?q?.=20Ignore=20W33.=20Reporting=20changes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/libs/osnma_msg_receiver.cc | 87 ++++++++++------- src/core/libs/osnma_msg_receiver.h | 2 + src/core/system_parameters/CMakeLists.txt | 2 + .../system_parameters/galileo_inav_message.h | 3 +- src/core/system_parameters/osnma_data.cc | 8 +- src/core/system_parameters/osnma_data.h | 13 ++- src/core/system_parameters/osnma_helper.cc | 34 +++++++ src/core/system_parameters/osnma_helper.h | 33 +++++++ .../osnma/osnma_msg_receiver_test.cc | 97 ++++++++++++++++++- 9 files changed, 230 insertions(+), 49 deletions(-) create mode 100644 src/core/system_parameters/osnma_helper.cc create mode 100644 src/core/system_parameters/osnma_helper.h diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1c1da25a9..29f896f8b 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -22,6 +22,7 @@ #include "gnss_crypto.h" #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader +#include "osnma_helper.h" #include // for DLOG #include // for gr::io_signature::make #include @@ -60,6 +61,7 @@ osnma_msg_receiver::osnma_msg_receiver( { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(pemFilePath, merkleFilePath); + d_helper = std::make_unique(); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -89,14 +91,13 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); - LOG(INFO) << "Galileo OSNMA: Subframe received starting at " + LOG(WARNING) << "Galileo OSNMA: Subframe received starting at " << "WN=" << nma_msg->WN_sf0 << ", TOW=" << nma_msg->TOW_sf0 << ", from satellite " - << sat - << std::endl; + << sat; process_osnma_message(nma_msg); @@ -127,7 +128,10 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& { read_nma_header(osnma_msg->hkroot[0]); if(d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3 /*&& d_kroot_verified*/) - return; + { + LOG(ERROR) << "Galileo OSNMA: NMAS invalid, skipping osnma message\n"; + return; + } read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 @@ -574,6 +578,9 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN; // FIXME this is ugly. + d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; + d_osnma_data.d_mack_message.WN = osnma_msg->WN_sf0; read_mack_body(); process_mack_message(); // TODO - shorten the MACK processing for the cases where no TK verified or no Kroot verified (warm and cold start) @@ -649,8 +656,6 @@ void osnma_msg_receiver::read_mack_header() d_osnma_data.d_mack_message.header.tag0 = first_lt_bits; d_osnma_data.d_mack_message.header.macseq = macseq; d_osnma_data.d_mack_message.header.cop = cop; - d_osnma_data.d_mack_message.PRNa = d_osnma_data.d_nav_data.PRNa; // FIXME this is ugly. - d_osnma_data.d_mack_message.TOW = d_osnma_data.d_nav_data.TOW_sf0; } /** @@ -866,9 +871,10 @@ void osnma_msg_receiver::process_mack_message() if(d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()){ bool ret = verify_macseq(*mack); if (ret || d_flag_debug){ - for(auto& tag:mack->tag_and_info) + for(std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { - Tag t(tag, mack->TOW, mack->PRNa); + auto& tag = mack->tag_and_info[i]; + Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; } @@ -992,7 +998,43 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) } bool osnma_msg_receiver::verify_tag(Tag& tag) { - std::vector m = tag.build_message(); + // build message + std::vector m; + m.push_back(static_cast(tag.PRN_d)); + m.push_back(static_cast(tag.PRNa)); + uint32_t GST = d_helper->compute_gst(tag.TOW, tag.WN); + std::vector GST_uint8 = d_helper->gst_to_uint8(GST); + m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); + m.push_back(tag.CTR); + // Extracts only two bits from d_osnma_data.d_nma_header.nmas + uint8_t two_bits_nmas = d_osnma_data.d_nma_header.nmas & 0b00000011; + two_bits_nmas = two_bits_nmas << 6; + m.push_back(two_bits_nmas); + + // convert std::string to vector + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.TOW][tag.PRNa].ephemeris_iono_vector_2; + std::vector ephemeris_iono_vector_2_bytes(ephemeris_iono_vector_2.begin(), ephemeris_iono_vector_2.end()); + + // Convert and add ephemeris_iono_vector_2 into the vector + for (uint8_t byte : ephemeris_iono_vector_2_bytes) { + m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m + m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m + } + if(m.back() == 0) { + m.pop_back(); // Remove the last element if its value is 0 (only padding was added) + } + else { + // Pad with zeros if the last element wasn't full + for (int bits = 2; bits < 8; bits += 2) { + // Check if the last element in the vector has 2 '00' bits in its LSB position + if((m.back() & 0b00000011) == 0) { + m.back() <<= 2; // Shift the existing bits to make room for new 2 bits + } + else { + break; // If it does not have 2 '00' bits in its LSB position, then the padding is complete + } + } + } std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 @@ -1044,36 +1086,9 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) - { -// if(tag.ADKD == 0 || tag.ADKD == 12) -// { -// std::cout << "Galileo OSNMA: tag verification successful for PRN_a " -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " -// << "Ephemeris, Clock and Ionospheric data" << ". " -// << std::endl; -// } -// else if(tag.ADKD == 4) -// { -// std::cout << "Galileo OSNMA: tag verification successful for PRN_a " -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << "NavData= " -// << "Timing data" << ". " -// << std::endl; -// } return true; - - } else - { -// std::cout << "Galileo OSNMA: Tag verification failed for PRN_a " -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].PRNa << " with WN=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].WN_sf0 << ", TOW=" -// << d_satellite_nav_data[tag.PRN_d][tag.TOW-30].TOW_sf0 << std::endl; return false; - } } void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 157c78750..8137c9824 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -40,6 +40,7 @@ friend class test_case_name##_##test_name##_Test class OSNMA_DSM_Reader; class Gnss_Crypto; +class Osnma_Helper; class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; @@ -88,6 +89,7 @@ private: std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW std::unique_ptr d_dsm_reader; std::unique_ptr d_crypto; + std::unique_ptr d_helper; std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. std::array, 16> d_dsm_id_received{}; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 4c6e9fb20..46c5fb4b7 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -96,6 +96,8 @@ set(SYSTEM_PARAMETERS_HEADERS Galileo_OSNMA.h osnma_data.h osnma_dsm_reader.h + osnma_helper.cc + osnma_helper.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 13db80706..0e9c15b25 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -51,7 +51,8 @@ public: uint32_t PRN{}; uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already uint32_t TOW_sf0{}; - std::vector EphemerisClockAndStatusData {}; + std::vector EphemerisClockAndStatusData {}; // TODO _2 rename and substitute this + std::string EphemerisClockAndStatusData_2{}; std::vector TimingData {}; Galileo_Ephemeris EphemerisData {}; Galileo_Iono IonoData {}; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 65145ae16..25124bb81 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -35,6 +35,9 @@ void NavData::init(const std::shared_ptr &osnma_msg) PRNa = osnma_msg->PRN; WN_sf0 = osnma_msg->WN_sf0; TOW_sf0 = osnma_msg->TOW_sf0; + + // new parsing, directly parsing bits + ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; }; void NavData::generate_eph_iono_vector() { @@ -166,8 +169,3 @@ void NavData::generate_utc_vector() } } -std::vector Tag::build_message() -{ - // TODO - return std::vector(); -} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 121853d2a..6e3439a4c 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -121,7 +121,8 @@ public: MACK_header header; std::vector tag_and_info; std::vector key; - uint32_t TOW; // TODO duplicated variable + uint32_t TOW; // TODO duplicated variable, also in NavData + uint32_t WN; uint32_t PRNa; }; @@ -131,6 +132,7 @@ public: NavData()=default; void init(const std::shared_ptr &osnma_msg); std::vector ephemeris_iono_vector{}; + std::string ephemeris_iono_vector_2{}; std::vector utc_vector{}; uint32_t PRNa{}; uint32_t WN_sf0{}; @@ -168,10 +170,12 @@ public: SUCCESS, FAIL, UNVERIFIED}; - Tag(const MACK_tag_and_info& MTI, uint32_t TOW, uint32_t PRNa) + Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR) : tag_id(id_counter++), - TOW(TOW), + TOW(TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing + WN(WN), PRNa(PRNa), + CTR(CTR), status(UNVERIFIED), received_tag(MTI.tag), computed_tag(0), @@ -184,10 +188,11 @@ public: const uint32_t tag_id; uint32_t TOW; + uint32_t WN; uint32_t PRNa; + uint8_t CTR; e_verification_status status; uint64_t received_tag; - std::vector build_message(); uint32_t static id_counter; uint64_t computed_tag; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc new file mode 100644 index 000000000..462fd5d34 --- /dev/null +++ b/src/core/system_parameters/osnma_helper.cc @@ -0,0 +1,34 @@ +/*! +* \file osnma_helper.h +* \brief Class for auxiliary osnma functions +* \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- + */ + +#include "osnma_helper.h" + +uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const +{ + uint32_t GST = (WN & 0x00000FFF) << 20 | (TOW & 0x000FFFFF); + return GST; +} + +std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const +{ + std::vector res(4); + + res[1] = static_cast((GST & 0xFF000000) >> 24); + res[2] = static_cast((GST & 0x00FF0000) >> 16); + res[3] = static_cast((GST & 0x0000FF00) >> 8); + res[4] = static_cast(GST & 0x000000FF); + return res; +} diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h new file mode 100644 index 000000000..0a1b72270 --- /dev/null +++ b/src/core/system_parameters/osnma_helper.h @@ -0,0 +1,33 @@ +/*! +* \file osnma_helper.h +* \brief Class for auxiliary osnma functions +* \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- +*/ + +#ifndef GNSS_SDR_OSNMA_HELPER_H +#define GNSS_SDR_OSNMA_HELPER_H + + +#include +#include +class Osnma_Helper +{ +public: + Osnma_Helper() = default; + ~Osnma_Helper() = default; + uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; + std::vector gst_to_uint8(uint32_t GST) const; +}; + + +#endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 65dd98006..f251756e8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -99,6 +99,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; const int DURATION_SUBFRAME{30}; + const int DUMMY_PAGE{63}; + bool flag_dummy_page{false}; std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS << ", TOW=" << TOW << ", WN=" << WN << std::endl; @@ -107,10 +109,12 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // Act while (end_of_hex_stream == false){ // loop over all bytes of data. Note all TestVectors have same amount of data. for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID "<< tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); std::array hkroot{}; std::array mack{}; byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words; for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index @@ -133,6 +137,34 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) bool tail_bits_OK = even_page.substr(even_page.size() - 6) == "000000" && odd_page.substr(odd_page.size() - 6) == "000000"; if(!even_odd_OK || !page_type_OK || !tail_bits_OK) std::cerr<< "OsnmaTestVectorsSimulation: error parsing pages." << std::endl; + + std::bitset<112> data_k(even_page.substr(2,112)); + std::bitset<16> data_j(odd_page.substr(2,16)); + std::bitset<112> shifted_data_k = data_k; +// uint8_t word_type = 0; +// for(int i = 0; i < 6; ++i) { +// word_type |= (data_k[104 + i] << i); +// } + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + std::cout<< "OsnmaTestVectorsSimulation: received Word "<< static_cast(word_type) << std::endl; + if( (word_type >= 1 && word_type <=5) || word_type == 6 || word_type == 10) + { + // store raw word + std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); + words[word_type] = data_combined; +// std::vector concatenatedData; +// for (std::size_t i = 0; i < data_k.size(); i += 8) { +// std::bitset<8> byte(data_k.to_string().substr(i, 8)); +// concatenatedData.push_back(static_cast(byte.to_ulong())); +// } +// for (std::size_t i = 0; i < data_j.size(); i += 8) { +// std::bitset<8> byte(data_j.to_string().substr(i, 8)); +// concatenatedData.push_back(static_cast(byte.to_ulong())); +// } + } + if(word_type == DUMMY_PAGE) + flag_dummy_page = true; + // place it into osnma object. std::bitset<40> osnmaBits(odd_page.substr(18, 40)); // Extract bits for hkroot and mack std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); @@ -142,8 +174,13 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) byte_index += SIZE_PAGE_BYTES; } + std::cout<< "----------" << std::endl; if(end_of_hex_stream) break; + if(flag_dummy_page){ + flag_dummy_page = false; + continue; // skip this SV + } osnmaMsg_sptr->hkroot = hkroot; osnmaMsg_sptr->mack = mack; @@ -151,6 +188,63 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; osnmaMsg_sptr->PRN = tv.svId; + bool allWordsReceived = true; + for (int i = 1; i <= 5; ++i) + { + if (words.find(i) == words.end() && flag_dummy_page == false) + { + allWordsReceived = false; + std::cerr<< "OsnmaTestVectorsSimulation: error parsing words 1->5. " + "Word "<< i << " should be received for each subframe but was not." << std::endl; + } + } + if(allWordsReceived) + { + + // Define the starting position and length of bits to extract for each word + std::map> extractionParams = { + {1, {6, 120}}, + {2, {6, 120}}, + {3, {6, 122}}, + {4, {6, 120}}, + {5, {6, 67}}, + // TODO words 6 and 10 for TimingData + }; + + // Iterate over the extraction parameters + for (const auto& param : extractionParams) { + uint8_t wordKey = param.first; + uint8_t start = param.second.first; + uint8_t length = param.second.second; + + // Extract the required bits + std::bitset<128> word = words[wordKey]; + + osnmaMsg_sptr->EphemerisClockAndStatusData_2 += words[wordKey]. + to_string().substr( + start, length); + +// std::bitset<8> byte; +// int byteIndex = 0; +// for (uint8_t i = start; i < start + length; ++i) { +// byte[byteIndex] = word[i]; +// byteIndex++; +// +// // Once we have collected 8 bits, we can add them as an uint8_t to the vector +// if (byteIndex == 8) { +// osnmaMsg_sptr->EphemerisClockAndStatusData.push_back(static_cast(byte.to_ulong())); +// byte.reset(); +// byteIndex = 0; +// } +// } +// +// // Push remaining bits if it didn't reach 8 bits +// if (byteIndex > 0) { +// osnmaMsg_sptr->EphemerisClockAndStatusData.push_back(static_cast(byte.to_ulong())); +// } + } + } + auto temp_obj = pmt::make_any(osnmaMsg_sptr); osnma->msg_handler_osnma(temp_obj); // osnma entry point @@ -169,9 +263,6 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) } - - - // Assert // TODO } From f11eb5b421ed1025ea1afafe3bc361798abfc77a Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 14 May 2024 16:15:17 +0200 Subject: [PATCH 165/499] [TAS-199] Add TagVerification test. Bugfix for verify_tag and osnma_helper. --- src/core/libs/osnma_msg_receiver.cc | 12 ++-- src/core/libs/osnma_msg_receiver.h | 1 + src/core/system_parameters/osnma_helper.cc | 32 ++++++++-- src/core/system_parameters/osnma_helper.h | 2 + src/tests/single_test_main.cc | 1 - .../osnma/osnma_msg_receiver_test.cc | 58 +++++++++++++++++-- 6 files changed, 91 insertions(+), 15 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 29f896f8b..024455597 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -873,6 +873,7 @@ void osnma_msg_receiver::process_mack_message() if (ret || d_flag_debug){ for(std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { + // add tags of current mack to the verification queue auto& tag = mack->tag_and_info[i]; Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); @@ -1002,7 +1003,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) std::vector m; m.push_back(static_cast(tag.PRN_d)); m.push_back(static_cast(tag.PRNa)); - uint32_t GST = d_helper->compute_gst(tag.TOW, tag.WN); + uint32_t GST = d_helper->compute_gst( tag.WN,tag.TOW); std::vector GST_uint8 = d_helper->gst_to_uint8(GST); m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); m.push_back(tag.CTR); @@ -1012,8 +1013,8 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) m.push_back(two_bits_nmas); // convert std::string to vector - std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.TOW][tag.PRNa].ephemeris_iono_vector_2; - std::vector ephemeris_iono_vector_2_bytes(ephemeris_iono_vector_2.begin(), ephemeris_iono_vector_2.end()); + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW].ephemeris_iono_vector_2; + std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); // Convert and add ephemeris_iono_vector_2 into the vector for (uint8_t byte : ephemeris_iono_vector_2_bytes) { @@ -1205,7 +1206,8 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() /** * @brief Verifies the MACSEQ of a received MACK_message. * - * \details checks for each tag in the retrieved mack message if its flexible (MACSEQ) or not (MACSEQ/MACLT depending on configuration param. (TODO) + * \details checks for each tag in the retrieved mack message if its flexible (MACSEQ) or not (MACSEQ/MACLT depending on configuration param, and + * verifies according to Eqs. 20, 21 SIS ICD. * @param message The MACK_message to verify. * @return True if the MACSEQ is valid, false otherwise. */ @@ -1218,7 +1220,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) std::vector sq2{}; std::vector applicable_sequence; const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); - // TODO as per RG example appears that the seq. q shall also be validated ageints either next or former Sf (depending on GST) + // TODO as per RG example appears that the seq. q shall also be validated against either next or former Sf (depending on GST) if (it != OSNMA_TABLE_16.cend()) { sq1 = it->second.sequence1; diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 8137c9824..b655094df 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -122,6 +122,7 @@ private: FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); FRIEND_TEST(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation); + FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); }; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 462fd5d34..b67454ddd 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -15,6 +15,7 @@ */ #include "osnma_helper.h" +#include uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const { @@ -24,11 +25,32 @@ uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const { - std::vector res(4); + std::vector res; - res[1] = static_cast((GST & 0xFF000000) >> 24); - res[2] = static_cast((GST & 0x00FF0000) >> 16); - res[3] = static_cast((GST & 0x0000FF00) >> 8); - res[4] = static_cast(GST & 0x000000FF); + res.push_back(static_cast((GST & 0xFF000000) >> 24)); + res.push_back(static_cast((GST & 0x00FF0000) >> 16)); + res.push_back(static_cast((GST & 0x0000FF00) >> 8)); + res.push_back(static_cast(GST & 0x000000FF)); return res; } + +std::vector Osnma_Helper::bytes(const std::string& binaryString) { + std::vector bytes; + + // Determine the size of the padding needed. + size_t padding_size = binaryString.size() % 8; + + std::string padded_binary = binaryString; + + if (padding_size != 0) { + padding_size = 8 - padding_size; // Compute padding size + padded_binary.append(padding_size, '0'); // Append zeros to the binary string + } + + for (size_t i = 0; i < padded_binary.size(); i += 8) { + uint8_t byte = std::bitset<8>(padded_binary.substr(i, 8)).to_ulong(); + bytes.push_back(byte); + } + + return bytes; +} \ No newline at end of file diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 0a1b72270..9bf1d860d 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -19,6 +19,7 @@ #include +#include #include class Osnma_Helper { @@ -27,6 +28,7 @@ public: ~Osnma_Helper() = default; uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; std::vector gst_to_uint8(uint32_t GST) const; + std::vector bytes(const std::string& binaryString); }; diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 2bea64518..de02b421c 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -78,7 +78,6 @@ Concurrent_Map global_gps_acq_assist_map; int main(int argc, char **argv) { #if USE_GLOG_AND_GFLAGS - gflags::ParseCommandLineFlags(&argc, &argv, true); try { testing::InitGoogleTest(&argc, argv); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index f251756e8..2b29ee3cf 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -58,6 +58,7 @@ public: TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Arrange + // ---------- osnma->d_tesla_key_verified = false; osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits @@ -75,6 +76,7 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Act + // ---------- bool result = osnma->verify_tesla_key(key, TOW); @@ -82,7 +84,8 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Assert - ASSERT_TRUE(result); // Adjust this according to what you expect + // ---------- + ASSERT_TRUE(result); } @@ -342,7 +345,6 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } - /** * @brief Sets the time based on the given input. * @@ -374,7 +376,6 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) } - void OsnmaMsgReceiverTest::initializeGoogleLog() { google::InitGoogleLogging(log_name.c_str()); @@ -416,4 +417,53 @@ void OsnmaMsgReceiverTest::initializeGoogleLog() throw; } } -} \ No newline at end of file +} + + +TEST_F(OsnmaMsgReceiverTest, TagVerification) { + // Arrange + // ---------- + osnma->d_tesla_key_verified = false; + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 + osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; + // local_time_verification would do this operation. TODO - eliminate duplication. + osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + + osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 + + + uint32_t TOW = 345630; + uint32_t WN = 1248; + uint32_t PRNa = 0; + uint8_t CTR = 2; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 0x00; + osnma->d_tesla_keys[TOW] = {0xEF, 0xF9}; + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0x00; + osnma->d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = ""; + osnma->d_osnma_data.d_nma_header.nmas = 0b00000010; + + MACK_tag_and_info MTI; + MTI.tag = 0x00; + MTI.tag_info.PRN_d = 0; + MTI.tag_info.ADKD = 0; + MTI.tag_info.cop = 0; + Tag t(MTI, TOW, WN, PRNa, CTR); + + // Act + // ---------- + bool result = osnma->verify_tag(t); + + + + + + // Assert + // ---------- + ASSERT_TRUE(result); + +} From 6731d1cb3eb2257c250106f842026f7fcf6bad8d Mon Sep 17 00:00:00 2001 From: Vladislav P Date: Thu, 29 Dec 2022 00:29:03 +0300 Subject: [PATCH 166/499] Add fake multichannel example config files Signed-off-by: Vladislav P --- ...lileo_Beidou_Glonass_L1_USRP_realtime.conf | 281 ++++++++++++++++++ ...GPS_Galileo_Beidou_L1_hackrf_realtime.conf | 237 +++++++++++++++ 2 files changed, 518 insertions(+) create mode 100644 conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf create mode 100644 conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf diff --git a/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf new file mode 100644 index 000000000..0c53dedb1 --- /dev/null +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf @@ -0,0 +1,281 @@ +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=8000000 +GNSS-SDR.Beidou_banned_prns=56,57,58 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=56000000 +SignalSource.freq=1584000000 +SignalSource.osmosdr_args=uhd,type=b200,num_recv_frames=256 +SignalSource.gain=50 +SignalSource.antenna=TX/RX +SignalSource.if_bw=56000000 +SignalSource.AGC_enabled=false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.RF_channels=3 +SignalSource.enable_throttle_control=false +SignalSource.dump=false + + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +SignalConditioner1.implementation=Signal_Conditioner +SignalConditioner2.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter2.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.decimation_factor=7 +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.filter_type=lowpass +InputFilter0.bw=7000000 +InputFilter0.tw=500000 +InputFilter0.IF=-22902000 +InputFilter0.sampling_frequency=56000000 +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.decimation_factor=7 +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.filter_type=lowpass +InputFilter1.bw=7000000 +InputFilter1.tw=500000 +InputFilter1.IF=-8580000 +InputFilter1.sampling_frequency=56000000 +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter2.implementation=Freq_Xlating_Fir_Filter +InputFilter2.decimation_factor=7 +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex +InputFilter2.taps_item_type=float +InputFilter2.filter_type=lowpass +InputFilter2.bw=7000000 +InputFilter2.tw=500000 +InputFilter2.IF=18000000 +InputFilter2.sampling_frequency=56000000 +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat + +;######### RESAMPLER CONFIG ############ +Resampler0.implementation=Pass_Through +Resampler1.implementation=Pass_Through +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=10 +Channels_1C.count=10 +Channels_B1.count=14 +Channels_1G.count=8 + +Channels_1B.RF_channel_ID=1 +Channels_1C.RF_channel_ID=1 +Channels_B1.RF_channel_ID=0 +Channels_1G.RF_channel_ID=2 + + +Channels.in_acquisition=2 + +;######### ACQUISITION BEIDOU CONFIG ############ +Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition +Acquisition_B1.item_type=gr_complex +Acquisition_B1.coherent_integration_time_ms=2 +;Acquisition_B1.max_dwells=2 +;Acquisition_B1.pfa=0.02 +Acquisition_B1.pfa=0.000002 +Acquisition_B1.doppler_max=6000 +Acquisition_B1.doppler_step=100 +Acquisition_B1.dump=false +Acquisition_B1.dump_filename=./bds_acq +;Acquisition_B1.blocking=true +Acquisition_B1.bit_transition_flag = false; + +;######### ACQUISITION GPS CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +Acquisition_1C.doppler_max=6000 +Acquisition_1C.doppler_step=200 +Acquisition_1C.max_dwells=4 +;Acquisition_1C.blocking=true +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### ACQUISITION GALILEO CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.coherent_integration_time_ms=2 +;Acquisition_1B.pfa=0.000008 +Acquisition_1B.pfa=0.025 +Acquisition_1B.doppler_max=6000 +Acquisition_1B.doppler_step=200 +Acquisition_1B.max_dwells=4 +;Acquisition_1B.repeat_satellite=true +Acquisition_1B.cboc=true +;Acquisition_1B.blocking=true +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### ACQUISITION GLONASS CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.coherent_integration_time_ms=1 +Acquisition_1G.max_dwells=4 +Acquisition_1G.pfa=0.02 +Acquisition_1G.doppler_max=6000 +Acquisition_1G.doppler_step=100 +Acquisition_1G.dump=false +Acquisition_1G.dump_filename=./G1_acq + + + +;######### TRACKING BEIDOU CONFIG ############ +Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking +Tracking_B1.item_type=gr_complex +Tracking_B1.extend_correlation_symbols=10 +Tracking_B1.pll_bw_hz=50.0 +Tracking_B1.dll_bw_hz=2.00 +Tracking_B1.pll_bw_narrow_hz=15.0 +Tracking_B1.dll_bw_narrow_hz=1.50 +;Tracking_B1.cn0_min=20 +;Tracking_B1.fll_bw_hz=20 +;Tracking_B1.enable_fll_pull_in=true +;Tracking_B1.enable_fll_steady_state=false +Tracking_B1.dump=false +Tracking_B1.dump_filename=./epl_tracking_ch_ + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_symbols=10 +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.early_late_space_narrow_chips=0.15 +Tracking_1C.pll_bw_hz=30.0 +Tracking_1C.dll_bw_hz=2.0 +Tracking_1C.pll_bw_narrow_hz=10.0 +Tracking_1C.dll_bw_narrow_hz=1.50 +Tracking_1C.fll_bw_hz=10 +Tracking_1C.enable_fll_pull_in=true +Tracking_1C.enable_fll_steady_state=false +Tracking_1C.dump=false +Tracking_1C.dump_filename=tracking_ch_ + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.extend_correlation_symbols=4 +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=30.0 +Tracking_1B.dll_bw_hz=2.0 +Tracking_1B.pll_bw_narrow_hz=20.0 +Tracking_1B.dll_bw_narrow_hz=1.50 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=20 + +;######### TRACKING GLONASS CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.pll_bw_hz=40 +Tracking_1G.dll_bw_hz=2.5 +Tracking_1G.extend_correlation_ms=1 +Tracking_1G.pll_bw_narrow_hz=20 +Tracking_1G.dll_bw_narrow_hz=1.5 +Tracking_1G.dump=false +Tracking_1G.dump_filename=./epl_tracking_ch_ + + + +;######### TELEMETRY DECODER BEIDOU CONFIG ############ +TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder +TelemetryDecoder_B1.dump=false + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER GALILEO E1B CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +;######### TELEMETRY DECODER GLONASS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1G.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.threshold_reject_GDOP=100 +PVT.elevation_mask=3 +PVT.raim_fde=1 +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.enable_rx_clock_correction=true +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/3 + +; To use gpsd with GNSS-SDR +; 1. run socat -d -d pty,raw,echo=0 pty,raw,echo=0 +; 2. Set PVT.nmea_dump_devname to first PTY from socat output +; 3. run gpsd -b -n -N /dev/pts/4 +; where /dev/pts/4 is the second PTY from socat output +; 4. run some gpsd client (xgps or other) + + + +PVT.enable_monitor=true +PVT.monitor_client_addresses=127.0.0.1 +PVT.monitor_udp_port=1111 + +Monitor.enable_monitor=true +Monitor.decimation_factor=4 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1112 + +;AcquisitionMonitor.enable_monitor=true +AcquisitionMonitor.client_addresses=127.0.0.1 +AcquisitionMonitor.udp_port=1112 + + diff --git a/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf new file mode 100644 index 000000000..0844dd1da --- /dev/null +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf @@ -0,0 +1,237 @@ +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=4000000 +GNSS-SDR.Beidou_banned_prns=56,57,58 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=20000000 +SignalSource.freq=1567420000 +SignalSource.if_bw=18000000 +;# Next line enables the internal HackRF One bias (3.3 VDC) +SignalSource.osmosdr_args=hackrf=0,bias=1,buffers=256 +SignalSource.gain=0 +SignalSource.rf_gain=40 +SignalSource.if_gain=40 +SignalSource.AGC_enabled=false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.RF_channels=2 +SignalSource.enable_throttle_control=false +SignalSource.dump=false + + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter1.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +;InputFilter0.implementation=Pass_Through +InputFilter0.decimation_factor=5 +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.filter_type=lowpass +InputFilter0.bw=3000000 +InputFilter0.tw=1000000 +InputFilter0.IF=-6322000 +InputFilter0.sampling_frequency=20000000 +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +;InputFilter1.implementation=Pass_Through +InputFilter1.decimation_factor=5 +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.filter_type=lowpass +InputFilter1.bw=3000000 +InputFilter1.tw=1000000 +InputFilter1.IF=8000000 +InputFilter1.sampling_frequency=20000000 +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat + + + + + +;######### RESAMPLER CONFIG ############ +Resampler0.implementation=Pass_Through +Resampler1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=10 +Channels_1C.count=10 +Channels_B1.count=14 + +Channels_1B.RF_channel_ID=1 +Channels_1C.RF_channel_ID=1 +Channels_B1.RF_channel_ID=0 + + + +Channels.in_acquisition=10 + +;######### ACQUISITION BEIDOU CONFIG ############ +Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition +Acquisition_B1.item_type=gr_complex +Acquisition_B1.coherent_integration_time_ms=2 +;Acquisition_B1.max_dwells=2 +;Acquisition_B1.pfa=0.02 +Acquisition_B1.pfa=0.000002 +Acquisition_B1.doppler_max=3800 +Acquisition_B1.doppler_step=100 +Acquisition_B1.dump=false +Acquisition_B1.dump_filename=./bds_acq +;Acquisition_B1.blocking=true +Acquisition_B1.bit_transition_flag = false; + +;######### ACQUISITION GPS CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=200 +Acquisition_1C.max_dwells=4 +;Acquisition_1C.blocking=true +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### ACQUISITION GALILEO CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.coherent_integration_time_ms=2 +;Acquisition_1B.pfa=0.000008 +Acquisition_1B.pfa=0.025 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=200 +Acquisition_1B.max_dwells=4 +;Acquisition_1B.repeat_satellite=true +Acquisition_1B.cboc=true +;Acquisition_1B.blocking=true +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + + + +;######### TRACKING BEIDOU CONFIG ############ +Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking +Tracking_B1.item_type=gr_complex +Tracking_B1.extend_correlation_symbols=10 +Tracking_B1.pll_bw_hz=30.0 +Tracking_B1.dll_bw_hz=2.00 +Tracking_B1.pll_bw_narrow_hz=15.0 +Tracking_B1.dll_bw_narrow_hz=0.50 +;Tracking_B1.cn0_min=20 +Tracking_B1.fll_bw_hz=20 +Tracking_B1.enable_fll_pull_in=true +Tracking_B1.enable_fll_steady_state=false +Tracking_B1.dump=false +Tracking_B1.dump_filename=./epl_tracking_ch_ + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_symbols=10 +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.early_late_space_narrow_chips=0.15 +Tracking_1C.pll_bw_hz=30.0 +Tracking_1C.dll_bw_hz=2.0 +Tracking_1C.pll_bw_narrow_hz=10.0 +Tracking_1C.dll_bw_narrow_hz=0.50 +Tracking_1C.fll_bw_hz=10 +Tracking_1C.enable_fll_pull_in=true +Tracking_1C.enable_fll_steady_state=false +Tracking_1C.dump=false +Tracking_1C.dump_filename=tracking_ch_ + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.extend_correlation_symbols=4 +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=30.0 +Tracking_1B.dll_bw_hz=2.0 +Tracking_1B.pll_bw_narrow_hz=20.0 +Tracking_1B.dll_bw_narrow_hz=0.50 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=20 + + +;######### TELEMETRY DECODER BEIDOU CONFIG ############ +TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder +TelemetryDecoder_B1.dump=false + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER GALILEO E1B CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.threshold_reject_GDOP=100 +PVT.elevation_mask=4 +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.enable_rx_clock_correction=true +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/3 + + +PVT.enable_monitor=true +PVT.monitor_client_addresses=127.0.0.1 +PVT.monitor_udp_port=1111 + +Monitor.enable_monitor=true +Monitor.decimation_factor=4 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1112 + +AcquisitionMonitor.enable_monitor=true +AcquisitionMonitor.client_addresses=127.0.0.1 +AcquisitionMonitor.udp_port=1112 + + From 5cee46aa06b56ed4488f166a16baffea054e6aad Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 14 May 2024 16:15:17 +0200 Subject: [PATCH 167/499] [TAS-199] Add TagVerification test. Bugfix for verify_tag and osnma_helper. --- src/core/libs/osnma_msg_receiver.cc | 30 +++++--- src/core/libs/osnma_msg_receiver.h | 1 + src/core/system_parameters/osnma_helper.cc | 32 ++++++-- src/core/system_parameters/osnma_helper.h | 2 + src/tests/single_test_main.cc | 1 - .../osnma/osnma_msg_receiver_test.cc | 76 ++++++++++++++++++- 6 files changed, 122 insertions(+), 20 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 29f896f8b..51c495e0f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -873,6 +873,7 @@ void osnma_msg_receiver::process_mack_message() if (ret || d_flag_debug){ for(std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { + // add tags of current mack to the verification queue auto& tag = mack->tag_and_info[i]; Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); @@ -998,11 +999,13 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) } bool osnma_msg_receiver::verify_tag(Tag& tag) { + // TODO case tag0, to be verified here?, PRNd not needed for it // build message std::vector m; - m.push_back(static_cast(tag.PRN_d)); + if(tag.CTR != 1) + m.push_back(static_cast(tag.PRN_d)); m.push_back(static_cast(tag.PRNa)); - uint32_t GST = d_helper->compute_gst(tag.TOW, tag.WN); + uint32_t GST = d_helper->compute_gst( tag.WN,tag.TOW); std::vector GST_uint8 = d_helper->gst_to_uint8(GST); m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); m.push_back(tag.CTR); @@ -1012,8 +1015,8 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) m.push_back(two_bits_nmas); // convert std::string to vector - std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.TOW][tag.PRNa].ephemeris_iono_vector_2; - std::vector ephemeris_iono_vector_2_bytes(ephemeris_iono_vector_2.begin(), ephemeris_iono_vector_2.end()); + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW-30].ephemeris_iono_vector_2; + std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); // Convert and add ephemeris_iono_vector_2 into the vector for (uint8_t byte : ephemeris_iono_vector_2_bytes) { @@ -1035,15 +1038,21 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) } } } - +// m = { +// 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, +// 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, +// 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, +// 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, +// 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 +// }; std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { - mac = d_crypto->computeHMAC_SHA_256(d_tesla_keys[tag.TOW], m); + mac = d_crypto->computeHMAC_SHA_256(d_tesla_keys[tag.TOW+30], m); } else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { - mac = d_crypto->computeCMAC_AES(d_tesla_keys[tag.TOW], m); + mac = d_crypto->computeCMAC_AES(d_tesla_keys[tag.TOW+30], m); } // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD @@ -1205,7 +1214,8 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() /** * @brief Verifies the MACSEQ of a received MACK_message. * - * \details checks for each tag in the retrieved mack message if its flexible (MACSEQ) or not (MACSEQ/MACLT depending on configuration param. (TODO) + * \details checks for each tag in the retrieved mack message if its flexible (MACSEQ) or not (MACSEQ/MACLT depending on configuration param, and + * verifies according to Eqs. 20, 21 SIS ICD. * @param message The MACK_message to verify. * @return True if the MACSEQ is valid, false otherwise. */ @@ -1218,7 +1228,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) std::vector sq2{}; std::vector applicable_sequence; const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); - // TODO as per RG example appears that the seq. q shall also be validated ageints either next or former Sf (depending on GST) + // TODO as per RG example appears that the seq. q shall also be validated against either next or former Sf (depending on GST) if (it != OSNMA_TABLE_16.cend()) { sq1 = it->second.sequence1; @@ -1317,7 +1327,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) // PRN was found, check if TOW exists in inner map LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; - auto tow_it = tow_map.find(t.TOW); + auto tow_it = tow_map.find(t.TOW-30); // TODO check ADKD to decide if (tow_it != tow_map.end()) { return true; } else { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 8137c9824..b655094df 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -122,6 +122,7 @@ private: FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); FRIEND_TEST(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation); + FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); }; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 462fd5d34..b67454ddd 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -15,6 +15,7 @@ */ #include "osnma_helper.h" +#include uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const { @@ -24,11 +25,32 @@ uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const { - std::vector res(4); + std::vector res; - res[1] = static_cast((GST & 0xFF000000) >> 24); - res[2] = static_cast((GST & 0x00FF0000) >> 16); - res[3] = static_cast((GST & 0x0000FF00) >> 8); - res[4] = static_cast(GST & 0x000000FF); + res.push_back(static_cast((GST & 0xFF000000) >> 24)); + res.push_back(static_cast((GST & 0x00FF0000) >> 16)); + res.push_back(static_cast((GST & 0x0000FF00) >> 8)); + res.push_back(static_cast(GST & 0x000000FF)); return res; } + +std::vector Osnma_Helper::bytes(const std::string& binaryString) { + std::vector bytes; + + // Determine the size of the padding needed. + size_t padding_size = binaryString.size() % 8; + + std::string padded_binary = binaryString; + + if (padding_size != 0) { + padding_size = 8 - padding_size; // Compute padding size + padded_binary.append(padding_size, '0'); // Append zeros to the binary string + } + + for (size_t i = 0; i < padded_binary.size(); i += 8) { + uint8_t byte = std::bitset<8>(padded_binary.substr(i, 8)).to_ulong(); + bytes.push_back(byte); + } + + return bytes; +} \ No newline at end of file diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 0a1b72270..9bf1d860d 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -19,6 +19,7 @@ #include +#include #include class Osnma_Helper { @@ -27,6 +28,7 @@ public: ~Osnma_Helper() = default; uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; std::vector gst_to_uint8(uint32_t GST) const; + std::vector bytes(const std::string& binaryString); }; diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index 2bea64518..de02b421c 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -78,7 +78,6 @@ Concurrent_Map global_gps_acq_assist_map; int main(int argc, char **argv) { #if USE_GLOG_AND_GFLAGS - gflags::ParseCommandLineFlags(&argc, &argv, true); try { testing::InitGoogleTest(&argc, argv); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index f251756e8..7ee09c51f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -58,6 +58,7 @@ public: TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Arrange + // ---------- osnma->d_tesla_key_verified = false; osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits @@ -75,6 +76,7 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Act + // ---------- bool result = osnma->verify_tesla_key(key, TOW); @@ -82,7 +84,8 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Assert - ASSERT_TRUE(result); // Adjust this according to what you expect + // ---------- + ASSERT_TRUE(result); } @@ -342,7 +345,6 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } - /** * @brief Sets the time based on the given input. * @@ -374,7 +376,6 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) } - void OsnmaMsgReceiverTest::initializeGoogleLog() { google::InitGoogleLogging(log_name.c_str()); @@ -416,4 +417,71 @@ void OsnmaMsgReceiverTest::initializeGoogleLog() throw; } } -} \ No newline at end of file +} + + +TEST_F(OsnmaMsgReceiverTest, TagVerification) { + // Arrange + // ---------- + // Tag0 + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "0000000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + + + + // Act + // ---------- + bool result_tag0 = osnma->verify_tag(t0); + + + + + + // Assert + // ---------- + //ASSERT_TRUE(result_tag0); + + // Tag3 + uint32_t TOW_Tag3 = 345660; + uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; + uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30 ; + WN = 1248; + PRNa = 2; + CTR = 3; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = + "111111111111111111111111111111110000000000000000000000010001001001001000" + "111000001000100111100010010111111111011110111111111001001100000100000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MTI.tag = static_cast(0x7BB238C883); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x04; + MTI.tag_info.cop = 0x0F; + Tag t3(MTI, TOW_Tag0, WN, PRNa, CTR); + + bool result_tag3 = osnma->verify_tag(t3); + + ASSERT_TRUE(result_tag3); + +} From 585cae0d706050284ef8c09699cb40fd917ba0fe Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 20 May 2024 11:24:31 +0200 Subject: [PATCH 168/499] [TAS-201] Update gnss_crypto_test and osnma_msg_receiver_test sections in CMakeLists for abseil --- .gitignore | 1 + src/tests/CMakeLists.txt | 53 ++++++++++++++++++++++++---------------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 5514c9cb4..c16e1f808 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ cmake-build-debug/ .vscode/ .vs/ Testing/ +/build/* \ No newline at end of file diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 9e0a2517a..97bbac838 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1344,17 +1344,13 @@ else() endif() endif() -if(ENABLE_BENCHMARKS) - add_subdirectory(benchmarks) -endif() - +######################################################### gnss_crypto_test if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) set(GNSS_CRYPTO_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc) - # Configure the test executable: if(USE_CMAKE_TARGET_SOURCES) add_executable(gnss_crypto_test) target_sources(gnss_crypto_test PRIVATE ${GNSS_CRYPTO_TEST_SOURCES}) @@ -1362,33 +1358,39 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) add_executable(gnss_crypto_test ${GNSS_CRYPTO_TEST_SOURCES}) endif() - # Link libraries that gnss_crypto_test requires: target_link_libraries(gnss_crypto_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog GTest::GTest GTest::Main core_system_parameters + Pugixml::pugixml ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(gnss_crypto_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(gnss_crypto_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(gnss_crypto_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + endif() - # Include any directories your test needs for header files: target_include_directories(gnss_crypto_test PRIVATE - #${GNSSSDR_SOURCE_DIR}/src/algorithms, - #${GNSSSDR_SOURCE_DIR}/src/core, - #${GNSSSDR_SOURCE_DIR}/src/core/receiver, ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) + + xcode_remove_warning_duplicates(gnss_crypto_test) # TODO - unsure if needed + + add_test(gnss_crypto_test gnss_crypto_test) + + set_property(TEST gnss_crypto_test PROPERTY TIMEOUT 1) endif() +######################################################### osnma_msg_receiver_test if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) set(OSNMA_MSG_RECEIVER_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc) - # Configure the test executable: if(USE_CMAKE_TARGET_SOURCES) add_executable(osnma_msg_receiver_test) target_sources(osnma_msg_receiver_test PRIVATE ${OSNMA_MSG_RECEIVER_TEST_SOURCES}) @@ -1396,22 +1398,31 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) add_executable(osnma_msg_receiver_test ${OSNMA_MSG_RECEIVER_TEST_SOURCES}) endif() - # Link libraries that gnss_crypto_test requires: target_link_libraries(osnma_msg_receiver_test PRIVATE Boost::thread - Gflags::gflags - Glog::glog GTest::GTest GTest::Main core_libs ) + if(ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(osnma_msg_receiver_test PRIVATE Gflags::gflags Glog::glog) + target_compile_definitions(osnma_msg_receiver_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) + else() + target_link_libraries(osnma_msg_receiver_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + endif() + + xcode_remove_warning_duplicates(osnma_msg_receiver_test) # TODO - unsure if needed + + add_test(osnma_msg_receiver_test osnma_msg_receiver_test) + + set_property(TEST osnma_msg_receiver_test PROPERTY TIMEOUT 1) - # Include any directories your test needs for header files: target_include_directories(osnma_msg_receiver_test PRIVATE - #${GNSSSDR_SOURCE_DIR}/src/algorithms, - #${GNSSSDR_SOURCE_DIR}/src/core, - #${GNSSSDR_SOURCE_DIR}/src/core/receiver, ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) -endif() \ No newline at end of file +endif() + +if(ENABLE_BENCHMARKS) + add_subdirectory(benchmarks) +endif() From a53b92b8614cf5e70f1962c982d88de3c5db367e Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 20 May 2024 15:36:50 +0200 Subject: [PATCH 169/499] [TAS-200] gnss_crypto_test :: extend unit test for m0 and adkd4 --- .../osnma/gnss_crypto_test.cc | 109 +++++++++++++----- 1 file changed, 78 insertions(+), 31 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index d78c8d688..a72d86998 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -9,47 +9,47 @@ TEST(GnssCryptoTest, VerifySignature) { std::unique_ptr d_crypto = std::make_unique(); // RG example - import crt certificate - result: FAIL -//std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; -//std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; -//std::vector publicKey { // PEM format - 1000 bits -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, -// -// 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, -// 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, -// 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, -// -// 0x0A, -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; +std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; +std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; +std::vector publicKey { // PEM format - 1000 bits + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + + 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, + + 0x0A, + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; // own ECDSA-P256 key and message generated and signed and verified successfully with openssl - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) +// std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) // std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, // 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, // 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK // raw r and s values - std::vector signature = { - 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, - 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, - 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, - 0xA5, 0xB9, 0xB2, 0x56 }; +// std::vector signature = { +// 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, +// 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, +// 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, +// 0xA5, 0xB9, 0xB2, 0x56 }; // std::vector publicKey{// PK associated to the PrK, in der format ---test // 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4A, 0xF3, // 0xEE, 0x3A, 0x94, 0x25, 0x25, 0x3D, 0x55, 0xC2, 0x5A, 0xC2, 0x2D, 0xCF, 0x14, 0x4D, 0x39, 0x0D, 0xB1, 0xFC, 0x7F, 0x31, 0x5A, 0x2A, 0x19, 0xAE, 0x4E, 0xD6, 0xCB, 0xA6, 0x59, // 0xD6, 0x99, 0x7C, 0xE8, 0xBD, 0x1F, 0x43, 0x34, 0x1C, 0x59, 0xD9, 0xD9, 0xCA, 0xC3, 0xEE, 0x58, 0xE5, 0xEA, 0xD3, 0x55, 0x44, 0xEA, 0x89, 0x71, 0x65, 0xD0, 0x92, 0x72, 0xA2, // 0xC8, 0x3C, 0x87, 0x5D }; - std::vector publicKey{ // PK associated to the PrK, in pem format - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - - 0x4D, 0x46, - 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, - 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, - 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, - 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, - 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, - - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - 0x2D, 0x2D, 0x2D, 0x0A }; +// std::vector publicKey{ // PK associated to the PrK, in pem format +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, +// +// 0x4D, 0x46, +// 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, +// 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, +// 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, +// 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, +// 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, +// +// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, +// 0x2D, 0x2D, 0x2D, 0x0A }; // own key - GnuTLS error: The curve is unsupported... x192 EC unsupported?? // std::vector message = {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64 }; // hello world @@ -161,7 +161,7 @@ TEST(GnssCryptoTest,VerifyPubKeyImport) } // Unit test for computeHMAC_SHA_256 function. -TEST(GnssCryptoTest, TestComputeHMACSHA256) { +TEST(GnssCryptoTest, TestComputeHMACSHA256) { // key and message generated with openssl std::unique_ptr d_crypto = std::make_unique(); std::vector key = { 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, @@ -182,4 +182,51 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256) { ASSERT_EQ(expected_output, output); -} \ No newline at end of file +} + +TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) { // key and message generated from RG A.6.5.1 + std::unique_ptr d_crypto = std::make_unique(); + std::vector key = { // RG K4 @ 345690 + 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, + 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; + + std::vector message{// m0 + 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, + 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, + 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, + 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00}; + + std::vector expected_output = { + 0xE3, 0x7B, 0xC4, 0xF8, 0x58, 0xAE, 0x1E, 0x5C, + 0xFD, 0xC4, 0x6F, 0x05, 0x4B, 0x1F, 0x47, 0xB9, 0xD2, 0xEA, 0x61, 0xE1, + 0xEF, 0x09, 0x11, 0x5C, 0xFE, 0x70, 0x68, 0x52, 0xBF, 0xF2, 0x3A, 0x83}; + + std::vector output = d_crypto->computeHMAC_SHA_256(key, message); + + ASSERT_EQ(expected_output, output); +} + +TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) { // key and message generated from RG A.6.5.2 + std::unique_ptr d_crypto = std::make_unique(); + std::vector key = { // RG K4 @ 345690 + 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, + 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; + + std::vector message{ + 0x02, 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x03, 0xBF, + 0xFF, 0xFF, 0xFF, 0xC0, 0x00,0x00, 0x44, 0x92, 0x38, + 0x22, 0x78, 0x97, 0xFD, 0xEF, 0xF9, 0x30, 0x40}; + + std::vector expected_output = { + 0x7B, 0xB2, 0x38, 0xC8, 0x83, 0xC0, 0x6A, 0x2B, 0x50, 0x8F, + 0xE6, 0x3F, 0xB7, 0xF4, 0xF5, 0x4D, 0x44, 0xAB, 0xEE, 0x4D, + 0xCE, 0xB9, 0x3D, 0xCF, 0x65, 0xCB, 0x3A, 0x5B, 0x81, 0x4A, 0x34, 0xE9}; + + + std::vector output = d_crypto->computeHMAC_SHA_256(key, message); + + ASSERT_EQ(expected_output, output); +} + +// TODO extend to HMAC-AES \ No newline at end of file From d52603aba5f0888eaa359d048ab9815b03682d84 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 21 May 2024 18:08:25 +0200 Subject: [PATCH 170/499] [TAS-161] debug tag_verification :: extract build_message, unit test for BuildTagMessageM0 and fix unit test for TagVerification --- src/core/libs/osnma_msg_receiver.cc | 85 +++++++++---------- src/core/libs/osnma_msg_receiver.h | 2 + .../osnma/osnma_msg_receiver_test.cc | 53 +++++++++++- 3 files changed, 93 insertions(+), 47 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 51c495e0f..968015996 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1001,50 +1001,8 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) { // TODO case tag0, to be verified here?, PRNd not needed for it // build message - std::vector m; - if(tag.CTR != 1) - m.push_back(static_cast(tag.PRN_d)); - m.push_back(static_cast(tag.PRNa)); - uint32_t GST = d_helper->compute_gst( tag.WN,tag.TOW); - std::vector GST_uint8 = d_helper->gst_to_uint8(GST); - m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); - m.push_back(tag.CTR); - // Extracts only two bits from d_osnma_data.d_nma_header.nmas - uint8_t two_bits_nmas = d_osnma_data.d_nma_header.nmas & 0b00000011; - two_bits_nmas = two_bits_nmas << 6; - m.push_back(two_bits_nmas); + std::vector m = build_message(tag); - // convert std::string to vector - std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW-30].ephemeris_iono_vector_2; - std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); - - // Convert and add ephemeris_iono_vector_2 into the vector - for (uint8_t byte : ephemeris_iono_vector_2_bytes) { - m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m - m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m - } - if(m.back() == 0) { - m.pop_back(); // Remove the last element if its value is 0 (only padding was added) - } - else { - // Pad with zeros if the last element wasn't full - for (int bits = 2; bits < 8; bits += 2) { - // Check if the last element in the vector has 2 '00' bits in its LSB position - if((m.back() & 0b00000011) == 0) { - m.back() <<= 2; // Shift the existing bits to make room for new 2 bits - } - else { - break; // If it does not have 2 '00' bits in its LSB position, then the padding is complete - } - } - } -// m = { -// 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, -// 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, -// 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, -// 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, -// 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 -// }; std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { @@ -1099,6 +1057,47 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) else return false; } +std::vector osnma_msg_receiver::build_message(const Tag& tag) +{ + std::vector m; + if(tag.CTR != 1) + m.push_back(static_cast(tag.PRN_d)); + m.push_back(static_cast(tag.PRNa)); + uint32_t GST = d_helper->compute_gst( tag.WN,tag.TOW); + std::vector GST_uint8 = d_helper->gst_to_uint8(GST); + m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); + m.push_back(tag.CTR); + // Extracts only two bits from d_osnma_data.d_nma_header.nmas + uint8_t two_bits_nmas = d_osnma_data.d_nma_header.nmas & 0b00000011; + two_bits_nmas = two_bits_nmas << 6; + m.push_back(two_bits_nmas); + + // convert std::string to vector + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW-30].ephemeris_iono_vector_2; + std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); + + // Convert and add ephemeris_iono_vector_2 into the vector + for (uint8_t byte : ephemeris_iono_vector_2_bytes) { + m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m + m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m + } + if(m.back() == 0) { + m.pop_back(); // Remove the last element if its value is 0 (only padding was added) + } + else { + // Pad with zeros if the last element wasn't full + for (int bits = 2; bits < 8; bits += 2) { + // Check if the last element in the vector has 2 '00' bits in its LSB position + if((m.back() & 0b00000011) == 0) { + m.back() <<= 2; // Shift the existing bits to make room for new 2 bits + } + else { + break; // If it does not have 2 '00' bits in its LSB position, then the padding is complete + } + } + } + return m; +} void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) { // control size of container diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index b655094df..d7aeb9df4 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -123,6 +123,8 @@ private: FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); FRIEND_TEST(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation); FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); + FRIEND_TEST(OsnmaMsgReceiverTest, BuildTagMessageM0); + std::vector build_message(const Tag& tag); }; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 7ee09c51f..fe39fc979 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -420,6 +420,51 @@ void OsnmaMsgReceiverTest::initializeGoogleLog() } +TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) +{ + // Arrange + // ---------- + // m0 + std::vector expected_message = { + 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, + 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, + 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, + 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 + }; + + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + + + + // Act + // ---------- + auto computed_message = osnma->build_message(t0); + + + // Assert + // ---------- + ASSERT_TRUE(computed_message == expected_message); + +} TEST_F(OsnmaMsgReceiverTest, TagVerification) { // Arrange // ---------- @@ -432,9 +477,9 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { uint8_t CTR = 1; osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "0000000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000000"; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; osnma->d_osnma_data.d_nma_header.nmas = 0b10; MACK_tag_and_info MTI; @@ -467,7 +512,7 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { CTR = 3; osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "111111111111111111111111111111110000000000000000000000010001001001001000" @@ -482,6 +527,6 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { bool result_tag3 = osnma->verify_tag(t3); - ASSERT_TRUE(result_tag3); + ASSERT_TRUE(result_tag0 && result_tag3); } From 163c915c728deb88f3fb0cacc3a3710293d37899 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 21 May 2024 18:08:25 +0200 Subject: [PATCH 171/499] [TAS-161] debug tag_verification :: extract build_message, unit test for BuildTagMessageM0 and fix unit test for TagVerification --- src/tests/single_test_main.cc | 1 - .../osnma/osnma_msg_receiver_test.cc | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index de02b421c..beece7581 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -86,7 +86,6 @@ int main(int argc, char **argv) catch (...) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest - google::InitGoogleLogging(argv[0]); #else absl::ParseCommandLine(argc, argv); try diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index fe39fc979..1769dfb45 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -40,8 +40,8 @@ protected: std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; set_time(input_time); - std::string pemFilePath = "OSNMA_PublicKey_20230803105952_newPKID_1.pem"; - std::string merkleFilePath = "OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; + std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); } void TearDown() override{ @@ -93,7 +93,11 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { initializeGoogleLog(); // Arrange - std::vector testVectors = readTestVectorsFromFile(/*"/home/cgm/CLionProjects/osnma/src/tests/data/*/"16_AUG_2023_GST_05_00_01.csv"); + std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); + if (testVectors.empty()){ + ASSERT_TRUE(false); + } + bool end_of_hex_stream{false}; int offset_byte{0}; int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size From b0eb958be06314452bba4d26cd0eaa7e34bb3216 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 22 May 2024 21:01:24 +0200 Subject: [PATCH 172/499] [TAS-203] bug osnma_test_vector_config_1 adkd dependence on key selection --- src/core/libs/osnma_msg_receiver.cc | 17 ++++++++++++----- .../osnma/osnma_msg_receiver_test.cc | 19 ++++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 968015996..42a89c957 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -570,7 +570,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place // DEBUG PARSING MACK MESSAGES WHEN DSM-KROOT NOT YET AVAILABLE // d_osnma_data.d_dsm_kroot_message.ts = 9; // d_osnma_data.d_dsm_kroot_message.ks = 4; @@ -860,6 +860,7 @@ void osnma_msg_receiver::process_mack_message() LOG(WARNING) << "But it will be processed for debugging purposes."; } // verify tesla key and add it to the container of verified keys if successful + // TODO not verify tesla key for each satellite if already verified. bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.TOW_sf0); if(retV){ d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); @@ -1004,13 +1005,19 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) std::vector m = build_message(tag); std::vector mac; - if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + std::vector applicable_key; + if (tag.ADKD == 0 || tag.ADKD == 4) + applicable_key = d_tesla_keys[tag.TOW + 30]; + else // ADKD 12 + applicable_key = d_tesla_keys[tag.TOW + 300]; + + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { - mac = d_crypto->computeHMAC_SHA_256(d_tesla_keys[tag.TOW+30], m); + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); } else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { - mac = d_crypto->computeCMAC_AES(d_tesla_keys[tag.TOW+30], m); + mac = d_crypto->computeCMAC_AES(applicable_key, m); } // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD @@ -1073,7 +1080,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) m.push_back(two_bits_nmas); // convert std::string to vector - std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW-30].ephemeris_iono_vector_2; + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW - 30].ephemeris_iono_vector_2; std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); // Convert and add ephemeris_iono_vector_2 into the vector diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 1769dfb45..4ba431e75 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -44,9 +44,6 @@ protected: std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); } - void TearDown() override{ - google::ShutdownGoogleLogging(); - } public: static std::vector parseNavBits(const std::string& hex); @@ -122,6 +119,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) std::array mack{}; byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) std::map> words; + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index @@ -225,8 +223,6 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) uint8_t length = param.second.second; // Extract the required bits - std::bitset<128> word = words[wordKey]; - osnmaMsg_sptr->EphemerisClockAndStatusData_2 += words[wordKey]. to_string().substr( start, length); @@ -333,6 +329,19 @@ std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes } return bit_string; } + +/** + * @brief Extracts a range of bytes from a TestVector's navBits vector. + * + * This function extracts a extracts the bytes of complete page (odd+even) + * from the navBits vector of a TestVector object. + * + * + * @param tv The TestVector object from which to extract bytes. + * @param byte_index The index of the first byte to extract. + * @param num_bytes The number of bytes to extract. + * @return A vector containing the extracted bytes, or an empty vector if extraction is not possible. + */ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes) { // Ensure we don't go beyond the end of tv.navBits From ecbc65028fd205821cb5f55f4fd70fb4e4d969f5 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Fri, 24 May 2024 02:16:07 +0200 Subject: [PATCH 173/499] Conditionally link protobuf to its dependencies in Debug mode This is a workaround to the issue of certain versions of protobuf not advertising their dependencies when using `find_package(Protobuf)`. --- CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a22d32316..09eed123f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2621,6 +2621,15 @@ if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSI endif() else() find_package(Protobuf) + + if((CMAKE_BUILD_TYPE STREQUAL "Debug") AND Protobuf_FOUND AND absl_FOUND) + string(REGEX REPLACE "^[0-9]+\.([0-9]+\.[0-9]+)$" "\\1.0" PROTOBUF_LIBRARY_VERSION "${Protobuf_VERSION}") + if((PROTOBUF_LIBRARY_VERSION VERSION_GREATER_EQUAL "22") AND (PROTOBUF_LIBRARY_VERSION VERSION_LESS "26")) + find_package(PkgConfig REQUIRED) + pkg_check_modules(protobuf REQUIRED IMPORTED_TARGET protobuf=${PROTOBUF_LIBRARY_VERSION}) + target_link_libraries(protobuf::libprotobuf INTERFACE PkgConfig::protobuf) + endif() + endif() endif() set_package_properties(Protobuf PROPERTIES URL "https://protobuf.dev/" From a4697db0ccf2cd4277b8e1a0a416beedb5cde443 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Fri, 24 May 2024 03:26:27 +0200 Subject: [PATCH 174/499] Added a comment to explain a regular expression --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09eed123f..abc1c9f7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2623,6 +2623,8 @@ else() find_package(Protobuf) if((CMAKE_BUILD_TYPE STREQUAL "Debug") AND Protobuf_FOUND AND absl_FOUND) + # This Regular Expression is used to convert the version string provided by `find_package(Protobuf)` into the + # appropriate binary version string. So, for instance, "4.25.3" becomes "25.3.0". string(REGEX REPLACE "^[0-9]+\.([0-9]+\.[0-9]+)$" "\\1.0" PROTOBUF_LIBRARY_VERSION "${Protobuf_VERSION}") if((PROTOBUF_LIBRARY_VERSION VERSION_GREATER_EQUAL "22") AND (PROTOBUF_LIBRARY_VERSION VERSION_LESS "26")) find_package(PkgConfig REQUIRED) From 3dd256eced226d6c7e9ad10917cb3ee65ea3486b Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Fri, 24 May 2024 03:31:41 +0200 Subject: [PATCH 175/499] Removed redundant `find_package(PkgConfig)` --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abc1c9f7b..60f291c05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2627,7 +2627,6 @@ else() # appropriate binary version string. So, for instance, "4.25.3" becomes "25.3.0". string(REGEX REPLACE "^[0-9]+\.([0-9]+\.[0-9]+)$" "\\1.0" PROTOBUF_LIBRARY_VERSION "${Protobuf_VERSION}") if((PROTOBUF_LIBRARY_VERSION VERSION_GREATER_EQUAL "22") AND (PROTOBUF_LIBRARY_VERSION VERSION_LESS "26")) - find_package(PkgConfig REQUIRED) pkg_check_modules(protobuf REQUIRED IMPORTED_TARGET protobuf=${PROTOBUF_LIBRARY_VERSION}) target_link_libraries(protobuf::libprotobuf INTERFACE PkgConfig::protobuf) endif() From 49a0070a02990db4ea2749f5d4d0ede2e64d7ef7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 May 2024 17:53:11 +0200 Subject: [PATCH 176/499] Bump local version of Protocol Buffers to 27.0 and google/benchmark to 1.8.4 --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60f291c05..e09242a1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,12 +351,12 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "26.1") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.3") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.4") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) From ea38f7e727d990e200e2610d6eb607ce4d2c9184 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 26 May 2024 22:01:14 +0200 Subject: [PATCH 177/499] Update CHANGELOG --- docs/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 18ef1d679..9109f44bf 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -17,6 +17,10 @@ All notable changes to GNSS-SDR will be documented in this file. ### Improvements in Interoperability: - Improved error handling in UDP connections. +- Make it possible to receive multiple constellations using a single channel + wideband device (HackRF/LimeSDR/USRP). Demonstration: + https://www.youtube.com/watch?v=ZQs2sFchJ6w + https://www.youtube.com/watch?v=HnZkKj9a-QM ### Improvements in Portability: From d320ea70ffccf00b037e9c892f97a75526de0c8c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 26 May 2024 22:01:46 +0200 Subject: [PATCH 178/499] Fix typo in comment --- src/core/receiver/gnss_flowgraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 00eb0f37c..957077eca 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -264,7 +264,7 @@ void GNSSFlowgraph::init() } /* - * Instantiate the receiver av message monitor block, if required + * Instantiate the receiver nav message monitor block, if required */ enable_navdata_monitor_ = configuration_->property("NavDataMonitor.enable_monitor", false); if (enable_navdata_monitor_) From 434fff9cbfb0e98526b4dcb2ee5df822fecf688e Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 3 Jun 2024 19:59:32 +0200 Subject: [PATCH 179/499] [TAS-203] bug osnma_test_vector_config_1 II bug in build_message (PRN_d instead of PRNa) tags_awaiting_verification increase buffer size Reporting: modify tag reporting --- src/core/libs/osnma_msg_receiver.cc | 39 ++++++++++++------- .../osnma/osnma_msg_receiver_test.cc | 6 +-- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 42a89c957..dfc067796 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -453,9 +453,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_kroot_verified = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); if (d_kroot_verified) { - LOG(INFO) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; - LOG(INFO) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; - LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + LOG(WARNING) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; + LOG(WARNING) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; + LOG(WARNING) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; } @@ -860,12 +860,15 @@ void osnma_msg_receiver::process_mack_message() LOG(WARNING) << "But it will be processed for debugging purposes."; } // verify tesla key and add it to the container of verified keys if successful - // TODO not verify tesla key for each satellite if already verified. - bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.TOW_sf0); - if(retV){ - d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); + if (d_tesla_keys.find(d_osnma_data.d_nav_data.TOW_sf0) == d_tesla_keys.end()) // check if already available => no need to verify + { + bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.TOW_sf0); + if(retV){ + d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); + } } + // MACSEQ - verify current macks, then add current retrieved mack to the end. auto mack = d_macks_awaiting_MACSEQ_verification.begin(); while (mack != d_macks_awaiting_MACSEQ_verification.end()){ @@ -925,7 +928,7 @@ void osnma_msg_receiver::process_mack_message() else { it.second.status = Tag::FAIL; - LOG(ERROR) << "Galileo OSNMA: Tag verification failure for tag Id= " + LOG(ERROR) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id= " << it.second.tag_id << ", TOW=" << it.second.TOW @@ -937,7 +940,7 @@ void osnma_msg_receiver::process_mack_message() } } else { - LOG(INFO) << "Galileo OSNMA: Tag verification skipped for Tag Id= " + LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED for Tag Id= " << it.second.tag_id << ", TOW=" << it.second.TOW @@ -1080,7 +1083,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) m.push_back(two_bits_nmas); // convert std::string to vector - std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRNa][tag.TOW - 30].ephemeris_iono_vector_2; + std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); // Convert and add ephemeris_iono_vector_2 into the vector @@ -1210,10 +1213,16 @@ void osnma_msg_receiver::remove_verified_tags() */ void osnma_msg_receiver::control_tags_awaiting_verify_size() { - while(d_tags_awaiting_verify.size() > 60) + while(d_tags_awaiting_verify.size() > 500) { - LOG(WARNING) << "Galileo OSNMA: delete tag due to exceeding buffer size. "; - d_tags_awaiting_verify.erase(d_tags_awaiting_verify.begin()); + auto it = d_tags_awaiting_verify.begin(); + LOG(WARNING) << "Galileo OSNMA: Tag verification :: DELETED tag due to exceeding buffer size. " + << "Tag Id= " << it->second.tag_id + << ", TOW=" << it->first + << ", ADKD=" << static_cast(it->second.ADKD) + << ", from satellite " << it->second.PRNa + << std::endl; + d_tags_awaiting_verify.erase(it); } } @@ -1328,12 +1337,12 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) { - auto prn_it = d_satellite_nav_data.find(t.PRNa); + auto prn_it = d_satellite_nav_data.find(t.PRN_d); if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; - auto tow_it = tow_map.find(t.TOW-30); // TODO check ADKD to decide + auto tow_it = tow_map.find(t.TOW - 30); if (tow_it != tow_map.end()) { return true; } else { diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 4ba431e75..2c6eca790 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -113,7 +113,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // Act while (end_of_hex_stream == false){ // loop over all bytes of data. Note all TestVectors have same amount of data. for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID "<< tv.svId << std::endl; + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); std::array hkroot{}; std::array mack{}; @@ -191,7 +191,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; - osnmaMsg_sptr->PRN = tv.svId; + osnmaMsg_sptr->PRN = tv.svId; // PRNa bool allWordsReceived = true; for (int i = 1; i <= 5; ++i) @@ -216,7 +216,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // TODO words 6 and 10 for TimingData }; - // Iterate over the extraction parameters + // Fill NavData bits -- Iterate over the extraction parameters for (const auto& param : extractionParams) { uint8_t wordKey = param.first; uint8_t start = param.second.first; From 6508e985a13a1efd916c5cd90b9235ffb6e507f0 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 4 Jun 2024 17:35:00 +0200 Subject: [PATCH 180/499] [TAS-206] [Feature] NavData for ADKD=4 for osnma_test_vector. --- src/core/libs/osnma_msg_receiver.cc | 20 ++++- .../system_parameters/galileo_inav_message.h | 1 + src/core/system_parameters/osnma_data.cc | 1 + src/core/system_parameters/osnma_data.h | 1 + .../osnma/osnma_msg_receiver_test.cc | 82 ++++++++++++------- 5 files changed, 70 insertions(+), 35 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index dfc067796..6e0b161c4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1082,12 +1082,24 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) two_bits_nmas = two_bits_nmas << 6; m.push_back(two_bits_nmas); + // Add applicable NavData bits to message + std::string applicable_nav_data; + std::vector applicable_nav_data_bytes; + if (tag.ADKD == 0 || tag.ADKD == 12) + { + applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; + } + else if (tag.ADKD == 4) + { + applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; + } + else + std::cerr<<"Galileo OSNMA :: Tag verification :: unknown ADKD" <<"\n"; // convert std::string to vector - std::string ephemeris_iono_vector_2 = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; - std::vector ephemeris_iono_vector_2_bytes = d_helper->bytes(ephemeris_iono_vector_2); + applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); - // Convert and add ephemeris_iono_vector_2 into the vector - for (uint8_t byte : ephemeris_iono_vector_2_bytes) { + // Convert and add NavData bytes into the message, taking care of that NMAS has only 2 bits + for (uint8_t byte : applicable_nav_data_bytes) { m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 0e9c15b25..bc5d5f780 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -54,6 +54,7 @@ public: std::vector EphemerisClockAndStatusData {}; // TODO _2 rename and substitute this std::string EphemerisClockAndStatusData_2{}; std::vector TimingData {}; + std::string TimingData_2{}; Galileo_Ephemeris EphemerisData {}; Galileo_Iono IonoData {}; Galileo_Utc_Model UtcModelData {}; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 25124bb81..4424c55ba 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -38,6 +38,7 @@ void NavData::init(const std::shared_ptr &osnma_msg) // new parsing, directly parsing bits ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; + utc_vector_2 = osnma_msg->TimingData_2; }; void NavData::generate_eph_iono_vector() { diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 6e3439a4c..cf9bcb7d9 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -134,6 +134,7 @@ public: std::vector ephemeris_iono_vector{}; std::string ephemeris_iono_vector_2{}; std::vector utc_vector{}; + std::string utc_vector_2{}; uint32_t PRNa{}; uint32_t WN_sf0{}; uint32_t TOW_sf0{}; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 2c6eca790..1c4b1c7b9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -90,6 +90,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { initializeGoogleLog(); // Arrange + // ---------- std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); if (testVectors.empty()){ ASSERT_TRUE(false); @@ -98,10 +99,10 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) bool end_of_hex_stream{false}; int offset_byte{0}; int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240/8}; - const int SIZE_SUBFRAME_PAGES{15}; - const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; - const int DURATION_SUBFRAME{30}; + const int SIZE_PAGE_BYTES{240/8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; // total bytes of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; @@ -110,7 +111,11 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) << ", WN=" << WN << std::endl; + + + // Act + // ---------- while (end_of_hex_stream == false){ // loop over all bytes of data. Note all TestVectors have same amount of data. for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; @@ -118,7 +123,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) std::array hkroot{}; std::array mack{}; byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words; + std::map> words; // structure containing and for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { @@ -179,6 +184,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) byte_index += SIZE_PAGE_BYTES; } + std::cout<< "----------" << std::endl; if(end_of_hex_stream) break; @@ -193,17 +199,21 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; osnmaMsg_sptr->PRN = tv.svId; // PRNa - bool allWordsReceived = true; + // TODO - refactor this logic, currently it is split + + // check if words 1--> 5 words are received + bool ephClockStatusWordsReceived = true; for (int i = 1; i <= 5; ++i) { - if (words.find(i) == words.end() && flag_dummy_page == false) + if (words.find(i) == words.end()) { - allWordsReceived = false; + ephClockStatusWordsReceived = false; std::cerr<< "OsnmaTestVectorsSimulation: error parsing words 1->5. " "Word "<< i << " should be received for each subframe but was not." << std::endl; } } - if(allWordsReceived) + // extract bits as needed by osnma block + if(ephClockStatusWordsReceived) { // Define the starting position and length of bits to extract for each word @@ -222,32 +232,38 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) uint8_t start = param.second.first; uint8_t length = param.second.second; - // Extract the required bits + // Extract the required bits and fill osnma block osnmaMsg_sptr->EphemerisClockAndStatusData_2 += words[wordKey]. to_string().substr( start, length); - -// std::bitset<8> byte; -// int byteIndex = 0; -// for (uint8_t i = start; i < start + length; ++i) { -// byte[byteIndex] = word[i]; -// byteIndex++; -// -// // Once we have collected 8 bits, we can add them as an uint8_t to the vector -// if (byteIndex == 8) { -// osnmaMsg_sptr->EphemerisClockAndStatusData.push_back(static_cast(byte.to_ulong())); -// byte.reset(); -// byteIndex = 0; -// } -// } -// -// // Push remaining bits if it didn't reach 8 bits -// if (byteIndex > 0) { -// osnmaMsg_sptr->EphemerisClockAndStatusData.push_back(static_cast(byte.to_ulong())); -// } } } + // check w6 && w10 is received + bool timingWordsReceived = words.find(6) != words.end() && + words.find(10) != words.end(); + + // extract bits as needed by osnma block + if(timingWordsReceived){ + // Define the starting position and length of bits to extract for each word + std::map> extractionParams = { + {6, {6, 99}}, + {10, {86, 42}} + }; + + // Fill NavData bits -- Iterate over the extraction parameters + for (const auto& param : extractionParams) + { + uint8_t wordKey = param.first; + uint8_t start = param.second.first; + uint8_t length = param.second.second; + + // Extract the required bits and fill osnma block + osnmaMsg_sptr->TimingData_2 += words[wordKey].to_string().substr( + start, length); + } + + } auto temp_obj = pmt::make_any(osnmaMsg_sptr); osnma->msg_handler_osnma(temp_obj); // osnma entry point @@ -266,8 +282,12 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) } + + // Assert - // TODO + // ---------- + + // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) } std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) @@ -527,7 +547,7 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = + osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = "111111111111111111111111111111110000000000000000000000010001001001001000" "111000001000100111100010010111111111011110111111111001001100000100000000"; osnma->d_osnma_data.d_nma_header.nmas = 0b10; From ec67ea86a3ba479f4843f680a7a408f4fcb3eab4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 6 Jun 2024 11:19:02 +0200 Subject: [PATCH 181/499] Bump local version of Protocol Buffers to 27.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e09242a1b..adb3781f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,7 +351,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") From d62e2e0de57542653845393b8805e71751a2161e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 8 Jun 2024 19:50:43 +0200 Subject: [PATCH 182/499] Bump local version of google/glog to 0.7.1 --- CMakeLists.txt | 2 +- README.md | 120 +++++++++++++++++++++++----------------------- docs/CHANGELOG.md | 2 +- 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adb3781f1..f172666e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -349,7 +349,7 @@ set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") ################################################################################ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") -set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.0") +set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") diff --git a/README.md b/README.md index 357e06637..a904764b0 100644 --- a/README.md +++ b/README.md @@ -59,60 +59,60 @@ information about this open-source, software-defined GNSS receiver. (click to expand) -1. [Table of Contents](#table-of-contents) -2. [How to build GNSS-SDR](#how-to-build-gnss-sdr) - 1. [GNU/Linux](#gnulinux) - 1. [Alternative 1: Install dependencies using software packages](#alternative-1-install-dependencies-using-software-packages) - 1. [Debian / Ubuntu](#debian--ubuntu) - 2. [AlmaLinux](#almalinux) - 3. [Arch Linux](#arch-linux) - 4. [CentOS](#centos) - 5. [Fedora](#fedora) - 6. [openSUSE](#opensuse) - 7. [Rocky Linux](#rocky-linux) - 2. [Alternative 2: Install dependencies using PyBOMBS](#alternative-2-install-dependencies-using-pybombs) - 3. [Manual installation of other required dependencies](#manual-installation-of-other-required-dependencies) - 1. [Install Armadillo, a C++ linear algebra library](#install-armadillo-a-c-linear-algebra-library) - 2. [Install Gflags, a commandline flags processing module for C++](#install-gflags-a-commandline-flags-processing-module-for-c) - 3. [Install Glog, a library that implements application-level logging](#install-glog-a-library-that-implements-application-level-logging) - 4. [Install the GnuTLS or OpenSSL libraries](#install-the-gnutls-or-openssl-libraries) - 5. [Install Matio, MATLAB MAT file I/O library](#install-matio-matlab-mat-file-io-library) - 6. [Install Protocol Buffers, a portable mechanism for serialization of structured data](#install-protocol-buffers-a-portable-mechanism-for-serialization-of-structured-data) - 7. [Install Pugixml, a light-weight C++ XML processing library](#install-pugixml-a-light-weight-c-xml-processing-library) - 8. [Download GoogleTest](#download-googletest) - 4. [Clone GNSS-SDR's Git repository](#clone-gnss-sdrs-git-repository) - 5. [Build and install GNSS-SDR](#build-and-install-gnss-sdr) - 1. [Build OSMOSDR support (OPTIONAL)](#build-osmosdr-support-optional) - 2. [Build FMCOMMS2 based SDR Hardware support (OPTIONAL)](#build-fmcomms2-based-sdr-hardware-support-optional) - 3. [Build OpenCL support (OPTIONAL)](#build-opencl-support-optional) - 4. [Build CUDA support (OPTIONAL)](#build-cuda-support-optional) - 2. [macOS](#macos) - 1. [Macports](#macports) - 2. [Homebrew](#homebrew) - 3. [Other package managers](#other-package-managers) - 4. [Build GNSS-SDR](#build-gnss-sdr) - 3. [Other builds](#other-builds) -3. [Updating GNSS-SDR](#updating-gnss-sdr) -4. [Getting started](#getting-started) -5. [Using GNSS-SDR](#using-gnss-sdr) - 1. [Control plane](#control-plane) - 1. [Configuration](#configuration) - 2. [GNSS block factory](#gnss-block-factory) - 2. [Signal Processing plane](#signal-processing-plane) - 1. [Signal Source](#signal-source) - 2. [Signal Conditioner](#signal-conditioner) - 1. [Data type adapter](#data-type-adapter) - 2. [Input filter](#input-filter) - 3. [Resampler](#resampler) - 3. [Channel](#channel) - 1. [Acquisition](#acquisition) - 2. [Tracking](#tracking) - 3. [Decoding of the navigation message](#decoding-of-the-navigation-message) - 4. [Observables](#observables) - 5. [Computation of Position, Velocity, and Time](#computation-of-position-velocity-and-time) -6. [About the software license](#about-the-software-license) -7. [Publications and Credits](#publications-and-credits) -8. [Ok, now what?](#ok-now-what) +- [Table of Contents](#table-of-contents) +- [How to build GNSS-SDR](#how-to-build-gnss-sdr) + - [GNU/Linux](#gnulinux) + - [Alternative 1: Install dependencies using software packages](#alternative-1-install-dependencies-using-software-packages) + - [Debian / Ubuntu](#debian--ubuntu) + - [AlmaLinux](#almalinux) + - [Arch Linux](#arch-linux) + - [CentOS](#centos) + - [Fedora](#fedora) + - [openSUSE](#opensuse) + - [Rocky Linux](#rocky-linux) + - [Alternative 2: Install dependencies using PyBOMBS](#alternative-2-install-dependencies-using-pybombs) + - [Manual installation of other required dependencies](#manual-installation-of-other-required-dependencies) + - [Install Armadillo, a C++ linear algebra library](#install-armadillo-a-c-linear-algebra-library) + - [Install Gflags, a commandline flags processing module for C++](#install-gflags-a-commandline-flags-processing-module-for-c) + - [Install Glog, a library that implements application-level logging](#install-glog-a-library-that-implements-application-level-logging) + - [Install the GnuTLS or OpenSSL libraries](#install-the-gnutls-or-openssl-libraries) + - [Install Matio, MATLAB MAT file I/O library](#install-matio-matlab-mat-file-io-library) + - [Install Protocol Buffers, a portable mechanism for serialization of structured data](#install-protocol-buffers-a-portable-mechanism-for-serialization-of-structured-data) + - [Install Pugixml, a light-weight C++ XML processing library](#install-pugixml-a-light-weight-c-xml-processing-library) + - [Download GoogleTest](#download-googletest) + - [Clone GNSS-SDR's Git repository](#clone-gnss-sdrs-git-repository) + - [Build and install GNSS-SDR](#build-and-install-gnss-sdr) + - [Build OSMOSDR support (OPTIONAL)](#build-osmosdr-support-optional) + - [Build FMCOMMS2 based SDR Hardware support (OPTIONAL)](#build-fmcomms2-based-sdr-hardware-support-optional) + - [Build OpenCL support (OPTIONAL)](#build-opencl-support-optional) + - [Build CUDA support (OPTIONAL)](#build-cuda-support-optional) + - [macOS](#macos) + - [Macports](#macports) + - [Homebrew](#homebrew) + - [Other package managers](#other-package-managers) + - [Build GNSS-SDR](#build-gnss-sdr) + - [Other builds](#other-builds) +- [Updating GNSS-SDR](#updating-gnss-sdr) +- [Getting started](#getting-started) +- [Using GNSS-SDR](#using-gnss-sdr) + - [Control plane](#control-plane) + - [Configuration](#configuration) + - [GNSS block factory](#gnss-block-factory) + - [Signal Processing plane](#signal-processing-plane) + - [Signal Source](#signal-source) + - [Signal Conditioner](#signal-conditioner) + - [Data type adapter](#data-type-adapter) + - [Input filter](#input-filter) + - [Resampler](#resampler) + - [Channel](#channel) + - [Acquisition](#acquisition) + - [Tracking](#tracking) + - [Decoding of the navigation message](#decoding-of-the-navigation-message) + - [Observables](#observables) + - [Computation of Position, Velocity, and Time](#computation-of-position-velocity-and-time) +- [About the software license](#about-the-software-license) +- [Publications and Credits](#publications-and-credits) +- [Ok, now what?](#ok-now-what) @@ -437,9 +437,9 @@ v20240116 is available in your system. #### Install [Glog](https://github.com/google/glog "Glog's Homepage"), a library that implements application-level logging ``` -$ wget https://github.com/google/glog/archive/v0.7.0.tar.gz -$ tar xvfz v0.7.0.tar.gz -$ cd glog-0.7.0 +$ wget https://github.com/google/glog/archive/v0.7.1.tar.gz +$ tar xvfz v0.7.1.tar.gz +$ cd glog-0.7.1 $ mkdir build && cd build $ cmake .. $ make @@ -468,9 +468,9 @@ GNSS-SDR can also work well with #### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library ``` -$ wget https://github.com/tbeu/matio/releases/download/v1.5.26/matio-1.5.26.tar.gz -$ tar xvfz matio-1.5.26.tar.gz -$ cd matio-1.5.26 +$ wget https://github.com/tbeu/matio/releases/download/v1.5.26/matio-1.5.27.tar.gz +$ tar xvfz matio-1.5.27.tar.gz +$ cd matio-1.5.27 $ ./configure $ make $ sudo make install diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9109f44bf..e7e594fb9 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -24,7 +24,7 @@ All notable changes to GNSS-SDR will be documented in this file. ### Improvements in Portability: -- Fix building against google-glog 0.7.0. +- Fix building against google-glog 0.7.x. - Find dependencies in the loongarch64 architecture. - Soft transition from [GFlags](https://github.com/gflags/gflags) and [Google Logging (glog)](https://github.com/google/glog) to Abseil From 6671d9bf7befccf77f22732dcb204fa5c757f605 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 9 Jun 2024 22:22:39 +0200 Subject: [PATCH 183/499] [TAS-213] implement configuration_2 osnma test vectors TODO - parametrize test, since now the hardcoded configuration files are to be selected. --- .../osnma/osnma_msg_receiver_test.cc | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 1c4b1c7b9..498fd822c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -14,6 +14,7 @@ struct TestVector std::vector navBits; }; +// TODO - parametrize class for different configurations (config_1, config_2, etc.. potentially 5 or 6 more) an make sure wont affect current TEST_F class OsnmaMsgReceiverTest : public ::testing::Test { protected: @@ -30,18 +31,22 @@ protected: std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm const uint32_t LEAP_SECONDS = 0;//13 + 5; void set_time(std::tm& input); - std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; +// std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; + std::string log_name {"CONFIG2-2023-07-20-PKID2-MT2-OSNMA"}; void initializeGoogleLog(); void SetUp() override { - flag_CRC_test = false; + flag_CRC_test = false; // TODO what for? page_even = ""; - std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; +// std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; + std::tm input_time = {0, 0, 0, 20, 7 - 1, 2023 - 1900, 0}; set_time(input_time); - std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; - std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; +// std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; +// std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.pem"; + std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); } @@ -91,7 +96,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) initializeGoogleLog(); // Arrange // ---------- - std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); +// std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); + std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); if (testVectors.empty()){ ASSERT_TRUE(false); } @@ -116,7 +122,10 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // Act // ---------- - while (end_of_hex_stream == false){ // loop over all bytes of data. Note all TestVectors have same amount of data. + + // loop over all bytes of data. Note: all TestVectors have same amount of data. + while (end_of_hex_stream == false){ + // loop over all SVs, extract a subframe for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); @@ -162,15 +171,6 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // store raw word std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); words[word_type] = data_combined; -// std::vector concatenatedData; -// for (std::size_t i = 0; i < data_k.size(); i += 8) { -// std::bitset<8> byte(data_k.to_string().substr(i, 8)); -// concatenatedData.push_back(static_cast(byte.to_ulong())); -// } -// for (std::size_t i = 0; i < data_j.size(); i += 8) { -// std::bitset<8> byte(data_j.to_string().substr(i, 8)); -// concatenatedData.push_back(static_cast(byte.to_ulong())); -// } } if(word_type == DUMMY_PAGE) flag_dummy_page = true; @@ -192,6 +192,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) flag_dummy_page = false; continue; // skip this SV } + + // Fill osnma object osnmaMsg_sptr->hkroot = hkroot; osnmaMsg_sptr->mack = mack; @@ -201,7 +203,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // TODO - refactor this logic, currently it is split - // check if words 1--> 5 words are received + // check if words 1--> 5 words are received => fill EphClockStatus data vector bool ephClockStatusWordsReceived = true; for (int i = 1; i <= 5; ++i) { @@ -239,10 +241,9 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) } } - // check w6 && w10 is received + // check w6 && w10 is received => fill TimingData data vector bool timingWordsReceived = words.find(6) != words.end() && words.find(10) != words.end(); - // extract bits as needed by osnma block if(timingWordsReceived){ // Define the starting position and length of bits to extract for each word @@ -264,6 +265,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) } } + + // Call the handler, as if it came from telemetry decoder block auto temp_obj = pmt::make_any(osnmaMsg_sptr); osnma->msg_handler_osnma(temp_obj); // osnma entry point @@ -412,7 +415,7 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) void OsnmaMsgReceiverTest::initializeGoogleLog() { google::InitGoogleLogging(log_name.c_str()); - FLAGS_minloglevel = 1; + FLAGS_minloglevel = 0; // INFO FLAGS_logtostderr = 0; // add this line FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; if (FLAGS_log_dir.empty()) From dc18110e5d27d9d9e341a87664636267bf213857 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Jun 2024 10:49:47 +0200 Subject: [PATCH 184/499] Update list of Galileo satellites --- src/core/system_parameters/gnss_satellite.cc | 28 ++++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index d05c880b3..c2b2516fd 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -548,7 +548,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_ switch (PRN_) { case 1: - block_ = std::string("FOC-FM10"); // Galileo Full Operational Capability (FOC) satellite FM10 / GSAT-0210, launched on May 24, 2016. + block_ = std::string("FOC-FM10"); // Galileo Full Operational Capability (FOC) satellite FM10 / GSAT-0210, launched on May 24, 2016. NOT USABLE. break; case 2: block_ = std::string("FOC-FM11"); // Galileo Full Operational Capability (FOC) satellite FM11 / GSAT-0211, launched on May 24, 2016. @@ -562,6 +562,9 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_ case 5: block_ = std::string("FOC-FM14"); // Galileo Full Operational Capability (FOC) satellite FM14 / GSAT-0214, launched on November 17, 2016. break; + case 6: + block_ = std::string("FOC-FM27"); // Galileo Full Operational Capability (FOC) satellite FM27 / GSAT0227, launched on Apr. 28, 2024. UNDER COMMISSIONING. + break; case 7: block_ = std::string("FOC-FM7"); // Galileo Full Operational Capability (FOC) satellite FM7 / GSAT-0207, launched on November 17, 2016. break; @@ -581,16 +584,16 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_ block_ = std::string("IOV-FM2"); // Galileo In-Orbit Validation (IOV) satellite FM2 (Flight Model 2) also known as GSAT0102, from French Guiana at 10:30 GMT on October 21, 2011. break; case 13: - block_ = std::string("FOC-FM20"); // Galileo Full Operational Capability (FOC) satellite FM20 / GSAT0220, launched on Jul. 25, 2018. UNDER COMMISSIONING. + block_ = std::string("FOC-FM20"); // Galileo Full Operational Capability (FOC) satellite FM20 / GSAT0220, launched on Jul. 25, 2018. break; case 14: - block_ = std::string("FOC-FM2*"); // Galileo Full Operational Capability (FOC) satellite FM2 / GSAT0202, launched into incorrect orbit on August 22, 2014. Moved to usable orbit in March, 2015. UNDER TESTING. + block_ = std::string("FOC-FM2*"); // Galileo Full Operational Capability (FOC) satellite FM2 / GSAT0202, launched into incorrect orbit on August 22, 2014. Moved to usable orbit in March, 2015. Not usable since 18/02/2021. break; case 15: - block_ = std::string("FOC-FM21"); // Galileo Full Operational Capability (FOC) satellite FM21 / GSAT0221, launched on Jul. 25, 2018. UNDER COMMISSIONING. + block_ = std::string("FOC-FM21"); // Galileo Full Operational Capability (FOC) satellite FM21 / GSAT0221, launched on Jul. 25, 2018. break; case 18: - block_ = std::string("FOC-FM1*"); // Galileo Full Operational Capability (FOC) satellite FM1 / GSAT0201, launched into incorrect orbit on August 22, 2014. Moved to usable orbit in December, 2014. UNDER TESTING. + block_ = std::string("FOC-FM1*"); // Galileo Full Operational Capability (FOC) satellite FM1 / GSAT0201, launched into incorrect orbit on August 22, 2014. Moved to usable orbit in December, 2014. Not usable since 18/02/2021. break; case 19: block_ = std::string("IOV-FM3"); // Galileo In-Orbit Validation (IOV) satellite FM3 (Flight Model 3) / GSAT0103, launched on October 12, 2012. @@ -599,7 +602,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_ block_ = std::string("IOV-FM4**"); // Galileo In-Orbit Validation (IOV) satellite FM4 (Flight Model 4) / GSAT0104, launched on October 12, 2012. Payload power problem beginning May 27, 2014 led to permanent loss of E5 and E6 transmissions, E1 transmission restored. UNAVAILABLE FROM 2014-05-27 UNTIL FURTHER NOTICE break; case 21: - block_ = std::string("FOC-FM15"); // Galileo Full Operational Capability (FOC) satellite FM15 / GSAT0215, launched on Dec. 12, 2017. UNDER COMMISSIONING. + block_ = std::string("FOC-FM15"); // Galileo Full Operational Capability (FOC) satellite FM15 / GSAT0215, launched on Dec. 12, 2017. break; case 22: block_ = std::string("FOC-FM4**"); // Galileo Full Operational Capability (FOC) satellite FM4 / GSAT0204, launched on March 27, 2015. REMOVED FROM ACTIVE SERVICE ON 2017-12-08 UNTIL FURTHER NOTICE FOR CONSTELLATION MANAGEMENT PURPOSES. @@ -608,28 +611,31 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_ block_ = std::string("FOC-FM5"); // Galileo Full Operational Capability (FOC) satellite FM5 / GSAT0205, launched on Sept. 11, 2015. break; case 25: - block_ = std::string("FOC-FM16"); // Galileo Full Operational Capability (FOC) satellite FM16 / GSAT0216, launched on Dec. 12, 2017. UNDER COMMISSIONING. + block_ = std::string("FOC-FM16"); // Galileo Full Operational Capability (FOC) satellite FM16 / GSAT0216, launched on Dec. 12, 2017. break; case 26: block_ = std::string("FOC-FM3"); // Galileo Full Operational Capability (FOC) satellite FM3 / GSAT0203, launched on March 27, 2015. break; case 27: - block_ = std::string("FOC-FM17"); // Galileo Full Operational Capability (FOC) satellite FM17 / GSAT0217, launched on Dec. 12, 2017. UNDER COMMISSIONING. + block_ = std::string("FOC-FM17"); // Galileo Full Operational Capability (FOC) satellite FM17 / GSAT0217, launched on Dec. 12, 2017. + break; + case 29: + block_ = std::string("FOC-FM25"); // Galileo Full Operational Capability (FOC) satellite FM25 / GSAT0225, launched on Apr. 28, 2024. UNDER COMMISSIONING. break; case 30: block_ = std::string("FOC-FM6"); // Galileo Full Operational Capability (FOC) satellite FM6 / GSAT0206, launched on Sept. 11, 2015. break; case 31: - block_ = std::string("FOC-FM18"); // Galileo Full Operational Capability (FOC) satellite FM18 / GSAT0218, launched on Dec. 12, 2017. UNDER COMMISSIONING. + block_ = std::string("FOC-FM18"); // Galileo Full Operational Capability (FOC) satellite FM18 / GSAT0218, launched on Dec. 12, 2017. break; case 33: - block_ = std::string("FOC-FM22"); // Galileo Full Operational Capability (FOC) satellite FM22 / GSAT0222, launched on Jul. 25, 2018. UNDER COMMISSIONING. + block_ = std::string("FOC-FM22"); // Galileo Full Operational Capability (FOC) satellite FM22 / GSAT0222, launched on Jul. 25, 2018. break; case 34: block_ = std::string("FOC-FM23"); // Galileo Full Operational Capability (FOC) satellite FM23 / GSAT0223, launched on December 5, 2021. break; case 36: - block_ = std::string("FOC-FM19"); // Galileo Full Operational Capability (FOC) satellite FM19 / GSAT0219, launched on Jul. 25, 2018. UNDER COMMISSIONING. + block_ = std::string("FOC-FM19"); // Galileo Full Operational Capability (FOC) satellite FM19 / GSAT0219, launched on Jul. 25, 2018. break; default: block_ = std::string("Unknown"); From 8ed2893fa3b746215f8e6d42dab527c3f85f282c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Jun 2024 12:55:37 +0200 Subject: [PATCH 185/499] Update block of GPS satellite --- src/core/system_parameters/gnss_satellite.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index c2b2516fd..7a13616e1 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -391,7 +391,7 @@ std::string Gnss_Satellite::what_block(const std::string& system_, uint32_t PRN_ block_ = std::string("IIF"); // Plane C break; case 28: - block_ = std::string("IIR"); // Plane B + block_ = std::string("III"); // Plane B break; case 29: block_ = std::string("IIR-M"); // Plane C From 5dfd479cb3e86bae096cf079ae48df2a28d2783f Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 10 Jun 2024 18:59:40 +0200 Subject: [PATCH 186/499] [TAS-216] configuration_2 debug verify_dsm_pkr() and make it work - several bugs fixed for DSM-PKR verification. - improved verification, taking into account leaf position (odd/even), which determines concatenation order. - now: configuration_2 leads to successful DSM-PKR verification. --- src/core/libs/osnma_msg_receiver.cc | 98 +++++++++++++++-------------- 1 file changed, 52 insertions(+), 46 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 6e0b161c4..f58fd0d29 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -223,19 +223,19 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } // Annotate bid d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; - // TODO FIXME Galileo OSNMA: Available blocks for DSM_ID 6: [ - - - - - X - - - - - - - - - - ] in the first received Sf.. size 16? - LOG(INFO) << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; + std::stringstream available_blocks; + available_blocks << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) // block 0 not received yet { for (auto id_received : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) { if (id_received == 0) { - LOG(INFO) << "- "; + available_blocks << "- "; } else { - LOG(INFO) << "X "; + available_blocks << "X "; } } } @@ -245,15 +245,16 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ { if (d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][k] == 0) { - LOG(INFO) << "- "; + available_blocks << "- "; } else { - LOG(INFO) << "X "; + available_blocks << "X "; } } } - LOG(INFO) << "]" << std::endl; + available_blocks<< "]" << std::endl; + LOG(INFO) << available_blocks.str() << std::endl; } /** @@ -402,7 +403,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((l_lk_bytes * 8.0) + l_ds_bits) / 104.0); if (l_dk_bits != check_l_dk) { - LOG(ERROR) << "Galileo OSNMA: Failed length reading" << std::endl; + LOG(ERROR) << "Galileo OSNMA: Failed length reading of DSM-KROOT message" << std::endl; } else { @@ -475,58 +476,59 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { - LOG(WARNING) << "OSNMA: DSM-PKR message received."; + LOG(WARNING) << "Galileo OSNMA: DSM-PKR message received."; // Save DSM-PKR message d_osnma_data.d_dsm_pkr_message.nb_dp = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_pkr_message.mid = d_dsm_reader->get_mid(dsm_msg); - for (int k = 0; k > 128; k++) + for (int k = 0; k < 128; k++) { d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1]; } d_osnma_data.d_dsm_pkr_message.npkt = d_dsm_reader->get_npkt(dsm_msg); d_osnma_data.d_dsm_pkr_message.npktid = d_dsm_reader->get_npktid(dsm_msg); - uint32_t l_npk = 0; + uint32_t l_npk_bytes = 0; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); if (it != OSNMA_TABLE_5.cend()) { const auto it2 = OSNMA_TABLE_6.find(it->second); if (it2 != OSNMA_TABLE_6.cend()) { - l_npk = it2->second / 8; + l_npk_bytes = it2->second / 8; } } - uint32_t l_dp = dsm_msg.size(); + uint32_t l_dp_bytes = dsm_msg.size(); if (d_osnma_data.d_dsm_pkr_message.npkt == 4) { LOG(WARNING) << "OSNMA: OAM received"; - l_npk = l_dp - 130; // bytes + l_npk_bytes = l_dp_bytes - 130; // bytes } - d_osnma_data.d_dsm_pkr_message.npk = std::vector(l_npk, 0); // ECDSA Public Key - for (uint32_t k = 0; k > l_npk; k++) + d_osnma_data.d_dsm_pkr_message.npk = std::vector(l_npk_bytes, 0); // ECDSA Public Key + for (uint32_t k = 0; k < l_npk_bytes; k++) { d_osnma_data.d_dsm_pkr_message.npk[k] = dsm_msg[k + 130]; } - uint32_t l_pd = l_dp - 130 - l_npk; - uint32_t check_l_dp = 104 * std::ceil(static_cast(1040.0 + l_npk * 8.0) / 104.0); - if (l_dp != check_l_dp) + uint32_t l_pd_bytes = l_dp_bytes - 130 - l_npk_bytes; + uint32_t check_l_dp_bytes = 104 * std::ceil(static_cast(1040.0 + l_npk_bytes * 8.0) / 104.0) / 8; + if (l_dp_bytes != check_l_dp_bytes) { - LOG(ERROR) << "Galileo OSNMA: Failed length reading" << std::endl; + LOG(ERROR) << "Galileo OSNMA: Failed length reading of DSM-PKR message" << std::endl; } else { - d_osnma_data.d_dsm_pkr_message.p_dp = std::vector(l_pd, 0); - for (uint32_t k = 0; k < l_pd; k++) + d_osnma_data.d_dsm_pkr_message.p_dp = std::vector(l_pd_bytes, 0); + for (uint32_t k = 0; k < l_pd_bytes; k++) { - d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp - l_pd + k]; + d_osnma_data.d_dsm_pkr_message.p_dp[k] = dsm_msg[l_dp_bytes - l_pd_bytes + k]; } + // TODO: kroot fields are 0 in case no DSM-KROOT received yet, need to take this into account. // std::vector mi; // (NPKT + NPKID + NPK) LOG(INFO) << "Galileo OSNMA: DSM-PKR with CID=" << static_cast(d_osnma_data.d_nma_header.cid) - << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) - << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 + << ", PKID=" << static_cast(d_osnma_data.d_dsm_pkr_message.npktid) + /*<< ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600*/ << " received" << std::endl; // C: NPK verification against Merkle tree root. if (!d_public_key_verified) @@ -962,35 +964,39 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) // TODO create function for recursively apply hash // build base leaf m_i -// auto leaf = message.mid; std::vector m_i; m_i.reserve(2 + message.npk.size()); - m_i[0] = message.npkt; - m_i[1] = message.npktid; - for (uint8_t i = 2; i < m_i.size(); i++) + m_i.push_back((message.npkt << 4) + message.npktid); + for (uint8_t i = 0; i < message.npk.size(); i++) { m_i.push_back(message.npk[i]); } // compute intermediate leafs' values - std::vector x_0,x_1,x_2,x_3,x_4; -// uint8_t k = 0; - x_0 = d_crypto->computeSHA256(m_i); - x_0.insert(x_0.end(),message.itn.begin(),&message.itn[31]); - x_1 = d_crypto->computeSHA256(x_0); - x_1.insert(x_1.end(),&message.itn[32],&message.itn[63]); - x_2 = d_crypto->computeSHA256(x_1); - x_2.insert(x_2.end(),&message.itn[64],&message.itn[95]); - x_3 = d_crypto->computeSHA256(x_2); - x_3.insert(x_3.end(),&message.itn[96],&message.itn[127]); - // root leaf computation - x_4 = d_crypto->computeSHA256(x_3); +// std::vector x_0,x_1,x_2,x_3,x_4; + LOG(INFO) << "Galileo OSNMA: DSM-PKR :: leaf provided: m_" << static_cast(message.mid) << std::endl; - // C: d_crypto->getMerkleRoot([m_0:m_15]) I realised I could have done this... - // C: ... but why computing all the possible results? I have only one leaf in each osnma message... - // verify that computed root matches merkle root + std::vector x_next, x_current = d_crypto->computeSHA256(m_i); + for (size_t i = 0 ; i < 4 ; i++) + { + x_next.clear(); + bool leaf_is_on_right = ((message.mid / (1 << (i))) % 2) == 1; - if(x_4 == d_crypto->getMerkleRoot()) + if (leaf_is_on_right) { + // Leaf is on the right -> first the itn, then concatenate the leaf + x_next.insert(x_next.end(), &message.itn[32*i], &message.itn[32*i + 32]); + x_next.insert(x_next.end(), x_current.begin(), x_current.end()); + } else { + // Leaf is on the left -> first the leaf, then concatenate the itn + x_next.insert(x_next.end(), x_current.begin(), x_current.end()); + x_next.insert(x_next.end(), &message.itn[32*i], &message.itn[32*i + 32]); + } + + // Compute the next node. + x_current = d_crypto->computeSHA256(x_next); + } + + if(x_current == d_crypto->getMerkleRoot()) { LOG(INFO) << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; return true; From 4f7a22f35c80a737eb6d96f4140d118abd490fc9 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 10 Jun 2024 19:01:17 +0200 Subject: [PATCH 187/499] [TAS-219] Configuration_2, num_of_hashes needed huge - Confused PK date with recording date, lead to Kroot time to be in the future (impossible) --- .../signal-processing-blocks/osnma/osnma_msg_receiver_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 498fd822c..c480f9cb8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -32,7 +32,7 @@ protected: const uint32_t LEAP_SECONDS = 0;//13 + 5; void set_time(std::tm& input); // std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; - std::string log_name {"CONFIG2-2023-07-20-PKID2-MT2-OSNMA"}; + std::string log_name {"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; void initializeGoogleLog(); void SetUp() override @@ -41,7 +41,7 @@ protected: page_even = ""; // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; - std::tm input_time = {0, 0, 0, 20, 7 - 1, 2023 - 1900, 0}; + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; set_time(input_time); // std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; From 8de00f92bf517755788056bdb084ccc9d48f82b4 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 10 Jun 2024 19:47:41 +0200 Subject: [PATCH 188/499] [TAS-198] tag verification: debug MACSEQ (flex) - reset the d_GST_Sf computation being d_GST_SIS - 30 seconds. All FLX tags successfuly verified. --- src/core/libs/osnma_msg_receiver.cc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f58fd0d29..92c06497a 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1255,7 +1255,7 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) { // MACSEQ verification - //d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; @@ -1310,7 +1310,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) // Fixed as well as FLX Tags share first part - Eq. 22 ICD std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag - m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); + m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); // TODO d_GST_Sf left useless m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); m[4] = static_cast(d_GST_Sf & 0x000000FF); @@ -1321,10 +1321,6 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) m[2*i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | mack.tag_and_info[flxTags[i]].tag_info.cop; } - // m = {0x18, 0x4f, 0x93, 0x53, 0x04, 0x05, 0x0f, 0x1f, 0x0f}; - // applicable_key = {0x11, 0x26, 0x47, 0x3b, 0x0e, 0x05, 0x05, 0x35, - // 0xb0, 0xf2, 0xa7, 0x24, 0x00, 0x22, 0xba, 0x8f}; - // applicable_OSNMA.d_mack_message.header.macseq = 0xbb8; // compute mac std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 From 0e168a8ff03b90ec1626916f5b5f4c59093c1ae9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 11 Jun 2024 14:16:36 +0200 Subject: [PATCH 189/499] Build fixes --- src/core/libs/osnma_msg_receiver.cc | 7 ++++++- src/core/system_parameters/CMakeLists.txt | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 92c06497a..c7fe99558 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -23,7 +23,6 @@ #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" -#include // for DLOG #include // for gr::io_signature::make #include #include @@ -32,6 +31,12 @@ #include #include // for typeid +#if USE_GLOG_AND_GFLAGS +#include // for DLOG +#else +#include +#endif + #if HAS_GENERIC_LAMBDA #else #include diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 02f727d31..518e64264 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -96,8 +96,8 @@ set(SYSTEM_PARAMETERS_HEADERS Galileo_OSNMA.h osnma_data.h osnma_dsm_reader.h - osnma_helper.cc - osnma_helper.h + osnma_helper.cc + osnma_helper.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) @@ -123,6 +123,8 @@ target_link_libraries(core_system_parameters PUBLIC Boost::date_time Boost::serialization + PRIVATE + Pugixml::pugixml ) if(ENABLE_GLOG_AND_GFLAGS) From ed32e84402e478467cfd329b03fb1f425f277e2c Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 11 Jun 2024 18:33:58 +0200 Subject: [PATCH 190/499] [TAS-221] [BUG] FLX tag verification fails for recorded signals but succeeds for configuration_2 (otv) Implemented changes to ensure accurate computation of the d_GST_Sf in message receiver. Checked test is not affected by this. Logging improvements have been made. --- src/core/libs/osnma_msg_receiver.cc | 27 +++++++++++-------- src/core/system_parameters/osnma_helper.cc | 10 +++++++ .../osnma/osnma_msg_receiver_test.cc | 2 ++ 3 files changed, 28 insertions(+), 11 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 92c06497a..f89cb6824 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -91,15 +91,19 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); - LOG(WARNING) << "Galileo OSNMA: Subframe received starting at " - << "WN=" - << nma_msg->WN_sf0 - << ", TOW=" - << nma_msg->TOW_sf0 - << ", from satellite " - << sat; - process_osnma_message(nma_msg); + std::ostringstream output_message; + output_message << "Galileo OSNMA: Subframe received starting at " + << "WN=" + << nma_msg->WN_sf0 + << ", TOW=" + << nma_msg->TOW_sf0 + << ", from satellite " + << sat; + LOG(WARNING) << output_message.str(); + std::cout << output_message.str() << std::endl; + + process_osnma_message(nma_msg); } else @@ -1079,6 +1083,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) if(tag.CTR != 1) m.push_back(static_cast(tag.PRN_d)); m.push_back(static_cast(tag.PRNa)); + // TODO: maybe here I have to use d_receiver_time instead of d_GST_SIS which is what I am computing uint32_t GST = d_helper->compute_gst( tag.WN,tag.TOW); std::vector GST_uint8 = d_helper->gst_to_uint8(GST); m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); @@ -1091,7 +1096,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) // Add applicable NavData bits to message std::string applicable_nav_data; std::vector applicable_nav_data_bytes; - if (tag.ADKD == 0 || tag.ADKD == 12) + if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; } @@ -1100,7 +1105,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; } else - std::cerr<<"Galileo OSNMA :: Tag verification :: unknown ADKD" <<"\n"; + LOG(ERROR) <<"Galileo OSNMA :: Tag verification :: unknown ADKD" <<"\n"; // convert std::string to vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); @@ -1255,7 +1260,7 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) { // MACSEQ verification - d_GST_Sf = d_GST_SIS - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index b67454ddd..9ce394543 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -34,6 +34,16 @@ std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const return res; } +/** + * @brief Convert a binary string to a vector of bytes. + * + * This function takes a binary string and converts it into a vector of uint8_t bytes. + * The binary string is padded with zeros if necessary to ensure that the total number + * of bits is a multiple of a byte. + * + * @param binaryString The binary string to be converted. + * @return The vector of bytes converted from the binary string. + */ std::vector Osnma_Helper::bytes(const std::string& binaryString) { std::vector bytes; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index c480f9cb8..226e8e892 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -408,6 +408,8 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) this->TOW = time_of_week + LEAP_SECONDS; // Return the week number and time of week as a pair + // TODO: d_GST_SIS or d_receiver_time? doubt + // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); From 1a32ccaa19bc817a4bddd4f488240abba36e0981 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 13 Jun 2024 01:13:17 +0200 Subject: [PATCH 191/499] [TAS-208 WIP ] [Feature] Retrieve directly NavData bits from Telemetry Decoder (ADKD4 and 0/12) - appear to retrieve data as expected. - However, tag verification fails still (new dat file) --- .../galileo_telemetry_decoder_gs.cc | 24 ++++++++++++++----- .../galileo_telemetry_decoder_gs.h | 6 ++--- .../system_parameters/galileo_inav_message.cc | 24 +++++++++++++++++++ .../system_parameters/galileo_inav_message.h | 19 +++++++++++++++ 4 files changed, 64 insertions(+), 9 deletions(-) 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 859ef8b86..14e1c52d8 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 @@ -471,7 +471,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set - d_flag_osnma_ephemeris = true; + d_flag_osnma_adkd_0_12 = true; // W1-> W5 available } else { @@ -522,7 +522,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in << " dB-Hz" << TEXT_RESET << std::endl; } - d_flag_osnma_iono_and_time = true; } if (d_inav_nav.have_new_utc_model() == true) @@ -559,7 +558,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_delta_t = tmp_obj->A_0G + tmp_obj->A_1G * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G), 64.0))); DLOG(INFO) << "delta_t=" << d_delta_t << "[s]"; - d_flag_osnma_utc_model = true; + d_flag_osnma_adkd_4_utc = true; } if (d_inav_nav.have_new_almanac() == true) @@ -593,15 +592,28 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in DLOG(INFO) << "Current parameters:"; DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms; DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); + + d_flag_osnma_adkd_4_gst = true; } // get osnma message if the needed nav data is available - auto adkd_4_12_nav_data_available = d_flag_osnma_iono_and_time && d_flag_osnma_ephemeris; - auto newOSNMA = d_inav_nav.have_new_nma(); - if (d_band == '1' && newOSNMA && adkd_4_12_nav_data_available == true && d_flag_osnma_utc_model == true) + bool adkd_4_nav_data_available = d_flag_osnma_adkd_4_utc && d_flag_osnma_adkd_4_gst; + auto newOSNMA = d_inav_nav.have_new_nma();if (d_band == '1' && newOSNMA && (adkd_4_nav_data_available == true || d_flag_osnma_adkd_0_12 == true)) { + + const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); + + if(adkd_4_nav_data_available) + tmp_obj->TimingData_2 = d_inav_nav.get_osnma_adkd_4_nav_bits(); + if(d_flag_osnma_adkd_0_12) + tmp_obj->EphemerisClockAndStatusData_2 = d_inav_nav.get_osnma_adkd_0_12_nav_bits(); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); + + d_flag_osnma_adkd_4_utc= false; + d_flag_osnma_adkd_4_gst = false; + d_flag_osnma_adkd_0_12 = false; } } 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 bad8c8fc5..4b1725e8a 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 @@ -155,9 +155,9 @@ private: bool d_there_are_e1_channels; bool d_there_are_e6_channels; bool d_use_ced; - bool d_flag_osnma_ephemeris; // flag to indicate if the ephemeris is complete for OSNMA processing - bool d_flag_osnma_utc_model; // flag to indicate if the GST conversion parameters are complete for OSNMA processing - bool d_flag_osnma_iono_and_time; // flag to indicate if the iono correction and time is complete for OSNMA processing + bool d_flag_osnma_adkd_0_12; // flag to indicate if the ephemeris is complete for OSNMA processing + bool d_flag_osnma_adkd_4_gst; // flag to indicate if the GST conversion parameters are complete for OSNMA processing + bool d_flag_osnma_adkd_4_utc; // flag to indicate if the iono correction and time is complete for OSNMA processing }; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index d31bd781b..442f67178 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -614,6 +614,7 @@ void Galileo_Inav_Message::read_page_1(const std::bitset& DLOG(INFO) << "A_1= " << A_1; flag_ephemeris_1 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_1 = data_bits.to_string().substr(5,120); } @@ -635,6 +636,7 @@ void Galileo_Inav_Message::read_page_2(const std::bitset& DLOG(INFO) << "iDot_2= " << iDot_2; flag_ephemeris_2 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_2 = data_bits.to_string().substr(5,120); } @@ -664,6 +666,7 @@ void Galileo_Inav_Message::read_page_3(const std::bitset& DLOG(INFO) << "SISA_3= " << SISA_3; flag_ephemeris_3 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_3 = data_bits.to_string().substr(5, 122); } @@ -697,6 +700,7 @@ void Galileo_Inav_Message::read_page_4(const std::bitset& DLOG(INFO) << "spare_4 = " << spare_4; flag_ephemeris_4 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_4 = data_bits.to_string().substr(5, 120); } @@ -1016,6 +1020,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) flag_iono_and_GST = true; // set to false externally flag_TOW_set = true; // set to false externally DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_5 = data_jk_bits.to_string().substr(5, 67); break; case 6: // Word type 6: GST-UTC conversion parameters @@ -1045,6 +1050,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) flag_utc_model = true; // set to false externally flag_TOW_set = true; // set to false externally DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_6 = data_jk_bits.to_string().substr(5, 99); break; case 7: // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number @@ -1201,6 +1207,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) DLOG(INFO) << "WN_0G_10= " << WN_0G_10; flag_almanac_4 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; + nav_bits_word_10 = data_jk_bits.to_string().substr(85, 42); break; case 16: // Word type 16: Reduced Clock and Ephemeris Data (CED) parameters @@ -1425,3 +1432,20 @@ bool Galileo_Inav_Message::have_new_nma() return false; } } +std::string Galileo_Inav_Message::get_osnma_adkd_4_nav_bits() +{ + nav_bits_adkd_4 = nav_bits_word_6 + nav_bits_word_10; + nav_bits_word_6 = ""; + nav_bits_word_10 = ""; + return nav_bits_adkd_4; +} +std::string Galileo_Inav_Message::get_osnma_adkd_0_12_nav_bits() +{ + nav_bits_adkd_0_12 = nav_bits_word_1 + nav_bits_word_2 + nav_bits_word_3 + nav_bits_word_4 + nav_bits_word_5; + nav_bits_word_1 = ""; + nav_bits_word_2 = ""; + nav_bits_word_3 = ""; + nav_bits_word_4 = ""; + nav_bits_word_5 = ""; + return nav_bits_adkd_0_12; +} diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index bc5d5f780..19999a735 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -139,6 +139,16 @@ public: */ OSNMA_msg get_osnma_msg(); + /* + * @brief Retrieves the OSNMA ADKD 4 NAV bits. Resets the string. + */ + std::string get_osnma_adkd_4_nav_bits(); + + /* + * @brief Retrieves the OSNMA ADKD 0/12 NAV bits. Resets the string. + */ + std::string get_osnma_adkd_0_12_nav_bits(); + inline bool get_flag_CRC_test() const { return flag_CRC_test; @@ -430,6 +440,15 @@ private: uint8_t page_position_in_inav_subframe{255}; std::array nma_position_filled{}; OSNMA_msg nma_msg{}; + std::string nav_bits_adkd_4{}; + std::string nav_bits_word_6{}; + std::string nav_bits_word_10{}; + std::string nav_bits_adkd_0_12{}; + std::string nav_bits_word_1{}; + std::string nav_bits_word_2{}; + std::string nav_bits_word_3{}; + std::string nav_bits_word_4{}; + std::string nav_bits_word_5{}; uint8_t IODnav_LSB17{}; uint8_t IODnav_LSB18{}; From d1b97cfa092b9f564d235d473b54d742a64e9c43 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 14 Jun 2024 20:45:55 +0200 Subject: [PATCH 192/499] Clean log --- src/algorithms/PVT/libs/rtcm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index e4d933863..1ce2bbd1a 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -728,10 +728,10 @@ private: { if (first == true) { - LOG(INFO) << "Client says:"; + DLOG(INFO) << "Client says:"; first = false; } - LOG(INFO) << client_says; + DLOG(INFO) << client_says; client_says = client_says.substr(80, client_says.length() - 80); } do_read_message_header(); From d41efd2653004abd35d60f5c2d582b8b14eb1b58 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 21 Jun 2024 10:29:20 +0200 Subject: [PATCH 193/499] Really fix signature verification with GnuTLS --- src/core/system_parameters/gnss_crypto.cc | 364 ++++++++-------------- src/core/system_parameters/gnss_crypto.h | 34 +- 2 files changed, 143 insertions(+), 255 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index d3cd11380..12d113ae0 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -1,7 +1,8 @@ /*! * \file gnss_crypto.cc - * \brief Class for computing cryptografic functions - * \author Carles Fernandez, 2023. cfernandez(at)cttc.es + * \brief Class for computing cryptographic functions + * \author Carles Fernandez, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de * * * ----------------------------------------------------------------------------- @@ -9,7 +10,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -20,9 +21,9 @@ #include #include #include +#include #include #include -#include #if USE_OPENSSL_FALLBACK #include @@ -30,29 +31,27 @@ #include #include #if USE_OPENSSL_3 -#include #include +#include #include #include -#include #include -#include #define OPENSSL_ENGINE nullptr #else #include #endif -#else +#else // GnuTLS +#include #include #include #include -#include #endif Gnss_Crypto::Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath) { #if USE_OPENSSL_FALLBACK -#else - // gnutls_global_init(); +#else // GnuTLS + gnutls_global_init(); #endif readPublicKeyFromPEM(pemFilePath); read_merkle_xml(merkleTreePath); @@ -69,11 +68,13 @@ Gnss_Crypto::~Gnss_Crypto() EC_KEY_free(d_PublicKey); } #endif -#else // GNU-TLS - if (d_PublicKey != NULL) { +#else // GnuTLS + if (d_PublicKey != NULL) + { gnutls_pubkey_deinit(d_PublicKey); d_PublicKey = NULL; } + gnutls_global_deinit(); #endif } @@ -82,25 +83,12 @@ bool Gnss_Crypto::have_public_key() const { #if USE_OPENSSL_FALLBACK return (d_PublicKey != nullptr); -#else +#else // GnuTLS return (d_PublicKey != gnutls_pubkey_t{}); #endif } -std::string Gnss_Crypto::convert_to_utf8_str(const std::vector& input) const -{ - const char hex[] = "0123456789ABCDEF"; - std::string str(input.size() * 2, '0'); - for (size_t i = 0; i < input.size(); i++) - { - str[(i * 2) + 0] = hex[((input[i] & 0xF0) >> 4)]; - str[(i * 2) + 1] = hex[((input[i] & 0x0F))]; - } - return str; -} - - std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) const { std::vector result; @@ -236,11 +224,6 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) } -// void Gnss_Crypto::set_public_key(const std::vector& publickey) -// { -// } - - std::vector Gnss_Crypto::computeSHA256(const std::vector& input) const { std::vector output(32); // SHA256 hash size @@ -273,7 +256,7 @@ std::vector Gnss_Crypto::computeSHA256(const std::vector& inpu SHA256_Update(&sha256Context, input.data(), input.size()); SHA256_Final(output.data(), &sha256Context); #endif -#else +#else // GnuTLS std::vector output_aux(32); gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); @@ -301,7 +284,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in #else // SHA3-256 not implemented in OpenSSL < 3.0 #endif -#else +#else // GnuTLS std::vector output_aux(32); gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); @@ -358,7 +341,7 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector hmac.resize(hmacLen); output = hmac; #endif -#else +#else // GnuTLS std::vector output_aux(32); gnutls_hmac_hd_t hmac; gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); @@ -421,7 +404,7 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke output = mac; #endif -#else +#else // GnuTLS gnutls_cipher_hd_t cipher; std::vector mac(16); std::vector message = input; @@ -471,8 +454,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) std::cerr << "OpenSSL: error reading the Public Key from file " << pemFilePath << ". Aborting import" << std::endl; return; } - -#else +#else // GnuTLS // Import the PEM data gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(pemContent.data())), static_cast(pemContent.size())}; gnutls_pubkey_t pubkey; @@ -493,62 +475,21 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) gnutls_pubkey_deinit(pubkey); #endif std::cout << "Public key successfully read from file " << pemFilePath << std::endl; - //print_pubkey_hex(d_PublicKey); } -bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) +bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) const { std::vector digest = this->computeSHA256(message); if (!have_public_key()) { - std::cerr << "Galileo OSNMA::Kroot verification error::Public key not available"<< std::endl; + std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; return false; } bool success = false; #if USE_OPENSSL_FALLBACK -// using low-level API to test function -- it works in unit tests, not in real bytes. -// EVP_MD_CTX *mdctx = NULL; // verification context; a struct that wraps the message to be verified. -// int ret = 0; // error -// -// /* Create the Message Digest Context */ -// if(!(mdctx = EVP_MD_CTX_new())) goto err; // Allocates and returns a digest context. -// -// /* Initialize `key` with a public key */ -// // hashes cnt bytes of data at d into the verification context ctx -// if(1 != EVP_DigestVerifyInit(mdctx, NULL /*TODO null?*/, EVP_sha256(), NULL, d_PublicKey)) goto err; -// -// /* Initialize `key` with a public key */ -// if(1 != EVP_DigestVerifyUpdate(mdctx, message.data(), message.size())) goto err; -// -// -// if( 1 == EVP_DigestVerifyFinal(mdctx, signature.data(), signature.size())) -// { -// return true; -// } -// else -// { -// unsigned long errCode = ERR_get_error(); -// int lib_code = ERR_GET_LIB(errCode); -// char* err = ERR_error_string(errCode, NULL); -// const char* error_string = ERR_error_string(errCode, NULL); -// std::cerr << "OpenSSL: message authentication failed: " << err /*<< -// "from library with code " << lib_code << -// " error string: " << error_string */<< std::endl; -// } -//err: -// if(ret != 1) -// { -// /* Do some error handling */ -// // notify other blocks -// std::cout << "ECDSA_Verify_OSSL()::error " << ret << std::endl; -// -// } - - #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; - //print_pubkey_hex(d_PublicKey); ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); bool do_operation = true; @@ -556,7 +497,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { do_operation = false; } - // convert raw signature into DER format, needed for verify_signature + // convert raw signature into DER format size_t half_size = signature.size() / 2; std::vector raw_r(signature.begin(), signature.begin() + half_size); std::vector raw_s(signature.begin() + half_size, signature.end()); @@ -575,12 +516,12 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st if (ECDSA_SIG_set0(sig, r, s) != 1) { std::cerr << "Failed to set R and S values in ECDSA_SIG" << std::endl; - ECDSA_SIG_free(sig); // Free the ECDSA_SIG struct as it's no longer needed + ECDSA_SIG_free(sig); // Free the ECDSA_SIG struct as it is no longer needed return false; } std::vector derSignature; - unsigned char *derSig = nullptr; + unsigned char* derSig = nullptr; int derSigLength = i2d_ECDSA_SIG(sig, &derSig); if (derSigLength <= 0) @@ -591,7 +532,6 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st derSignature.assign(derSig, derSig + derSigLength); - if (EVP_PKEY_verify_init(ctx) <= 0) { do_operation = false; @@ -616,10 +556,9 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st { unsigned long errCode = ERR_get_error(); char* err = ERR_error_string(errCode, NULL); - std::cerr << "OpenSSL: message authentication failed: " << err << std::endl; + std::cerr << "OpenSSL: message authentication failed: " << err << std::endl; } #else - auto digest = this->computeSHA256(message); int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, signature.data(), static_cast(signature.size()), d_PublicKey); if (verification == 1) { @@ -635,34 +574,26 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } #endif -#else - // GNU-TLS - gnutls_global_init(); - // debug info gnu-tls remove when not needed anymore! - gnutls_global_set_log_level(9); - gnutls_global_set_log_function(Gnss_Crypto::my_log_func); +#else // GnuTLS + // Convert signature to DER format + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) + { + std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + return false; + } - unsigned int bit_size; - if (gnutls_pubkey_get_pk_algorithm(d_PublicKey, &bit_size) != GNUTLS_PK_ECDSA) + // Prepare the digest datum + gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; + gnutls_datum_t der_sig_data = {der_sig.data(), static_cast(der_sig.size())}; + + // Verify the DER-encoded signature + int ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &digest_data, &der_sig_data); + success = (ret >= 0); + if (!success) { - std::cerr << "GnuTLS: the Public Key does not contain a ECDSA key. Aborting signature verification" << std::endl; + std::cerr << "GnuTLS: message authentication failed: " << gnutls_strerror(ret) << std::endl; } - gnutls_datum_t signature_{}; - signature_.data = const_cast(signature.data()); - signature_.size = signature.size(); - gnutls_datum_t data_{}; - data_.data = const_cast(message.data()); - data_.size = message.size(); - int ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &data_, &signature_); - if (ret >= 0) - { - success = true; - } - else - { - std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; - } - gnutls_global_deinit(); #endif return success; } @@ -707,75 +638,47 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector& publicKey) { #if USE_OPENSSL_FALLBACK - BIO *bio = NULL; - EVP_PKEY *pkey = NULL; + BIO* bio = NULL; + EVP_PKEY* pkey = NULL; bio = BIO_new_mem_buf(publicKey.data(), publicKey.size()); - if (!bio) { + if (!bio) + { std::cerr << "Failed to create BIO for key \n"; return; } - pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL); - BIO_free(bio); + pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL); + BIO_free(bio); - if (!pkey) { - std::cerr << "OpenSSL: error setting the public key " - << ". Aborting import" << std::endl; + if (!pkey) + { + std::cerr << "OpenSSL: error setting the public key." << std::endl; return; } - //print_pubkey_hex(pkey); - - if(!pubkey_copy(pkey, &d_PublicKey)) - return - - EVP_PKEY_free(pkey); -#else -// // GNU-TLS -// gnutls_global_init(); -// -// // debug info gnu-tls remove when not needed anymore! -// gnutls_global_set_log_level(9); -// gnutls_global_set_log_function(Gnss_Crypto::my_log_func); + if (!pubkey_copy(pkey, &d_PublicKey)) + { + return; + } + EVP_PKEY_free(pkey); +#else // GnuTLS gnutls_pubkey_t pubkey; gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; gnutls_pubkey_init(&pubkey); int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); - //ret = gnutls_pubkey_import_x509_raw(pubkey, &pemDatum,GNUTLS_X509_FMT_PEM,0); if (ret != GNUTLS_E_SUCCESS) { gnutls_pubkey_deinit(pubkey); - std::cerr << "GnuTLS: error setting the public key " - << ". Aborting import" << std::endl; + std::cerr << "GnuTLS: error setting the public key" << std::endl; std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; return; } - // d_PublicKey = pubkey; pubkey_copy(pubkey, &d_PublicKey); -// std::cout << "pubkey: " << std::endl; -// print_pubkey_hex(pubkey); -// std::cout << "d_PublicKey before : " << std::endl; -// print_pubkey_hex(d_PublicKey); gnutls_pubkey_deinit(pubkey); -// std::cout << "d_PublicKey after: " << std::endl; -// print_pubkey_hex(d_PublicKey); - -// gnutls_global_deinit(); #endif - } -std::vector Gnss_Crypto::get_public_key() -{ -#if USE_OPENSSL_FALLBACK - // TODO -#else -// GNU-TLS - // TODO -#endif - return {}; -} #if USE_OPENSSL_FALLBACK bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) @@ -794,9 +697,6 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) return false; } - // Add a null-terminator to the data in the memory buffer - //BIO_write(mem_bio, "\0", 1); - // Read the data from the memory buffer char* bio_data; long data_len = BIO_get_mem_data(mem_bio, &bio_data); @@ -824,95 +724,87 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) return true; } -void Gnss_Crypto::print_pubkey_hex(EVP_PKEY* pubkey) + +#else // GnuTLS-specific functions + +bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const { - BIO* mem_bio = BIO_new(BIO_s_mem()); - if (!mem_bio) { - std::cerr << "Failed to create new memory BIO\n"; - return; + if (raw_signature.size() % 2 != 0) + { + std::cerr << "Invalid raw ECDSA signature size" << std::endl; + return false; } - if (!PEM_write_bio_PUBKEY(mem_bio, pubkey)){ - std::cerr << "Failed to write public key to BIO\n"; - BIO_free(mem_bio); - return; + size_t half_size = raw_signature.size() / 2; + std::vector raw_r(raw_signature.begin(), raw_signature.begin() + half_size); + std::vector raw_s(raw_signature.begin() + half_size, raw_signature.end()); + + auto encode_asn1_integer = [](const std::vector& value) -> std::vector { + std::vector result; + result.push_back(0x02); // INTEGER tag + + if (value[0] & 0x80) + { + result.push_back(value.size() + 1); // Length byte + result.push_back(0x00); // Add leading zero byte to ensure positive integer + } + else + { + result.push_back(value.size()); // Length byte + } + + result.insert(result.end(), value.begin(), value.end()); + return result; + }; + + std::vector der_r = encode_asn1_integer(raw_r); + std::vector der_s = encode_asn1_integer(raw_s); + + size_t total_length = der_r.size() + der_s.size(); + der_signature.push_back(0x30); // SEQUENCE tag + if (total_length > 127) + { + der_signature.push_back(0x81); // Long form length } + der_signature.push_back(static_cast(total_length)); - BUF_MEM* mem_ptr; - BIO_get_mem_ptr(mem_bio, &mem_ptr); // Fetch the underlying BUF_MEM structure from the BIO. + der_signature.insert(der_signature.end(), der_r.begin(), der_r.end()); + der_signature.insert(der_signature.end(), der_s.begin(), der_s.end()); - std::stringstream ss; - - // Iterate through each byte in mem_ptr->data and print its hex value. - for (size_t i = 0; i < mem_ptr->length; i++) { - ss << std::hex << std::setw(2) << std::setfill('0') << - static_cast(static_cast(mem_ptr->data[i])); - } - - //std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; - - BIO_free(mem_bio); + return true; } -#else // gnutls-specific functions - void Gnss_Crypto::my_log_func(int level, const char *msg){ - fprintf(stderr, " %s", level, msg);} - bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) - { - gnutls_datum_t key_datum; - int ret; - // Export the public key from src to memory - ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); - if (ret < 0) - { - gnutls_free(key_datum.data); - return false; - } +bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) +{ + gnutls_datum_t key_datum; - // Initialize dest - ret = gnutls_pubkey_init(dest); - if (ret < 0) - { - gnutls_free(key_datum.data); - return false; - } + // Export the public key from src to memory + int ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); + if (ret < 0) + { + gnutls_free(key_datum.data); + return false; + } - // Import the public key data from key_datum to dest - ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); - gnutls_free(key_datum.data); + // Initialize dest + ret = gnutls_pubkey_init(dest); + if (ret < 0) + { + gnutls_free(key_datum.data); + return false; + } - if (ret < 0) - { - gnutls_pubkey_deinit(*dest); - return false; - } + // Import the public key data from key_datum to dest + ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); + gnutls_free(key_datum.data); - return true; - } + if (ret < 0) + { + gnutls_pubkey_deinit(*dest); + return false; + } - void Gnss_Crypto::print_pubkey_hex(gnutls_pubkey_t pubkey) - { - gnutls_datum_t key_datum; - int ret; - - // Export the public key from pubkey to memory in DER format - ret = gnutls_pubkey_export2(pubkey, GNUTLS_X509_FMT_PEM, &key_datum); - if (ret < 0) { - std::cerr << "Failed to export public key: " << gnutls_strerror(ret) << std::endl; - return; - } - - std::stringstream ss; - - // Iterate through each byte in key_datum.data and print its hex value - for (unsigned int i = 0; i < key_datum.size; ++i) { - ss << std::hex << std::setw(2) << std::setfill('0') << static_cast(key_datum.data[i]); - } - - std::cout << "Public key in hex format: 0x" << ss.str() << std::endl; - - // Free the memory allocated to key_datum.data - gnutls_free(key_datum.data); - } + return true; +} #endif diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 1191a7ed5..41341d981 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -1,7 +1,8 @@ /*! * \file gnss_crypto.h - * \brief Class for computing cryptografic functions - * \author Carles Fernandez, 2023. cfernandez(at)cttc.es + * \brief Class for computing cryptographic functions + * \author Carles Fernandez, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de * * * ----------------------------------------------------------------------------- @@ -9,7 +10,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -38,40 +39,35 @@ public: Gnss_Crypto() = default; ~Gnss_Crypto(); Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath); + + void readPublicKeyFromPEM(const std::string& pemFilePath); + void read_merkle_xml(const std::string& merkleFilePath); + void set_public_key(const std::vector& publickey); bool have_public_key() const; - std::string convert_to_utf8_str(const std::vector& input) const; - std::vector convert_from_hex_str(const std::string& input) const; + bool verify_signature(const std::vector& message, const std::vector& signature) const; std::vector computeSHA256(const std::vector& input) const; std::vector computeSHA3_256(const std::vector& input) const; std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; - - bool verify_signature(const std::vector& message, const std::vector& signature); - void readPublicKeyFromPEM(const std::string& pemFilePath); - void read_merkle_xml(const std::string& merkleFilePath); std::vector getMerkleRoot(const std::vector>& merkle) const; - std::vector getMerkleRoot() const + + inline std::vector getMerkleRoot() const { return d_x_4_0; } - void set_public_key(const std::vector& publickey); - static std::vector get_public_key(); - private: + std::vector convert_from_hex_str(const std::string& input) const; #if USE_OPENSSL_FALLBACK - bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); - void print_pubkey_hex(EVP_PKEY* pubkey); #if USE_OPENSSL_3 EVP_PKEY* d_PublicKey{}; #else EC_KEY* d_PublicKey = nullptr; #endif -#else + bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); +#else // GnuTLS gnutls_pubkey_t d_PublicKey{}; - void set_ecc_key(const std::vector& pK, const std::vector ecP); - static void my_log_func(int level, const char* msg); - void print_pubkey_hex(gnutls_pubkey_t); + bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; bool pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest); #endif std::vector d_x_4_0; From c8c7d4c3520164f8425920e378c47bc0c46ef4bd Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Fri, 21 Jun 2024 19:46:49 +0200 Subject: [PATCH 194/499] [TAS-224] Update telemetry decoder to directly process Navigation Data bits This update refactors the telemetry decoder to directly retrieve and compute Navigation Data bits. WIP as the tag verification still fails --- .../galileo_telemetry_decoder_gs.cc | 56 +++++--- src/core/libs/osnma_msg_receiver.cc | 126 +++++++++++++----- src/core/libs/osnma_msg_receiver.h | 2 +- .../system_parameters/galileo_inav_message.cc | 49 ++++--- .../system_parameters/galileo_inav_message.h | 4 + src/core/system_parameters/osnma_data.cc | 4 +- 6 files changed, 172 insertions(+), 69 deletions(-) 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 14e1c52d8..a404a100a 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 @@ -439,7 +439,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } // 4. Push the new navigation data to the queues - if (d_inav_nav.have_new_ephemeris() == true) + if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_ephemeris()); @@ -471,12 +471,26 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set - d_flag_osnma_adkd_0_12 = true; // W1-> W5 available +// d_flag_osnma_adkd_0_12 = true; // W1-> W5 available + // extract bits, reset container. + bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << d_satellite.get_PRN() << ") " << "TOW_sf=" << d_inav_nav.get_TOW5() - 24 <>( // < PRNd , navDataBits, TOW_Sosf> + d_satellite.get_PRN(), + d_inav_nav.get_osnma_adkd_0_12_nav_bits(), + d_inav_nav.get_TOW5() - 24); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); + d_inav_nav.reset_osnma_nav_bits_adkd0_12(); + } + + } else { // If we still do not have ephemeris, check if we have a reduced CED - if ((d_band == '1') && d_use_ced && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) + if ((d_band == '1') && d_use_ced && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) // C: W16 has some Eph. params, uneeded for OSNMa I guess { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_reduced_ced()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); @@ -492,7 +506,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } } - if (d_inav_nav.have_new_iono_and_GST() == true) + if (d_inav_nav.have_new_iono_and_GST() == true) // C: W5 { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_iono()); @@ -521,10 +535,9 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in << d_satellite << " with CN0=" << std::setprecision(2) << cn0 << std::setprecision(default_precision) << " dB-Hz" << TEXT_RESET << std::endl; } - } - if (d_inav_nav.have_new_utc_model() == true) + if (d_inav_nav.have_new_utc_model() == true) // C: tells if W6 is available { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_utc_model()); @@ -561,7 +574,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_flag_osnma_adkd_4_utc = true; } - if (d_inav_nav.have_new_almanac() == true) + if (d_inav_nav.have_new_almanac() == true) // flag_almanac_4 tells if W10 available. { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_almanac()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); @@ -597,23 +610,32 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } // get osnma message if the needed nav data is available - bool adkd_4_nav_data_available = d_flag_osnma_adkd_4_utc && d_flag_osnma_adkd_4_gst; - auto newOSNMA = d_inav_nav.have_new_nma();if (d_band == '1' && newOSNMA && (adkd_4_nav_data_available == true || d_flag_osnma_adkd_0_12 == true)) + bool adkd_4_nav_data_available = d_flag_osnma_adkd_4_utc && d_flag_osnma_adkd_4_gst; // supposition: data did not change bt. flags reset and now. + + // bool adkd_4_nav_data_available = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; // newApproach: let decoder decide when block starts and let it fill the data, and just check for length + if(adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) { + bool check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=4 navData, PRN_d (" << d_satellite.get_PRN() << ") " << "TOW_sf=" << d_inav_nav.get_TOW6() - 4 <>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe + d_satellite.get_PRN(), + d_inav_nav.get_osnma_adkd_4_nav_bits(), + d_inav_nav.get_TOW6() - 4); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); + d_inav_nav.reset_osnma_nav_bits_adkd4(); + } + } + auto newOSNMA = d_inav_nav.have_new_nma(); + if (d_band == '1' && newOSNMA) + { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); - if(adkd_4_nav_data_available) - tmp_obj->TimingData_2 = d_inav_nav.get_osnma_adkd_4_nav_bits(); - if(d_flag_osnma_adkd_0_12) - tmp_obj->EphemerisClockAndStatusData_2 = d_inav_nav.get_osnma_adkd_0_12_nav_bits(); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - d_flag_osnma_adkd_4_utc= false; - d_flag_osnma_adkd_4_gst = false; - d_flag_osnma_adkd_0_12 = false; } } diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1a9c8cfc7..302609798 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -95,7 +95,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); - const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); + const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); // TODO remove if unneeded std::ostringstream output_message; output_message << "Galileo OSNMA: Subframe received starting at " @@ -110,6 +110,27 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) process_osnma_message(nma_msg); + std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; + } + else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) + { + // TODO - PRNa is a typo here, I think for d_satellite_nav_data, is PRN_d the name to use + const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); + uint32_t PRNa = std::get<0>(*inav_data); + std::string nav_data = std::get<1>(*inav_data);; + uint32_t TOW = std::get<2>(*inav_data); + + // iono data => 549 bits, utc data, 141 bits. + if(nav_data.size() == 549) + { + d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = nav_data; + } + else if(nav_data.size() == 141) + { + d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; + } + else + LOG(ERROR) << "osnma_msg_receiver incorrect navData parsing!"; } else { @@ -581,7 +602,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place +// add_satellite_data(osnma_msg->PRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place // DEBUG PARSING MACK MESSAGES WHEN DSM-KROOT NOT YET AVAILABLE // d_osnma_data.d_dsm_kroot_message.ts = 9; // d_osnma_data.d_dsm_kroot_message.ks = 4; @@ -923,14 +944,18 @@ void osnma_msg_receiver::process_mack_message() { it.second.status = Tag::SUCCESS; LOG(WARNING) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " - << it.second.tag_id - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", from satellite " - << it.second.PRNa - << std::endl; + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) + << std::endl; } /* TODO notify PVT via pmt * have_new_data() true @@ -939,27 +964,36 @@ void osnma_msg_receiver::process_mack_message() else { it.second.status = Tag::FAIL; - LOG(ERROR) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id= " - << it.second.tag_id - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", from satellite " - << it.second.PRNa - << std::endl; + LOG(ERROR) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id=" + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) + << std::endl; } } else { LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED for Tag Id= " - << it.second.tag_id - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", from satellite " - << it.second.PRNa - << " due to missing key or navData. "; + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) + << ". Key available ("<< tag_has_key_available(it.second) <<"), navData ("<< tag_has_nav_data_available(it.second) <<"). " + << std::endl; } } @@ -1078,7 +1112,23 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) + { + std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " + << tag.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << tag.received_tag << std::dec + << ", TOW=" + << tag.TOW + << ", ADKD=" + << static_cast(tag.ADKD) + << ", PRNa=" + << static_cast(tag.PRNa) + << ", PRNd=" + << static_cast(tag.PRN_d) + << std::endl; return true; + } + else return false; } @@ -1219,17 +1269,27 @@ void osnma_msg_receiver::remove_verified_tags() for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end() ; ){ if (it->second.status == Tag::SUCCESS || it->second.status == Tag::FAIL) { - LOG(INFO) << "Galileo OSNMA: delete tag for tag Id= " - << it->second.tag_id << ", PRN_a= " - << it->second.PRNa << ", TOW=" - << it->second.TOW << ", ADKD= " - << static_cast(it->second.ADKD) << ", status= " - << it->second.status << std::endl; + LOG(INFO) << "Galileo OSNMA: Tag verification :: DELETE tag Id=" + << it->second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it->second.received_tag << std::dec + << ", TOW=" + << it->second.TOW + << ", ADKD=" + << static_cast(it->second.ADKD) + << ", PRNa=" + << static_cast(it->second.PRNa) + << ", PRNd=" + << static_cast(it->second.PRN_d) + << ", status= " + << it->second.status + << std::endl; it = d_tags_awaiting_verify.erase(it); } else ++it; } + std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; } /** * @brief Control the size of the tags awaiting verification multimap. diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index d7aeb9df4..4e662ef55 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -83,7 +83,7 @@ private: bool tag_has_nav_data_available(Tag& t); bool tag_has_key_available(Tag& t); - std::map> d_satellite_nav_data; // map holding NavData sorted by SVID and TOW. + std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::vector d_macks_awaiting_MACSEQ_verification; std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 442f67178..baa140149 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -185,7 +185,7 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even if (page_position_in_inav_subframe != 255) { if (page_position_in_inav_subframe == 0) - { + { // TODO - is it redundant? receiving Word 2 already resets this nma_position_filled = std::array{}; nma_msg.mack = std::array{}; nma_msg.hkroot = std::array{}; @@ -215,7 +215,7 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even } } - +// C: tells if W1-->W4 available from same blcok bool Galileo_Inav_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class { if ((flag_ephemeris_1 == true) and (flag_ephemeris_2 == true) and (flag_ephemeris_3 == true) and (flag_ephemeris_4 == true) and (flag_iono_and_GST == true)) @@ -349,7 +349,7 @@ bool Galileo_Inav_Message::have_new_ephemeris() // Check if we have a new ephem return false; } - +// C: tells if W5 is available bool Galileo_Inav_Message::have_new_iono_and_GST() // Check if we have a new iono data set stored in the galileo navigation class { if ((flag_iono_and_GST == true) and (flag_utc_model == true)) // the condition on flag_utc_model is added to have a time stamp for iono @@ -361,7 +361,7 @@ bool Galileo_Inav_Message::have_new_iono_and_GST() // Check if we have a new io return false; } - +// C: tells if W6 is available bool Galileo_Inav_Message::have_new_utc_model() // Check if we have a new utc data set stored in the galileo navigation class { if (flag_utc_model == true) @@ -373,9 +373,13 @@ bool Galileo_Inav_Message::have_new_utc_model() // Check if we have a new utc d return false; } - +// flag_almanac_4 tells if W10 available. bool Galileo_Inav_Message::have_new_almanac() // Check if we have a new almanac data set stored in the galileo navigation class { +// if(flag_almanac_4) +// { +// flag_adkd_4_complete = true; +// } if ((flag_almanac_1 == true) and (flag_almanac_2 == true) and (flag_almanac_3 == true) and (flag_almanac_4 == true)) { // All Almanac data have been received @@ -614,7 +618,7 @@ void Galileo_Inav_Message::read_page_1(const std::bitset& DLOG(INFO) << "A_1= " << A_1; flag_ephemeris_1 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_1 = data_bits.to_string().substr(5,120); + nav_bits_word_1 = data_bits.to_string().substr(6,120); } @@ -636,7 +640,7 @@ void Galileo_Inav_Message::read_page_2(const std::bitset& DLOG(INFO) << "iDot_2= " << iDot_2; flag_ephemeris_2 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_2 = data_bits.to_string().substr(5,120); + nav_bits_word_2 = data_bits.to_string().substr(6,120); } @@ -666,7 +670,7 @@ void Galileo_Inav_Message::read_page_3(const std::bitset& DLOG(INFO) << "SISA_3= " << SISA_3; flag_ephemeris_3 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_3 = data_bits.to_string().substr(5, 122); + nav_bits_word_3 = data_bits.to_string().substr(6, 122); } @@ -700,7 +704,7 @@ void Galileo_Inav_Message::read_page_4(const std::bitset& DLOG(INFO) << "spare_4 = " << spare_4; flag_ephemeris_4 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_4 = data_bits.to_string().substr(5, 120); + nav_bits_word_4 = data_bits.to_string().substr(6, 120); } @@ -872,10 +876,14 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) case 2: // Word type 2: Ephemeris (2/4) { + // start of subframe, reset osnma parameters TODO - refactor page_position_in_inav_subframe = 0; nma_msg.mack = std::array{}; nma_msg.hkroot = std::array{}; nma_position_filled = std::array{}; + reset_osnma_nav_bits_adkd4(); + reset_osnma_nav_bits_adkd0_12(); + read_page_2(data_jk_bits); if (enable_rs) { @@ -1020,7 +1028,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) flag_iono_and_GST = true; // set to false externally flag_TOW_set = true; // set to false externally DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_5 = data_jk_bits.to_string().substr(5, 67); + nav_bits_word_5 = data_jk_bits.to_string().substr(6, 67); break; case 6: // Word type 6: GST-UTC conversion parameters @@ -1050,7 +1058,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) flag_utc_model = true; // set to false externally flag_TOW_set = true; // set to false externally DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_6 = data_jk_bits.to_string().substr(5, 99); + nav_bits_word_6 = data_jk_bits.to_string().substr(6, 99); break; case 7: // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number @@ -1207,7 +1215,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) DLOG(INFO) << "WN_0G_10= " << WN_0G_10; flag_almanac_4 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_10 = data_jk_bits.to_string().substr(85, 42); + nav_bits_word_10 = data_jk_bits.to_string().substr(86, 42); break; case 16: // Word type 16: Reduced Clock and Ephemeris Data (CED) parameters @@ -1387,6 +1395,8 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) nma_position_filled = std::array{}; nma_msg.mack = std::array{}; nma_msg.hkroot = std::array{}; + reset_osnma_nav_bits_adkd4(); + reset_osnma_nav_bits_adkd0_12(); } return page_number; @@ -1407,7 +1417,7 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 24; // TODO - why not TOW_0? + int32_t TOW_sf0 = TOW_5 - 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start if (TOW_sf0 < 0) { TOW_sf0 += 604800; @@ -1435,17 +1445,24 @@ bool Galileo_Inav_Message::have_new_nma() std::string Galileo_Inav_Message::get_osnma_adkd_4_nav_bits() { nav_bits_adkd_4 = nav_bits_word_6 + nav_bits_word_10; - nav_bits_word_6 = ""; - nav_bits_word_10 = ""; + return nav_bits_adkd_4; } std::string Galileo_Inav_Message::get_osnma_adkd_0_12_nav_bits() { nav_bits_adkd_0_12 = nav_bits_word_1 + nav_bits_word_2 + nav_bits_word_3 + nav_bits_word_4 + nav_bits_word_5; + return nav_bits_adkd_0_12; +} +void Galileo_Inav_Message::reset_osnma_nav_bits_adkd0_12() +{ nav_bits_word_1 = ""; nav_bits_word_2 = ""; nav_bits_word_3 = ""; nav_bits_word_4 = ""; nav_bits_word_5 = ""; - return nav_bits_adkd_0_12; +} +void Galileo_Inav_Message::reset_osnma_nav_bits_adkd4() +{ + nav_bits_word_6 = ""; + nav_bits_word_10 = ""; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 19999a735..a4cc6a31a 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -143,11 +143,15 @@ public: * @brief Retrieves the OSNMA ADKD 4 NAV bits. Resets the string. */ std::string get_osnma_adkd_4_nav_bits(); + void reset_osnma_nav_bits_adkd4(); + bool flag_adkd_4_complete{false}; /* * @brief Retrieves the OSNMA ADKD 0/12 NAV bits. Resets the string. */ std::string get_osnma_adkd_0_12_nav_bits(); + void reset_osnma_nav_bits_adkd0_12(); + bool flag_adkd_0_12_complete{false}; inline bool get_flag_CRC_test() const { diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 4424c55ba..49051b7be 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -37,8 +37,8 @@ void NavData::init(const std::shared_ptr &osnma_msg) TOW_sf0 = osnma_msg->TOW_sf0; // new parsing, directly parsing bits - ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; - utc_vector_2 = osnma_msg->TimingData_2; +// ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; +// utc_vector_2 = osnma_msg->TimingData_2; }; void NavData::generate_eph_iono_vector() { From f1e616c4e5e556e83fb49821875e62792fb4e5f7 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 22 Jun 2024 14:04:08 +0200 Subject: [PATCH 195/499] =?UTF-8?q?[TAS-226]=20[FEAT]=20Remove=20tags=20sk?= =?UTF-8?q?ipped=20=E2=89=A5=2010=20times?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/libs/osnma_msg_receiver.cc | 25 ++++++++++++++++++++++--- src/core/system_parameters/osnma_data.h | 5 +++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 302609798..02c3d48e4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -109,8 +109,6 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) std::cout << output_message.str() << std::endl; process_osnma_message(nma_msg); - - std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; } else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) { @@ -915,6 +913,7 @@ void osnma_msg_receiver::process_mack_message() d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; } + std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; mack = d_macks_awaiting_MACSEQ_verification.erase(mack); } else @@ -980,7 +979,8 @@ void osnma_msg_receiver::process_mack_message() } } else { - LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED for Tag Id= " + it.second.skipped ++; + LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED (x"<< it.second.skipped <<")for Tag Id= " << it.second.tag_id << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase << it.second.received_tag << std::dec @@ -1286,6 +1286,25 @@ void osnma_msg_receiver::remove_verified_tags() << std::endl; it = d_tags_awaiting_verify.erase(it); } + else if (it->second.skipped >= 10) + { + LOG(INFO) << "Galileo OSNMA: Tag verification :: DELETE tag Id=" + << it->second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it->second.received_tag << std::dec + << ", TOW=" + << it->second.TOW + << ", ADKD=" + << static_cast(it->second.ADKD) + << ", PRNa=" + << static_cast(it->second.PRNa) + << ", PRNd=" + << static_cast(it->second.PRN_d) + << ", status= " + << it->second.status + << std::endl; + it = d_tags_awaiting_verify.erase(it); + } else ++it; } diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index cf9bcb7d9..b27f6dfb3 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -182,8 +182,8 @@ public: computed_tag(0), PRN_d(MTI.tag_info.PRN_d), ADKD(MTI.tag_info.ADKD), - cop(MTI.tag_info.cop) - + cop(MTI.tag_info.cop), + skipped(0) { } @@ -201,6 +201,7 @@ public: uint8_t PRN_d; uint8_t ADKD; uint8_t cop; + uint32_t skipped; }; /** \} */ /** \} */ From 849a900adfde07030ed9a84e62270b754b7c830c Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 22 Jun 2024 14:54:08 +0200 Subject: [PATCH 196/499] [TAS-228] [FEAT] adapt osnma test vector to new navData passing All tags either verified SUCCESSFULLY or Skipped. Skipping issue still present. --- src/core/libs/osnma_msg_receiver.cc | 6 ++-- .../osnma/osnma_msg_receiver_test.cc | 31 +++++++++++++++++-- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 02c3d48e4..8447fb5fc 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -121,10 +121,12 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // iono data => 549 bits, utc data, 141 bits. if(nav_data.size() == 549) { + LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " << "TOW_sf=" << TOW <second.skipped >= 10) + else if (it->second.skipped >= 20) { LOG(INFO) << "Galileo OSNMA: Tag verification :: DELETE tag Id=" << it->second.tag_id diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 226e8e892..ec89911ce 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -225,20 +225,32 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) {3, {6, 122}}, {4, {6, 120}}, {5, {6, 67}}, - // TODO words 6 and 10 for TimingData }; // Fill NavData bits -- Iterate over the extraction parameters + std::string nav_data_ADKD_0_12 = ""; for (const auto& param : extractionParams) { uint8_t wordKey = param.first; uint8_t start = param.second.first; uint8_t length = param.second.second; // Extract the required bits and fill osnma block - osnmaMsg_sptr->EphemerisClockAndStatusData_2 += words[wordKey]. + nav_data_ADKD_0_12 += words[wordKey]. to_string().substr( start, length); } + // send to osnma block + bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> + tv.svId, + nav_data_ADKD_0_12, + osnmaMsg_sptr->TOW_sf0); + osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + + } } // check w6 && w10 is received => fill TimingData data vector @@ -252,6 +264,7 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) {10, {86, 42}} }; + std::string nav_data_ADKD_4 = ""; // Fill NavData bits -- Iterate over the extraction parameters for (const auto& param : extractionParams) { @@ -260,9 +273,21 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) uint8_t length = param.second.second; // Extract the required bits and fill osnma block - osnmaMsg_sptr->TimingData_2 += words[wordKey].to_string().substr( + nav_data_ADKD_4 += words[wordKey].to_string().substr( start, length); } + // send to osnma block + bool check_size_is_ok = nav_data_ADKD_4.size() == 141; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> + tv.svId, + nav_data_ADKD_4, + osnmaMsg_sptr->TOW_sf0); + osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + + } } From bac36b2df513f16a37b15526a24b937e1ce04146 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 23 Jun 2024 09:49:14 +0200 Subject: [PATCH 197/499] Read .crt files instead of .pem files Define the following global configuration parameters: GNSS-SDR.osnma_public_key (string, by default pointing to ../data/OSNMA_PublicKey_20240115100000_newPKID_1.crt) GNSS-SDR.osnma_merkletree (string, by default pointing to ../data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml) Add logging of OSNMA events Clean public API of Gnss_Crypto class --- src/core/receiver/gnss_flowgraph.cc | 6 +- src/core/system_parameters/CMakeLists.txt | 4 +- src/core/system_parameters/Galileo_OSNMA.h | 3 +- src/core/system_parameters/gnss_crypto.cc | 185 ++++++++++++++++----- src/core/system_parameters/gnss_crypto.h | 8 +- 5 files changed, 159 insertions(+), 47 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 4b5f71012..acdea9df2 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -124,9 +124,9 @@ void GNSSFlowgraph::init() if (configuration_->property("Channels_1B.count", 0) > 0) { enable_osnma_rx_ = true; - auto pemFilePath = configuration_->property("GNSS-SDR.OSNMA_pem", PEMFILE_DEFAULT); - auto merKleTreePath = configuration_->property("GNSS-SDR.OSNMA_MerkleTree", MERKLEFILE_DEFAULT); - osnma_rx_ = osnma_msg_receiver_make(pemFilePath, merKleTreePath); + const auto certFilePath = configuration_->property("GNSS-SDR.osnma_public_key", CRTFILE_DEFAULT); + const auto merKleTreePath = configuration_->property("GNSS-SDR.osnma_merkletree", MERKLEFILE_DEFAULT); + osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath); } else { diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 518e64264..607c3702a 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -29,8 +29,9 @@ set(SYSTEM_PARAMETERS_SOURCES glonass_gnav_utc_model.cc glonass_gnav_navigation_message.cc reed_solomon.cc - osnma_dsm_reader.cc osnma_data.cc + osnma_dsm_reader.cc + osnma_helper.cc ) set(SYSTEM_PARAMETERS_HEADERS @@ -96,7 +97,6 @@ set(SYSTEM_PARAMETERS_HEADERS Galileo_OSNMA.h osnma_data.h osnma_dsm_reader.h - osnma_helper.cc osnma_helper.h ) diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index e6530b610..bc919c4b3 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -161,7 +161,8 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} const std::string PEMFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem"); -const std::string MERKLEFILE_DEFAULT("./OSNMA_MerkleTree_20210920133026.xml"); +const std::string CRTFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); +const std::string MERKLEFILE_DEFAULT("../data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); class Mack_lookup { diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 12d113ae0..e78e29e39 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -30,6 +30,7 @@ #include #include #include +#include #if USE_OPENSSL_3 #include #include @@ -47,13 +48,23 @@ #include #endif -Gnss_Crypto::Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath) +#if USE_GLOG_AND_GFLAGS +#include // for DLOG +#else +#include +#endif + + +Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath) { #if USE_OPENSSL_FALLBACK #else // GnuTLS gnutls_global_init(); #endif - readPublicKeyFromPEM(pemFilePath); + if (!readPublicKeyFromCRT(certFilePath)) + { + readPublicKeyFromPEM(PEMFILE_DEFAULT); + } read_merkle_xml(merkleTreePath); } @@ -69,10 +80,10 @@ Gnss_Crypto::~Gnss_Crypto() } #endif #else // GnuTLS - if (d_PublicKey != NULL) + if (d_PublicKey != nullptr) { gnutls_pubkey_deinit(d_PublicKey); - d_PublicKey = NULL; + d_PublicKey = nullptr; } gnutls_global_deinit(); #endif @@ -145,11 +156,11 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) std::string signalVersion = galHeader.child("signalVersion").text().get(); std::string dataVersion = galHeader.child("dataVersion").text().get(); - std::cout << " Source: " << source.child_value("mission") << " - " << source.child_value("segment") << " - " << source.child_value("element") << std::endl; - std::cout << " Destination: " << destination.child_value("mission") << " - " << destination.child_value("segment") << " - " << destination.child_value("element") << std::endl; - std::cout << " Issue Date: " << issueDate << std::endl; - std::cout << " Signal Version: " << signalVersion << std::endl; - std::cout << " Data Version: " << dataVersion << std::endl; + LOG(INFO) << "OSNMA Merkletree - Source: " << source.child_value("mission") << " - " << source.child_value("segment") << " - " << source.child_value("element"); + LOG(INFO) << "OSNMA Merkletree - Destination: " << destination.child_value("mission") << " - " << destination.child_value("segment") << " - " << destination.child_value("element"); + LOG(INFO) << "OSNMA Merkletree - Issue Date: " << issueDate; + LOG(INFO) << "OSNMA Merkletree - Signal Version: " << signalVersion; + LOG(INFO) << "OSNMA Merkletree - Data Version: " << dataVersion; // Accessing data from the body pugi::xml_node merkleTree = body.child("MerkleTree"); @@ -157,8 +168,8 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) int n = std::stoi(merkleTree.child_value("N")); std::string hashFunction = merkleTree.child_value("HashFunction"); - std::cout << " N: " << n << std::endl; - std::cout << " Hash Function: " << hashFunction << std::endl; + LOG(INFO) << "OSNMA Merkletree - N: " << n; + LOG(INFO) << "OSNMA Merkletree - Hash Function: " << hashFunction; for (pugi::xml_node publicKey : merkleTree.children("PublicKey")) { @@ -168,21 +179,21 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) std::string point = publicKey.child_value("point"); std::string pkType = publicKey.child_value("PKType"); - std::cout << " Public Key: " << i << std::endl; - std::cout << " PKID: " << pkid << std::endl; - std::cout << " Length in Bits: " << lengthInBits << std::endl; - std::cout << " Point: " << point << std::endl; - std::cout << " PK Type: " << pkType << std::endl; + LOG(INFO) << "OSNMA Merkletree - Public Key: " << i; + LOG(INFO) << "OSNMA Merkletree - PKID: " << pkid; + LOG(INFO) << "OSNMA Merkletree - Length in Bits: " << lengthInBits; + LOG(INFO) << "OSNMA Merkletree - Point: " << point; + LOG(INFO) << "OSNMA Merkletree - PK Type: " << pkType; } for (pugi::xml_node treeNode : merkleTree.children("TreeNode")) { int j = std::stoi(treeNode.child_value("j")); int i = std::stoi(treeNode.child_value("i")); int lengthInBits = std::stoi(treeNode.child_value("lengthInBits")); - std::cout << " Node length (bits): " << lengthInBits << std::endl; + LOG(INFO) << "OSNMA Merkletree - Node length (bits): " << lengthInBits; std::string x_ji = treeNode.child_value("x_ji"); - std::cout << " Size string (bytes): " << x_ji.size() << std::endl; - std::cout << " m_" << j << "_" << i << " = " << x_ji << std::endl; + LOG(INFO) << "OSNMA Merkletree - Size string (bytes): " << x_ji.size(); + LOG(INFO) << "OSNMA Merkletree - m_" << j << "_" << i << " = " << x_ji; if (j == 4 && i == 0) { d_x_4_0 = convert_from_hex_str(x_ji); @@ -220,7 +231,8 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) d_x_0_1 = convert_from_hex_str("AA1A8B68E5DB293106B5BC8806F9790E8ACF8DC2D28A6EF6C1AC7233A9813D3F"); return; } - std::cout << "Merkle Tree successfully read from file " << merkleFilePath << std::endl; + std::cout << "OSNMA Merkle Tree successfully read from file " << merkleFilePath << std::endl; + LOG(INFO) << "OSNMA Merkle Tree successfully read from file " << merkleFilePath; } @@ -451,7 +463,8 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) BIO_free(bio); if (d_PublicKey == nullptr) { - std::cerr << "OpenSSL: error reading the Public Key from file " << pemFilePath << ". Aborting import" << std::endl; + std::cerr << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import" << std::endl; + LOG(INFO) << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import"; return; } #else // GnuTLS @@ -464,17 +477,105 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) if (ret != GNUTLS_E_SUCCESS) { gnutls_pubkey_deinit(pubkey); - std::cerr << "GnuTLS: error reading the Public Key from file " + std::cerr << "GnuTLS: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import" << std::endl; std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; + LOG(INFO) << "GnuTLS: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import"; return; } pubkey_copy(pubkey, &d_PublicKey); gnutls_pubkey_deinit(pubkey); #endif - std::cout << "Public key successfully read from file " << pemFilePath << std::endl; + std::cout << "OSNMA Public key successfully read from file " << pemFilePath << std::endl; + LOG(INFO) << "OSNMA Public key successfully read from file " << pemFilePath; +} + + +bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) +{ +#if USE_OPENSSL_FALLBACK + // Open the .crt file + std::ifstream crtFile(crtFilePath, std::ios::binary); + if (!crtFile.is_open()) + { + std::cerr << "Unable to open file: " << crtFilePath << std::endl; + return false; + } + + // Read certificate + std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); + BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); + if (!bio) + { + std::cerr << "Unable to create BIO for file: " << crtFilePath << std::endl; + return false; + } + X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); + if (!cert) + { + std::cerr << "Unable to read certificate from file: " << crtFilePath << std::endl; + BIO_free(bio); + return false; + } + + // Read the public key from the certificate + EVP_PKEY* pubkey = X509_get_pubkey(cert); + if (!pubkey) + { + std::cerr << "Failed to extract the public key" << std::endl; + X509_free(cert); + return false; + } + pubkey_copy(pubkey, &d_PublicKey); + EVP_PKEY_free(pubkey); + BIO_free(bio); + X509_free(cert); +#else // GnuTLS + // Open the .crt file + std::ifstream crtFile(crtFilePath, std::ios::binary); + if (!crtFile.is_open()) + { + // CRT file not found + // If it was not the default, maybe it is a configuration error + if (crtFilePath != CRTFILE_DEFAULT) + { + std::cerr << "File " << crtFilePath << " not found" << std::endl; + } + return false; + } + + std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); + + gnutls_x509_crt_t cert; + gnutls_x509_crt_init(&cert); + int ret = gnutls_x509_crt_import(cert, (const gnutls_datum_t*)&buffer, GNUTLS_X509_FMT_PEM); + if (ret < 0) + { + std::cerr << "Failed to import certificate: " << gnutls_strerror(ret) << std::endl; + gnutls_x509_crt_deinit(cert); + return false; + } + + gnutls_pubkey_t pubkey; + gnutls_pubkey_init(&pubkey); + + ret = gnutls_pubkey_import_x509(pubkey, cert, 0); + if (ret < 0) + { + std::cerr << "Failed to import public key: " << gnutls_strerror(ret) << std::endl; + gnutls_pubkey_deinit(pubkey); + gnutls_x509_crt_deinit(cert); + return false; + } + pubkey_copy(pubkey, &d_PublicKey); + gnutls_x509_crt_deinit(cert); + gnutls_pubkey_deinit(pubkey); +#endif + std::cout << "OSNMA Public key successfully read from file " << crtFilePath << std::endl; + LOG(INFO) << "OSNMA Public key successfully read from file " << crtFilePath; + return true; } @@ -551,18 +652,21 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st if (verification == 1) { success = true; + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; } else { unsigned long errCode = ERR_get_error(); - char* err = ERR_error_string(errCode, NULL); - std::cerr << "OpenSSL: message authentication failed: " << err << std::endl; + char* err = ERR_error_string(errCode, nullptr); + std::cerr << "OpenSSL: OSNMA message authentication failed: " << err << std::endl; + LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; } #else int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, signature.data(), static_cast(signature.size()), d_PublicKey); if (verification == 1) { success = true; + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; } else if (verification == 0) { @@ -570,9 +674,9 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } else { - std::cerr << "OpenSSL: message authentication failed" << std::endl; + std::cerr << "OpenSSL: OSNMA message authentication failed" << std::endl; + LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; } - #endif #else // GnuTLS // Convert signature to DER format @@ -590,9 +694,14 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st // Verify the DER-encoded signature int ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &digest_data, &der_sig_data); success = (ret >= 0); - if (!success) + if (success) { - std::cerr << "GnuTLS: message authentication failed: " << gnutls_strerror(ret) << std::endl; + LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + } + else + { + std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; + LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); } #endif return success; @@ -638,8 +747,8 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector& publicKey) { #if USE_OPENSSL_FALLBACK - BIO* bio = NULL; - EVP_PKEY* pkey = NULL; + BIO* bio = nullptr; + EVP_PKEY* pkey = nullptr; bio = BIO_new_mem_buf(publicKey.data(), publicKey.size()); if (!bio) { @@ -647,12 +756,13 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) return; } - pkey = PEM_read_bio_PUBKEY(bio, NULL, NULL, NULL); + pkey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); BIO_free(bio); if (!pkey) { - std::cerr << "OpenSSL: error setting the public key." << std::endl; + std::cerr << "OpenSSL: error setting the OSNMA public key." << std::endl; + LOG(INFO) << "OpenSSL: error setting the OSNMA public key."; return; } @@ -677,6 +787,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) pubkey_copy(pubkey, &d_PublicKey); gnutls_pubkey_deinit(pubkey); #endif + LOG(INFO) << "OSNMA Public Key successfully set up."; } @@ -685,7 +796,7 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) { // Open a memory buffer BIO* mem_bio = BIO_new(BIO_s_mem()); - if (mem_bio == NULL) + if (mem_bio == nullptr) { return false; } @@ -703,15 +814,15 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) // Create a new memory buffer and load the data into it BIO* mem_bio2 = BIO_new_mem_buf(bio_data, data_len); - if (mem_bio2 == NULL) + if (mem_bio2 == nullptr) { BIO_free(mem_bio); return false; } // Read the public key from the new memory buffer - *dest = PEM_read_bio_PUBKEY(mem_bio2, NULL, NULL, NULL); - if (*dest == NULL) + *dest = PEM_read_bio_PUBKEY(mem_bio2, nullptr, nullptr, nullptr); + if (*dest == nullptr) { BIO_free(mem_bio); BIO_free(mem_bio2); diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 41341d981..e8b41fddd 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -36,12 +36,9 @@ class Gnss_Crypto { public: - Gnss_Crypto() = default; + Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); ~Gnss_Crypto(); - Gnss_Crypto(const std::string& pemFilePath, const std::string& merkleTreePath); - void readPublicKeyFromPEM(const std::string& pemFilePath); - void read_merkle_xml(const std::string& merkleFilePath); void set_public_key(const std::vector& publickey); bool have_public_key() const; bool verify_signature(const std::vector& message, const std::vector& signature) const; @@ -57,6 +54,9 @@ public: } private: + void read_merkle_xml(const std::string& merkleFilePath); + void readPublicKeyFromPEM(const std::string& pemFilePath); + bool readPublicKeyFromCRT(const std::string& crtFilePath); std::vector convert_from_hex_str(const std::string& input) const; #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 From 8dfd341d2c01dec6b41ee2c5fb88296c0a64a9cd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 23 Jun 2024 11:10:40 +0200 Subject: [PATCH 198/499] Fix tests building --- src/tests/CMakeLists.txt | 54 +-- src/tests/single_test_main.cc | 3 +- src/tests/test_main.cc | 2 +- .../osnma/gnss_crypto_test.cc | 304 ++++++++------- .../osnma/osnma_msg_receiver_test.cc | 362 ++++++++---------- 5 files changed, 322 insertions(+), 403 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 97bbac838..8de611f5f 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1344,52 +1344,14 @@ else() endif() endif() -######################################################### gnss_crypto_test - -if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) - set(GNSS_CRYPTO_TEST_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc - ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc) - - if(USE_CMAKE_TARGET_SOURCES) - add_executable(gnss_crypto_test) - target_sources(gnss_crypto_test PRIVATE ${GNSS_CRYPTO_TEST_SOURCES}) - else() - add_executable(gnss_crypto_test ${GNSS_CRYPTO_TEST_SOURCES}) - endif() - - target_link_libraries(gnss_crypto_test - PRIVATE - Boost::thread - GTest::GTest - GTest::Main - core_system_parameters - Pugixml::pugixml - ) - if(ENABLE_GLOG_AND_GFLAGS) - target_link_libraries(gnss_crypto_test PRIVATE Gflags::gflags Glog::glog) - target_compile_definitions(gnss_crypto_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) - else() - target_link_libraries(gnss_crypto_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) - endif() - - target_include_directories(gnss_crypto_test - PRIVATE - ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) - - xcode_remove_warning_duplicates(gnss_crypto_test) # TODO - unsure if needed - - add_test(gnss_crypto_test gnss_crypto_test) - - set_property(TEST gnss_crypto_test PROPERTY TIMEOUT 1) -endif() ######################################################### osnma_msg_receiver_test if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) set(OSNMA_MSG_RECEIVER_TEST_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc - ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc) + ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc + ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc + ) if(USE_CMAKE_TARGET_SOURCES) add_executable(osnma_msg_receiver_test) @@ -1399,7 +1361,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) endif() target_link_libraries(osnma_msg_receiver_test - PRIVATE + PRIVATE + gnss_sdr_flags Boost::thread GTest::GTest GTest::Main @@ -1416,11 +1379,12 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) add_test(osnma_msg_receiver_test osnma_msg_receiver_test) - set_property(TEST osnma_msg_receiver_test PROPERTY TIMEOUT 1) + set_property(TEST osnma_msg_receiver_test PROPERTY TIMEOUT 30) target_include_directories(osnma_msg_receiver_test - PRIVATE - ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters) + PRIVATE + ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters + ) endif() if(ENABLE_BENCHMARKS) diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index beece7581..c0a6e1dee 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -19,6 +19,7 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" +#include "gnss_sdr_flags.h" #include #include #include @@ -36,7 +37,6 @@ using namespace google; DECLARE_string(log_dir); #endif #else -#include "gnss_sdr_flags.h" #include #include #include @@ -44,7 +44,6 @@ DECLARE_string(log_dir); #include #include #include - class TestLogSink : public absl::LogSink { public: diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 8611d44b8..7990ca258 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -113,7 +113,7 @@ private: #include "unit-tests/signal-processing-blocks/adapter/pass_through_test.cc" #include "unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc" #include "unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc" -#include "unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc" +// #include "unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc" #include "unit-tests/signal-processing-blocks/pvt/geohash_test.cc" #include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc" diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index a72d86998..a80ef055a 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -1,192 +1,186 @@ -#include #include "gnss_crypto.h" +#include class GnssCryptoTest : public ::testing::Test { - }; -TEST(GnssCryptoTest, VerifySignature) { - // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" - std::unique_ptr d_crypto = std::make_unique(); - -// RG example - import crt certificate - result: FAIL -std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; -std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; -std::vector publicKey { // PEM format - 1000 bits - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - - 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, - - 0x0A, - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; - - // own ECDSA-P256 key and message generated and signed and verified successfully with openssl -// std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) -// std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, -// 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, -// 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK - // raw r and s values -// std::vector signature = { -// 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, -// 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, -// 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, -// 0xA5, 0xB9, 0xB2, 0x56 }; - - // std::vector publicKey{// PK associated to the PrK, in der format ---test -// 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4A, 0xF3, -// 0xEE, 0x3A, 0x94, 0x25, 0x25, 0x3D, 0x55, 0xC2, 0x5A, 0xC2, 0x2D, 0xCF, 0x14, 0x4D, 0x39, 0x0D, 0xB1, 0xFC, 0x7F, 0x31, 0x5A, 0x2A, 0x19, 0xAE, 0x4E, 0xD6, 0xCB, 0xA6, 0x59, -// 0xD6, 0x99, 0x7C, 0xE8, 0xBD, 0x1F, 0x43, 0x34, 0x1C, 0x59, 0xD9, 0xD9, 0xCA, 0xC3, 0xEE, 0x58, 0xE5, 0xEA, 0xD3, 0x55, 0x44, 0xEA, 0x89, 0x71, 0x65, 0xD0, 0x92, 0x72, 0xA2, -// 0xC8, 0x3C, 0x87, 0x5D }; -// std::vector publicKey{ // PK associated to the PrK, in pem format -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, -// -// 0x4D, 0x46, -// 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, -// 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, -// 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, -// 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, -// 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, -// -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, -// 0x2D, 0x2D, 0x2D, 0x0A }; - - // own key - GnuTLS error: The curve is unsupported... x192 EC unsupported?? - // std::vector message = {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64 }; // hello world - // std::vector signature = {0x30, 0x34, 0x02, 0x18, 0x4F, 0xAC, 0x9C, 0x5A, 0x44, 0xCF, 0xFD, 0x42, 0x6A, 0x58, 0x97, 0xA4, 0x94, 0x53, 0x2C, 0x79, 0xD1, 0x7B, 0x8B, 0xF9, 0x93, 0x03, 0xA2, 0xAF, 0x02, 0x18, 0x46, 0xF2, 0xF3, 0xCF, 0x9A, 0x23, 0x39, 0xB4, 0x25, 0x11, 0x89, 0x9A, 0x44, 0x7E, 0x2F, 0xB1, 0xE1, 0x58, 0xAF, 0xCE, 0xC1,0xB4, 0xA1, 0x38 }; - // std::vector publicKey = { - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x45, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x49, 0x44, 0x4D, 0x67, 0x41, 0x45, 0x51, 0x55, 0x61, 0x30, 0x6C, 0x38, 0x4D, 0x35, 0x76, 0x50, 0x58, 0x2B, 0x74, 0x4A, 0x76, 0x63, 0x4C, 0x2B, 0x45, 0x45, 0x4C, 0x34, 0x6E, 0x71, 0x79, 0x75, 0x53, 0x43, 0x0A, 0x4D, 0x4E, 0x46, 0x4A, 0x64, 0x43, 0x5A, 0x62, 0x62, 0x58, - // 0x35, 0x70, 0x4D, 0x36, 0x69, 0x4C, 0x52, 0x53, 0x30, 0x43, 0x51, 0x59, 0x45, 0x67, 0x56, 0x47, 0x51, 0x6B, 0x65, 0x75, 0x74, 0x74, 0x35, 0x78, 0x2F, 0x45, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, - // 0x0A }; - // std::vector ecparam = { - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51, 0x4D, 0x42, 0x41, 0x67, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, - // 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; - - d_crypto->set_public_key(publicKey); - bool result = d_crypto->verify_signature(message, signature); - - ASSERT_TRUE(result); - -//TEST(GnssCryptoTest, sha256Test) -//{ -// std::unique_ptr d_crypto; -// -// auto str = "Hello World!"; -// std::vector input (str, str + strlen(str)); -// -// auto expectedOutputStr = "86933b0b147ac4c010266b99004158fa17937db89a03dd7bb2ca5ef7f43c325a"; -// std::vector expectedOutput(expectedOutputStr, expectedOutputStr + strlen(expectedOutputStr)); -// -// std::vector computedOutput = d_crypto->computeSHA256(input); -// -// ASSERT_TRUE(computedOutput == expectedOutput - } - - -TEST(GnssCryptoTest,VerifyPubKeyImport) +TEST(GnssCryptoTest, VerifySignature) { // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" - std::unique_ptr d_crypto = std::make_unique(); + const std::string fake("fake"); + std::unique_ptr d_crypto = std::make_unique(fake, fake); + + // RG example - import crt certificate - result: FAIL + std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; + std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; + std::vector publicKey{// PEM format - 1000 bits + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, + 0x0A, + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + + // own ECDSA-P256 key and message generated and signed and verified successfully with openssl + // std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) + // std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, + // 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, + // 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK + // raw r and s values + // std::vector signature = { + // 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, + // 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, + // 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, + // 0xA5, 0xB9, 0xB2, 0x56 }; + + // std::vector publicKey{// PK associated to the PrK, in der format ---test + // 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4A, 0xF3, + // 0xEE, 0x3A, 0x94, 0x25, 0x25, 0x3D, 0x55, 0xC2, 0x5A, 0xC2, 0x2D, 0xCF, 0x14, 0x4D, 0x39, 0x0D, 0xB1, 0xFC, 0x7F, 0x31, 0x5A, 0x2A, 0x19, 0xAE, 0x4E, 0xD6, 0xCB, 0xA6, 0x59, + // 0xD6, 0x99, 0x7C, 0xE8, 0xBD, 0x1F, 0x43, 0x34, 0x1C, 0x59, 0xD9, 0xD9, 0xCA, 0xC3, 0xEE, 0x58, 0xE5, 0xEA, 0xD3, 0x55, 0x44, 0xEA, 0x89, 0x71, 0x65, 0xD0, 0x92, 0x72, 0xA2, + // 0xC8, 0x3C, 0x87, 0x5D }; + // std::vector publicKey{ // PK associated to the PrK, in pem format + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + // + // 0x4D, 0x46, + // 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, + // 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, + // 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, + // 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, + // 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, + // + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, + // 0x2D, 0x2D, 0x2D, 0x0A }; + + // own key - GnuTLS error: The curve is unsupported... x192 EC unsupported?? + // std::vector message = {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64 }; // hello world + // std::vector signature = {0x30, 0x34, 0x02, 0x18, 0x4F, 0xAC, 0x9C, 0x5A, 0x44, 0xCF, 0xFD, 0x42, 0x6A, 0x58, 0x97, 0xA4, 0x94, 0x53, 0x2C, 0x79, 0xD1, 0x7B, 0x8B, 0xF9, 0x93, 0x03, 0xA2, 0xAF, 0x02, 0x18, 0x46, 0xF2, 0xF3, 0xCF, 0x9A, 0x23, 0x39, 0xB4, 0x25, 0x11, 0x89, 0x9A, 0x44, 0x7E, 0x2F, 0xB1, 0xE1, 0x58, 0xAF, 0xCE, 0xC1,0xB4, 0xA1, 0x38 }; + // std::vector publicKey = { + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x45, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x49, 0x44, 0x4D, 0x67, 0x41, 0x45, 0x51, 0x55, 0x61, 0x30, 0x6C, 0x38, 0x4D, 0x35, 0x76, 0x50, 0x58, 0x2B, 0x74, 0x4A, 0x76, 0x63, 0x4C, 0x2B, 0x45, 0x45, 0x4C, 0x34, 0x6E, 0x71, 0x79, 0x75, 0x53, 0x43, 0x0A, 0x4D, 0x4E, 0x46, 0x4A, 0x64, 0x43, 0x5A, 0x62, 0x62, 0x58, + // 0x35, 0x70, 0x4D, 0x36, 0x69, 0x4C, 0x52, 0x53, 0x30, 0x43, 0x51, 0x59, 0x45, 0x67, 0x56, 0x47, 0x51, 0x6B, 0x65, 0x75, 0x74, 0x74, 0x35, 0x78, 0x2F, 0x45, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, + // 0x0A }; + // std::vector ecparam = { + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51, 0x4D, 0x42, 0x41, 0x67, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, + // 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; + + d_crypto->set_public_key(publicKey); + bool result = d_crypto->verify_signature(message, signature); + + ASSERT_TRUE(result); +} +// TEST(GnssCryptoTest, sha256Test) +//{ +// std::unique_ptr d_crypto; +// +// auto str = "Hello World!"; +// std::vector input (str, str + strlen(str)); +// +// auto expectedOutputStr = "86933b0b147ac4c010266b99004158fa17937db89a03dd7bb2ca5ef7f43c325a"; +// std::vector expectedOutput(expectedOutputStr, expectedOutputStr + strlen(expectedOutputStr)); +// +// std::vector computedOutput = d_crypto->computeSHA256(input); +// +// ASSERT_TRUE(computedOutput == expectedOutput + + +TEST(GnssCryptoTest, VerifyPubKeyImport) +{ + // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" + const std::string fake("fake"); + std::unique_ptr d_crypto = std::make_unique(fake, fake); // RG example - key is raw 520 bits example shown - // std::vector publicKey = { // base64 decoding error - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - // - // 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, - // 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, - // 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, - // 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, 0x47, 0x49, - // - // 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A - // - // }; + // std::vector publicKey = { // base64 decoding error + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + // + // 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, + // 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, + // 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, + // 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, 0x47, 0x49, + // + // 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A + // + // }; // RG example crt exported and convert PK.pem - key is raw 1000 bits ,..., why mismatch!? does key get truncated? - // std::vector publicKey { - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; + // std::vector publicKey { + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; // own ECDSA P 256 public key and own message generated (2024-02-19-Own-Key-ECDSA-openssl) - std::vector publicKey{ // PEM + std::vector publicKey{// PEM 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - 0x2D, 0x2D, 0x2D, 0x0A }; + 0x2D, 0x2D, 0x2D, 0x0A}; d_crypto->set_public_key(publicKey); ASSERT_TRUE(d_crypto->have_public_key()); - - - - - - // std::vector publicKey = { // DER format -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, -// 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, -// 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x30, 0x82, 0x02, 0x6C, 0x30, 0x82, 0x02, 0x12, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47, 0xC4, 0xF1, 0x43, 0xC3, 0xFA, 0x61, 0xA5, 0x29, 0x4E, 0x63, -// 0xD5, 0x57, 0x2B, 0x01, 0x62, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x37, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x18, 0x30, -// 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x45, 0x55, 0x53, 0x50, 0x41, 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x49, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x33, 0x30, 0x37, 0x32, 0x30, 0x31, 0x31, 0x32, 0x32, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x35, 0x30, 0x38, 0x30, 0x38, 0x31, 0x31, 0x33, -// 0x33, 0x30, 0x30, 0x5A, 0x30, 0x3A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x12, 0x45, 0x55, 0x53, 0x50, 0x41, -// 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x45, 0x45, 0x20, 0x50, 0x4B, 0x52, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, -// 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, -// 0x47, 0x49, 0xA3, 0x81, 0xFC, 0x30, 0x81, 0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6A, 0x22, 0x16, 0x58, 0x9B, 0x23, 0xC9, 0x43, 0x41, 0x3C, 0xB6, 0xF8, 0x9D, 0x93, 0x0F, 0xE0, 0xFE, 0x6A, 0x3C, 0x54, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, -// 0x14, 0x20, 0xC0, 0x54, 0x85, 0xAF, 0x82, 0xAE, 0x96, 0x3C, 0xBC, 0xDF, 0xC1, 0xB9, 0x05, 0xDE, 0xD7, 0x46, 0x72, 0x32, 0xA3, 0x30, 0x63, 0x06, 0x03, 0x55, 0x1D, 0x20, 0x04, 0x5C, 0x30, 0x5A, 0x30, 0x4E, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0xD5, 0x11, 0x01, 0x01, 0x01, 0x30, 0x3F, 0x30, 0x3D, -// 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, -// 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x08, 0x06, 0x06, 0x04, 0x00, 0x8F, 0x7A, 0x01, 0x02, 0x30, 0x42, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x3B, 0x30, 0x39, 0x30, 0x37, 0xA0, 0x35, 0xA0, 0x33, 0x86, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, -// 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, -// 0x07, 0x80, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xE9, 0xBB, 0x90, 0x8E, 0xE5, 0x0C, 0xF3, 0xDA, 0x57, 0x71, 0xE3, 0xD0, 0xD2, 0xEA, 0xAC, 0x1B, 0x00, 0xF3, 0x51, 0xE9, 0xD8, 0xBB, 0x0A, 0xB2, 0x4C, 0x8A, 0x65, 0x52, 0x79, -// 0x9F, 0x43, 0xF6, 0x02, 0x20, 0x10, 0x65, 0x2F, 0x6A, 0xF8, 0x26, 0x20, 0x42, 0xFF, 0x09, 0x6B, 0xD0, 0x8D, 0x0B, 0x75, 0x15, 0x24, 0xBF, 0xE4, 0xFE, 0x60, 0xC3, 0x6E, 0x2D, 0x31, 0x32, 0xED, 0x65, 0x6C, 0x5C, 0x8B, 0x14 }; - -// std::vector publicKey= { // PEM format -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, -// 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, -// 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, -// 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x30, 0x82, 0x02, 0x6C, 0x30, 0x82, 0x02, 0x12, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47, 0xC4, 0xF1, 0x43, 0xC3, 0xFA, 0x61, 0xA5, 0x29, 0x4E, 0x63, + // 0xD5, 0x57, 0x2B, 0x01, 0x62, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x37, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x18, 0x30, + // 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x45, 0x55, 0x53, 0x50, 0x41, 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x49, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x33, 0x30, 0x37, 0x32, 0x30, 0x31, 0x31, 0x32, 0x32, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x35, 0x30, 0x38, 0x30, 0x38, 0x31, 0x31, 0x33, + // 0x33, 0x30, 0x30, 0x5A, 0x30, 0x3A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x12, 0x45, 0x55, 0x53, 0x50, 0x41, + // 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x45, 0x45, 0x20, 0x50, 0x4B, 0x52, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, + // 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, + // 0x47, 0x49, 0xA3, 0x81, 0xFC, 0x30, 0x81, 0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6A, 0x22, 0x16, 0x58, 0x9B, 0x23, 0xC9, 0x43, 0x41, 0x3C, 0xB6, 0xF8, 0x9D, 0x93, 0x0F, 0xE0, 0xFE, 0x6A, 0x3C, 0x54, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, + // 0x14, 0x20, 0xC0, 0x54, 0x85, 0xAF, 0x82, 0xAE, 0x96, 0x3C, 0xBC, 0xDF, 0xC1, 0xB9, 0x05, 0xDE, 0xD7, 0x46, 0x72, 0x32, 0xA3, 0x30, 0x63, 0x06, 0x03, 0x55, 0x1D, 0x20, 0x04, 0x5C, 0x30, 0x5A, 0x30, 0x4E, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0xD5, 0x11, 0x01, 0x01, 0x01, 0x30, 0x3F, 0x30, 0x3D, + // 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, + // 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x08, 0x06, 0x06, 0x04, 0x00, 0x8F, 0x7A, 0x01, 0x02, 0x30, 0x42, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x3B, 0x30, 0x39, 0x30, 0x37, 0xA0, 0x35, 0xA0, 0x33, 0x86, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, + // 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, + // 0x07, 0x80, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xE9, 0xBB, 0x90, 0x8E, 0xE5, 0x0C, 0xF3, 0xDA, 0x57, 0x71, 0xE3, 0xD0, 0xD2, 0xEA, 0xAC, 0x1B, 0x00, 0xF3, 0x51, 0xE9, 0xD8, 0xBB, 0x0A, 0xB2, 0x4C, 0x8A, 0x65, 0x52, 0x79, + // 0x9F, 0x43, 0xF6, 0x02, 0x20, 0x10, 0x65, 0x2F, 0x6A, 0xF8, 0x26, 0x20, 0x42, 0xFF, 0x09, 0x6B, 0xD0, 0x8D, 0x0B, 0x75, 0x15, 0x24, 0xBF, 0xE4, 0xFE, 0x60, 0xC3, 0x6E, 0x2D, 0x31, 0x32, 0xED, 0x65, 0x6C, 0x5C, 0x8B, 0x14 }; + // std::vector publicKey= { // PEM format + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, + // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; } + // Unit test for computeHMAC_SHA_256 function. -TEST(GnssCryptoTest, TestComputeHMACSHA256) { // key and message generated with openssl - std::unique_ptr d_crypto = std::make_unique(); +TEST(GnssCryptoTest, TestComputeHMACSHA256) +{ + // key and message generated with openssl + const std::string fake("fake"); + std::unique_ptr d_crypto = std::make_unique(fake, fake); std::vector key = { - 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, - 0x7D, 0x48, 0xE7, 0xF1, 0x48, 0x0C, 0xC2, 0x98, - 0xEB, 0x62, 0x3E, 0x95, 0x6B, 0x2B, 0xCE, 0xA3, - 0xB4, 0xD4, 0xDB, 0x31, 0xEE, 0x96, 0xAB, 0xFA }; + 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, + 0x7D, 0x48, 0xE7, 0xF1, 0x48, 0x0C, 0xC2, 0x98, + 0xEB, 0x62, 0x3E, 0x95, 0x6B, 0x2B, 0xCE, 0xA3, + 0xB4, 0xD4, 0xDB, 0x31, 0xEE, 0x96, 0xAB, 0xFA}; - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world con 0x0A std::vector expected_output = { - 0xC3, 0x51, 0xF6, 0xFD, 0xDD, 0xC9, 0x8B, 0x41, - 0xD6, 0xF4, 0x77, 0x6D, 0xAC, 0xE8, 0xE0, 0x14, - 0xB2, 0x7A, 0xCC, 0x22, 0x00, 0xAA, 0xD2, 0x37, - 0xD0, 0x79, 0x06, 0x12, 0x83, 0x40, 0xB7, 0xA6 }; - + 0xC3, 0x51, 0xF6, 0xFD, 0xDD, 0xC9, 0x8B, 0x41, + 0xD6, 0xF4, 0x77, 0x6D, 0xAC, 0xE8, 0xE0, 0x14, + 0xB2, 0x7A, 0xCC, 0x22, 0x00, 0xAA, 0xD2, 0x37, + 0xD0, 0x79, 0x06, 0x12, 0x83, 0x40, 0xB7, 0xA6}; std::vector output = d_crypto->computeHMAC_SHA_256(key, message); ASSERT_EQ(expected_output, output); - - } -TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) { // key and message generated from RG A.6.5.1 - std::unique_ptr d_crypto = std::make_unique(); - std::vector key = { // RG K4 @ 345690 + +TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) +{ // key and message generated from RG A.6.5.1 + const std::string fake("fake"); + std::unique_ptr d_crypto = std::make_unique(fake, fake); + std::vector key = {// RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; @@ -207,15 +201,18 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) { // key and message generated fr ASSERT_EQ(expected_output, output); } -TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) { // key and message generated from RG A.6.5.2 - std::unique_ptr d_crypto = std::make_unique(); - std::vector key = { // RG K4 @ 345690 + +TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) +{ // key and message generated from RG A.6.5.2 + const std::string fake("fake"); + std::unique_ptr d_crypto = std::make_unique(fake, fake); + std::vector key = {// RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; std::vector message{ 0x02, 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x03, 0xBF, - 0xFF, 0xFF, 0xFF, 0xC0, 0x00,0x00, 0x44, 0x92, 0x38, + 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x44, 0x92, 0x38, 0x22, 0x78, 0x97, 0xFD, 0xEF, 0xF9, 0x30, 0x40}; std::vector expected_output = { @@ -223,7 +220,6 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) { // key and message generated 0xE6, 0x3F, 0xB7, 0xF4, 0xF5, 0x4D, 0x44, 0xAB, 0xEE, 0x4D, 0xCE, 0xB9, 0x3D, 0xCF, 0x65, 0xCB, 0x3A, 0x5B, 0x81, 0x4A, 0x34, 0xE9}; - std::vector output = d_crypto->computeHMAC_SHA_256(key, message); ASSERT_EQ(expected_output, output); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 226e8e892..c54d25580 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -2,7 +2,6 @@ #include #include #include -#include #include #include @@ -25,26 +24,26 @@ protected: std::string page_even; OSNMA_msg osnma_msg{}; std::array nma_position_filled; - uint32_t d_GST_SIS{}; // 16 AUG 2023 05 00 01 + uint32_t d_GST_SIS{}; // 16 AUG 2023 05 00 01 uint32_t TOW{}; uint32_t WN{}; - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0;//13 + 5; + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + const uint32_t LEAP_SECONDS = 0; // 13 + 5; void set_time(std::tm& input); -// std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; - std::string log_name {"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; - void initializeGoogleLog(); + // std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; + std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; + // void initializeGoogleLog(); void SetUp() override { - flag_CRC_test = false; // TODO what for? + flag_CRC_test = false; // TODO what for? page_even = ""; -// std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; + // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; set_time(input_time); -// std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; -// std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + // std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; + // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.pem"; std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); @@ -58,121 +57,120 @@ public: }; -TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { +TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) +{ // Arrange // ---------- osnma->d_tesla_key_verified = false; - osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 - osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 + osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; // local_time_verification would do this operation. TODO - eliminate duplication. osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); - osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; - osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. - std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 + osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 uint32_t TOW = 345630; - - - // Act // ---------- bool result = osnma->verify_tesla_key(key, TOW); - - - - // Assert // ---------- ASSERT_TRUE(result); - } + TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { - initializeGoogleLog(); + // initializeGoogleLog(); // Arrange // ---------- -// std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); + // std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); - if (testVectors.empty()){ + if (testVectors.empty()) + { ASSERT_TRUE(false); } bool end_of_hex_stream{false}; int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240/8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; // total bytes of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES * SIZE_SUBFRAME_PAGES}; // total bytes of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; - std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; - - - + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; // Act // ---------- // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (end_of_hex_stream == false){ + while (end_of_hex_stream == false) + { // loop over all SVs, extract a subframe - for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; + for (const TestVector& tv : testVectors) + { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); std::array hkroot{}; std::array mack{}; - byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words; // structure containing and + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words; // structure containing and - for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index - std::vector page_bytes = extract_page_bytes(tv,byte_index,SIZE_PAGE_BYTES); - if(page_bytes.empty()){ - std::cout<< "OsnmaTestVectorsSimulation: end of TestVectors \n" << "byte_index="< data_k(even_page.substr(2,112)); - std::bitset<16> data_j(odd_page.substr(2,16)); + std::bitset<112> data_k(even_page.substr(2, 112)); + std::bitset<16> data_j(odd_page.substr(2, 16)); std::bitset<112> shifted_data_k = data_k; -// uint8_t word_type = 0; -// for(int i = 0; i < 6; ++i) { -// word_type |= (data_k[104 + i] << i); -// } - uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word - std::cout<< "OsnmaTestVectorsSimulation: received Word "<< static_cast(word_type) << std::endl; - if( (word_type >= 1 && word_type <=5) || word_type == 6 || word_type == 10) + // uint8_t word_type = 0; + // for(int i = 0; i < 6; ++i) { + // word_type |= (data_k[104 + i] << i); + // } + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; + if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) { // store raw word std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); words[word_type] = data_combined; } - if(word_type == DUMMY_PAGE) + if (word_type == DUMMY_PAGE) flag_dummy_page = true; // place it into osnma object. std::bitset<40> osnmaBits(odd_page.substr(18, 40)); @@ -185,12 +183,13 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) byte_index += SIZE_PAGE_BYTES; } - std::cout<< "----------" << std::endl; - if(end_of_hex_stream) + std::cout << "----------" << std::endl; + if (end_of_hex_stream) break; - if(flag_dummy_page){ + if (flag_dummy_page) + { flag_dummy_page = false; - continue; // skip this SV + continue; // skip this SV } // Fill osnma object @@ -198,8 +197,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->mack = mack; osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; - osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; - osnmaMsg_sptr->PRN = tv.svId; // PRNa + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; + osnmaMsg_sptr->PRN = tv.svId; // PRNa // TODO - refactor this logic, currently it is split @@ -210,14 +209,14 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) if (words.find(i) == words.end()) { ephClockStatusWordsReceived = false; - std::cerr<< "OsnmaTestVectorsSimulation: error parsing words 1->5. " - "Word "<< i << " should be received for each subframe but was not." << std::endl; + std::cerr << "OsnmaTestVectorsSimulation: error parsing words 1->5. " + "Word " + << i << " should be received for each subframe but was not." << std::endl; } } // extract bits as needed by osnma block - if(ephClockStatusWordsReceived) + if (ephClockStatusWordsReceived) { - // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {1, {6, 120}}, @@ -229,15 +228,15 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) }; // Fill NavData bits -- Iterate over the extraction parameters - for (const auto& param : extractionParams) { + for (const auto& param : extractionParams) + { uint8_t wordKey = param.first; uint8_t start = param.second.first; uint8_t length = param.second.second; // Extract the required bits and fill osnma block - osnmaMsg_sptr->EphemerisClockAndStatusData_2 += words[wordKey]. - to_string().substr( - start, length); + osnmaMsg_sptr->EphemerisClockAndStatusData_2 += words[wordKey].to_string().substr( + start, length); } } @@ -245,12 +244,12 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) bool timingWordsReceived = words.find(6) != words.end() && words.find(10) != words.end(); // extract bits as needed by osnma block - if(timingWordsReceived){ + if (timingWordsReceived) + { // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {6, {6, 99}}, - {10, {86, 42}} - }; + {10, {86, 42}}}; // Fill NavData bits -- Iterate over the extraction parameters for (const auto& param : extractionParams) @@ -263,27 +262,26 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->TimingData_2 += words[wordKey].to_string().substr( start, length); } - } // Call the handler, as if it came from telemetry decoder block auto temp_obj = pmt::make_any(osnmaMsg_sptr); - osnma->msg_handler_osnma(temp_obj); // osnma entry point + osnma->msg_handler_osnma(temp_obj); // osnma entry point } - if(!end_of_hex_stream){ - offset_byte = byte_index; // update offset for the next subframe + if (!end_of_hex_stream) + { + offset_byte = byte_index; // update offset for the next subframe d_GST_SIS += DURATION_SUBFRAME; TOW = d_GST_SIS & 0x000FFFFF; - WN = (d_GST_SIS & 0xFFF00000) >> 20 ; - std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS + WN = (d_GST_SIS & 0xFFF00000) >> 20; + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS << ", TOW=" << TOW << ", WN=" << WN << std::endl; } - - } @@ -293,20 +291,24 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) } + std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) { std::ifstream file(filename); std::vector testVectors; - if (!file.is_open()) { - std::cerr<<"Error reading the file \"" << filename <<"\" \n"; + if (!file.is_open()) + { + std::cerr << "Error reading the file \"" << filename << "\" \n"; return testVectors; } std::string line; std::getline(file, line); - if (line != "SVID,NumNavBits,NavBitsHEX\r" ){ - std::cerr<<"Error parsing first line" <<"\n"; - } + if (line != "SVID,NumNavBits,NavBitsHEX\r") + { + std::cerr << "Error parsing first line" + << "\n"; + } while (std::getline(file, line)) { @@ -329,23 +331,27 @@ std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std: return testVectors; } + + std::vector OsnmaMsgReceiverTest::parseNavBits(const std::string& hex) { std::vector bytes; - for (unsigned int i = 0; i < hex.length()-1; i += 2) + for (unsigned int i = 0; i < hex.length() - 1; i += 2) { std::string byteString = hex.substr(i, 2); - uint8_t byte = (uint8_t) strtol(byteString.c_str(), NULL, 16); + uint8_t byte = (uint8_t)strtol(byteString.c_str(), NULL, 16); bytes.push_back(byte); } return bytes; } + + std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes) { std::string bit_string; bit_string.reserve(bytes.size() * 8); - for(const auto& byte : bytes) + for (const auto& byte : bytes) { std::bitset<8> bits(byte); bit_string += bits.to_string(); @@ -353,6 +359,7 @@ std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes return bit_string; } + /** * @brief Extracts a range of bytes from a TestVector's navBits vector. * @@ -381,6 +388,8 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } + + /** * @brief Sets the time based on the given input. * @@ -404,118 +413,37 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) uint32_t sec_in_week = 7 * 24 * 60 * 60; uint32_t week_number = duration_sec.count() / sec_in_week; uint32_t time_of_week = duration_sec.count() % sec_in_week; - this->WN = week_number; - this->TOW = time_of_week + LEAP_SECONDS; + this->WN = week_number; + this->TOW = time_of_week + LEAP_SECONDS; // Return the week number and time of week as a pair // TODO: d_GST_SIS or d_receiver_time? doubt // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 - this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); - - -} -void OsnmaMsgReceiverTest::initializeGoogleLog() -{ - google::InitGoogleLogging(log_name.c_str()); - FLAGS_minloglevel = 0; // INFO - FLAGS_logtostderr = 0; // add this line - FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; - if (FLAGS_log_dir.empty()) - { - std::cout << "Logging will be written at " - << std::filesystem::temp_directory_path() - << '\n' - << "Use gnss-sdr --log_dir=/path/to/log to change that.\n"; - } - else - { - try - { - const std::filesystem::path p(FLAGS_log_dir); - if (!std::filesystem::exists(p)) - { - std::cout << "The path " - << FLAGS_log_dir - << " does not exist, attempting to create it.\n"; - std::error_code ec; - if (!std::filesystem::create_directory(p, ec)) - { - std::cout << "Could not create the " << FLAGS_log_dir << " folder.\n"; - gflags::ShutDownCommandLineFlags(); - throw std::runtime_error("Could not create folder for logs"); - } - } - std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; - } - catch (const std::exception& e) - { - std::cerr << e.what() << '\n'; - std::cerr << "Could not create the " << FLAGS_log_dir << " folder.\n"; - gflags::ShutDownCommandLineFlags(); - throw; - } - } + this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); } TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) { - // Arrange - // ---------- - // m0 - std::vector expected_message = { - 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, - 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, - 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, - 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, - 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 - }; - - uint32_t TOW_Tag0 = 345660; - uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; - uint32_t WN = 1248; - uint32_t PRNa = 2; - uint8_t CTR = 1; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MACK_tag_and_info MTI; - MTI.tag = static_cast(0xE37BC4F858); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x00; - MTI.tag_info.cop = 0x0F; - Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - - - // Act - // ---------- - auto computed_message = osnma->build_message(t0); - - - // Assert - // ---------- - ASSERT_TRUE(computed_message == expected_message); - -} -TEST_F(OsnmaMsgReceiverTest, TagVerification) { // Arrange // ---------- - // Tag0 + // m0 + std::vector expected_message = { + 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, + 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, + 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, + 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00}; + uint32_t TOW_Tag0 = 345660; uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; uint32_t WN = 1248; uint32_t PRNa = 2; uint8_t CTR = 1; - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; osnma->d_osnma_data.d_nma_header.nmas = 0b10; @@ -528,29 +456,62 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + // Act + // ---------- + auto computed_message = osnma->build_message(t0); + + + // Assert + // ---------- + ASSERT_TRUE(computed_message == expected_message); +} + + +TEST_F(OsnmaMsgReceiverTest, TagVerification) +{ + // Arrange + // ---------- + // Tag0 + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + // Act // ---------- bool result_tag0 = osnma->verify_tag(t0); - - - // Assert // ---------- - //ASSERT_TRUE(result_tag0); + // ASSERT_TRUE(result_tag0); // Tag3 uint32_t TOW_Tag3 = 345660; uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; - uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30 ; + uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30; WN = 1248; PRNa = 2; CTR = 3; - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = "111111111111111111111111111111110000000000000000000000010001001001001000" @@ -566,5 +527,4 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { bool result_tag3 = osnma->verify_tag(t3); ASSERT_TRUE(result_tag0 && result_tag3); - } From d4cc036cbd7866460b7de00190788286002c7f81 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 23 Jun 2024 12:03:12 +0200 Subject: [PATCH 199/499] Fix HMAC-SHA256 computation with OpenSSL > 3.0 --- src/core/system_parameters/gnss_crypto.cc | 60 ++++++++++++++++++----- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index e78e29e39..a73907e73 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -34,6 +34,7 @@ #if USE_OPENSSL_3 #include #include +#include #include #include #include @@ -315,23 +316,58 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 std::vector hmac(EVP_MAX_MD_SIZE); + size_t output_length = 0; + // Create the context for the HMAC operation + EVP_MAC* mac = EVP_MAC_fetch(nullptr, "HMAC", nullptr); + if (!mac) + { + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to fetch HMAC"; + return output; + } - // Create HMAC-SHA256 context - EVP_MD_CTX* ctx = EVP_MD_CTX_new(); - EVP_PKEY* pkey = EVP_PKEY_new_mac_key(EVP_PKEY_HMAC, nullptr, key.data(), key.size()); + EVP_MAC_CTX* ctx = EVP_MAC_CTX_new(mac); + if (!ctx) + { + EVP_MAC_free(mac); + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to create HMAC context"; + return output; + } - // Initialize HMAC-SHA256 context - EVP_DigestSignInit(ctx, nullptr, EVP_sha256(), nullptr, pkey); + // Initialize the HMAC context with the key and the SHA-256 algorithm + OSSL_PARAM params[] = { + OSSL_PARAM_construct_utf8_string(OSSL_ALG_PARAM_DIGEST, const_cast("SHA256"), 0), + OSSL_PARAM_construct_end()}; - // Compute HMAC-SHA256 - EVP_DigestSignUpdate(ctx, input.data(), input.size()); - size_t macLength; - EVP_DigestSignFinal(ctx, hmac.data(), &macLength); + if (EVP_MAC_init(ctx, key.data(), key.size(), params) <= 0) + { + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to initialize HMAC context"; + return output; + } - EVP_PKEY_free(pkey); - EVP_MD_CTX_free(ctx); + // Update the HMAC context with the input data + if (EVP_MAC_update(ctx, input.data(), input.size()) <= 0) + { + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to update HMAC context"; + return output; + } - hmac.resize(macLength); + // Finalize the HMAC and retrieve the output + if (EVP_MAC_final(ctx, hmac.data(), &output_length, hmac.size()) <= 0) + { + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to finalize HMAC"; + return output; + } + + // Clean up the HMAC context + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + hmac.resize(output_length); output = hmac; #else std::vector hmac(32); From 378820e76b654ef583b681d27cfa9230f00dc0bc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 23 Jun 2024 13:10:38 +0200 Subject: [PATCH 200/499] Add unit test for SHA3-256 hash algorithm --- .../osnma/gnss_crypto_test.cc | 75 +++++-------------- 1 file changed, 18 insertions(+), 57 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index a80ef055a..d17ae5e47 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -7,7 +7,6 @@ class GnssCryptoTest : public ::testing::Test TEST(GnssCryptoTest, VerifySignature) { - // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" const std::string fake("fake"); std::unique_ptr d_crypto = std::make_unique(fake, fake); @@ -22,66 +21,11 @@ TEST(GnssCryptoTest, VerifySignature) 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; - // own ECDSA-P256 key and message generated and signed and verified successfully with openssl - // std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // Hello world con 0x0A al final. Raw message (unhashed) - // std::vector signature{0x30, 0x45, 0x02, 0x21, 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, 0xC8, 0x93, 0x16, 0x5A, - // 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, - // 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, 0xA5, 0xB9, 0xB2, 0x56}; // Hello world hashed and then encrypted with PrK - // raw r and s values - // std::vector signature = { - // 0x00, 0xFB, 0xE6, 0x09, 0x74, 0x5C, 0x12, 0xE8, 0x2C, 0x0C, 0xC9, 0x7A, 0x8E, 0x13, 0x88, 0x87, 0xDA, 0xBF, 0x08, 0x43, 0xF8, - // 0xC8, 0x93, 0x16, 0x5A, 0x0F, 0x7A, 0xA4, 0xBF, 0x4A, 0xE1, 0xE1, 0xDB, 0x02, 0x20, 0x6B, 0xCB, 0x2F, 0x80, 0x69, 0xBB, 0xDE, - // 0xC9, 0x11, 0x1D, 0x51, 0x2B, 0x9F, 0x61, 0xA0, 0xC1, 0x29, 0xD1, 0x0B, 0x58, 0x09, 0x82, 0x58, 0xFC, 0x9E, 0x00, 0xC7, 0xEE, - // 0xA5, 0xB9, 0xB2, 0x56 }; - - // std::vector publicKey{// PK associated to the PrK, in der format ---test - // 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x4A, 0xF3, - // 0xEE, 0x3A, 0x94, 0x25, 0x25, 0x3D, 0x55, 0xC2, 0x5A, 0xC2, 0x2D, 0xCF, 0x14, 0x4D, 0x39, 0x0D, 0xB1, 0xFC, 0x7F, 0x31, 0x5A, 0x2A, 0x19, 0xAE, 0x4E, 0xD6, 0xCB, 0xA6, 0x59, - // 0xD6, 0x99, 0x7C, 0xE8, 0xBD, 0x1F, 0x43, 0x34, 0x1C, 0x59, 0xD9, 0xD9, 0xCA, 0xC3, 0xEE, 0x58, 0xE5, 0xEA, 0xD3, 0x55, 0x44, 0xEA, 0x89, 0x71, 0x65, 0xD0, 0x92, 0x72, 0xA2, - // 0xC8, 0x3C, 0x87, 0x5D }; - // std::vector publicKey{ // PK associated to the PrK, in pem format - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - // - // 0x4D, 0x46, - // 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, - // 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, - // 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, - // 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, - // 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, - // - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - // 0x2D, 0x2D, 0x2D, 0x0A }; - - // own key - GnuTLS error: The curve is unsupported... x192 EC unsupported?? - // std::vector message = {0x68, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64 }; // hello world - // std::vector signature = {0x30, 0x34, 0x02, 0x18, 0x4F, 0xAC, 0x9C, 0x5A, 0x44, 0xCF, 0xFD, 0x42, 0x6A, 0x58, 0x97, 0xA4, 0x94, 0x53, 0x2C, 0x79, 0xD1, 0x7B, 0x8B, 0xF9, 0x93, 0x03, 0xA2, 0xAF, 0x02, 0x18, 0x46, 0xF2, 0xF3, 0xCF, 0x9A, 0x23, 0x39, 0xB4, 0x25, 0x11, 0x89, 0x9A, 0x44, 0x7E, 0x2F, 0xB1, 0xE1, 0x58, 0xAF, 0xCE, 0xC1,0xB4, 0xA1, 0x38 }; - // std::vector publicKey = { - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x45, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x49, 0x44, 0x4D, 0x67, 0x41, 0x45, 0x51, 0x55, 0x61, 0x30, 0x6C, 0x38, 0x4D, 0x35, 0x76, 0x50, 0x58, 0x2B, 0x74, 0x4A, 0x76, 0x63, 0x4C, 0x2B, 0x45, 0x45, 0x4C, 0x34, 0x6E, 0x71, 0x79, 0x75, 0x53, 0x43, 0x0A, 0x4D, 0x4E, 0x46, 0x4A, 0x64, 0x43, 0x5A, 0x62, 0x62, 0x58, - // 0x35, 0x70, 0x4D, 0x36, 0x69, 0x4C, 0x52, 0x53, 0x30, 0x43, 0x51, 0x59, 0x45, 0x67, 0x56, 0x47, 0x51, 0x6B, 0x65, 0x75, 0x74, 0x74, 0x35, 0x78, 0x2F, 0x45, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, - // 0x0A }; - // std::vector ecparam = { - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x42, 0x67, 0x67, 0x71, 0x68, 0x6B, 0x6A, 0x4F, 0x50, 0x51, 0x4D, 0x42, 0x41, 0x67, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, - // 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x45, 0x43, 0x20, 0x50, 0x41, 0x52, 0x41, 0x4D, 0x45, 0x54, 0x45, 0x52, 0x53, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; - d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature(message, signature); ASSERT_TRUE(result); } -// TEST(GnssCryptoTest, sha256Test) -//{ -// std::unique_ptr d_crypto; -// -// auto str = "Hello World!"; -// std::vector input (str, str + strlen(str)); -// -// auto expectedOutputStr = "86933b0b147ac4c010266b99004158fa17937db89a03dd7bb2ca5ef7f43c325a"; -// std::vector expectedOutput(expectedOutputStr, expectedOutputStr + strlen(expectedOutputStr)); -// -// std::vector computedOutput = d_crypto->computeSHA256(input); -// -// ASSERT_TRUE(computedOutput == expectedOutput TEST(GnssCryptoTest, VerifyPubKeyImport) @@ -110,7 +54,7 @@ TEST(GnssCryptoTest, VerifyPubKeyImport) // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; // own ECDSA P 256 public key and own message generated (2024-02-19-Own-Key-ECDSA-openssl) - std::vector publicKey{// PEM + std::vector publicKey{ // PEM 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, @@ -225,4 +169,21 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) ASSERT_EQ(expected_output, output); } + +TEST(GnssCryptoTest, TestComputeSHA3_256) +{ + const std::string fake("fake"); + std::unique_ptr d_crypto = std::make_unique(fake, fake); + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world + + std::vector expected_output = { + 0xCC, 0xB8, 0xF9, 0x23, 0x5F, 0x4A, 0x93, 0x2C, 0xA0, 0xAB, + 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, + 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; + + std::vector output = d_crypto->computeSHA3_256(message); + + ASSERT_EQ(expected_output, output); +} + // TODO extend to HMAC-AES \ No newline at end of file From a704c1004472f2612e30cb82e3a9cf47deec33e6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 23 Jun 2024 13:34:57 +0200 Subject: [PATCH 201/499] Add SHA_256 unit test --- src/core/system_parameters/gnss_crypto.h | 1 + .../osnma/gnss_crypto_test.cc | 131 +++++++----------- 2 files changed, 51 insertions(+), 81 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index e8b41fddd..24d858f7d 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -36,6 +36,7 @@ class Gnss_Crypto { public: + Gnss_Crypto() = default; Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); ~Gnss_Crypto(); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index d17ae5e47..95137e21d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -5,15 +5,46 @@ class GnssCryptoTest : public ::testing::Test }; +TEST(GnssCryptoTest, TestComputeSHA_256) +{ + std::unique_ptr d_crypto = std::make_unique(); + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world + + std::vector expected_output = { + 0x18, 0x94, 0xA1, 0x9C, 0x85, 0xBA, 0x15, 0x3A, 0xCB, 0xF7, + 0x43, 0xAC, 0x4E, 0x43, 0xFC, 0x00, 0x4C, 0x89, 0x16, 0x04, 0xB2, + 0x6F, 0x8C, 0x69, 0xE1, 0xE8, 0x3E, 0xA2, 0xAF, 0xC7, 0xC4, 0x8F}; + + std::vector output = d_crypto->computeSHA256(message); + + ASSERT_EQ(expected_output, output); +} + + +TEST(GnssCryptoTest, TestComputeSHA3_256) +{ + std::unique_ptr d_crypto = std::make_unique(); + std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world + + std::vector expected_output = { + 0xCC, 0xB8, 0xF9, 0x23, 0x5F, 0x4A, 0x93, 0x2C, 0xA0, 0xAB, + 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, + 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; + + std::vector output = d_crypto->computeSHA3_256(message); + + ASSERT_EQ(expected_output, output); +} + + TEST(GnssCryptoTest, VerifySignature) { - const std::string fake("fake"); - std::unique_ptr d_crypto = std::make_unique(fake, fake); + std::unique_ptr d_crypto = std::make_unique(); - // RG example - import crt certificate - result: FAIL + // RG example - import crt certificate - result: FAIL std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - std::vector publicKey{// PEM format - 1000 bits + std::vector publicKey{ // PEM format - 1000 bits 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, @@ -30,31 +61,9 @@ TEST(GnssCryptoTest, VerifySignature) TEST(GnssCryptoTest, VerifyPubKeyImport) { - // "../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem" - const std::string fake("fake"); - std::unique_ptr d_crypto = std::make_unique(fake, fake); + std::unique_ptr d_crypto = std::make_unique(); - // RG example - key is raw 520 bits example shown - // std::vector publicKey = { // base64 decoding error - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - // - // 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, - // 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, - // 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, - // 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, 0x47, 0x49, - // - // 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A - // - // }; - - // RG example crt exported and convert PK.pem - key is raw 1000 bits ,..., why mismatch!? does key get truncated? - // std::vector publicKey { - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A } ; - // own ECDSA P 256 public key and own message generated (2024-02-19-Own-Key-ECDSA-openssl) - std::vector publicKey{ // PEM + std::vector publicKey{// PEM 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, @@ -68,39 +77,14 @@ TEST(GnssCryptoTest, VerifyPubKeyImport) d_crypto->set_public_key(publicKey); ASSERT_TRUE(d_crypto->have_public_key()); - - // std::vector publicKey = { // DER format - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x30, 0x82, 0x02, 0x6C, 0x30, 0x82, 0x02, 0x12, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x10, 0x47, 0xC4, 0xF1, 0x43, 0xC3, 0xFA, 0x61, 0xA5, 0x29, 0x4E, 0x63, - // 0xD5, 0x57, 0x2B, 0x01, 0x62, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x30, 0x37, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x18, 0x30, - // 0x16, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x0F, 0x45, 0x55, 0x53, 0x50, 0x41, 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x49, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D, 0x32, 0x33, 0x30, 0x37, 0x32, 0x30, 0x31, 0x31, 0x32, 0x32, 0x33, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x35, 0x30, 0x38, 0x30, 0x38, 0x31, 0x31, 0x33, - // 0x33, 0x30, 0x30, 0x5A, 0x30, 0x3A, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x45, 0x53, 0x31, 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x05, 0x45, 0x55, 0x53, 0x50, 0x41, 0x31, 0x1B, 0x30, 0x19, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C, 0x12, 0x45, 0x55, 0x53, 0x50, 0x41, - // 0x20, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x20, 0x45, 0x45, 0x20, 0x50, 0x4B, 0x52, 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07, 0x03, 0x42, 0x00, 0x04, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, - // 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA, 0x88, 0x68, 0x4D, 0x91, 0x8C, 0xF0, 0x27, 0x28, 0x8E, 0xBC, 0xB3, 0xF3, 0x8A, 0xFC, 0x73, 0xE0, 0xA0, 0xB9, 0x0E, 0xDA, 0x28, 0xD0, 0xF3, 0x10, 0x19, 0xC8, 0x37, 0x4F, 0x07, 0x57, - // 0x47, 0x49, 0xA3, 0x81, 0xFC, 0x30, 0x81, 0xF9, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x6A, 0x22, 0x16, 0x58, 0x9B, 0x23, 0xC9, 0x43, 0x41, 0x3C, 0xB6, 0xF8, 0x9D, 0x93, 0x0F, 0xE0, 0xFE, 0x6A, 0x3C, 0x54, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, - // 0x14, 0x20, 0xC0, 0x54, 0x85, 0xAF, 0x82, 0xAE, 0x96, 0x3C, 0xBC, 0xDF, 0xC1, 0xB9, 0x05, 0xDE, 0xD7, 0x46, 0x72, 0x32, 0xA3, 0x30, 0x63, 0x06, 0x03, 0x55, 0x1D, 0x20, 0x04, 0x5C, 0x30, 0x5A, 0x30, 0x4E, 0x06, 0x0B, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x83, 0xD5, 0x11, 0x01, 0x01, 0x01, 0x30, 0x3F, 0x30, 0x3D, - // 0x06, 0x08, 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x02, 0x01, 0x16, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, - // 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x08, 0x06, 0x06, 0x04, 0x00, 0x8F, 0x7A, 0x01, 0x02, 0x30, 0x42, 0x06, 0x03, 0x55, 0x1D, 0x1F, 0x04, 0x3B, 0x30, 0x39, 0x30, 0x37, 0xA0, 0x35, 0xA0, 0x33, 0x86, 0x31, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3A, 0x2F, 0x2F, 0x77, 0x77, 0x77, 0x2E, - // 0x67, 0x73, 0x63, 0x2D, 0x65, 0x75, 0x72, 0x6F, 0x70, 0x61, 0x2E, 0x65, 0x75, 0x2F, 0x67, 0x73, 0x63, 0x2D, 0x70, 0x72, 0x6F, 0x64, 0x75, 0x63, 0x74, 0x73, 0x2F, 0x4F, 0x53, 0x4E, 0x4D, 0x41, 0x2F, 0x50, 0x4B, 0x49, 0x2F, 0x30, 0x0E, 0x06, 0x03, 0x55, 0x1D, 0x0F, 0x01, 0x01, 0xFF, 0x04, 0x04, 0x03, 0x02, - // 0x07, 0x80, 0x30, 0x0A, 0x06, 0x08, 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x21, 0x00, 0xE9, 0xBB, 0x90, 0x8E, 0xE5, 0x0C, 0xF3, 0xDA, 0x57, 0x71, 0xE3, 0xD0, 0xD2, 0xEA, 0xAC, 0x1B, 0x00, 0xF3, 0x51, 0xE9, 0xD8, 0xBB, 0x0A, 0xB2, 0x4C, 0x8A, 0x65, 0x52, 0x79, - // 0x9F, 0x43, 0xF6, 0x02, 0x20, 0x10, 0x65, 0x2F, 0x6A, 0xF8, 0x26, 0x20, 0x42, 0xFF, 0x09, 0x6B, 0xD0, 0x8D, 0x0B, 0x75, 0x15, 0x24, 0xBF, 0xE4, 0xFE, 0x60, 0xC3, 0x6E, 0x2D, 0x31, 0x32, 0xED, 0x65, 0x6C, 0x5C, 0x8B, 0x14 }; - - // std::vector publicKey= { // PEM format - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - // 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - // 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, - // 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A }; } // Unit test for computeHMAC_SHA_256 function. TEST(GnssCryptoTest, TestComputeHMACSHA256) { - // key and message generated with openssl - const std::string fake("fake"); - std::unique_ptr d_crypto = std::make_unique(fake, fake); + std::unique_ptr d_crypto = std::make_unique(); + std::vector key = { 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, 0x7D, 0x48, 0xE7, 0xF1, 0x48, 0x0C, 0xC2, 0x98, @@ -121,14 +105,15 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256) TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) -{ // key and message generated from RG A.6.5.1 - const std::string fake("fake"); - std::unique_ptr d_crypto = std::make_unique(fake, fake); - std::vector key = {// RG K4 @ 345690 +{ + // key and message generated from RG A.6.5.1 + std::unique_ptr d_crypto = std::make_unique(); + + std::vector key = { // RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; - std::vector message{// m0 + std::vector message{ // m0 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, @@ -147,10 +132,11 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) -{ // key and message generated from RG A.6.5.2 - const std::string fake("fake"); - std::unique_ptr d_crypto = std::make_unique(fake, fake); - std::vector key = {// RG K4 @ 345690 +{ + // key and message generated from RG A.6.5.2 + std::unique_ptr d_crypto = std::make_unique(); + + std::vector key = { // RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; @@ -169,21 +155,4 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) ASSERT_EQ(expected_output, output); } - -TEST(GnssCryptoTest, TestComputeSHA3_256) -{ - const std::string fake("fake"); - std::unique_ptr d_crypto = std::make_unique(fake, fake); - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world - - std::vector expected_output = { - 0xCC, 0xB8, 0xF9, 0x23, 0x5F, 0x4A, 0x93, 0x2C, 0xA0, 0xAB, - 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, - 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; - - std::vector output = d_crypto->computeSHA3_256(message); - - ASSERT_EQ(expected_output, output); -} - // TODO extend to HMAC-AES \ No newline at end of file From 8ea75116acbcb9405b63dccdf19f010e20d64d56 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 23 Jun 2024 13:48:31 +0200 Subject: [PATCH 202/499] Fix intantiation of Gnss_Crypto() with GnuTLS --- src/core/system_parameters/gnss_crypto.cc | 9 +++++++++ src/core/system_parameters/gnss_crypto.h | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index a73907e73..06c9d6538 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -56,6 +56,15 @@ #endif +Gnss_Crypto::Gnss_Crypto() +{ +#if USE_OPENSSL_FALLBACK +#else // GnuTLS + gnutls_global_init(); +#endif +} + + Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath) { #if USE_OPENSSL_FALLBACK diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 24d858f7d..9d60c8a77 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -36,7 +36,7 @@ class Gnss_Crypto { public: - Gnss_Crypto() = default; + Gnss_Crypto(); Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); ~Gnss_Crypto(); From 584b95e62e01a44ccc7b4b80bd3f3be15d6c8b92 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 24 Jun 2024 14:01:34 +0200 Subject: [PATCH 203/499] Fix CMAC-AES implementation in OpenSSL>3.0.0. Add unit test --- src/core/system_parameters/gnss_crypto.cc | 70 +++++++++++++------ .../osnma/gnss_crypto_test.cc | 31 ++++++-- 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 06c9d6538..947b8a436 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -38,6 +38,7 @@ #include #include #include +#include #define OPENSSL_ENGINE nullptr #else #include @@ -416,35 +417,62 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke std::vector output(16); #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 - std::vector mac(EVP_MAX_MD_SIZE); // CMAC-AES output size + std::vector aux(EVP_MAX_MD_SIZE); // CMAC-AES output size + size_t output_length = 0; - EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new(); - EVP_MAC* cmac = EVP_MAC_fetch(nullptr, "CMAC-AES", nullptr); + // Create the context for the CMAC operation + EVP_MAC* mac = EVP_MAC_fetch(nullptr, "CMAC", nullptr); + if (!mac) + { + LOG(INFO) << "OSNMA CMAC-AES: Failed to fetch CMAC"; + return output; + } - EVP_MAC_CTX* cmacCtx = EVP_MAC_CTX_new(cmac); + EVP_MAC_CTX* ctx = EVP_MAC_CTX_new(mac); + if (!ctx) + { + LOG(INFO) << "OSNMA CMAC-AES: Failed to create CMAC context"; + return output; + } - OSSL_PARAM params[4]; - params[0] = OSSL_PARAM_construct_utf8_string("key", (char*)key.data(), key.size()); - params[1] = OSSL_PARAM_construct_octet_string("iv", nullptr, 0); // Set IV to nullptr - params[2] = OSSL_PARAM_construct_octet_string("aad", nullptr, 0); // Set AAD to nullptr - params[3] = OSSL_PARAM_construct_end(); + // Initialize the CMAC context with the key and the AES algorithm + OSSL_PARAM params[] = { + OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER, const_cast("AES-128-CBC"), 0), + OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, const_cast(key.data()), key.size()), + OSSL_PARAM_construct_end()}; - // Set AES-128 CMAC cipher and key - EVP_MAC_init(cmacCtx, nullptr, 0, params); + if (EVP_MAC_init(ctx, nullptr, 0, params) <= 0) + { + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + LOG(INFO) << "OSNMA CMAC-AES: Failed to initialize CMAC context"; + return output; + } - // Compute CMAC-AES - EVP_MAC_update(cmacCtx, input.data(), input.size()); - size_t macLength = mac.size(); - size_t outputLength = 16; + // Update the CMAC context with the input data + if (EVP_MAC_update(ctx, input.data(), input.size()) <= 0) + { + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + LOG(INFO) << "OSNMA CMAC-AES: Failed to update CMAC context"; + return output; + } - EVP_MAC_final(cmacCtx, mac.data(), &macLength, outputLength); + // Finalize the CMAC and retrieve the output + if (EVP_MAC_final(ctx, aux.data(), &output_length, aux.size()) <= 0) + { + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); + LOG(INFO) << "OSNMA CMAC-AES: Failed to finalize CMAC"; + return output; + } - EVP_MAC_free(cmac); - EVP_MAC_CTX_free(cmacCtx); - EVP_CIPHER_CTX_free(ctx); + // Clean up the CMAC context + EVP_MAC_CTX_free(ctx); + EVP_MAC_free(mac); - mac.resize(macLength); - output = mac; + aux.resize(output_length); + output = aux; #else std::vector mac(16); // CMAC-AES output size diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 95137e21d..87f5afbfa 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -44,7 +44,7 @@ TEST(GnssCryptoTest, VerifySignature) // RG example - import crt certificate - result: FAIL std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - std::vector publicKey{ // PEM format - 1000 bits + std::vector publicKey{// PEM format - 1000 bits 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, @@ -109,11 +109,11 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) // key and message generated from RG A.6.5.1 std::unique_ptr d_crypto = std::make_unique(); - std::vector key = { // RG K4 @ 345690 + std::vector key = {// RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; - std::vector message{ // m0 + std::vector message{// m0 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, @@ -136,7 +136,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) // key and message generated from RG A.6.5.2 std::unique_ptr d_crypto = std::make_unique(); - std::vector key = { // RG K4 @ 345690 + std::vector key = {// RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; @@ -155,4 +155,25 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) ASSERT_EQ(expected_output, output); } -// TODO extend to HMAC-AES \ No newline at end of file + +TEST(GnssCryptoTest, TestComputeCMAC_AES) +{ + // Tests vectors from https://datatracker.ietf.org/doc/html/rfc4493#appendix-A + std::unique_ptr d_crypto = std::make_unique(); + + std::vector key = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C}; + + std::vector message{ + 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, + 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A}; + + std::vector expected_output = { + 0x07, 0x0A, 0x16, 0xB4, 0x6B, 0x4D, 0x41, 0x44, + 0xF7, 0x9B, 0xDD, 0x9D, 0xD0, 0x4A, 0x28, 0x7C}; + + std::vector output = d_crypto->computeCMAC_AES(key, message); + + ASSERT_EQ(expected_output, output); +} \ No newline at end of file From 2cf96bda87ac04c96cad663f83211118bf20c8b0 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 24 Jun 2024 14:41:49 +0200 Subject: [PATCH 204/499] =?UTF-8?q?[TAS-226]=20[FEAT]=20Remove=20tags=20sk?= =?UTF-8?q?ipped=20=E2=89=A5=2010=20times?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Take into account TOW to decide whether to skip a tag or not. Still, I dont like the logic of iterating over and over the tags. Once a tag is verified once, it should be not checked unless next TOW subframe came (new Data or new Key available) Adittionally: solved a small specification bug for ADKD=12, improved reporting (status of Tag is a string now) --- src/core/libs/osnma_msg_receiver.cc | 15 +++++++++------ src/core/system_parameters/osnma_helper.cc | 12 +++++++++++- src/core/system_parameters/osnma_helper.h | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 8447fb5fc..c515228ba 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -980,7 +980,10 @@ void osnma_msg_receiver::process_mack_message() << std::endl; } } - else { + else if(it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0){ + // case 1: adkd=12 and t.Tow + 300 < current TOW + // case 2: adkd=0/4 and t.Tow + 30 < current TOW + // case 3: any adkd and t.Tow > current TOW it.second.skipped ++; LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED (x"<< it.second.skipped <<")for Tag Id= " << it.second.tag_id @@ -1063,7 +1066,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) if (tag.ADKD == 0 || tag.ADKD == 4) applicable_key = d_tesla_keys[tag.TOW + 30]; else // ADKD 12 - applicable_key = d_tesla_keys[tag.TOW + 300]; + applicable_key = d_tesla_keys[tag.TOW + 330]; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { @@ -1284,7 +1287,7 @@ void osnma_msg_receiver::remove_verified_tags() << ", PRNd=" << static_cast(it->second.PRN_d) << ", status= " - << it->second.status + << d_helper->verification_status_str(it->second.status) << std::endl; it = d_tags_awaiting_verify.erase(it); } @@ -1303,7 +1306,7 @@ void osnma_msg_receiver::remove_verified_tags() << ", PRNd=" << static_cast(it->second.PRN_d) << ", status= " - << it->second.status + << d_helper->verification_status_str(it->second.status) << std::endl; it = d_tags_awaiting_verify.erase(it); } @@ -1478,14 +1481,14 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t){ } else if (t.ADKD == 12) { - auto it = d_tesla_keys.find(t.TOW + 300); + auto it = d_tesla_keys.find(t.TOW + 330); if (it != d_tesla_keys.end()) { LOG(INFO)<< "Galileo OSNMA: hasKey = true " << std::endl; return true; } } - LOG(INFO) << "Galileo OSNMA: hasKey = false " << std::endl; + LOG(INFO) << "Galileo OSNMA: hasKey = false "; return false; } std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes) diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 9ce394543..aa338f408 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -63,4 +63,14 @@ std::vector Osnma_Helper::bytes(const std::string& binaryString) { } return bytes; -} \ No newline at end of file +} + +std::string Osnma_Helper::verification_status_str(int status) +{ + switch (status) { + case 0: return "SUCCESS"; + case 1: return "FAIL"; + case 2: return "UNVERIFIED"; + default: return "UNKNOWN"; + } +} diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 9bf1d860d..2f8df078b 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -29,7 +29,7 @@ public: uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString); + std::string verification_status_str(int status); }; - #endif // GNSS_SDR_OSNMA_HELPER_H From 9a1def7aa40c6ad631d3f9b82fd76901d1929187 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Jun 2024 10:50:00 +0200 Subject: [PATCH 205/499] Fix building with old compilers --- src/core/libs/osnma_msg_receiver.cc | 650 ++++++++++-------- src/core/system_parameters/osnma_dsm_reader.h | 22 - 2 files changed, 348 insertions(+), 324 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index c515228ba..4a5e95ac9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -21,15 +21,18 @@ #include "Galileo_OSNMA.h" #include "gnss_crypto.h" #include "gnss_satellite.h" -#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader +#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" #include // for gr::io_signature::make +#include #include #include #include #include #include #include // for typeid +#include + #if USE_GLOG_AND_GFLAGS #include // for DLOG @@ -95,16 +98,16 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { const auto nma_msg = wht::any_cast>(pmt::any_ref(msg)); - const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); // TODO remove if unneeded + const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); // TODO remove if unneeded std::ostringstream output_message; output_message << "Galileo OSNMA: Subframe received starting at " - << "WN=" - << nma_msg->WN_sf0 - << ", TOW=" - << nma_msg->TOW_sf0 - << ", from satellite " - << sat; + << "WN=" + << nma_msg->WN_sf0 + << ", TOW=" + << nma_msg->TOW_sf0 + << ", from satellite " + << sat; LOG(WARNING) << output_message.str(); std::cout << output_message.str() << std::endl; @@ -113,28 +116,31 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) { // TODO - PRNa is a typo here, I think for d_satellite_nav_data, is PRN_d the name to use - const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); + const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); uint32_t PRNa = std::get<0>(*inav_data); - std::string nav_data = std::get<1>(*inav_data);; + std::string nav_data = std::get<1>(*inav_data); + ; uint32_t TOW = std::get<2>(*inav_data); // iono data => 549 bits, utc data, 141 bits. - if(nav_data.size() == 549) + if (nav_data.size() == 549) { - LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " << "TOW_sf=" << TOW <(d_osnma_data); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); @@ -157,17 +163,17 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { read_nma_header(osnma_msg->hkroot[0]); - if(d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3 /*&& d_kroot_verified*/) + if (d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3 /*&& d_kroot_verified*/) { - LOG(ERROR) << "Galileo OSNMA: NMAS invalid, skipping osnma message\n"; + LOG(WARNING) << "Galileo OSNMA: NMAS invalid, skipping osnma message"; return; } read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); - process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 - if(d_osnma_data.d_dsm_kroot_message.towh_k != 0) + process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 + if (d_osnma_data.d_dsm_kroot_message.towh_k != 0) local_time_verification(osnma_msg); - read_and_process_mack_block(osnma_msg); // only process them if at least 3 available. + read_and_process_mack_block(osnma_msg); // only process them if at least 3 available. } @@ -199,9 +205,8 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID LOG(INFO) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); LOG(INFO) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); - LOG(INFO)<< "Galileo OSNMA: Received block " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) - << " from DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) - << std::endl; + LOG(INFO) << "Galileo OSNMA: Received block " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) + << " from DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id); } /* @@ -219,7 +224,6 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ // First block indicates number of blocks in DSM message if (d_osnma_data.d_dsm_header.dsm_block_id == 0) { - uint8_t nb = d_dsm_reader->get_number_blocks_index(d_dsm_message[d_osnma_data.d_dsm_header.dsm_id][0]); uint16_t number_of_blocks = 0; if (d_osnma_data.d_dsm_header.dsm_id < 12) @@ -255,7 +259,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][d_osnma_data.d_dsm_header.dsm_block_id] = 1; std::stringstream available_blocks; available_blocks << "Galileo OSNMA: Available blocks for DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id) << ": [ "; - if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) // block 0 not received yet + if (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == 0) // block 0 not received yet { for (auto id_received : d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id]) { @@ -283,8 +287,8 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } } } - available_blocks<< "]" << std::endl; - LOG(INFO) << available_blocks.str() << std::endl; + available_blocks << "]"; + LOG(INFO) << available_blocks.str(); } /** @@ -296,57 +300,53 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptrWN_sf0 & 0x00000FFF) << 20 | (osnma_msg->TOW_sf0 & 0x000FFFFF); - //std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; - //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k * 3600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - //d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. - if(d_receiver_time != 0) + // std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; + // d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; + d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k * 3600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + // d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; + // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. + if (d_receiver_time != 0) { - - d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. -// d_receiver_time += 30; - //std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; - + d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. + // d_receiver_time += 30; + // std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; } else - {// local time not initialised -> compute it. - d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. - //std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; + { // local time not initialised -> compute it. + d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. + // std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; } // verify time constraint std::time_t delta_T = abs(d_receiver_time - d_GST_SIS); - if( delta_T <= d_T_L ) + if (delta_T <= d_T_L) { d_tags_allowed = tags_to_verify::all; - d_tags_to_verify = {0,4,12}; - LOG(INFO) << "Galileo OSNMA: time constraint OK (" << delta_T << "\n"; - LOG(INFO) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; - //std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; + d_tags_to_verify = {0, 4, 12}; + LOG(INFO) << "Galileo OSNMA: time constraint OK (" << delta_T; + LOG(INFO) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS; + // std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; // TODO set flag to false to avoid processing dsm and MACK messages } - else if( delta_T > d_T_L && delta_T <= 10* delta_T ) + else if (delta_T > d_T_L && delta_T <= 10 * delta_T) { d_tags_allowed = tags_to_verify::slow_eph; d_tags_to_verify = {12}; - LOG(WARNING) << "Galileo OSNMA: time constraint allows only slow MACs to be verified\n"; - LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; - LOG(WARNING)<< "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; - + LOG(WARNING) << "Galileo OSNMA: time constraint allows only slow MACs to be verified"; + LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS; + LOG(WARNING) << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; } else { d_tags_allowed = tags_to_verify::none; d_tags_to_verify = {}; - LOG(ERROR) << "Galileo OSNMA: time constraint violation\n"; - LOG(ERROR) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS << "\n"; - LOG(ERROR) << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; - + LOG(WARNING) << "Galileo OSNMA: time constraint violation"; + LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS; + LOG(WARNING) << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; } - } + /** * @brief Process DSM block of an OSNMA message. * @@ -362,7 +362,8 @@ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osn if ((d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] != 0) && (d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] == std::accumulate(d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cbegin(), d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id].cend(), 0))) { - std::vector dsm_msg(std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * SIZE_DSM_BLOCKS_BYTES, 0); + size_t len = std::size_t(d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]) * SIZE_DSM_BLOCKS_BYTES; + std::vector dsm_msg(len, 0); for (uint32_t i = 0; i < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; i++) { for (size_t j = 0; j < SIZE_DSM_BLOCKS_BYTES; j++) @@ -376,6 +377,7 @@ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osn } } + /* * case DSM-Kroot: * - computes the padding and compares with received message @@ -415,7 +417,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg l_ds_bits = it->second; } const uint16_t l_ds_bytes = l_ds_bits / 8; - d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); // C: this accounts for padding in case needed. + d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); // C: this accounts for padding in case needed. for (uint16_t k = 0; k < l_ds_bytes; k++) { d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + l_lk_bytes + k]; @@ -433,20 +435,20 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((l_lk_bytes * 8.0) + l_ds_bits) / 104.0); if (l_dk_bits != check_l_dk) { - LOG(ERROR) << "Galileo OSNMA: Failed length reading of DSM-KROOT message" << std::endl; + LOG(WARNING) << "Galileo OSNMA: Failed length reading of DSM-KROOT message"; } else { // validation of padding const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; - MSG.reserve(size_m + l_ds_bytes + 1); // C: message will get too many zeroes? ((12+1)+16) + 64 + 1? => in theory not, allocating is not assigning - MSG.push_back(osnma_msg->hkroot[0]); // C: NMA header + MSG.reserve(size_m + l_ds_bytes + 1); // C: message will get too many zeroes? ((12+1)+16) + 64 + 1? => in theory not, allocating is not assigning + MSG.push_back(osnma_msg->hkroot[0]); // C: NMA header for (uint16_t i = 1; i < size_m; i++) { MSG.push_back(dsm_msg[i]); } - std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 + std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); @@ -479,27 +481,25 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(INFO) << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600 << std::endl; + << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; local_time_verification(osnma_msg); d_kroot_verified = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); if (d_kroot_verified) { - LOG(WARNING) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; - LOG(WARNING) << "Galileo OSNMA: KROOT authentication successful !" << std::endl; - LOG(WARNING) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + std::cout << "Galileo OSNMA: KROOT authentication successful!" << std::endl; + LOG(INFO) << "Galileo OSNMA: KROOT authentication successful!"; + LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " - << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks) << std::endl; + << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); } else { - LOG(ERROR) << "Galileo OSNMA: KROOT authentication failed. " << std::endl; - LOG(INFO) << "Galileo OSNMA: KROOT authentication failed. " << std::endl; + LOG(WARNING) << "Galileo OSNMA: KROOT authentication failed."; } - } else { - LOG(ERROR) << "Galileo OSNMA: Error computing padding bits." << std::endl; + LOG(WARNING) << "Galileo OSNMA: Error computing padding bits."; // TODO - here will have to decide if perform the verification or not. Since this step is not mandatory, one could as well have skipped it. } } @@ -544,7 +544,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t check_l_dp_bytes = 104 * std::ceil(static_cast(1040.0 + l_npk_bytes * 8.0) / 104.0) / 8; if (l_dp_bytes != check_l_dp_bytes) { - LOG(ERROR) << "Galileo OSNMA: Failed length reading of DSM-PKR message" << std::endl; + LOG(WARNING) << "Galileo OSNMA: Failed length reading of DSM-PKR message"; } else { @@ -559,7 +559,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", PKID=" << static_cast(d_osnma_data.d_dsm_pkr_message.npktid) /*<< ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600*/ - << " received" << std::endl; + << " received"; // C: NPK verification against Merkle tree root. if (!d_public_key_verified) { @@ -570,7 +570,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); } } - } } else @@ -582,6 +581,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } + /** * @brief Reads the Mack message from the given OSNMA_msg object. * @@ -601,16 +601,16 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place -// DEBUG PARSING MACK MESSAGES WHEN DSM-KROOT NOT YET AVAILABLE -// d_osnma_data.d_dsm_kroot_message.ts = 9; -// d_osnma_data.d_dsm_kroot_message.ks = 4; -// d_osnma_data.d_dsm_kroot_message.kroot = std::vector(16); - if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 - { // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future + d_osnma_data.d_nav_data.init(osnma_msg); // TODO refactor it + // add_satellite_data(osnma_msg->PRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place + // DEBUG PARSING MACK MESSAGES WHEN DSM-KROOT NOT YET AVAILABLE + // d_osnma_data.d_dsm_kroot_message.ts = 9; + // d_osnma_data.d_dsm_kroot_message.ks = 4; + // d_osnma_data.d_dsm_kroot_message.kroot = std::vector(16); + if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 + { // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future read_mack_header(); - d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly. + d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly. d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; d_osnma_data.d_mack_message.WN = osnma_msg->WN_sf0; read_mack_body(); @@ -620,14 +620,15 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr((d_mack_message[7/* bytes of MACK header */ + k * 7 /* offset of k-th tag */])) << 32); + tag += (static_cast((d_mack_message[7 /* bytes of MACK header */ + k * 7 /* offset of k-th tag */])) << 32); tag += (static_cast((d_mack_message[8 + k * 7])) << 24); tag += (static_cast((d_mack_message[9 + k * 7])) << 16); tag += (static_cast((d_mack_message[10 + k * 7])) << 8); @@ -847,7 +849,7 @@ void osnma_msg_receiver::read_mack_body() PRN_d += d_mack_message[12 + k * 7]; ADKD += ((d_mack_message[13 + k * 7] & 0xF0) >> 4); cop += (d_mack_message[13 + k * 7] & 0x0F); - if (k == (nt - 2)) // end of Tag&Info + if (k == (nt - 2)) // end of Tag&Info { d_osnma_data.d_mack_message.key = std::vector(d_osnma_data.d_dsm_kroot_message.kroot.size()); for (size_t j = 0; j < d_osnma_data.d_dsm_kroot_message.kroot.size(); j++) @@ -881,38 +883,43 @@ void osnma_msg_receiver::read_mack_body() */ void osnma_msg_receiver::process_mack_message() { - if(d_kroot_verified == false && d_tesla_key_verified == false) + if (d_kroot_verified == false && d_tesla_key_verified == false) { - LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed. "<< ", " - << "No Kroot nor TESLA key available" << std::endl; - if(!d_flag_debug){ - return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. + LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed. " + << ", " + << "No Kroot nor TESLA key available"; + if (!d_flag_debug) + { + return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. } else LOG(WARNING) << "But it will be processed for debugging purposes."; } // verify tesla key and add it to the container of verified keys if successful - if (d_tesla_keys.find(d_osnma_data.d_nav_data.TOW_sf0) == d_tesla_keys.end()) // check if already available => no need to verify + if (d_tesla_keys.find(d_osnma_data.d_nav_data.TOW_sf0) == d_tesla_keys.end()) // check if already available => no need to verify { bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.TOW_sf0); - if(retV){ - d_tesla_keys.insert(std::pair(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); + if (retV) + { + d_tesla_keys.insert(std::pair>(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); } } - // MACSEQ - verify current macks, then add current retrieved mack to the end. auto mack = d_macks_awaiting_MACSEQ_verification.begin(); - while (mack != d_macks_awaiting_MACSEQ_verification.end()){ - if(d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()){ + while (mack != d_macks_awaiting_MACSEQ_verification.end()) + { + if (d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()) + { bool ret = verify_macseq(*mack); - if (ret || d_flag_debug){ - for(std::size_t i = 0; i < mack->tag_and_info.size(); ++i) + if (ret || d_flag_debug) + { + for (std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { // add tags of current mack to the verification queue auto& tag = mack->tag_and_info[i]; - Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. - d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); + Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. + d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; } std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; @@ -923,90 +930,91 @@ void osnma_msg_receiver::process_mack_message() mack = d_macks_awaiting_MACSEQ_verification.erase(mack); } } - else { // key not yet available - keep in container until then -- might be deleted if container size exceeds max allowed + else + { // key not yet available - keep in container until then -- might be deleted if container size exceeds max allowed ++mack; } } // add current received MACK to the container to be verified in the next iteration (on this one no key available) d_macks_awaiting_MACSEQ_verification.push_back(d_osnma_data.d_mack_message); - // Tag verification - for (auto & it : d_tags_awaiting_verify){ + for (auto& it : d_tags_awaiting_verify) + { bool ret; - if(tag_has_key_available(it.second) && tag_has_nav_data_available(it.second)){ + if (tag_has_key_available(it.second) && tag_has_nav_data_available(it.second)) + { ret = verify_tag(it.second); /* TODO - take into account: * - COP: if * - ADKD type * - NavData the tag verifies (min. number of bits verified to consider NavData OK) * */ - if(ret) + if (ret) { it.second.status = Tag::SUCCESS; LOG(WARNING) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " - << it.second.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << it.second.received_tag << std::dec - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", PRNa=" - << static_cast(it.second.PRNa) - << ", PRNd=" - << static_cast(it.second.PRN_d) - << std::endl; + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d); } - /* TODO notify PVT via pmt - * have_new_data() true - * signal which one is verified - * communicate to PVT*/ + /* TODO notify PVT via pmt + * have_new_data() true + * signal which one is verified + * communicate to PVT*/ else - { - it.second.status = Tag::FAIL; - LOG(ERROR) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id=" - << it.second.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << it.second.received_tag << std::dec - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", PRNa=" - << static_cast(it.second.PRNa) - << ", PRNd=" - << static_cast(it.second.PRN_d) - << std::endl; - } + { + it.second.status = Tag::FAIL; + LOG(WARNING) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id=" + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d); + } } - else if(it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0){ + else if (it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0) + { // case 1: adkd=12 and t.Tow + 300 < current TOW // case 2: adkd=0/4 and t.Tow + 30 < current TOW // case 3: any adkd and t.Tow > current TOW - it.second.skipped ++; - LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED (x"<< it.second.skipped <<")for Tag Id= " - << it.second.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << it.second.received_tag << std::dec - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", PRNa=" - << static_cast(it.second.PRNa) - << ", PRNd=" - << static_cast(it.second.PRN_d) - << ". Key available ("<< tag_has_key_available(it.second) <<"), navData ("<< tag_has_nav_data_available(it.second) <<"). " - << std::endl; + it.second.skipped++; + LOG(WARNING) << "Galileo OSNMA: Tag verification :: SKIPPED (x" << it.second.skipped << ")for Tag Id= " + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) + << ". Key available (" << tag_has_key_available(it.second) << "), navData (" << tag_has_nav_data_available(it.second) << "). "; } } remove_verified_tags(); - control_tags_awaiting_verify_size(); // remove the oldest tags if size is too big. + control_tags_awaiting_verify_size(); // remove the oldest tags if size is too big. } + bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) { // TODO create function for recursively apply hash @@ -1021,30 +1029,33 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) } // compute intermediate leafs' values -// std::vector x_0,x_1,x_2,x_3,x_4; - LOG(INFO) << "Galileo OSNMA: DSM-PKR :: leaf provided: m_" << static_cast(message.mid) << std::endl; + // std::vector x_0,x_1,x_2,x_3,x_4; + LOG(INFO) << "Galileo OSNMA: DSM-PKR :: leaf provided: m_" << static_cast(message.mid); std::vector x_next, x_current = d_crypto->computeSHA256(m_i); - for (size_t i = 0 ; i < 4 ; i++) - { - x_next.clear(); - bool leaf_is_on_right = ((message.mid / (1 << (i))) % 2) == 1; + for (size_t i = 0; i < 4; i++) + { + x_next.clear(); + bool leaf_is_on_right = ((message.mid / (1 << (i))) % 2) == 1; - if (leaf_is_on_right) { - // Leaf is on the right -> first the itn, then concatenate the leaf - x_next.insert(x_next.end(), &message.itn[32*i], &message.itn[32*i + 32]); - x_next.insert(x_next.end(), x_current.begin(), x_current.end()); - } else { - // Leaf is on the left -> first the leaf, then concatenate the itn - x_next.insert(x_next.end(), x_current.begin(), x_current.end()); - x_next.insert(x_next.end(), &message.itn[32*i], &message.itn[32*i + 32]); - } + if (leaf_is_on_right) + { + // Leaf is on the right -> first the itn, then concatenate the leaf + x_next.insert(x_next.end(), &message.itn[32 * i], &message.itn[32 * i + 32]); + x_next.insert(x_next.end(), x_current.begin(), x_current.end()); + } + else + { + // Leaf is on the left -> first the leaf, then concatenate the itn + x_next.insert(x_next.end(), x_current.begin(), x_current.end()); + x_next.insert(x_next.end(), &message.itn[32 * i], &message.itn[32 * i + 32]); + } - // Compute the next node. - x_current = d_crypto->computeSHA256(x_next); - } + // Compute the next node. + x_current = d_crypto->computeSHA256(x_next); + } - if(x_current == d_crypto->getMerkleRoot()) + if (x_current == d_crypto->getMerkleRoot()) { LOG(INFO) << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; return true; @@ -1055,6 +1066,8 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) return false; } } + + bool osnma_msg_receiver::verify_tag(Tag& tag) { // TODO case tag0, to be verified here?, PRNd not needed for it @@ -1065,20 +1078,20 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) std::vector applicable_key; if (tag.ADKD == 0 || tag.ADKD == 4) applicable_key = d_tesla_keys[tag.TOW + 30]; - else // ADKD 12 + else // ADKD 12 applicable_key = d_tesla_keys[tag.TOW + 330]; - if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); } - else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { mac = d_crypto->computeCMAC_AES(applicable_key, m); } // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD - uint8_t lt_bits = 0; // TODO - remove this duplication of code. + uint8_t lt_bits = 0; // TODO - remove this duplication of code. const auto it2 = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); if (it2 != OSNMA_TABLE_11.cend()) { @@ -1119,34 +1132,33 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) if (tag.received_tag == computed_mac) { std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " - << tag.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << tag.received_tag << std::dec - << ", TOW=" - << tag.TOW - << ", ADKD=" - << static_cast(tag.ADKD) - << ", PRNa=" - << static_cast(tag.PRNa) - << ", PRNd=" - << static_cast(tag.PRN_d) - << std::endl; + << tag.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << tag.received_tag << std::dec + << ", TOW=" + << tag.TOW + << ", ADKD=" + << static_cast(tag.ADKD) + << ", PRNa=" + << static_cast(tag.PRNa) + << ", PRNd=" + << static_cast(tag.PRN_d); return true; } - - else - return false; + return false; } + + std::vector osnma_msg_receiver::build_message(const Tag& tag) { std::vector m; - if(tag.CTR != 1) + if (tag.CTR != 1) m.push_back(static_cast(tag.PRN_d)); m.push_back(static_cast(tag.PRNa)); // TODO: maybe here I have to use d_receiver_time instead of d_GST_SIS which is what I am computing - uint32_t GST = d_helper->compute_gst( tag.WN,tag.TOW); + uint32_t GST = d_helper->compute_gst(tag.WN, tag.TOW); std::vector GST_uint8 = d_helper->gst_to_uint8(GST); - m.insert(m.end(),GST_uint8.begin(),GST_uint8.end()); + m.insert(m.end(), GST_uint8.begin(), GST_uint8.end()); m.push_back(tag.CTR); // Extracts only two bits from d_osnma_data.d_nma_header.nmas uint8_t two_bits_nmas = d_osnma_data.d_nma_header.nmas & 0b00000011; @@ -1156,7 +1168,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) // Add applicable NavData bits to message std::string applicable_nav_data; std::vector applicable_nav_data_bytes; - if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. + if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; } @@ -1165,76 +1177,91 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; } else - LOG(ERROR) <<"Galileo OSNMA :: Tag verification :: unknown ADKD" <<"\n"; + LOG(WARNING) << "Galileo OSNMA :: Tag verification :: unknown ADKD"; // convert std::string to vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); // Convert and add NavData bytes into the message, taking care of that NMAS has only 2 bits - for (uint8_t byte : applicable_nav_data_bytes) { + for (uint8_t byte : applicable_nav_data_bytes) + { m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m - m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m + m.push_back(byte << 6); // Then take the last 2 bits of byte, shift them to MSB position and insert the new element into m } - if(m.back() == 0) { + if (m.back() == 0) + { m.pop_back(); // Remove the last element if its value is 0 (only padding was added) } - else { + else + { // Pad with zeros if the last element wasn't full - for (int bits = 2; bits < 8; bits += 2) { + for (int bits = 2; bits < 8; bits += 2) + { // Check if the last element in the vector has 2 '00' bits in its LSB position - if((m.back() & 0b00000011) == 0) { + if ((m.back() & 0b00000011) == 0) + { m.back() <<= 2; // Shift the existing bits to make room for new 2 bits } - else { + else + { break; // If it does not have 2 '00' bits in its LSB position, then the padding is complete } } } return m; } + + void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) { // control size of container - while (d_satellite_nav_data[SV_ID].size() >= 25) { + while (d_satellite_nav_data[SV_ID].size() >= 25) + { d_satellite_nav_data[SV_ID].erase(d_satellite_nav_data[SV_ID].begin()); } - //d_osnma_data[TOW] = crypto; // crypto - d_satellite_nav_data[SV_ID][TOW] = data; // nav - //std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; + // d_osnma_data[TOW] = crypto; // crypto + d_satellite_nav_data[SV_ID][TOW] = data; // nav + // std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; } + + void osnma_msg_receiver::display_data() { -// if(d_satellite_nav_data.empty()) -// return; -// -// for(const auto& satellite : d_satellite_nav_data) { -// std::cout << "SV_ID: " << satellite.first << std::endl; -// for(const auto& towData : satellite.second) { -// std::cout << "\tTOW: " << towData.first << " key: "; -// for(size_t i = 0; i < towData.second.d_mack_message.key.size(); i++) { -// std::cout << std::hex << std::setfill('0') << std::setw(2) -// << static_cast(towData.second.d_mack_message.key[i]) << " "; -// } -// } -// } + // if(d_satellite_nav_data.empty()) + // return; + // + // for(const auto& satellite : d_satellite_nav_data) { + // std::cout << "SV_ID: " << satellite.first << std::endl; + // for(const auto& towData : satellite.second) { + // std::cout << "\tTOW: " << towData.first << " key: "; + // for(size_t i = 0; i < towData.second.d_mack_message.key.size(); i++) { + // std::cout << std::hex << std::setfill('0') << std::setw(2) + // << static_cast(towData.second.d_mack_message.key[i]) << " "; + // } + // } + // } } + + bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TOW) { uint32_t num_of_hashes_needed; - uint32_t GST_SFi = d_receiver_time - 30; // GST of target key is to be used. + uint32_t GST_SFi = d_receiver_time - 30; // GST of target key is to be used. std::vector hash; - const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks)/8; - //std::vector validated_key; - if(d_tesla_key_verified){ // have to go up to last verified key + const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; + // std::vector validated_key; + if (d_tesla_key_verified) + { // have to go up to last verified key d_validated_key = d_tesla_keys.rbegin()->second; - num_of_hashes_needed = (d_receiver_time - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified - LOG(INFO) << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key " << std::endl; + num_of_hashes_needed = (d_receiver_time - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified + LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key"; - hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); + hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); } - else{// have to go until Kroot + else + { // have to go until Kroot d_validated_key = d_osnma_data.d_dsm_kroot_message.kroot; - num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 IC - LOG(INFO) << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) need to be performed up to Kroot " << std::endl; + num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 IC + LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) need to be performed up to Kroot"; hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); } @@ -1247,23 +1274,26 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO } if (computed_key == d_validated_key && num_of_hashes_needed > 0) { - LOG(WARNING) << "Galileo OSNMA:: TESLA key verification :: SUCCESS! " << std::endl; - d_tesla_keys.insert(std::pair(TOW,key)); + LOG(WARNING) << "Galileo OSNMA:: TESLA key verification :: SUCCESS!"; + d_tesla_keys.insert(std::pair>(TOW, key)); d_tesla_key_verified = true; d_last_verified_key_GST = d_receiver_time; } - else if(num_of_hashes_needed > 0){ - LOG(ERROR) << "Galileo OSNMA:: TESLA key verification :: FAILED " << std::endl; - if(d_flag_debug){ - d_tesla_keys.insert(std::pair(TOW,key)); + else if (num_of_hashes_needed > 0) + { + LOG(WARNING) << "Galileo OSNMA:: TESLA key verification :: FAILED"; + if (d_flag_debug) + { + d_tesla_keys.insert(std::pair>(TOW, key)); d_last_verified_key_GST = d_receiver_time; d_tesla_key_verified = true; // TODO - if intermediate verification fails, can one still use the former verified tesla key or should go to Kroot or even retrieve new Kroot? } } return d_tesla_key_verified; - } + + /** * @brief Removes the tags that have been verified from the multimap d_tags_awaiting_verify. * @@ -1271,7 +1301,8 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO */ void osnma_msg_receiver::remove_verified_tags() { - for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end() ; ){ + for (auto it = d_tags_awaiting_verify.begin(); it != d_tags_awaiting_verify.end();) + { if (it->second.status == Tag::SUCCESS || it->second.status == Tag::FAIL) { LOG(INFO) << "Galileo OSNMA: Tag verification :: DELETE tag Id=" @@ -1287,8 +1318,7 @@ void osnma_msg_receiver::remove_verified_tags() << ", PRNd=" << static_cast(it->second.PRN_d) << ", status= " - << d_helper->verification_status_str(it->second.status) - << std::endl; + << d_helper->verification_status_str(it->second.status); it = d_tags_awaiting_verify.erase(it); } else if (it->second.skipped >= 20) @@ -1306,8 +1336,7 @@ void osnma_msg_receiver::remove_verified_tags() << ", PRNd=" << static_cast(it->second.PRN_d) << ", status= " - << d_helper->verification_status_str(it->second.status) - << std::endl; + << d_helper->verification_status_str(it->second.status); it = d_tags_awaiting_verify.erase(it); } else @@ -1315,6 +1344,8 @@ void osnma_msg_receiver::remove_verified_tags() } std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; } + + /** * @brief Control the size of the tags awaiting verification multimap. * @@ -1325,19 +1356,19 @@ void osnma_msg_receiver::remove_verified_tags() */ void osnma_msg_receiver::control_tags_awaiting_verify_size() { - while(d_tags_awaiting_verify.size() > 500) + while (d_tags_awaiting_verify.size() > 500) { auto it = d_tags_awaiting_verify.begin(); LOG(WARNING) << "Galileo OSNMA: Tag verification :: DELETED tag due to exceeding buffer size. " << "Tag Id= " << it->second.tag_id << ", TOW=" << it->first << ", ADKD=" << static_cast(it->second.ADKD) - << ", from satellite " << it->second.PRNa - << std::endl; + << ", from satellite " << it->second.PRNa; d_tags_awaiting_verify.erase(it); } } + /** * @brief Verifies the MACSEQ of a received MACK_message. * @@ -1349,8 +1380,8 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) { // MACSEQ verification - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. - std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; std::vector applicable_sequence; @@ -1363,7 +1394,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } // Assign relevant sequence based on subframe time - if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. + if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. { applicable_sequence = sq1; } @@ -1373,55 +1404,56 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } else { - LOG(ERROR) << "Galileo OSNMA: Mismatch in the GST verification. " << std::endl; + LOG(WARNING) << "Galileo OSNMA: Mismatch in the GST verification."; } - if(mack.tag_and_info.size() != applicable_sequence.size() - 1) + if (mack.tag_and_info.size() != applicable_sequence.size() - 1) { - LOG(ERROR) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!" << std::endl; + LOG(WARNING) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!"; return false; } - std::vector flxTags {}; + std::vector flxTags{}; std::string tempADKD; // MACLT verification for (uint8_t i = 0; i < mack.tag_and_info.size(); i++) { - tempADKD = applicable_sequence[i+1]; - if(tempADKD == "FLX") + tempADKD = applicable_sequence[i + 1]; + if (tempADKD == "FLX") { - flxTags.push_back(i); // C: just need to save the index in the sequence + flxTags.push_back(i); // C: just need to save the index in the sequence } - else if(mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i+1])) + else if (mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i + 1])) { - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table. " << std::endl; - return false; // C: suffices one incorrect to abort and not process the rest of the tags + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table."; + return false; // C: suffices one incorrect to abort and not process the rest of the tags } } - if(flxTags.empty()){ - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD matches MAC Look-up table. " << std::endl; + if (flxTags.empty()) + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD matches MAC Look-up table."; return true; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag - m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); // TODO d_GST_Sf left useless + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); // TODO d_GST_Sf left useless m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); m[4] = static_cast(d_GST_Sf & 0x000000FF); // Case tags flexible - Eq. 21 ICD - for (uint8_t i = 0; i < flxTags.size() ; i++) + for (uint8_t i = 0; i < flxTags.size(); i++) { - m[2*i + 5] = mack.tag_and_info[flxTags[i]].tag_info.PRN_d; - m[2*i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + m[2 * i + 5] = mack.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[2 * i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | mack.tag_and_info[flxTags[i]].tag_info.cop; } // compute mac std::vector mac; - if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); } - else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { mac = d_crypto->computeCMAC_AES(applicable_key, m); } @@ -1432,39 +1464,51 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) mac_msb = (mac[0] << 8) + mac[1]; } uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; - if (computed_macseq == mack.header.macseq){ - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK " << std::endl; + if (computed_macseq == mack.header.macseq) + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; return true; } - else{ - LOG(ERROR) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed " << std::endl; + else + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed"; return false; } - } + + bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) { auto prn_it = d_satellite_nav_data.find(t.PRN_d); - if (prn_it != d_satellite_nav_data.end()) { + if (prn_it != d_satellite_nav_data.end()) + { // PRN was found, check if TOW exists in inner map LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW - 30); - if (tow_it != tow_map.end()) { + if (tow_it != tow_map.end()) + { return true; - } else { + } + else + { // TOW not found return false; } - } else { + } + else + { // PRN was not found LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; return false; } return false; } -bool osnma_msg_receiver::tag_has_key_available(Tag& t){ + + +bool osnma_msg_receiver::tag_has_key_available(Tag& t) +{ // check adkd of tag // if adkd = 0 or 4 => look for d_tesla_keys[t.TOW+30] // if adkd = 12 => look for d_tesla_keys[t.TOW+300] @@ -1484,36 +1528,38 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t){ auto it = d_tesla_keys.find(t.TOW + 330); if (it != d_tesla_keys.end()) { - LOG(INFO)<< "Galileo OSNMA: hasKey = true " << std::endl; + LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } LOG(INFO) << "Galileo OSNMA: hasKey = false "; return false; } + + std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes) { auto start = std::chrono::high_resolution_clock::now(); std::vector K_II = key; - std::vector K_I; // result of the recursive hash operations + std::vector K_I; // result of the recursive hash operations std::vector msg; // compute the tesla key for current SF (GST_SFi and K_II change in each iteration) - for (uint32_t i = 1; i <= num_of_hashes_needed ; i++) + for (uint32_t i = 1; i <= num_of_hashes_needed; i++) { // build message digest m = (K_I+1 || GST_SFi || alpha) msg.reserve(K_II.size() + sizeof(GST_SFi) + sizeof(d_osnma_data.d_dsm_kroot_message.alpha)); - std::copy(K_II.begin(),K_II.end(),std::back_inserter(msg)); + std::copy(K_II.begin(), K_II.end(), std::back_inserter(msg)); msg.push_back((GST_SFi & 0xFF000000) >> 24); msg.push_back((GST_SFi & 0x00FF0000) >> 16); msg.push_back((GST_SFi & 0x0000FF00) >> 8); msg.push_back(GST_SFi & 0x000000FF); - // extract alpha -// d_osnma_data.d_dsm_kroot_message.alpha = 0xa06221261ad9; - for (int k = 5; k >= 0;k--) + // extract alpha + // d_osnma_data.d_dsm_kroot_message.alpha = 0xa06221261ad9; + for (int k = 5; k >= 0; k--) { // TODO: static extracts the MSB in case from larger to shorter int? - msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (k * 8)) & 0xFF)); // extract first 6 bytes of alpha. + msg.push_back(static_cast((d_osnma_data.d_dsm_kroot_message.alpha >> (k * 8)) & 0xFF)); // extract first 6 bytes of alpha. } // compute hash std::vector hash; @@ -1530,31 +1576,31 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede hash = std::vector(32); } // truncate hash - K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits + K_I.reserve(lk_bytes); // TODO - case hash function has 512 bits for (int k = 0; k < lk_bytes; k++) { K_I.push_back(hash[k]); } // set parameters for next iteration - GST_SFi -= 30; // next SF time is the actual minus 30 seconds - K_II = K_I; // next key is the actual one - K_I.clear(); // empty the actual one for a new computation + GST_SFi -= 30; // next SF time is the actual minus 30 seconds + K_II = K_I; // next key is the actual one + K_I.clear(); // empty the actual one for a new computation msg.clear(); } // check that the final time matches the Kroot time bool check; - if(!d_tesla_key_verified) + if (!d_tesla_key_verified) check = GST_SFi + 30 == d_GST_0 - 30; else check = GST_SFi + 30 == d_last_verified_key_GST; - if(!check) - LOG(ERROR) << "Galileo OSNMA: TESLA verification error. Kroot time mismatch! \n"; // ICD. Eq. 18 + if (!check) + LOG(WARNING) << "Galileo OSNMA: TESLA verification error. Kroot time mismatch!"; // ICD. Eq. 18 else - LOG(INFO) << "Galileo OSNMA: TESLA verification. Kroot time matches! \n"; // ICD. Eq. 18 + LOG(INFO) << "Galileo OSNMA: TESLA verification. Kroot time matches!"; // ICD. Eq. 18 // compare computed current key against received key auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = end - start; - LOG(INFO) << "Galileo OSNMA: TESLA verification ("<< num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds.\n"; + LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; return K_II; } diff --git a/src/core/system_parameters/osnma_dsm_reader.h b/src/core/system_parameters/osnma_dsm_reader.h index 3eeeb5bea..5031a140e 100644 --- a/src/core/system_parameters/osnma_dsm_reader.h +++ b/src/core/system_parameters/osnma_dsm_reader.h @@ -63,7 +63,6 @@ public: uint8_t get_npktid(const std::vector& dsm_msg) const; private: -#if __cplusplus == 201103L static constexpr std::uint8_t mask_nmas{0xC0}; static constexpr std::uint8_t mask_cid{0x30}; static constexpr std::uint8_t mask_cpks{0x07}; @@ -83,27 +82,6 @@ private: static constexpr std::uint8_t mask_dsm_mid{0x0F}; static constexpr std::uint8_t mask_dsm_npkt{0xF0}; static constexpr std::uint8_t mask_dsm_npktid{0x0F}; -#else - static constexpr std::uint8_t mask_nmas{0b1100'0000}; - static constexpr std::uint8_t mask_cid{0b0011'0000}; - static constexpr std::uint8_t mask_cpks{0b0000'1110}; - static constexpr std::uint8_t mask_nma_header_reserved{0b0000'0001}; - static constexpr std::uint8_t mask_dsm_id{0b1111'0000}; - static constexpr std::uint8_t mask_dsm_block_id{0b0000'1111}; - static constexpr std::uint8_t mask_dsm_number_blocks{0b1111'0000}; - static constexpr std::uint8_t mask_dsm_pkid{0b0000'1111}; - static constexpr std::uint8_t mask_dsm_cidkr{0b1100'0000}; - static constexpr std::uint8_t mask_dsm_reserved1{0b0011'0000}; - static constexpr std::uint8_t mask_dsm_hf{0b0000'1100}; - static constexpr std::uint8_t mask_dsm_mf{0b0000'0011}; - static constexpr std::uint8_t mask_dsm_ks{0b1111'0000}; - static constexpr std::uint8_t mask_dsm_ts{0b0000'1111}; - static constexpr std::uint8_t mask_dsm_reserved{0b1111'0000}; - static constexpr std::uint8_t mask_dsm_wk_k_msbyte{0b0000'1111}; - static constexpr std::uint8_t mask_dsm_mid{0b0000'1111}; - static constexpr std::uint8_t mask_dsm_npkt{0b1111'0000}; - static constexpr std::uint8_t mask_dsm_npktid{0b0000'1111}; -#endif }; /** \} */ From 23bb5c85c581ca663acf736196686c925f3802cf Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Jun 2024 11:45:09 +0200 Subject: [PATCH 206/499] Fix building against OpenSSL 1.0 --- src/core/system_parameters/gnss_crypto.cc | 99 ++++++++++++++++++----- src/core/system_parameters/gnss_crypto.h | 3 +- 2 files changed, 82 insertions(+), 20 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 947b8a436..9f2ba82fb 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -380,24 +380,16 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector hmac.resize(output_length); output = hmac; #else - std::vector hmac(32); - // Create HMAC context - HMAC_CTX* ctx = HMAC_CTX_new(); - HMAC_Init_ex(ctx, key.data(), key.size(), EVP_sha256(), nullptr); + unsigned int outputLength = EVP_MAX_MD_SIZE; + unsigned char* result = HMAC(EVP_sha256(), key.data(), key.size(), input.data(), input.size(), output.data(), &outputLength); + if (result == nullptr) + { + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to compute HMAC-SHA256"; + return output; + } - // Update HMAC context with the message - HMAC_Update(ctx, input.data(), input.size()); - - // Finalize HMAC computation - unsigned int hmacLen; - HMAC_Final(ctx, hmac.data(), &hmacLen); - - // Clean up HMAC context - HMAC_CTX_free(ctx); - - // Resize the HMAC vector to the actual length - hmac.resize(hmacLen); - output = hmac; + // Resize the output vector to the actual length of the HMAC-SHA256 output + output.resize(outputLength); #endif #else // GnuTLS std::vector output_aux(32); @@ -595,6 +587,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) // Read the public key from the certificate EVP_PKEY* pubkey = X509_get_pubkey(cert); +#if USE_OPENSSL_3 if (!pubkey) { std::cerr << "Failed to extract the public key" << std::endl; @@ -603,6 +596,18 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) } pubkey_copy(pubkey, &d_PublicKey); EVP_PKEY_free(pubkey); +#else + EC_KEY* ec_pubkey = EVP_PKEY_get1_EC_KEY(pubkey); + EVP_PKEY_free(pubkey); + if (!ec_pubkey) + { + std::cerr << "Failed to extract the public key" << std::endl; + X509_free(cert); + return false; + } + pubkey_copy(ec_pubkey, &d_PublicKey); + EC_KEY_free(ec_pubkey); +#endif BIO_free(bio); X509_free(cert); #else // GnuTLS @@ -838,12 +843,19 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) LOG(INFO) << "OpenSSL: error setting the OSNMA public key."; return; } - +#if USE_OPENSSL_3 if (!pubkey_copy(pkey, &d_PublicKey)) { return; } - +#else + EC_KEY* ec_pkey = EVP_PKEY_get1_EC_KEY(pkey); + if (!pubkey_copy(ec_pkey, &d_PublicKey)) + { + return; + } + EC_KEY_free(ec_pkey); +#endif EVP_PKEY_free(pkey); #else // GnuTLS gnutls_pubkey_t pubkey; @@ -865,6 +877,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) #if USE_OPENSSL_FALLBACK +#if USE_OPENSSL_3 bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) { // Open a memory buffer @@ -909,6 +922,54 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) return true; } +#else // OpenSSL 1.x + +bool Gnss_Crypto::pubkey_copy(EC_KEY* src, EC_KEY** dest) +{ + // Open a memory buffer + BIO* mem_bio = BIO_new(BIO_s_mem()); + if (mem_bio == nullptr) + { + return false; + } + + // Export the public key from src into the memory buffer in PEM format + if (!PEM_write_bio_EC_PUBKEY(mem_bio, src)) + { + BIO_free(mem_bio); + return false; + } + + // Read the data from the memory buffer + char* bio_data; + long data_len = BIO_get_mem_data(mem_bio, &bio_data); + + // Create a new memory buffer and load the data into it + BIO* mem_bio2 = BIO_new_mem_buf(bio_data, data_len); + if (mem_bio2 == nullptr) + { + BIO_free(mem_bio); + return false; + } + + // Read the public key from the new memory buffer + *dest = PEM_read_bio_EC_PUBKEY(mem_bio2, nullptr, nullptr, nullptr); + if (*dest == nullptr) + { + BIO_free(mem_bio); + BIO_free(mem_bio2); + return false; + } + + // Clean up + BIO_free(mem_bio); + BIO_free(mem_bio2); + + return true; +} + +#endif + #else // GnuTLS-specific functions bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 9d60c8a77..dae62bf88 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -61,11 +61,12 @@ private: std::vector convert_from_hex_str(const std::string& input) const; #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 + bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); EVP_PKEY* d_PublicKey{}; #else + bool pubkey_copy(EC_KEY* src, EC_KEY** dest); EC_KEY* d_PublicKey = nullptr; #endif - bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); #else // GnuTLS gnutls_pubkey_t d_PublicKey{}; bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; From cae618b450d08221fdbbd07a2f3ac5fa63e08829 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Jun 2024 12:42:07 +0200 Subject: [PATCH 207/499] Fix ECDSA signature verification when linking againts OpenSSL 1.0 --- src/core/system_parameters/gnss_crypto.cc | 115 ++++++++++++---------- src/core/system_parameters/gnss_crypto.h | 6 +- 2 files changed, 66 insertions(+), 55 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 9f2ba82fb..5adab48b3 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -305,7 +305,11 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in EVP_DigestFinal_ex(mdctx, output.data(), nullptr); EVP_MD_CTX_free(mdctx); #else - // SHA3-256 not implemented in OpenSSL < 3.0 + // SHA3-256 not implemented in OpenSSL 1.0, it was introduced in OpenSSL 1.1.1 + if (!input.empty()) + { + // TODO + } #endif #else // GnuTLS std::vector output_aux(32); @@ -384,8 +388,8 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector unsigned char* result = HMAC(EVP_sha256(), key.data(), key.size(), input.data(), input.size(), output.data(), &outputLength); if (result == nullptr) { - LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to compute HMAC-SHA256"; - return output; + LOG(WARNING) << "OSNMA HMAC_SHA_256 computation failed to compute HMAC-SHA256"; + return output; } // Resize the output vector to the actual length of the HMAC-SHA256 output @@ -740,7 +744,13 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; } #else - int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, signature.data(), static_cast(signature.size()), d_PublicKey); + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) + { + std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + return false; + } + int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, der_sig.data(), static_cast(der_sig.size()), d_PublicKey); if (verification == 1) { success = true; @@ -749,6 +759,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st else if (verification == 0) { std::cerr << "OpenSSL: invalid signature found when verifying message" << std::endl; + LOG(WARNING) << "OpenSSL: invalid signature found when verifying message"; } else { @@ -876,6 +887,54 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) } +bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const +{ + if (raw_signature.size() % 2 != 0) + { + std::cerr << "Invalid raw ECDSA signature size" << std::endl; + return false; + } + + size_t half_size = raw_signature.size() / 2; + std::vector raw_r(raw_signature.begin(), raw_signature.begin() + half_size); + std::vector raw_s(raw_signature.begin() + half_size, raw_signature.end()); + + auto encode_asn1_integer = [](const std::vector& value) -> std::vector { + std::vector result; + result.push_back(0x02); // INTEGER tag + + if (value[0] & 0x80) + { + result.push_back(value.size() + 1); // Length byte + result.push_back(0x00); // Add leading zero byte to ensure positive integer + } + else + { + result.push_back(value.size()); // Length byte + } + + result.insert(result.end(), value.begin(), value.end()); + return result; + }; + + std::vector der_r = encode_asn1_integer(raw_r); + std::vector der_s = encode_asn1_integer(raw_s); + + size_t total_length = der_r.size() + der_s.size(); + der_signature.push_back(0x30); // SEQUENCE tag + if (total_length > 127) + { + der_signature.push_back(0x81); // Long form length + } + der_signature.push_back(static_cast(total_length)); + + der_signature.insert(der_signature.end(), der_r.begin(), der_r.end()); + der_signature.insert(der_signature.end(), der_s.begin(), der_s.end()); + + return true; +} + + #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) @@ -972,54 +1031,6 @@ bool Gnss_Crypto::pubkey_copy(EC_KEY* src, EC_KEY** dest) #else // GnuTLS-specific functions -bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const -{ - if (raw_signature.size() % 2 != 0) - { - std::cerr << "Invalid raw ECDSA signature size" << std::endl; - return false; - } - - size_t half_size = raw_signature.size() / 2; - std::vector raw_r(raw_signature.begin(), raw_signature.begin() + half_size); - std::vector raw_s(raw_signature.begin() + half_size, raw_signature.end()); - - auto encode_asn1_integer = [](const std::vector& value) -> std::vector { - std::vector result; - result.push_back(0x02); // INTEGER tag - - if (value[0] & 0x80) - { - result.push_back(value.size() + 1); // Length byte - result.push_back(0x00); // Add leading zero byte to ensure positive integer - } - else - { - result.push_back(value.size()); // Length byte - } - - result.insert(result.end(), value.begin(), value.end()); - return result; - }; - - std::vector der_r = encode_asn1_integer(raw_r); - std::vector der_s = encode_asn1_integer(raw_s); - - size_t total_length = der_r.size() + der_s.size(); - der_signature.push_back(0x30); // SEQUENCE tag - if (total_length > 127) - { - der_signature.push_back(0x81); // Long form length - } - der_signature.push_back(static_cast(total_length)); - - der_signature.insert(der_signature.end(), der_r.begin(), der_r.end()); - der_signature.insert(der_signature.end(), der_s.begin(), der_s.end()); - - return true; -} - - bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) { gnutls_datum_t key_datum; diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index dae62bf88..bbcac1afa 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -58,19 +58,19 @@ private: void read_merkle_xml(const std::string& merkleFilePath); void readPublicKeyFromPEM(const std::string& pemFilePath); bool readPublicKeyFromCRT(const std::string& crtFilePath); + bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; std::vector convert_from_hex_str(const std::string& input) const; #if USE_OPENSSL_FALLBACK #if USE_OPENSSL_3 bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); EVP_PKEY* d_PublicKey{}; -#else +#else // OpenSSL 1.x bool pubkey_copy(EC_KEY* src, EC_KEY** dest); EC_KEY* d_PublicKey = nullptr; #endif #else // GnuTLS - gnutls_pubkey_t d_PublicKey{}; - bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; bool pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest); + gnutls_pubkey_t d_PublicKey{}; #endif std::vector d_x_4_0; std::vector d_x_3_1; From 2c833051a5a2969d677063a6cf30108889c65ca3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 25 Jun 2024 13:59:23 +0200 Subject: [PATCH 208/499] Fix SHA3-256 implementation when linking against OpenSSL 1.1.1 --- src/core/system_parameters/CMakeLists.txt | 4 ++++ src/core/system_parameters/gnss_crypto.cc | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 607c3702a..0ef4cf22e 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -163,6 +163,10 @@ if(OPENSSL_FOUND) target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_FALLBACK=1 -DUSE_OPENSSL_3=1) message("USE_OPENSSL_3: " ${DUSE_OPENSSL_3}) message("USE_OPENSSL_FALLBACK:" ${USE_OPENSSL_FALLBACK}) + else() + if(NOT OPENSSL_VERSION VERSION_LESS "1.1.1") + target_compile_definitions(core_system_parameters PRIVATE -DUSE_OPENSSL_FALLBACK=1 -DUSE_OPENSSL_111=1) + endif() endif() endif() diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 5adab48b3..0f1774271 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -60,6 +60,11 @@ Gnss_Crypto::Gnss_Crypto() { #if USE_OPENSSL_FALLBACK +#if !(USE_OPENSSL_3 || USE_OPENSSL_111) + LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." + << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of OpenSSL" + << " and rebuild GNSS-SDR against it."; +#endif #else // GnuTLS gnutls_global_init(); #endif @@ -69,6 +74,11 @@ Gnss_Crypto::Gnss_Crypto() Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath) { #if USE_OPENSSL_FALLBACK +#if !(USE_OPENSSL_3 || USE_OPENSSL_111) + LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." + << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of OpenSSL" + << " and rebuild GNSS-SDR against it."; +#endif #else // GnuTLS gnutls_global_init(); #endif @@ -296,7 +306,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in { std::vector output(32); // SHA256 hash size #if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 +#if USE_OPENSSL_3 || USE_OPENSSL_111 EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); const EVP_MD* md = EVP_sha3_256(); @@ -308,7 +318,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in // SHA3-256 not implemented in OpenSSL 1.0, it was introduced in OpenSSL 1.1.1 if (!input.empty()) { - // TODO + // do nothing } #endif #else // GnuTLS From 1d815f0bbf1ab797857a997b59764621dfdf25c2 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 26 Jun 2024 15:01:05 +0200 Subject: [PATCH 209/499] [TAS-227] [BUG] Tag verification fails for .dat files (WIP) WIP --- .../galileo_telemetry_decoder_gs.cc | 56 +- src/core/libs/osnma_msg_receiver.cc | 78 ++- src/core/libs/osnma_msg_receiver.h | 2 +- .../system_parameters/galileo_inav_message.cc | 2 +- src/core/system_parameters/osnma_helper.cc | 11 + src/core/system_parameters/osnma_helper.h | 1 + .../osnma/osnma_msg_receiver_test.cc | 513 ++++++++++-------- 7 files changed, 369 insertions(+), 294 deletions(-) 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 a404a100a..3b3d4b06a 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 @@ -439,6 +439,35 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } // 4. Push the new navigation data to the queues + // extract OSNMA bits, reset container. + bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: new ADKD=0/12 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW5() - 25 <>( // < PRNd , navDataBits, TOW_Sosf> + d_satellite.get_PRN(), + d_inav_nav.get_osnma_adkd_0_12_nav_bits(), + d_inav_nav.get_TOW5() - 25); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) <<")";//: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); + d_inav_nav.reset_osnma_nav_bits_adkd0_12(); + } + + check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: new ADKD=4 navData from " << d_satellite <<" at TOW_sf=" << d_inav_nav.get_TOW6() - 5 <>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe + d_satellite.get_PRN(), + d_inav_nav.get_osnma_adkd_4_nav_bits(), + d_inav_nav.get_TOW6() - 5); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) <<")";//: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); + d_inav_nav.reset_osnma_nav_bits_adkd4(); + } + + if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) { // get object for this SV (mandatory) @@ -472,20 +501,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set // d_flag_osnma_adkd_0_12 = true; // W1-> W5 available - // extract bits, reset container. - bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; - if(check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << d_satellite.get_PRN() << ") " << "TOW_sf=" << d_inav_nav.get_TOW5() - 24 <>( // < PRNd , navDataBits, TOW_Sosf> - d_satellite.get_PRN(), - d_inav_nav.get_osnma_adkd_0_12_nav_bits(), - d_inav_nav.get_TOW5() - 24); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); - d_inav_nav.reset_osnma_nav_bits_adkd0_12(); - } - - } else { @@ -615,19 +630,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // bool adkd_4_nav_data_available = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; // newApproach: let decoder decide when block starts and let it fill the data, and just check for length if(adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) { - bool check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; - if(check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=4 navData, PRN_d (" << d_satellite.get_PRN() << ") " << "TOW_sf=" << d_inav_nav.get_TOW6() - 4 <>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe - d_satellite.get_PRN(), - d_inav_nav.get_osnma_adkd_4_nav_bits(), - d_inav_nav.get_TOW6() - 4); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - d_inav_nav.reset_osnma_nav_bits_adkd4(); - } - } auto newOSNMA = d_inav_nav.have_new_nma(); if (d_band == '1' && newOSNMA) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 4a5e95ac9..45ad958ee 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -62,13 +62,13 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, osnma_msg_receiver::osnma_msg_receiver( - const std::string& pemFilePath, + const std::string& crtFilePath, const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); - d_crypto = std::make_unique(pemFilePath, merkleFilePath); + d_crypto = std::make_unique(crtFilePath, merkleFilePath); d_helper = std::make_unique(); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); @@ -101,13 +101,13 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); // TODO remove if unneeded std::ostringstream output_message; - output_message << "Galileo OSNMA: Subframe received starting at " - << "WN=" - << nma_msg->WN_sf0 - << ", TOW=" - << nma_msg->TOW_sf0 - << ", from satellite " - << sat; + output_message << "Galileo OSNMA: complete OSNMA message received starting at " + << "WN=" + << nma_msg->WN_sf0 + << ", TOW=" + << nma_msg->TOW_sf0 + << ", from satellite " + << sat; LOG(WARNING) << output_message.str(); std::cout << output_message.str() << std::endl; @@ -125,14 +125,14 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // iono data => 549 bits, utc data, 141 bits. if (nav_data.size() == 549) { - LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " - << "TOW_sf=" << TOW; +// LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " +// << "TOW_sf=" << TOW; d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = nav_data; } else if (nav_data.size() == 141) { - LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " - << "TOW_sf=" << TOW; +// LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " +// << "TOW_sf=" << TOW; d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; } else @@ -322,8 +322,8 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; // TODO set flag to false to avoid processing dsm and MACK messages @@ -914,13 +914,25 @@ void osnma_msg_receiver::process_mack_message() bool ret = verify_macseq(*mack); if (ret || d_flag_debug) { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; for (std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { // add tags of current mack to the verification queue auto& tag = mack->tag_and_info[i]; Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; + LOG(INFO) << "Galileo OSNMA: Add Tag Id= " + << t.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << t.received_tag << std::dec + << ", TOW=" + << t.TOW + << ", ADKD=" + << static_cast(t.ADKD) + << ", PRNa=" + << static_cast(t.PRNa) + << ", PRNd=" + << static_cast(t.PRN_d); } std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; mack = d_macks_awaiting_MACSEQ_verification.erase(mack); @@ -1070,6 +1082,11 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) bool osnma_msg_receiver::verify_tag(Tag& tag) { + // Debug + LOG(INFO) << "Galileo OSNMA: Tag verification :: Start for tag Id= " + << tag.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << tag.received_tag << std::dec; // TODO case tag0, to be verified here?, PRNd not needed for it // build message std::vector m = build_message(tag); @@ -1077,9 +1094,16 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) std::vector mac; std::vector applicable_key; if (tag.ADKD == 0 || tag.ADKD == 4) - applicable_key = d_tesla_keys[tag.TOW + 30]; - else // ADKD 12 - applicable_key = d_tesla_keys[tag.TOW + 330]; + { + applicable_key = d_tesla_keys[tag.TOW + 30]; + LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 30); + } + else // ADKD 12 + { + applicable_key = d_tesla_keys[tag.TOW + 330]; + LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 330); + } + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { @@ -1142,7 +1166,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) << ", PRNa=" << static_cast(tag.PRNa) << ", PRNd=" - << static_cast(tag.PRN_d); + << static_cast(tag.PRN_d) << std::endl; return true; } return false; @@ -1171,10 +1195,12 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; + LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else if (tag.ADKD == 4) { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; + LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else LOG(WARNING) << "Galileo OSNMA :: Tag verification :: unknown ADKD"; @@ -1484,7 +1510,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map - LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW - 30); if (tow_it != tow_map.end()) @@ -1500,7 +1526,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) else { // PRN was not found - LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; return false; } return false; @@ -1519,7 +1545,7 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t) auto it = d_tesla_keys.find(t.TOW + 30); if (it != d_tesla_keys.end()) { - LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } @@ -1528,11 +1554,11 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t) auto it = d_tesla_keys.find(t.TOW + 330); if (it != d_tesla_keys.end()) { - LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } - LOG(INFO) << "Galileo OSNMA: hasKey = false "; + //LOG(INFO) << "Galileo OSNMA: hasKey = false "; return false; } @@ -1601,6 +1627,6 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede // compare computed current key against received key auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = end - start; - LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; +// LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; return K_II; } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 4e662ef55..aef9fd91e 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -59,7 +59,7 @@ public: ~osnma_msg_receiver() = default; //!< Default destructor private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); - osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); + osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index baa140149..a8509db23 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1417,7 +1417,7 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start + int32_t TOW_sf0 = TOW_5 - 25;//- 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start TODO review if (TOW_sf0 < 0) { TOW_sf0 += 604800; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index aa338f408..7cf3165c2 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -16,6 +16,8 @@ #include "osnma_helper.h" #include +#include +#include uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const { @@ -74,3 +76,12 @@ std::string Osnma_Helper::verification_status_str(int status) default: return "UNKNOWN"; } } +std::string Osnma_Helper::convert_to_hex_string(const std::vector& vector) +{ + std::stringstream ss; + ss << std::hex << std::setfill('0'); + for (auto byte : vector) { + ss << std::setw(2) << static_cast(byte); + } + return ss.str(); +} diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 2f8df078b..e78fdba0f 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -30,6 +30,7 @@ public: std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString); std::string verification_status_str(int status); + std::string convert_to_hex_string(const std::vector& vector); }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 35cb9fd45..7b94baf0c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -14,42 +15,39 @@ struct TestVector }; // TODO - parametrize class for different configurations (config_1, config_2, etc.. potentially 5 or 6 more) an make sure wont affect current TEST_F +// note: until the test is parametrized for configuration 1 and 2, in order to change between them you have to comment/uncomment the respective calls in this test, identified with comments // conf. 1/2 +// log_name, input_time, crtFilePath, merkleFilePath, testVectors class OsnmaMsgReceiverTest : public ::testing::Test { protected: osnma_msg_receiver_sptr osnma; - Galileo_Inav_Message galileo_message; - uint8_t page_position_in_inav_subframe; - bool flag_CRC_test; - std::string page_even; OSNMA_msg osnma_msg{}; std::array nma_position_filled; - uint32_t d_GST_SIS{}; // 16 AUG 2023 05 00 01 + uint32_t d_GST_SIS{}; uint32_t TOW{}; uint32_t WN{}; - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0; // 13 + 5; + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + const uint32_t LEAP_SECONDS = 0; //13 + 5; void set_time(std::tm& input); - // std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; - std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; - // void initializeGoogleLog(); +// std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; + std::string log_name {"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; + void initializeGoogleLog(); void SetUp() override { - flag_CRC_test = false; // TODO what for? - page_even = ""; - - // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; + initializeGoogleLog(); +// std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); - // std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; - // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; - std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.pem"; +// std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.crt"; // conf. 1 +// std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); } public: + static std::vector parseNavBits(const std::string& hex); static std::vector readTestVectorsFromFile(const std::string& filename); std::string bytes_to_str(const std::vector& bytes); @@ -57,85 +55,199 @@ public: }; -TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) +TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) { + // Arrange + // ---------- + // m0 + std::vector expected_message = { + 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, + 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, + 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, + 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 + }; + + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + + + + // Act + // ---------- + auto computed_message = osnma->build_message(t0); + + + // Assert + // ---------- + ASSERT_TRUE(computed_message == expected_message); + +} + +TEST_F(OsnmaMsgReceiverTest, TagVerification) { + // Arrange + // ---------- + // Tag0 + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + + + + // Act + // ---------- + bool result_tag0 = osnma->verify_tag(t0); + + + + + + // Assert + // ---------- + //ASSERT_TRUE(result_tag0); + + // Tag3 + uint32_t TOW_Tag3 = 345660; + uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; + uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30 ; + WN = 1248; + PRNa = 2; + CTR = 3; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = + "111111111111111111111111111111110000000000000000000000010001001001001000" + "111000001000100111100010010111111111011110111111111001001100000100000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MTI.tag = static_cast(0x7BB238C883); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x04; + MTI.tag_info.cop = 0x0F; + Tag t3(MTI, TOW_Tag0, WN, PRNa, CTR); + + bool result_tag3 = osnma->verify_tag(t3); + + ASSERT_TRUE(result_tag0 && result_tag3); + +} + +TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Arrange // ---------- osnma->d_tesla_key_verified = false; - osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 - osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 + osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; // local_time_verification would do this operation. TODO - eliminate duplication. osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); - osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; - osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. - std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 + osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 uint32_t TOW = 345630; + + + // Act // ---------- bool result = osnma->verify_tesla_key(key, TOW); + + + + // Assert // ---------- ASSERT_TRUE(result); -} +} TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { - // initializeGoogleLog(); // Arrange // ---------- - // std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); - std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); - if (testVectors.empty()) - { +// std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); // conf. 1 + std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 + if (testVectors.empty()){ ASSERT_TRUE(false); } bool end_of_hex_stream{false}; int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES * SIZE_SUBFRAME_PAGES}; // total bytes of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240/8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; // total bytes of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; + std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; + + + // Act // ---------- // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (end_of_hex_stream == false) - { + while (end_of_hex_stream == false){ // loop over all SVs, extract a subframe - for (const TestVector& tv : testVectors) - { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; + for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); std::array hkroot{}; std::array mack{}; - byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words; // structure containing and + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words_for_OSNMA; // structure containing and - for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index - std::vector page_bytes = extract_page_bytes(tv, byte_index, SIZE_PAGE_BYTES); - if (page_bytes.empty()) - { - std::cout << "OsnmaTestVectorsSimulation: end of TestVectors \n" - << "byte_index=" << byte_index << " expected= " << 432000 / 8 << std::endl; + std::vector page_bytes = extract_page_bytes(tv,byte_index,SIZE_PAGE_BYTES); + if(page_bytes.empty()){ + std::cout<< "OsnmaTestVectorsSimulation: end of TestVectors \n" << "byte_index="< data_k(even_page.substr(2, 112)); - std::bitset<16> data_j(odd_page.substr(2, 16)); + std::bitset<112> data_k(even_page.substr(2,112)); + std::bitset<16> data_j(odd_page.substr(2,16)); std::bitset<112> shifted_data_k = data_k; - // uint8_t word_type = 0; - // for(int i = 0; i < 6; ++i) { - // word_type |= (data_k[104 + i] << i); - // } - uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word - std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; - if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + std::cout<< "OsnmaTestVectorsSimulation: received Word "<< static_cast(word_type) << std::endl; + if( (word_type >= 1 && word_type <=5) || word_type == 6 || word_type == 10) { // store raw word std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); - words[word_type] = data_combined; + words_for_OSNMA[word_type] = data_combined; } - if (word_type == DUMMY_PAGE) + if(word_type == DUMMY_PAGE) flag_dummy_page = true; + // place it into osnma object. std::bitset<40> osnmaBits(odd_page.substr(18, 40)); + // Extract bits for hkroot and mack std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); @@ -183,13 +291,12 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) byte_index += SIZE_PAGE_BYTES; } - std::cout << "----------" << std::endl; - if (end_of_hex_stream) + std::cout<< "----------" << std::endl; + if(end_of_hex_stream) break; - if (flag_dummy_page) - { + if(flag_dummy_page){ flag_dummy_page = false; - continue; // skip this SV + continue; // skip this SV } // Fill osnma object @@ -197,26 +304,26 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->mack = mack; osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; - osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; - osnmaMsg_sptr->PRN = tv.svId; // PRNa + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; + osnmaMsg_sptr->PRN = tv.svId; // PRNa // TODO - refactor this logic, currently it is split - // check if words 1--> 5 words are received => fill EphClockStatus data vector + // check if words_for_OSNMA 1--> 5 words_for_OSNMA are received => fill EphClockStatus data vector bool ephClockStatusWordsReceived = true; for (int i = 1; i <= 5; ++i) { - if (words.find(i) == words.end()) + if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) { ephClockStatusWordsReceived = false; - std::cerr << "OsnmaTestVectorsSimulation: error parsing words 1->5. " - "Word " - << i << " should be received for each subframe but was not." << std::endl; + std::cerr<< "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " + "Word "<< i << " should be received for each subframe but was not." << std::endl; } } // extract bits as needed by osnma block - if (ephClockStatusWordsReceived) + if(ephClockStatusWordsReceived) { + // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {1, {6, 120}}, @@ -226,41 +333,41 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) {5, {6, 67}}, }; - // Fill NavData bits -- Iterate over the extraction parameters // Fill NavData bits -- Iterate over the extraction parameters + // Fill NavData bits -- Iterate over the extraction parameters std::string nav_data_ADKD_0_12 = ""; - for (const auto& param : extractionParams) - { + for (const auto& param : extractionParams) { uint8_t wordKey = param.first; uint8_t start = param.second.first; uint8_t length = param.second.second; // Extract the required bits and fill osnma block - nav_data_ADKD_0_12 += words[wordKey].to_string().substr(start, length); + nav_data_ADKD_0_12 += words_for_OSNMA[wordKey].to_string().substr(start, length); } // send to osnma block bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; - if (check_size_is_ok) + if(check_size_is_ok) { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> tv.svId, nav_data_ADKD_0_12, osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) <<"): 0b" << nav_data_ADKD_0_12; osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } } // check w6 && w10 is received => fill TimingData data vector - bool timingWordsReceived = words.find(6) != words.end() && - words.find(10) != words.end(); + bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && + words_for_OSNMA.find(10) != words_for_OSNMA.end(); // extract bits as needed by osnma block - if (timingWordsReceived) - { + if(timingWordsReceived){ // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {6, {6, 99}}, - {10, {86, 42}}}; + {10, {86, 42}} + }; std::string nav_data_ADKD_4 = ""; // Fill NavData bits -- Iterate over the extraction parameters @@ -271,42 +378,42 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) uint8_t length = param.second.second; // Extract the required bits and fill osnma block - nav_data_ADKD_4 += words[wordKey].to_string().substr( - start, length); + nav_data_ADKD_4 += words_for_OSNMA[wordKey].to_string().substr(start, length); } - // send to osnma block bool check_size_is_ok = nav_data_ADKD_4.size() == 141; - if (check_size_is_ok) + if(check_size_is_ok) { - std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> tv.svId, nav_data_ADKD_4, osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) <<"): 0b" << nav_data_ADKD_4; osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } + } // Call the handler, as if it came from telemetry decoder block auto temp_obj = pmt::make_any(osnmaMsg_sptr); - osnma->msg_handler_osnma(temp_obj); // osnma entry point + osnma->msg_handler_osnma(temp_obj); // osnma entry point } - if (!end_of_hex_stream) - { - offset_byte = byte_index; // update offset for the next subframe + if(!end_of_hex_stream){ + offset_byte = byte_index; // update offset for the next subframe d_GST_SIS += DURATION_SUBFRAME; TOW = d_GST_SIS & 0x000FFFFF; - WN = (d_GST_SIS & 0xFFF00000) >> 20; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS + WN = (d_GST_SIS & 0xFFF00000) >> 20 ; + std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS << ", TOW=" << TOW << ", WN=" << WN << std::endl; } + + } @@ -316,24 +423,22 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) } - +// Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. +// Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) { std::ifstream file(filename); std::vector testVectors; - if (!file.is_open()) - { - std::cerr << "Error reading the file \"" << filename << "\" \n"; + if (!file.is_open()) { + std::cerr<<"Error reading the file \"" << filename <<"\" \n"; return testVectors; } std::string line; std::getline(file, line); - if (line != "SVID,NumNavBits,NavBitsHEX\r") - { - std::cerr << "Error parsing first line" - << "\n"; - } + if (line != "SVID,NumNavBits,NavBitsHEX\r" ){ + std::cerr<<"Error parsing first line" <<"\n"; + } while (std::getline(file, line)) { @@ -356,35 +461,29 @@ std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std: return testVectors; } - - std::vector OsnmaMsgReceiverTest::parseNavBits(const std::string& hex) { std::vector bytes; - for (unsigned int i = 0; i < hex.length() - 1; i += 2) + for (unsigned int i = 0; i < hex.length()-1; i += 2) { std::string byteString = hex.substr(i, 2); - uint8_t byte = (uint8_t)strtol(byteString.c_str(), NULL, 16); + uint8_t byte = (uint8_t) strtol(byteString.c_str(), NULL, 16); bytes.push_back(byte); } return bytes; } - - std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes) { std::string bit_string; bit_string.reserve(bytes.size() * 8); - for (const auto& byte : bytes) + for(const auto& byte : bytes) { std::bitset<8> bits(byte); bit_string += bits.to_string(); } return bit_string; } - - /** * @brief Extracts a range of bytes from a TestVector's navBits vector. * @@ -413,8 +512,6 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } - - /** * @brief Sets the time based on the given input. * @@ -438,118 +535,56 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) uint32_t sec_in_week = 7 * 24 * 60 * 60; uint32_t week_number = duration_sec.count() / sec_in_week; uint32_t time_of_week = duration_sec.count() % sec_in_week; - this->WN = week_number; - this->TOW = time_of_week + LEAP_SECONDS; + this->WN = week_number; + this->TOW = time_of_week + LEAP_SECONDS; // Return the week number and time of week as a pair // TODO: d_GST_SIS or d_receiver_time? doubt // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 - this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); + this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); + + } - - -TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) +void OsnmaMsgReceiverTest::initializeGoogleLog() { - // Arrange - // ---------- - // m0 - std::vector expected_message = { - 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, - 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, - 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, - 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, - 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00}; - - uint32_t TOW_Tag0 = 345660; - uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; - uint32_t WN = 1248; - uint32_t PRNa = 2; - uint8_t CTR = 1; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MACK_tag_and_info MTI; - MTI.tag = static_cast(0xE37BC4F858); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x00; - MTI.tag_info.cop = 0x0F; - Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - - // Act - // ---------- - auto computed_message = osnma->build_message(t0); - - - // Assert - // ---------- - ASSERT_TRUE(computed_message == expected_message); + google::InitGoogleLogging(log_name.c_str()); + FLAGS_minloglevel = 0; // INFO + FLAGS_logtostderr = 0; // add this line + FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; + if (FLAGS_log_dir.empty()) + { + std::cout << "Logging will be written at " + << std::filesystem::temp_directory_path() + << '\n' + << "Use gnss-sdr --log_dir=/path/to/log to change that.\n"; + } + else + { + try + { + const std::filesystem::path p(FLAGS_log_dir); + if (!std::filesystem::exists(p)) + { + std::cout << "The path " + << FLAGS_log_dir + << " does not exist, attempting to create it.\n"; + std::error_code ec; + if (!std::filesystem::create_directory(p, ec)) + { + std::cout << "Could not create the " << FLAGS_log_dir << " folder.\n"; + gflags::ShutDownCommandLineFlags(); + throw std::runtime_error("Could not create folder for logs"); + } + } + std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; + } + catch (const std::exception& e) + { + std::cerr << e.what() << '\n'; + std::cerr << "Could not create the " << FLAGS_log_dir << " folder.\n"; + gflags::ShutDownCommandLineFlags(); + throw; + } + } } - -TEST_F(OsnmaMsgReceiverTest, TagVerification) -{ - // Arrange - // ---------- - // Tag0 - uint32_t TOW_Tag0 = 345660; - uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; - uint32_t WN = 1248; - uint32_t PRNa = 2; - uint8_t CTR = 1; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MACK_tag_and_info MTI; - MTI.tag = static_cast(0xE37BC4F858); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x00; - MTI.tag_info.cop = 0x0F; - Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - - // Act - // ---------- - bool result_tag0 = osnma->verify_tag(t0); - - - // Assert - // ---------- - // ASSERT_TRUE(result_tag0); - - // Tag3 - uint32_t TOW_Tag3 = 345660; - uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; - uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30; - WN = 1248; - PRNa = 2; - CTR = 3; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = - "111111111111111111111111111111110000000000000000000000010001001001001000" - "111000001000100111100010010111111111011110111111111001001100000100000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MTI.tag = static_cast(0x7BB238C883); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x04; - MTI.tag_info.cop = 0x0F; - Tag t3(MTI, TOW_Tag0, WN, PRNa, CTR); - - bool result_tag3 = osnma->verify_tag(t3); - - ASSERT_TRUE(result_tag0 && result_tag3); -} From c38fb0fca5756884c7f3088742226b7fa9ba64ad Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 28 Jun 2024 10:51:10 +0200 Subject: [PATCH 210/499] Fix building (add missing include) --- src/core/system_parameters/osnma_helper.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 7cf3165c2..3feeb96cf 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -18,6 +18,7 @@ #include #include #include +#include uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const { @@ -25,6 +26,7 @@ uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const return GST; } + std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const { std::vector res; @@ -36,6 +38,7 @@ std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const return res; } + /** * @brief Convert a binary string to a vector of bytes. * @@ -67,6 +70,7 @@ std::vector Osnma_Helper::bytes(const std::string& binaryString) { return bytes; } + std::string Osnma_Helper::verification_status_str(int status) { switch (status) { @@ -76,6 +80,8 @@ std::string Osnma_Helper::verification_status_str(int status) default: return "UNKNOWN"; } } + + std::string Osnma_Helper::convert_to_hex_string(const std::vector& vector) { std::stringstream ss; From 359693c0e88b92b0b34443a52bb3a5f19c143276 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 28 Jun 2024 13:03:14 +0200 Subject: [PATCH 211/499] Add GNSS-SDR.osnma_enable configuration parameter, by default set to true --- src/core/receiver/gnss_flowgraph.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index acdea9df2..af1795ee0 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -121,7 +121,7 @@ void GNSSFlowgraph::init() galileo_tow_map_ = nullptr; } - if (configuration_->property("Channels_1B.count", 0) > 0) + if (configuration_->property("Channels_1B.count", 0) > 0 && configuration_->property("GNSS-SDR.osnma_enable", true)) { enable_osnma_rx_ = true; const auto certFilePath = configuration_->property("GNSS-SDR.osnma_public_key", CRTFILE_DEFAULT); From db5466832cfeae205ee0f6f18611583dfa18f222 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 29 Jun 2024 11:10:35 +0200 Subject: [PATCH 212/499] Look for OpenSSL in the first place, fallback to GnuTLS if not found Fix test building in some environments --- CMakeLists.txt | 94 +--- cmake/Modules/GnssSdrCrypto.cmake | 152 ++++++ docs/CHANGELOG.md | 9 + src/core/libs/supl/CMakeLists.txt | 13 +- src/core/libs/supl/supl.h | 14 +- src/core/system_parameters/CMakeLists.txt | 49 +- src/core/system_parameters/gnss_crypto.cc | 436 +++++++++--------- src/core/system_parameters/gnss_crypto.h | 15 +- src/tests/CMakeLists.txt | 3 + .../osnma/osnma_msg_receiver_test.cc | 54 +-- 10 files changed, 410 insertions(+), 429 deletions(-) create mode 100644 cmake/Modules/GnssSdrCrypto.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index a97dee597..4264195a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2196,99 +2196,9 @@ endif() ################################################################################ -# GnuTLS - https://www.gnutls.org/ +# OpenSSL https://www.openssl.org/ or GnuTLS - https://www.gnutls.org/ ################################################################################ -find_package(GnuTLS) -set_package_properties(GnuTLS PROPERTIES - URL "https://www.gnutls.org/" - PURPOSE "Used for the SUPL protocol implementation." - TYPE REQUIRED -) -if(GnuTLS_FOUND AND GNUTLS_VERSION_STRING) - set_package_properties(GnuTLS PROPERTIES - DESCRIPTION "Transport Layer Security Library (found: v${GNUTLS_VERSION_STRING})" - ) -else() - set_package_properties(GnuTLS PROPERTIES - DESCRIPTION "Transport Layer Security Library" - ) -endif() -find_library(GNUTLS_OPENSSL_LIBRARY - NAMES gnutls-openssl libgnutls-openssl.so.27 - PATHS - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/i386-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib -) -#if(NOT GNUTLS_OPENSSL_LIBRARY) -if(GNUTLS_OPENSSL_LIBRARY) - if(GnuTLS_FOUND) - message(STATUS " But it was not built with openssl compatibility.") - endif() - message(STATUS " Looking for OpenSSL instead...") - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) # Trick for Homebrew - endif() - find_package(OpenSSL) - set_package_properties(OpenSSL PROPERTIES - URL "https://www.openssl.org" - DESCRIPTION "Cryptography and SSL/TLS Toolkit (found: v${OPENSSL_VERSION})" - PURPOSE "Used for the SUPL protocol implementation." - TYPE REQUIRED - ) - message("OPENSSL_FOUND: " ${OPENSSL_FOUND}) - if(OPENSSL_FOUND) - set_package_properties(GnuTLS PROPERTIES - PURPOSE "Not found, but OpenSSL can replace it." - ) - set(GNUTLS_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR}) - set(GNUTLS_LIBRARIES "") - set(GNUTLS_OPENSSL_LIBRARY ${OPENSSL_SSL_LIBRARY}) - else() - message(" The GnuTLS library with openssl compatibility enabled has not been found.") - message(" You can try to install the required libraries by typing:") - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(" sudo yum install openssl-devel") - else() - message(" sudo apt-get install libgnutls28-dev") - endif() - endif() - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - message(" 'sudo port install gnutls', if you are using Macports, or") - message(" 'brew install openssl', if you are using Homebrew.") - endif() - message(FATAL_ERROR "GnuTLS libraries with openssl compatibility are required to build gnss-sdr") - endif() -endif() +include(GnssSdrCrypto) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake new file mode 100644 index 000000000..33e1aaab1 --- /dev/null +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -0,0 +1,152 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + + +################################################################################ +# OpenSSL https://www.openssl.org/ +################################################################################ +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) # Trick for Homebrew +endif() +find_package(OpenSSL) +set_package_properties(OpenSSL + PROPERTIES + URL "https://www.openssl.org" + PURPOSE "Used for the OSNMA and SUPL protocol implementations." + TYPE REQUIRED +) +if(OPENSSL_FOUND) + set_package_properties(OpenSSL + PROPERTIES + DESCRIPTION "Cryptography and SSL/TLS Toolkit (found: v${OPENSSL_VERSION})" + ) +else() + set_package_properties(OpenSSL + PROPERTIES + DESCRIPTION "OpenSSL has not been found, but GnuTLS with openssl compatibility can replace it" + ) + ################################################################################ + # GnuTLS - https://www.gnutls.org/ + ################################################################################ + find_package(GnuTLS) + set_package_properties(GnuTLS PROPERTIES + URL "https://www.gnutls.org/" + PURPOSE "Used for the OSNMA and SUPL protocol implementations." + TYPE REQUIRED + ) + if(GnuTLS_FOUND AND GNUTLS_VERSION_STRING) + set_package_properties(GnuTLS PROPERTIES + DESCRIPTION "Transport Layer Security Library (found: v${GNUTLS_VERSION_STRING})" + ) + else() + set_package_properties(GnuTLS PROPERTIES + DESCRIPTION "Transport Layer Security Library" + ) + endif() + find_library(GNUTLS_OPENSSL_LIBRARY + NAMES gnutls-openssl libgnutls-openssl.so.27 + PATHS + /usr/lib + /usr/lib64 + /usr/lib/x86_64-linux-gnu + /usr/lib/aarch64-linux-gnu + /usr/lib/arm-linux-gnueabihf + /usr/lib/arm-linux-gnueabi + /usr/lib/i386-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/i386-gnu + /usr/lib/i686-gnu + /usr/lib/i686-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/i686-kfreebsd-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib/sh4-linux-gnu + /usr/lib/loongarch64-linux-gnu + /usr/local/lib + /usr/local/lib64 + /opt/local/lib + ) + + if(NOT GNUTLS_OPENSSL_LIBRARY) + message(" The GnuTLS library with openssl compatibility enabled has not been found.") + message(" You can try to install the required libraries by typing:") + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(" sudo yum install openssl-devel") + else() + message(" sudo apt-get install libgnutls28-dev") + endif() + endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + message(" 'sudo port install gnutls', if you are using Macports, or") + message(" 'brew install openssl', if you are using Homebrew.") + endif() + message(FATAL_ERROR "OpenSSL or the GnuTLS libraries with openssl compatibility are required to build gnss-sdr") + endif() +endif() + +################################################################################ + +function(link_to_crypto_dependencies target) + if(OPENSSL_FOUND) + if(TARGET OpenSSL::SSL) + target_link_libraries(core_system_parameters + PUBLIC + OpenSSL::SSL + ) + if(TARGET OpenSSL::Crypto) + target_link_libraries(core_system_parameters + PUBLIC + OpenSSL::Crypto + ) + endif() + else() + target_link_libraries(core_system_parameters + PUBLIC + ${OPENSSL_LIBRARIES} + "${OPENSSL_CRYPTO_LIBRARIES}" + ) + target_include_directories(core_system_parameters + PUBLIC + ${OPENSSL_INCLUDE_DIR} + ) + endif() + if(OPENSSL_VERSION) + if(OPENSSL_VERSION VERSION_GREATER "3.0.0") + target_compile_definitions(${target} PUBLIC -DUSE_OPENSSL_3=1) + else() + if(NOT OPENSSL_VERSION VERSION_LESS "1.1.1") + target_compile_definitions(${target} PUBLIC -DUSE_OPENSSL_111=1) + else() + endif() + endif() + else() + endif() + else() # GnuTLS + target_link_libraries(core_system_parameters + PUBLIC + ${GNUTLS_LIBRARIES} + ${GNUTLS_OPENSSL_LIBRARY} + ) + target_include_directories(core_system_parameters + PUBLIC + ${GNUTLS_INCLUDE_DIR} + ) + target_compile_definitions(${target} PUBLIC -DUSE_GNUTLS_FALLBACK=1) + endif() +endfunction() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7e594fb9..1812c76b7 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -55,6 +55,15 @@ All notable changes to GNSS-SDR will be documented in this file. This change has a downside in maintainability, since the source code becomes plagued with preprocessor directives required to maintain compatibility both with gflags and glog, and with Abseil. +- Historically, GNSS-SDR linked against the GnuTLS library for cryptographic + functions. If GnuTLS was not found, then the building system looked for and + linked against OpenSSL as a fallback. This was due to the OpenSSL 1.x dual + license scheme, which was incompatible with GPL v3.0 license, preventing it + from being a mandatory dependency for GNSS-SDR in most GNU/Linux + distributions. This issue was solved with the release of OpenSSL 3.0.0, which + transitioned to the Apache License 2.0, fully compatible with GPL v3.0. + Accordingly, the GNSS-SDR building system now looks for OpenSSL in the first + place and, if not found, then it looks for GnuTLS as a fallback. ### Improvements in Usability: diff --git a/src/core/libs/supl/CMakeLists.txt b/src/core/libs/supl/CMakeLists.txt index 743852047..78ab2b80e 100644 --- a/src/core/libs/supl/CMakeLists.txt +++ b/src/core/libs/supl/CMakeLists.txt @@ -46,16 +46,9 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU" AND (CMAKE_VERSION VERSION_GREATER "3 target_compile_options(core_libs_supl PUBLIC $<$:${MY_C_FLAGS}>) endif() -if(OPENSSL_FOUND) - target_compile_definitions(core_libs_supl PUBLIC -DUSE_OPENSSL_FALLBACK=1) -endif() -message("OPENSSL_FOUND: " ${OPENSSL_FOUND}) -message("USE_OPENSSL_FALLBACK:" ${USE_OPENSSL_FALLBACK}) -target_link_libraries(core_libs_supl - PUBLIC - ${GNUTLS_LIBRARIES} - ${GNUTLS_OPENSSL_LIBRARY} -) +# links to the appropriate library and defines +# USE_GNUTLS_FALLBACK, USE_OPENSSL_3, or USE_OPENSSL_111 accordingly. +link_to_crypto_dependencies(core_libs_supl) target_include_directories(core_libs_supl PUBLIC diff --git a/src/core/libs/supl/supl.h b/src/core/libs/supl/supl.h index c879112f6..8c9bef533 100644 --- a/src/core/libs/supl/supl.h +++ b/src/core/libs/supl/supl.h @@ -24,18 +24,18 @@ #define EXPORT #endif // clang-format off -#if USE_OPENSSL_FALLBACK -#include -#include -#include -#include -#include -#else +#if USE_GNUTLS_FALLBACK #include #include #include #include #include +#else +#include +#include +#include +#include +#include #endif // clang-format on #include diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 0ef4cf22e..055ff256e 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -124,7 +124,7 @@ target_link_libraries(core_system_parameters Boost::date_time Boost::serialization PRIVATE - Pugixml::pugixml + Pugixml::pugixml ) if(ENABLE_GLOG_AND_GFLAGS) @@ -140,50 +140,9 @@ target_include_directories(core_system_parameters ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) -if(OPENSSL_FOUND) - message("OPENSSL_FOUND: " ${OPENSSL_FOUND}) - if(TARGET OpenSSL::SSL) - target_link_libraries(core_system_parameters - PUBLIC - OpenSSL::SSL - ) - else() - target_link_libraries(core_system_parameters - PUBLIC - ${OPENSSL_LIBRARIES} - ) - target_include_directories(core_system_parameters - PUBLIC - ${OPENSSL_INCLUDE_DIR} - ) - endif() - if(OPENSSL_VERSION) - message("OPENSSL_VERSION: " ${OPENSSL_VERSION}) - if(OPENSSL_VERSION VERSION_GREATER "3.0.0") - target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_FALLBACK=1 -DUSE_OPENSSL_3=1) - message("USE_OPENSSL_3: " ${DUSE_OPENSSL_3}) - message("USE_OPENSSL_FALLBACK:" ${USE_OPENSSL_FALLBACK}) - else() - if(NOT OPENSSL_VERSION VERSION_LESS "1.1.1") - target_compile_definitions(core_system_parameters PRIVATE -DUSE_OPENSSL_FALLBACK=1 -DUSE_OPENSSL_111=1) - endif() - endif() - endif() - -else() - target_link_libraries(core_system_parameters - PUBLIC - ${GNUTLS_LIBRARIES} - ${GNUTLS_OPENSSL_LIBRARY} - ) - target_include_directories(core_system_parameters - PUBLIC - ${GNUTLS_INCLUDE_DIR} - ) -endif() -if(OPENSSL_FOUND) - target_compile_definitions(core_system_parameters PUBLIC -DUSE_OPENSSL_FALLBACK=1) -endif() +# links to the appropriate library and defines +# USE_GNUTLS_FALLBACK, USE_OPENSSL_3, or USE_OPENSSL_111 accordingly. +link_to_crypto_dependencies(core_system_parameters) if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 0f1774271..a50e2f00b 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -25,7 +25,12 @@ #include #include -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK +#include +#include +#include +#include +#else // OpenSSL #include #include #include @@ -40,14 +45,9 @@ #include #include #define OPENSSL_ENGINE nullptr -#else +#else // OpenSSL 1.x #include #endif -#else // GnuTLS -#include -#include -#include -#include #endif #if USE_GLOG_AND_GFLAGS @@ -59,28 +59,28 @@ Gnss_Crypto::Gnss_Crypto() { -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + gnutls_global_init(); +#else // OpenSSL #if !(USE_OPENSSL_3 || USE_OPENSSL_111) LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of OpenSSL" << " and rebuild GNSS-SDR against it."; #endif -#else // GnuTLS - gnutls_global_init(); #endif } Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath) { -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + gnutls_global_init(); +#else // OpenSSL #if !(USE_OPENSSL_3 || USE_OPENSSL_111) LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of OpenSSL" << " and rebuild GNSS-SDR against it."; #endif -#else // GnuTLS - gnutls_global_init(); #endif if (!readPublicKeyFromCRT(certFilePath)) { @@ -92,31 +92,30 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer Gnss_Crypto::~Gnss_Crypto() { -#if USE_OPENSSL_FALLBACK -#if USE_OPENSSL_3 -#else - if (d_PublicKey != nullptr) - { - EC_KEY_free(d_PublicKey); - } -#endif -#else // GnuTLS +#if USE_GNUTLS_FALLBACK if (d_PublicKey != nullptr) { gnutls_pubkey_deinit(d_PublicKey); d_PublicKey = nullptr; } gnutls_global_deinit(); +#else // OpenSSL +#if !USE_OPENSSL_3 + if (d_PublicKey != nullptr) + { + EC_KEY_free(d_PublicKey); + } +#endif #endif } bool Gnss_Crypto::have_public_key() const { -#if USE_OPENSSL_FALLBACK - return (d_PublicKey != nullptr); -#else // GnuTLS +#if USE_GNUTLS_FALLBACK return (d_PublicKey != gnutls_pubkey_t{}); +#else // OpenSSL + return (d_PublicKey != nullptr); #endif } @@ -260,7 +259,15 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) std::vector Gnss_Crypto::computeSHA256(const std::vector& input) const { std::vector output(32); // SHA256 hash size -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + std::vector output_aux(32); + gnutls_hash_hd_t hashHandle; + gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); + gnutls_hash(hashHandle, input.data(), input.size()); + gnutls_hash_output(hashHandle, output_aux.data()); + output = output_aux; + gnutls_hash_deinit(hashHandle, output_aux.data()); +#else // OpenSSL #if USE_OPENSSL_3 unsigned int mdLen; EVP_MD_CTX* mdCtx = EVP_MD_CTX_new(); @@ -283,20 +290,12 @@ std::vector Gnss_Crypto::computeSHA256(const std::vector& inpu return output; } EVP_MD_CTX_free(mdCtx); -#else +#else // OpenSSL 1.x SHA256_CTX sha256Context; SHA256_Init(&sha256Context); SHA256_Update(&sha256Context, input.data(), input.size()); SHA256_Final(output.data(), &sha256Context); #endif -#else // GnuTLS - std::vector output_aux(32); - gnutls_hash_hd_t hashHandle; - gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA256); - gnutls_hash(hashHandle, input.data(), input.size()); - gnutls_hash_output(hashHandle, output_aux.data()); - output = output_aux; - gnutls_hash_deinit(hashHandle, output_aux.data()); #endif return output; } @@ -305,7 +304,15 @@ std::vector Gnss_Crypto::computeSHA256(const std::vector& inpu std::vector Gnss_Crypto::computeSHA3_256(const std::vector& input) const { std::vector output(32); // SHA256 hash size -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + std::vector output_aux(32); + gnutls_hash_hd_t hashHandle; + gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); + gnutls_hash(hashHandle, input.data(), input.size()); + gnutls_hash_output(hashHandle, output_aux.data()); + output = output_aux; + gnutls_hash_deinit(hashHandle, output_aux.data()); +#else // OpenSSL #if USE_OPENSSL_3 || USE_OPENSSL_111 EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); const EVP_MD* md = EVP_sha3_256(); @@ -314,21 +321,13 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in EVP_DigestUpdate(mdctx, input.data(), input.size()); EVP_DigestFinal_ex(mdctx, output.data(), nullptr); EVP_MD_CTX_free(mdctx); -#else +#else // OpenSSL 1.x // SHA3-256 not implemented in OpenSSL 1.0, it was introduced in OpenSSL 1.1.1 if (!input.empty()) { // do nothing } #endif -#else // GnuTLS - std::vector output_aux(32); - gnutls_hash_hd_t hashHandle; - gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); - gnutls_hash(hashHandle, input.data(), input.size()); - gnutls_hash_output(hashHandle, output_aux.data()); - output = output_aux; - gnutls_hash_deinit(hashHandle, output_aux.data()); #endif return output; } @@ -337,7 +336,15 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const { std::vector output(32); -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + std::vector output_aux(32); + gnutls_hmac_hd_t hmac; + gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); + gnutls_hmac(hmac, input.data(), input.size()); + gnutls_hmac_output(hmac, output_aux.data()); + output = output_aux; + gnutls_hmac_deinit(hmac, output_aux.data()); +#else // OpenSSL #if USE_OPENSSL_3 std::vector hmac(EVP_MAX_MD_SIZE); size_t output_length = 0; @@ -393,7 +400,7 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector EVP_MAC_free(mac); hmac.resize(output_length); output = hmac; -#else +#else // OpenSSL 1.x unsigned int outputLength = EVP_MAX_MD_SIZE; unsigned char* result = HMAC(EVP_sha256(), key.data(), key.size(), input.data(), input.size(), output.data(), &outputLength); if (result == nullptr) @@ -405,14 +412,6 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector // Resize the output vector to the actual length of the HMAC-SHA256 output output.resize(outputLength); #endif -#else // GnuTLS - std::vector output_aux(32); - gnutls_hmac_hd_t hmac; - gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); - gnutls_hmac(hmac, input.data(), input.size()); - gnutls_hmac_output(hmac, output_aux.data()); - output = output_aux; - gnutls_hmac_deinit(hmac, output_aux.data()); #endif return output; } @@ -421,7 +420,18 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& key, const std::vector& input) const { std::vector output(16); -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + gnutls_cipher_hd_t cipher; + std::vector mac(16); + std::vector message = input; + gnutls_datum_t key_data = {const_cast(key.data()), static_cast(key.size())}; + gnutls_cipher_init(&cipher, GNUTLS_CIPHER_AES_128_CBC, &key_data, nullptr); + gnutls_cipher_set_iv(cipher, nullptr, 16); // Set IV to zero + gnutls_cipher_encrypt(cipher, message.data(), message.size()); // Encrypt the message with AES-128 + gnutls_cipher_tag(cipher, mac.data(), mac.size()); // Get the CMAC-AES tag + output = mac; + gnutls_cipher_deinit(cipher); +#else // OpenSSL #if USE_OPENSSL_3 std::vector aux(EVP_MAX_MD_SIZE); // CMAC-AES output size size_t output_length = 0; @@ -479,7 +489,7 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke aux.resize(output_length); output = aux; -#else +#else // OpenSSL 1.x std::vector mac(16); // CMAC-AES output size // Create CMAC context @@ -495,17 +505,6 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke output = mac; #endif -#else // GnuTLS - gnutls_cipher_hd_t cipher; - std::vector mac(16); - std::vector message = input; - gnutls_datum_t key_data = {const_cast(key.data()), static_cast(key.size())}; - gnutls_cipher_init(&cipher, GNUTLS_CIPHER_AES_128_CBC, &key_data, nullptr); - gnutls_cipher_set_iv(cipher, nullptr, 16); // Set IV to zero - gnutls_cipher_encrypt(cipher, message.data(), message.size()); // Encrypt the message with AES-128 - gnutls_cipher_tag(cipher, mac.data(), mac.size()); // Get the CMAC-AES tag - output = mac; - gnutls_cipher_deinit(cipher); #endif return output; } @@ -526,27 +525,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) return; } std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); -#if USE_OPENSSL_FALLBACK - // Create a BIO object from the string data - BIO* bio = BIO_new_mem_buf(pemContent.c_str(), pemContent.length()); - if (!bio) - { - std::cerr << "OpenSSL: error creating a BIO object with data read from file " << pemFilePath << ". Aborting import" << std::endl; - return; - } -#if USE_OPENSSL_3 - d_PublicKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); -#else - d_PublicKey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); -#endif - BIO_free(bio); - if (d_PublicKey == nullptr) - { - std::cerr << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import" << std::endl; - LOG(INFO) << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import"; - return; - } -#else // GnuTLS +#if USE_GNUTLS_FALLBACK // Import the PEM data gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(pemContent.data())), static_cast(pemContent.size())}; gnutls_pubkey_t pubkey; @@ -566,6 +545,26 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) pubkey_copy(pubkey, &d_PublicKey); gnutls_pubkey_deinit(pubkey); +#else // OpenSSL + // Create a BIO object from the string data + BIO* bio = BIO_new_mem_buf(pemContent.c_str(), pemContent.length()); + if (!bio) + { + std::cerr << "OpenSSL: error creating a BIO object with data read from file " << pemFilePath << ". Aborting import" << std::endl; + return; + } +#if USE_OPENSSL_3 + d_PublicKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); +#else // OpenSSL 1.x + d_PublicKey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); +#endif + BIO_free(bio); + if (d_PublicKey == nullptr) + { + std::cerr << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import" << std::endl; + LOG(INFO) << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import"; + return; + } #endif std::cout << "OSNMA Public key successfully read from file " << pemFilePath << std::endl; LOG(INFO) << "OSNMA Public key successfully read from file " << pemFilePath; @@ -574,57 +573,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { -#if USE_OPENSSL_FALLBACK - // Open the .crt file - std::ifstream crtFile(crtFilePath, std::ios::binary); - if (!crtFile.is_open()) - { - std::cerr << "Unable to open file: " << crtFilePath << std::endl; - return false; - } - - // Read certificate - std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); - BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); - if (!bio) - { - std::cerr << "Unable to create BIO for file: " << crtFilePath << std::endl; - return false; - } - X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); - if (!cert) - { - std::cerr << "Unable to read certificate from file: " << crtFilePath << std::endl; - BIO_free(bio); - return false; - } - - // Read the public key from the certificate - EVP_PKEY* pubkey = X509_get_pubkey(cert); -#if USE_OPENSSL_3 - if (!pubkey) - { - std::cerr << "Failed to extract the public key" << std::endl; - X509_free(cert); - return false; - } - pubkey_copy(pubkey, &d_PublicKey); - EVP_PKEY_free(pubkey); -#else - EC_KEY* ec_pubkey = EVP_PKEY_get1_EC_KEY(pubkey); - EVP_PKEY_free(pubkey); - if (!ec_pubkey) - { - std::cerr << "Failed to extract the public key" << std::endl; - X509_free(cert); - return false; - } - pubkey_copy(ec_pubkey, &d_PublicKey); - EC_KEY_free(ec_pubkey); -#endif - BIO_free(bio); - X509_free(cert); -#else // GnuTLS +#if USE_GNUTLS_FALLBACK // Open the .crt file std::ifstream crtFile(crtFilePath, std::ios::binary); if (!crtFile.is_open()) @@ -664,6 +613,56 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) pubkey_copy(pubkey, &d_PublicKey); gnutls_x509_crt_deinit(cert); gnutls_pubkey_deinit(pubkey); +#else // OpenSSL + // Open the .crt file + std::ifstream crtFile(crtFilePath, std::ios::binary); + if (!crtFile.is_open()) + { + std::cerr << "Unable to open file: " << crtFilePath << std::endl; + return false; + } + + // Read certificate + std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); + BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); + if (!bio) + { + std::cerr << "Unable to create BIO for file: " << crtFilePath << std::endl; + return false; + } + X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); + if (!cert) + { + std::cerr << "Unable to read certificate from file: " << crtFilePath << std::endl; + BIO_free(bio); + return false; + } + + // Read the public key from the certificate + EVP_PKEY* pubkey = X509_get_pubkey(cert); +#if USE_OPENSSL_3 + if (!pubkey) + { + std::cerr << "Failed to extract the public key" << std::endl; + X509_free(cert); + return false; + } + pubkey_copy(pubkey, &d_PublicKey); + EVP_PKEY_free(pubkey); +#else // OpenSSL 1.x + EC_KEY* ec_pubkey = EVP_PKEY_get1_EC_KEY(pubkey); + EVP_PKEY_free(pubkey); + if (!ec_pubkey) + { + std::cerr << "Failed to extract the public key" << std::endl; + X509_free(cert); + return false; + } + pubkey_copy(ec_pubkey, &d_PublicKey); + EC_KEY_free(ec_pubkey); +#endif + BIO_free(bio); + X509_free(cert); #endif std::cout << "OSNMA Public key successfully read from file " << crtFilePath << std::endl; LOG(INFO) << "OSNMA Public key successfully read from file " << crtFilePath; @@ -680,7 +679,32 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st return false; } bool success = false; -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + // Convert signature to DER format + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) + { + std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + return false; + } + + // Prepare the digest datum + gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; + gnutls_datum_t der_sig_data = {der_sig.data(), static_cast(der_sig.size())}; + + // Verify the DER-encoded signature + int ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &digest_data, &der_sig_data); + success = (ret >= 0); + if (success) + { + LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + } + else + { + std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; + LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); + } +#else // OpenSSL #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); @@ -753,7 +777,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st std::cerr << "OpenSSL: OSNMA message authentication failed: " << err << std::endl; LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; } -#else +#else // OpenSSL 1.x std::vector der_sig; if (!convert_raw_to_der_ecdsa(signature, der_sig)) { @@ -777,31 +801,6 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; } #endif -#else // GnuTLS - // Convert signature to DER format - std::vector der_sig; - if (!convert_raw_to_der_ecdsa(signature, der_sig)) - { - std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; - return false; - } - - // Prepare the digest datum - gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; - gnutls_datum_t der_sig_data = {der_sig.data(), static_cast(der_sig.size())}; - - // Verify the DER-encoded signature - int ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &digest_data, &der_sig_data); - success = (ret >= 0); - if (success) - { - LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; - } - else - { - std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; - LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); - } #endif return success; } @@ -845,7 +844,21 @@ std::vector Gnss_Crypto::getMerkleRoot(const std::vector& publicKey) { -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + gnutls_pubkey_t pubkey; + gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; + gnutls_pubkey_init(&pubkey); + int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); + if (ret != GNUTLS_E_SUCCESS) + { + gnutls_pubkey_deinit(pubkey); + std::cerr << "GnuTLS: error setting the public key" << std::endl; + std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; + return; + } + pubkey_copy(pubkey, &d_PublicKey); + gnutls_pubkey_deinit(pubkey); +#else // OpenSSL BIO* bio = nullptr; EVP_PKEY* pkey = nullptr; bio = BIO_new_mem_buf(publicKey.data(), publicKey.size()); @@ -876,22 +889,8 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) return; } EC_KEY_free(ec_pkey); -#endif +#endif // OpenSSL 1.x EVP_PKEY_free(pkey); -#else // GnuTLS - gnutls_pubkey_t pubkey; - gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; - gnutls_pubkey_init(&pubkey); - int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); - if (ret != GNUTLS_E_SUCCESS) - { - gnutls_pubkey_deinit(pubkey); - std::cerr << "GnuTLS: error setting the public key" << std::endl; - std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; - return; - } - pubkey_copy(pubkey, &d_PublicKey); - gnutls_pubkey_deinit(pubkey); #endif LOG(INFO) << "OSNMA Public Key successfully set up."; } @@ -945,7 +944,40 @@ bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signa } -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK // GnuTLS-specific functions +bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) +{ + gnutls_datum_t key_datum; + + // Export the public key from src to memory + int ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); + if (ret < 0) + { + gnutls_free(key_datum.data); + return false; + } + + // Initialize dest + ret = gnutls_pubkey_init(dest); + if (ret < 0) + { + gnutls_free(key_datum.data); + return false; + } + + // Import the public key data from key_datum to dest + ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); + gnutls_free(key_datum.data); + + if (ret < 0) + { + gnutls_pubkey_deinit(*dest); + return false; + } + + return true; +} +#else // OpenSSL #if USE_OPENSSL_3 bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) { @@ -1036,41 +1068,5 @@ bool Gnss_Crypto::pubkey_copy(EC_KEY* src, EC_KEY** dest) return true; } - #endif - -#else // GnuTLS-specific functions - -bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) -{ - gnutls_datum_t key_datum; - - // Export the public key from src to memory - int ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); - if (ret < 0) - { - gnutls_free(key_datum.data); - return false; - } - - // Initialize dest - ret = gnutls_pubkey_init(dest); - if (ret < 0) - { - gnutls_free(key_datum.data); - return false; - } - - // Import the public key data from key_datum to dest - ret = gnutls_pubkey_import(*dest, &key_datum, GNUTLS_X509_FMT_PEM); - gnutls_free(key_datum.data); - - if (ret < 0) - { - gnutls_pubkey_deinit(*dest); - return false; - } - - return true; -} #endif diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index bbcac1afa..7e0527750 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -22,10 +22,10 @@ #include #include #include -#if USE_OPENSSL_FALLBACK -#include -#else +#if USE_GNUTLS_FALLBACK #include +#else // OpenSSL +#include #endif /** \addtogroup Core @@ -60,7 +60,10 @@ private: bool readPublicKeyFromCRT(const std::string& crtFilePath); bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; std::vector convert_from_hex_str(const std::string& input) const; -#if USE_OPENSSL_FALLBACK +#if USE_GNUTLS_FALLBACK + bool pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest); + gnutls_pubkey_t d_PublicKey{}; +#else // OpenSSL #if USE_OPENSSL_3 bool pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest); EVP_PKEY* d_PublicKey{}; @@ -68,9 +71,6 @@ private: bool pubkey_copy(EC_KEY* src, EC_KEY** dest); EC_KEY* d_PublicKey = nullptr; #endif -#else // GnuTLS - bool pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest); - gnutls_pubkey_t d_PublicKey{}; #endif std::vector d_x_4_0; std::vector d_x_3_1; @@ -82,4 +82,5 @@ private: /** \} */ /** \} */ + #endif // GNSS_SDR_GNSS_CRYPTO_H \ No newline at end of file diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 8de611f5f..f1491b032 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1367,6 +1367,9 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) GTest::GTest GTest::Main core_libs + Gnuradio::blocks + Gnuradio::runtime + Gnuradio::filter # workaround for old systems ) if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(osnma_msg_receiver_test PRIVATE Gflags::gflags Glog::glog) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 7b94baf0c..743c2b877 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -1,11 +1,14 @@ #include #include -#include #include -#include -#include #include +#include "osnma_msg_receiver.h" +#if USE_GLOG_AND_GFLAGS +#include // for LOG +#else +#include +#endif struct TestVector { @@ -31,11 +34,9 @@ protected: void set_time(std::tm& input); // std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; std::string log_name {"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; - void initializeGoogleLog(); void SetUp() override { - initializeGoogleLog(); // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); @@ -545,46 +546,3 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) } -void OsnmaMsgReceiverTest::initializeGoogleLog() -{ - google::InitGoogleLogging(log_name.c_str()); - FLAGS_minloglevel = 0; // INFO - FLAGS_logtostderr = 0; // add this line - FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; - if (FLAGS_log_dir.empty()) - { - std::cout << "Logging will be written at " - << std::filesystem::temp_directory_path() - << '\n' - << "Use gnss-sdr --log_dir=/path/to/log to change that.\n"; - } - else - { - try - { - const std::filesystem::path p(FLAGS_log_dir); - if (!std::filesystem::exists(p)) - { - std::cout << "The path " - << FLAGS_log_dir - << " does not exist, attempting to create it.\n"; - std::error_code ec; - if (!std::filesystem::create_directory(p, ec)) - { - std::cout << "Could not create the " << FLAGS_log_dir << " folder.\n"; - gflags::ShutDownCommandLineFlags(); - throw std::runtime_error("Could not create folder for logs"); - } - } - std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; - } - catch (const std::exception& e) - { - std::cerr << e.what() << '\n'; - std::cerr << "Could not create the " << FLAGS_log_dir << " folder.\n"; - gflags::ShutDownCommandLineFlags(); - throw; - } - } -} - From a530981d5bc7fb97b09e8f76fa28da50880fbff0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 29 Jun 2024 11:41:28 +0200 Subject: [PATCH 213/499] Update README.md with openssl --- README.md | 30 ++++++++++++++---------------- cmake/Modules/GnssSdrCrypto.cmake | 2 +- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index a904764b0..5b7bc9dfd 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ information about this open-source, software-defined GNSS receiver. - [Install Armadillo, a C++ linear algebra library](#install-armadillo-a-c-linear-algebra-library) - [Install Gflags, a commandline flags processing module for C++](#install-gflags-a-commandline-flags-processing-module-for-c) - [Install Glog, a library that implements application-level logging](#install-glog-a-library-that-implements-application-level-logging) - - [Install the GnuTLS or OpenSSL libraries](#install-the-gnutls-or-openssl-libraries) + - [Install the OpenSSL libraries](#install-the-openssl-libraries) - [Install Matio, MATLAB MAT file I/O library](#install-matio-matlab-mat-file-io-library) - [Install Protocol Buffers, a portable mechanism for serialization of structured data](#install-protocol-buffers-a-portable-mechanism-for-serialization-of-structured-data) - [Install Pugixml, a light-weight C++ XML processing library](#install-pugixml-a-light-weight-c-xml-processing-library) @@ -168,16 +168,19 @@ $ sudo apt-get install build-essential cmake git pkg-config libboost-dev libboos libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \ libboost-serialization-dev liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr \ libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev \ - libgnutls-openssl-dev libpcap-dev libmatio-dev libpugixml-dev libgtest-dev \ - libprotobuf-dev protobuf-compiler python3-mako + libssl-dev libpcap-dev libmatio-dev libpugixml-dev libgtest-dev \ + libprotobuf-dev libcpu-features-dev protobuf-compiler python3-mako ``` Please note that the required files from `libgtest-dev` were named `googletest` in Debian 9 "stretch" and Ubuntu 18.04 "bionic", and renamed to `libgtest-dev` in Debian 10 "buster" and above. -Since Ubuntu 21.04 Hirsute / Debian 11, the package `libcpu-features-dev` is -also required. +In distributions older than Ubuntu 21.04 Hirsute / Debian 11, the package +`libcpu-features-dev` is not required. + +In distributions older than Ubuntu 22.04 Jammy / Debian 12, the package +`libssl-dev` must be replaced by `libgnutls-openssl-dev`. **Note for Ubuntu 14.04 LTS "trusty" users:** you will need to build from source and install GNU Radio manually, as explained below, since GNSS-SDR requires @@ -451,20 +454,15 @@ Please note that Glog is replaced by the [Abseil Logging Library](https://abseil.io/docs/cpp/guides/logging) if Abseil >= v20240116 is available in your system. -#### Install the GnuTLS or OpenSSL libraries +#### Install the OpenSSL libraries ``` -$ sudo apt-get install libgnutls-openssl-dev # For Debian/Ubuntu/LinuxMint -$ sudo yum install openssl-devel # For Fedora/CentOS/RHEL -$ sudo zypper install openssl-devel # For OpenSUSE -$ sudo pacman -S openssl # For Arch Linux +$ sudo apt-get install libssl-dev # For Debian/Ubuntu/LinuxMint +$ sudo yum install openssl-devel # For Fedora/CentOS/RHEL +$ sudo zypper install openssl-devel # For OpenSUSE +$ sudo pacman -S openssl # For Arch Linux ``` -In case the [GnuTLS](https://www.gnutls.org/ "GnuTLS's Homepage") library with -openssl extensions package is not available in your GNU/Linux distribution, -GNSS-SDR can also work well with -[OpenSSL](https://www.openssl.org/ "OpenSSL's Homepage"). - #### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library ``` @@ -838,7 +836,7 @@ In a terminal, type: ``` $ sudo port selfupdate $ sudo port upgrade outdated -$ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml gnutls +$ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml openssl3 $ sudo port install gnuradio +uhd +grc +zeromq $ sudo port install boost matio libad9361-iio libiio $ sudo port install py311-mako diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index 33e1aaab1..c873c6bc3 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -93,7 +93,7 @@ else() endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - message(" 'sudo port install gnutls', if you are using Macports, or") + message(" 'sudo port install openssl3', if you are using Macports, or") message(" 'brew install openssl', if you are using Homebrew.") endif() message(FATAL_ERROR "OpenSSL or the GnuTLS libraries with openssl compatibility are required to build gnss-sdr") From 609b85b8641b7603f2a2d0b5411be0504bd126b0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 29 Jun 2024 11:45:00 +0200 Subject: [PATCH 214/499] Fix cmakelint formatting --- cmake/Modules/GnssSdrCrypto.cmake | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index c873c6bc3..7c427bab2 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -20,12 +20,12 @@ set_package_properties(OpenSSL ) if(OPENSSL_FOUND) set_package_properties(OpenSSL - PROPERTIES + PROPERTIES DESCRIPTION "Cryptography and SSL/TLS Toolkit (found: v${OPENSSL_VERSION})" ) else() set_package_properties(OpenSSL - PROPERTIES + PROPERTIES DESCRIPTION "OpenSSL has not been found, but GnuTLS with openssl compatibility can replace it" ) ################################################################################ @@ -114,7 +114,7 @@ function(link_to_crypto_dependencies target) PUBLIC OpenSSL::Crypto ) - endif() + endif() else() target_link_libraries(core_system_parameters PUBLIC @@ -131,10 +131,9 @@ function(link_to_crypto_dependencies target) target_compile_definitions(${target} PUBLIC -DUSE_OPENSSL_3=1) else() if(NOT OPENSSL_VERSION VERSION_LESS "1.1.1") - target_compile_definitions(${target} PUBLIC -DUSE_OPENSSL_111=1) - else() + target_compile_definitions(${target} PUBLIC -DUSE_OPENSSL_111=1) endif() - endif() + endif() else() endif() else() # GnuTLS From 668ca7a5d8d6db1aa3c57bc6920c04064239544f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 29 Jun 2024 11:52:06 +0200 Subject: [PATCH 215/499] Fix link_to_crypto_dependencies function --- cmake/Modules/GnssSdrCrypto.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index 7c427bab2..67648d702 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -105,23 +105,23 @@ endif() function(link_to_crypto_dependencies target) if(OPENSSL_FOUND) if(TARGET OpenSSL::SSL) - target_link_libraries(core_system_parameters + target_link_libraries(${target} PUBLIC OpenSSL::SSL ) if(TARGET OpenSSL::Crypto) - target_link_libraries(core_system_parameters + target_link_libraries(${target} PUBLIC OpenSSL::Crypto ) endif() else() - target_link_libraries(core_system_parameters + target_link_libraries(${target} PUBLIC ${OPENSSL_LIBRARIES} "${OPENSSL_CRYPTO_LIBRARIES}" ) - target_include_directories(core_system_parameters + target_include_directories(${target} PUBLIC ${OPENSSL_INCLUDE_DIR} ) @@ -137,12 +137,12 @@ function(link_to_crypto_dependencies target) else() endif() else() # GnuTLS - target_link_libraries(core_system_parameters + target_link_libraries(${target} PUBLIC ${GNUTLS_LIBRARIES} ${GNUTLS_OPENSSL_LIBRARY} ) - target_include_directories(core_system_parameters + target_include_directories(${target} PUBLIC ${GNUTLS_INCLUDE_DIR} ) From 619c7aeed3671cfb738ad4a798db81453287a1e8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 29 Jun 2024 15:33:39 +0200 Subject: [PATCH 216/499] Bump local Armadillo version to 14.0.x and Protocol Buffers to 27.2 --- CMakeLists.txt | 4 ++-- README.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f172666e2..5801ced89 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -347,11 +347,11 @@ set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") ################################################################################ # Versions to download and build (but not to install system-wide) if not found ################################################################################ -set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") +set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.1") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.2") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") diff --git a/README.md b/README.md index a904764b0..85fb1720e 100644 --- a/README.md +++ b/README.md @@ -403,9 +403,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux $ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux -$ wget https://sourceforge.net/projects/arma/files/armadillo-12.8.1.tar.xz -$ tar xvfz armadillo-12.8.1.tar.xz -$ cd armadillo-12.8.1 +$ wget https://sourceforge.net/projects/arma/files/armadillo-14.0.0.tar.xz +$ tar xvfz armadillo-14.0.0.tar.xz +$ cd armadillo-14.0.0 $ cmake . $ make $ sudo make install From 22b6d703185b85bcb5e41213d13a4f345fbe2478 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 30 Jun 2024 09:45:51 +0200 Subject: [PATCH 217/499] Fix building of benchmarks in some environments --- src/tests/benchmarks/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tests/benchmarks/CMakeLists.txt b/src/tests/benchmarks/CMakeLists.txt index 133174871..28bddd050 100644 --- a/src/tests/benchmarks/CMakeLists.txt +++ b/src/tests/benchmarks/CMakeLists.txt @@ -104,10 +104,15 @@ macro(add_benchmark) ) endmacro() +set(EXTRA_BENCHMARK_DEPENDENCIES "") +if(ENABLE_GLOG_AND_GFLAGS) + set(EXTRA_BENCHMARK_DEPENDENCIES "Gflags::gflags;Glog::glog") +endif() + add_benchmark(benchmark_copy) -add_benchmark(benchmark_preamble core_system_parameters) -add_benchmark(benchmark_detector core_system_parameters) -add_benchmark(benchmark_reed_solomon core_system_parameters) +add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_atan2 Gnuradio::runtime) if(has_std_plus_void) From 413e5309ba9ed29772c46d06da9517953d746ee7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 30 Jun 2024 10:10:03 +0200 Subject: [PATCH 218/499] Add missing include --- .../signal-processing-blocks/osnma/osnma_msg_receiver_test.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 743c2b877..dc3e69684 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -1,5 +1,6 @@ #include #include +#include #include #include #include "osnma_msg_receiver.h" From d984822b453d7ba3fdac7182bebead653aecd985 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 30 Jun 2024 10:24:21 +0200 Subject: [PATCH 219/499] Fix for cross-compilation --- src/core/libs/osnma_msg_receiver.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 45ad958ee..955712c76 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -317,7 +317,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS)); if (delta_T <= d_T_L) { d_tags_allowed = tags_to_verify::all; From c2bb06076af3dc20b819a0cdc75fc2c2f0a2bb4a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 30 Jun 2024 12:04:57 +0200 Subject: [PATCH 220/499] Fix for old OpenSSL --- src/core/system_parameters/gnss_crypto.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index a50e2f00b..322e4acdd 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -547,7 +547,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) gnutls_pubkey_deinit(pubkey); #else // OpenSSL // Create a BIO object from the string data - BIO* bio = BIO_new_mem_buf(pemContent.c_str(), pemContent.length()); + BIO* bio = BIO_new_mem_buf(const_cast(pemContent.c_str()), pemContent.length()); if (!bio) { std::cerr << "OpenSSL: error creating a BIO object with data read from file " << pemFilePath << ". Aborting import" << std::endl; @@ -861,7 +861,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) #else // OpenSSL BIO* bio = nullptr; EVP_PKEY* pkey = nullptr; - bio = BIO_new_mem_buf(publicKey.data(), publicKey.size()); + bio = BIO_new_mem_buf(const_cast(publicKey.data()), publicKey.size()); if (!bio) { std::cerr << "Failed to create BIO for key \n"; From 95e3329f1011779628bd75baf97f99035c7ff3fb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 1 Jul 2024 01:31:09 +0200 Subject: [PATCH 221/499] Fix for old GnuTLS --- cmake/Modules/GnssSdrCrypto.cmake | 37 +++++++++++++++++++ src/core/system_parameters/gnss_crypto.cc | 45 +++++++++++++++++------ src/core/system_parameters/gnss_crypto.h | 1 + 3 files changed, 71 insertions(+), 12 deletions(-) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index 67648d702..a5e383790 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -82,6 +82,15 @@ else() /opt/local/lib ) + find_path(GNUTLS_INCLUDE_DIR NAMES gnutls/gnutls.h + PATHS + /usr/include + /usr/local/include + /opt/local/include # default location in Macports + /opt/homebrew/opt/gnutls/include/ + ${GNUTLS_ROOT_DIR}/include/ + ) + if(NOT GNUTLS_OPENSSL_LIBRARY) message(" The GnuTLS library with openssl compatibility enabled has not been found.") message(" You can try to install the required libraries by typing:") @@ -98,6 +107,22 @@ else() endif() message(FATAL_ERROR "OpenSSL or the GnuTLS libraries with openssl compatibility are required to build gnss-sdr") endif() + + # Test GnuTLS capabilities + file(READ "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" gnutls_gnutls_file_contents) + if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_SIGN_ECDSA_SHA256") + set(GNUTLS_SIGN_ECDSA_SHA256 TRUE) + endif() + if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_DIG_SHA3_256") + set(GNUTLS_DIG_SHA3_256 TRUE) + endif() + if("${gnutls_gnutls_file_contents}" MATCHES "#define GNUTLS_VERSION_MAJOR 2") + set(GNUTLS_HMAC_INIT_WITH_DIGEST TRUE) + endif() + file(READ "${GNUTLS_INCLUDE_DIR}/gnutls/abstract.h" gnutls_abstract_file_contents) + if("${gnutls_abstract_file_contents}" MATCHES "gnutls_pubkey_export2") + set(GNUTLS_PUBKEY_EXPORT2 TRUE) + endif() endif() ################################################################################ @@ -147,5 +172,17 @@ function(link_to_crypto_dependencies target) ${GNUTLS_INCLUDE_DIR} ) target_compile_definitions(${target} PUBLIC -DUSE_GNUTLS_FALLBACK=1) + if(GNUTLS_SIGN_ECDSA_SHA256) + target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_SIGN_ECDSA_SHA256=1) + endif() + if(GNUTLS_DIG_SHA3_256) + target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_DIG_SHA3_256=1) + endif() + if(GNUTLS_PUBKEY_EXPORT2) + target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_PUBKEY_EXPORT2=1) + endif() + if(GNUTLS_HMAC_INIT_WITH_DIGEST) + target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_HMAC_INIT_WITH_DIGEST=1) + endif() endif() endfunction() diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 322e4acdd..8ad7e55bb 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -27,7 +27,6 @@ #if USE_GNUTLS_FALLBACK #include -#include #include #include #else // OpenSSL @@ -61,6 +60,11 @@ Gnss_Crypto::Gnss_Crypto() { #if USE_GNUTLS_FALLBACK gnutls_global_init(); +#if !HAVE_GNUTLS_SIGN_ECDSA_SHA256 + LOG(WARNING) << "The GnuTLS library version you are linking against is too old for some OSNMA functions." + << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of GnuTLS or OpenSSL" + << " and rebuild GNSS-SDR against it."; +#endif #else // OpenSSL #if !(USE_OPENSSL_3 || USE_OPENSSL_111) LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." @@ -75,6 +79,11 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer { #if USE_GNUTLS_FALLBACK gnutls_global_init(); +#if !HAVE_GNUTLS_SIGN_ECDSA_SHA256 + LOG(WARNING) << "The GnuTLS library version you are linking against is too old for some OSNMA functions." + << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of GnuTLS or OpenSSL" + << " and rebuild GNSS-SDR against it."; +#endif #else // OpenSSL #if !(USE_OPENSSL_3 || USE_OPENSSL_111) LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." @@ -305,6 +314,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in { std::vector output(32); // SHA256 hash size #if USE_GNUTLS_FALLBACK +#if HAVE_GNUTLS_DIG_SHA3_256 std::vector output_aux(32); gnutls_hash_hd_t hashHandle; gnutls_hash_init(&hashHandle, GNUTLS_DIG_SHA3_256); @@ -312,6 +322,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in gnutls_hash_output(hashHandle, output_aux.data()); output = output_aux; gnutls_hash_deinit(hashHandle, output_aux.data()); +#endif #else // OpenSSL #if USE_OPENSSL_3 || USE_OPENSSL_111 EVP_MD_CTX* mdctx = EVP_MD_CTX_new(); @@ -339,7 +350,11 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector #if USE_GNUTLS_FALLBACK std::vector output_aux(32); gnutls_hmac_hd_t hmac; +#if HAVE_GNUTLS_HMAC_INIT_WITH_DIGEST + gnutls_hmac_init(&hmac, GNUTLS_DIG_SHA256, key.data(), key.size()); +#else gnutls_hmac_init(&hmac, GNUTLS_MAC_SHA256, key.data(), key.size()); +#endif gnutls_hmac(hmac, input.data(), input.size()); gnutls_hmac_output(hmac, output_aux.data()); output = output_aux; @@ -421,16 +436,15 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke { std::vector output(16); #if USE_GNUTLS_FALLBACK - gnutls_cipher_hd_t cipher; - std::vector mac(16); - std::vector message = input; - gnutls_datum_t key_data = {const_cast(key.data()), static_cast(key.size())}; - gnutls_cipher_init(&cipher, GNUTLS_CIPHER_AES_128_CBC, &key_data, nullptr); - gnutls_cipher_set_iv(cipher, nullptr, 16); // Set IV to zero - gnutls_cipher_encrypt(cipher, message.data(), message.size()); // Encrypt the message with AES-128 - gnutls_cipher_tag(cipher, mac.data(), mac.size()); // Get the CMAC-AES tag - output = mac; - gnutls_cipher_deinit(cipher); + // CMAC-AES not implemented in GnuTLS + if (!key.empty()) + { + // do nothing + } + if (!input.empty()) + { + // do nothing + } #else // OpenSSL #if USE_OPENSSL_3 std::vector aux(EVP_MAX_MD_SIZE); // CMAC-AES output size @@ -527,7 +541,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); #if USE_GNUTLS_FALLBACK // Import the PEM data - gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(pemContent.data())), static_cast(pemContent.size())}; + gnutls_datum_t pemDatum = {const_cast(reinterpret_cast(const_cast(pemContent.data()))), static_cast(pemContent.size())}; gnutls_pubkey_t pubkey; gnutls_pubkey_init(&pubkey); @@ -680,6 +694,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } bool success = false; #if USE_GNUTLS_FALLBACK +#if HAVE_GNUTLS_SIGN_ECDSA_SHA256 // Convert signature to DER format std::vector der_sig; if (!convert_raw_to_der_ecdsa(signature, der_sig)) @@ -704,6 +719,7 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); } +#endif #else // OpenSSL #if USE_OPENSSL_3 EVP_PKEY_CTX* ctx; @@ -950,7 +966,12 @@ bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) gnutls_datum_t key_datum; // Export the public key from src to memory +#if HAVE_GNUTLS_PUBKEY_EXPORT2 int ret = gnutls_pubkey_export2(src, GNUTLS_X509_FMT_PEM, &key_datum); +#else + size_t output_stata_size; + int ret = gnutls_pubkey_export(src, GNUTLS_X509_FMT_PEM, &key_datum, &output_stata_size); +#endif if (ret < 0) { gnutls_free(key_datum.data); diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 7e0527750..69df8d45d 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -23,6 +23,7 @@ #include #include #if USE_GNUTLS_FALLBACK +#include #include #else // OpenSSL #include From 2f475d6aafbe01113fcb75f8e80a95036ee18b3a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 1 Jul 2024 02:44:22 +0200 Subject: [PATCH 222/499] Fix CMAC-AES algorithm for OpenSSL 1.x --- src/core/system_parameters/gnss_crypto.cc | 37 +++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 8ad7e55bb..2062b0674 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -504,20 +504,45 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke aux.resize(output_length); output = aux; #else // OpenSSL 1.x - std::vector mac(16); // CMAC-AES output size + size_t mac_length = 0; // to hold the length of the MAC output // Create CMAC context CMAC_CTX* cmacCtx = CMAC_CTX_new(); - CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr); + if (!cmacCtx) + { + LOG(INFO) << "OSNMA CMAC-AES: Failed to create CMAC context"; + return output; + } - // Compute CMAC-AES - CMAC_Update(cmacCtx, input.data(), input.size()); - CMAC_Final(cmacCtx, mac.data(), nullptr); + // Initialize the CMAC context with the key and cipher + if (1 != CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr)) + { + LOG(INFO) << "OSNMA CMAC-AES: MAC_Init failed"; + CMAC_CTX_free(cmacCtx); + return output; + } + + // Compute the CMAC + if (1 != CMAC_Update(cmacCtx, input.data(), input.size())) + { + LOG(INFO) << "OSNMA CMAC-AES: CMAC_Update failed"; + CMAC_CTX_free(cmacCtx); + return output; + } + + // Finalize the CMAC computation and retrieve the output + if (1 != CMAC_Final(cmacCtx, output.data(), &mac_length)) + { + LOG(INFO) << "OSNMA CMAC-AES:CMAC_Final failed"; + CMAC_CTX_free(cmacCtx); + return output; + } // Clean up CMAC context CMAC_CTX_free(cmacCtx); - output = mac; + // Ensure the output vector is properly sized according to the actual MAC length + output.resize(mac_length); #endif #endif return output; From c31b6a1f4dacb0405414c0ba821de199783005e7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 1 Jul 2024 10:07:01 +0200 Subject: [PATCH 223/499] Fix building of local Armadillo --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5801ced89..b03062db2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2099,7 +2099,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} - -DBUILD_SHARED_LIBS=OFF + -DSTATIC_LIB=ON -DBUILD_SMOKE_TEST=OFF -DALLOW_BLAS_LAPACK_MACOS=ON ${ARMADILLO_CXX_VERSION} @@ -2118,7 +2118,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} - -DBUILD_SHARED_LIBS=OFF + -DSTATIC_LIB=ON -DBUILD_SMOKE_TEST=OFF -DALLOW_BLAS_LAPACK_MACOS=ON ${ARMADILLO_CXX_VERSION} From 4b4f6b9d7f9e1a255c5109979d7d34d4d2c72578 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 1 Jul 2024 22:43:54 +0200 Subject: [PATCH 224/499] Fix CMAC-AES with GnuTLS --- cmake/Modules/GnssSdrCrypto.cmake | 6 ++++ src/core/system_parameters/gnss_crypto.cc | 36 +++++++++++++++++++---- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index a5e383790..9649da9da 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -119,6 +119,9 @@ else() if("${gnutls_gnutls_file_contents}" MATCHES "#define GNUTLS_VERSION_MAJOR 2") set(GNUTLS_HMAC_INIT_WITH_DIGEST TRUE) endif() + if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_MAC_AES_CMAC_128") + set(GNUTLS_MAC_AES_CMAC_128 TRUE) + endif() file(READ "${GNUTLS_INCLUDE_DIR}/gnutls/abstract.h" gnutls_abstract_file_contents) if("${gnutls_abstract_file_contents}" MATCHES "gnutls_pubkey_export2") set(GNUTLS_PUBKEY_EXPORT2 TRUE) @@ -184,5 +187,8 @@ function(link_to_crypto_dependencies target) if(GNUTLS_HMAC_INIT_WITH_DIGEST) target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_HMAC_INIT_WITH_DIGEST=1) endif() + if(GNUTLS_MAC_AES_CMAC_128) + target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_MAC_AES_CMAC_128=1) + endif() endif() endfunction() diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 2062b0674..055bd0382 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -436,7 +436,32 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke { std::vector output(16); #if USE_GNUTLS_FALLBACK - // CMAC-AES not implemented in GnuTLS +#if HAVE_GNUTLS_MAC_AES_CMAC_128 + gnutls_hmac_hd_t hmac; + + // Initialize the HMAC context with the CMAC algorithm and key + int ret = gnutls_hmac_init(&hmac, GNUTLS_MAC_AES_CMAC_128, key.data(), key.size()); + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "OSNMA CMAC-AES: gnutls_hmac_init failed: " << gnutls_strerror(ret); + return output; + } + + // Update the HMAC context with the input data + ret = gnutls_hmac(hmac, input.data(), input.size()); + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "OSNMA CMAC-AES: gnutls_hmac failed: " << gnutls_strerror(ret); + gnutls_hmac_deinit(hmac, nullptr); + return output; + } + + // Retrieve the HMAC output + gnutls_hmac_output(hmac, output.data()); + + // Clean up the HMAC context + gnutls_hmac_deinit(hmac, nullptr); +#else if (!key.empty()) { // do nothing @@ -445,6 +470,7 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke { // do nothing } +#endif #else // OpenSSL #if USE_OPENSSL_3 std::vector aux(EVP_MAX_MD_SIZE); // CMAC-AES output size @@ -515,7 +541,7 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } // Initialize the CMAC context with the key and cipher - if (1 != CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr)) + if (CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr) != 1) { LOG(INFO) << "OSNMA CMAC-AES: MAC_Init failed"; CMAC_CTX_free(cmacCtx); @@ -523,7 +549,7 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } // Compute the CMAC - if (1 != CMAC_Update(cmacCtx, input.data(), input.size())) + if (CMAC_Update(cmacCtx, input.data(), input.size()) != 1) { LOG(INFO) << "OSNMA CMAC-AES: CMAC_Update failed"; CMAC_CTX_free(cmacCtx); @@ -531,9 +557,9 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } // Finalize the CMAC computation and retrieve the output - if (1 != CMAC_Final(cmacCtx, output.data(), &mac_length)) + if (CMAC_Final(cmacCtx, output.data(), &mac_length) != 1) { - LOG(INFO) << "OSNMA CMAC-AES:CMAC_Final failed"; + LOG(INFO) << "OSNMA CMAC-AES: CMAC_Final failed"; CMAC_CTX_free(cmacCtx); return output; } From b77784d1f3ba98ee603266b44725e0eda63df2ef Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 26 Jun 2024 15:01:05 +0200 Subject: [PATCH 225/499] [TAS-227] [BUG] Tag verification fails for .dat files --- .../galileo_telemetry_decoder_gs.cc | 56 +- src/core/libs/osnma_msg_receiver.cc | 86 ++- src/core/libs/osnma_msg_receiver.h | 2 +- .../system_parameters/galileo_inav_message.cc | 2 +- src/core/system_parameters/osnma_helper.cc | 11 + src/core/system_parameters/osnma_helper.h | 1 + .../osnma/osnma_msg_receiver_test.cc | 513 ++++++++++-------- 7 files changed, 373 insertions(+), 298 deletions(-) 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 a404a100a..a84db6946 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 @@ -439,6 +439,35 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } // 4. Push the new navigation data to the queues + // extract OSNMA bits, reset container. + bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: new ADKD=0/12 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW5() - 25 <>( // < PRNd , navDataBits, TOW_Sosf> + d_satellite.get_PRN(), + d_inav_nav.get_osnma_adkd_0_12_nav_bits(), + d_inav_nav.get_TOW5() - 25); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); + LOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d="<< static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) <<")";//: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); + d_inav_nav.reset_osnma_nav_bits_adkd0_12(); + } + + check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; + if(check_size_is_ok) + { + std::cout << "Galileo OSNMA: new ADKD=4 navData from " << d_satellite <<" at TOW_sf=" << d_inav_nav.get_TOW6() - 5 <>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe + d_satellite.get_PRN(), + d_inav_nav.get_osnma_adkd_4_nav_bits(), + d_inav_nav.get_TOW6() - 5); + this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); + LOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d="<< static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) <<")";//: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); + d_inav_nav.reset_osnma_nav_bits_adkd4(); + } + + if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) { // get object for this SV (mandatory) @@ -472,20 +501,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set // d_flag_osnma_adkd_0_12 = true; // W1-> W5 available - // extract bits, reset container. - bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; - if(check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << d_satellite.get_PRN() << ") " << "TOW_sf=" << d_inav_nav.get_TOW5() - 24 <>( // < PRNd , navDataBits, TOW_Sosf> - d_satellite.get_PRN(), - d_inav_nav.get_osnma_adkd_0_12_nav_bits(), - d_inav_nav.get_TOW5() - 24); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); - d_inav_nav.reset_osnma_nav_bits_adkd0_12(); - } - - } else { @@ -615,19 +630,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // bool adkd_4_nav_data_available = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; // newApproach: let decoder decide when block starts and let it fill the data, and just check for length if(adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) { - bool check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; - if(check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=4 navData, PRN_d (" << d_satellite.get_PRN() << ") " << "TOW_sf=" << d_inav_nav.get_TOW6() - 4 <>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe - d_satellite.get_PRN(), - d_inav_nav.get_osnma_adkd_4_nav_bits(), - d_inav_nav.get_TOW6() - 4); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - d_inav_nav.reset_osnma_nav_bits_adkd4(); - } - } auto newOSNMA = d_inav_nav.have_new_nma(); if (d_band == '1' && newOSNMA) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 4a5e95ac9..e03303a66 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -62,13 +62,13 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, osnma_msg_receiver::osnma_msg_receiver( - const std::string& pemFilePath, + const std::string& crtFilePath, const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); - d_crypto = std::make_unique(pemFilePath, merkleFilePath); + d_crypto = std::make_unique(crtFilePath, merkleFilePath); d_helper = std::make_unique(); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); @@ -101,13 +101,13 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); // TODO remove if unneeded std::ostringstream output_message; - output_message << "Galileo OSNMA: Subframe received starting at " - << "WN=" - << nma_msg->WN_sf0 - << ", TOW=" - << nma_msg->TOW_sf0 - << ", from satellite " - << sat; + output_message << "Galileo OSNMA: complete OSNMA message received starting at " + << "WN=" + << nma_msg->WN_sf0 + << ", TOW=" + << nma_msg->TOW_sf0 + << ", from satellite " + << sat; LOG(WARNING) << output_message.str(); std::cout << output_message.str() << std::endl; @@ -125,14 +125,14 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // iono data => 549 bits, utc data, 141 bits. if (nav_data.size() == 549) { - LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " - << "TOW_sf=" << TOW; +// LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " +// << "TOW_sf=" << TOW; d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = nav_data; } else if (nav_data.size() == 141) { - LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " - << "TOW_sf=" << TOW; +// LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " +// << "TOW_sf=" << TOW; d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; } else @@ -203,10 +203,10 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = d_dsm_reader->get_dsm_id(dsm_header); d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID - LOG(INFO) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); - LOG(INFO) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); - LOG(INFO) << "Galileo OSNMA: Received block " << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) - << " from DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id); +// LOG(INFO) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); +// LOG(INFO) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); + LOG(INFO) << "Galileo OSNMA: Received block DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) + << " with DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id); } /* @@ -322,8 +322,8 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; // TODO set flag to false to avoid processing dsm and MACK messages @@ -914,13 +914,25 @@ void osnma_msg_receiver::process_mack_message() bool ret = verify_macseq(*mack); if (ret || d_flag_debug) { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; for (std::size_t i = 0; i < mack->tag_and_info.size(); ++i) { // add tags of current mack to the verification queue auto& tag = mack->tag_and_info[i]; Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; + LOG(INFO) << "Galileo OSNMA: Add Tag Id= " + << t.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << t.received_tag << std::dec + << ", TOW=" + << t.TOW + << ", ADKD=" + << static_cast(t.ADKD) + << ", PRNa=" + << static_cast(t.PRNa) + << ", PRNd=" + << static_cast(t.PRN_d); } std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; mack = d_macks_awaiting_MACSEQ_verification.erase(mack); @@ -1070,6 +1082,11 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) bool osnma_msg_receiver::verify_tag(Tag& tag) { + // Debug +// LOG(INFO) << "Galileo OSNMA: Tag verification :: Start for tag Id= " +// << tag.tag_id +// << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase +// << tag.received_tag << std::dec; // TODO case tag0, to be verified here?, PRNd not needed for it // build message std::vector m = build_message(tag); @@ -1077,9 +1094,16 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) std::vector mac; std::vector applicable_key; if (tag.ADKD == 0 || tag.ADKD == 4) - applicable_key = d_tesla_keys[tag.TOW + 30]; - else // ADKD 12 - applicable_key = d_tesla_keys[tag.TOW + 330]; + { + applicable_key = d_tesla_keys[tag.TOW + 30]; +// LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 30); + } + else // ADKD 12 + { + applicable_key = d_tesla_keys[tag.TOW + 330]; +// LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 330); + } + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { @@ -1142,7 +1166,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) << ", PRNa=" << static_cast(tag.PRNa) << ", PRNd=" - << static_cast(tag.PRN_d); + << static_cast(tag.PRN_d) << std::endl; return true; } return false; @@ -1171,10 +1195,12 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; +// LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else if (tag.ADKD == 4) { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; +// LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else LOG(WARNING) << "Galileo OSNMA :: Tag verification :: unknown ADKD"; @@ -1484,7 +1510,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map - LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; std::map& tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW - 30); if (tow_it != tow_map.end()) @@ -1500,7 +1526,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) else { // PRN was not found - LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; return false; } return false; @@ -1519,7 +1545,7 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t) auto it = d_tesla_keys.find(t.TOW + 30); if (it != d_tesla_keys.end()) { - LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } @@ -1528,11 +1554,11 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t) auto it = d_tesla_keys.find(t.TOW + 330); if (it != d_tesla_keys.end()) { - LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; + //LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } - LOG(INFO) << "Galileo OSNMA: hasKey = false "; + //LOG(INFO) << "Galileo OSNMA: hasKey = false "; return false; } @@ -1601,6 +1627,6 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede // compare computed current key against received key auto end = std::chrono::high_resolution_clock::now(); std::chrono::duration elapsed = end - start; - LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; +// LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; return K_II; } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 4e662ef55..aef9fd91e 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -59,7 +59,7 @@ public: ~osnma_msg_receiver() = default; //!< Default destructor private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); - osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath); + osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index baa140149..a8509db23 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1417,7 +1417,7 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start + int32_t TOW_sf0 = TOW_5 - 25;//- 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start TODO review if (TOW_sf0 < 0) { TOW_sf0 += 604800; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index aa338f408..7cf3165c2 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -16,6 +16,8 @@ #include "osnma_helper.h" #include +#include +#include uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const { @@ -74,3 +76,12 @@ std::string Osnma_Helper::verification_status_str(int status) default: return "UNKNOWN"; } } +std::string Osnma_Helper::convert_to_hex_string(const std::vector& vector) +{ + std::stringstream ss; + ss << std::hex << std::setfill('0'); + for (auto byte : vector) { + ss << std::setw(2) << static_cast(byte); + } + return ss.str(); +} diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 2f8df078b..e78fdba0f 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -30,6 +30,7 @@ public: std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString); std::string verification_status_str(int status); + std::string convert_to_hex_string(const std::vector& vector); }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 35cb9fd45..7b94baf0c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -2,6 +2,7 @@ #include #include #include +#include #include #include @@ -14,42 +15,39 @@ struct TestVector }; // TODO - parametrize class for different configurations (config_1, config_2, etc.. potentially 5 or 6 more) an make sure wont affect current TEST_F +// note: until the test is parametrized for configuration 1 and 2, in order to change between them you have to comment/uncomment the respective calls in this test, identified with comments // conf. 1/2 +// log_name, input_time, crtFilePath, merkleFilePath, testVectors class OsnmaMsgReceiverTest : public ::testing::Test { protected: osnma_msg_receiver_sptr osnma; - Galileo_Inav_Message galileo_message; - uint8_t page_position_in_inav_subframe; - bool flag_CRC_test; - std::string page_even; OSNMA_msg osnma_msg{}; std::array nma_position_filled; - uint32_t d_GST_SIS{}; // 16 AUG 2023 05 00 01 + uint32_t d_GST_SIS{}; uint32_t TOW{}; uint32_t WN{}; - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0; // 13 + 5; + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + const uint32_t LEAP_SECONDS = 0; //13 + 5; void set_time(std::tm& input); - // std::string log_name {"CONFIG1-2023-08-23-PKID1-OSNMA"}; - std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; - // void initializeGoogleLog(); +// std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; + std::string log_name {"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; + void initializeGoogleLog(); void SetUp() override { - flag_CRC_test = false; // TODO what for? - page_even = ""; - - // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; + initializeGoogleLog(); +// std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); - // std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.pem"; - // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; - std::string pemFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.pem"; +// std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.crt"; // conf. 1 +// std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(pemFilePath, merkleFilePath); + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); } public: + static std::vector parseNavBits(const std::string& hex); static std::vector readTestVectorsFromFile(const std::string& filename); std::string bytes_to_str(const std::vector& bytes); @@ -57,85 +55,199 @@ public: }; -TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) +TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) { + // Arrange + // ---------- + // m0 + std::vector expected_message = { + 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, + 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, + 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, + 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 + }; + + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + + + + // Act + // ---------- + auto computed_message = osnma->build_message(t0); + + + // Assert + // ---------- + ASSERT_TRUE(computed_message == expected_message); + +} + +TEST_F(OsnmaMsgReceiverTest, TagVerification) { + // Arrange + // ---------- + // Tag0 + uint32_t TOW_Tag0 = 345660; + uint32_t TOW_NavData = TOW_Tag0 - 30; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t WN = 1248; + uint32_t PRNa = 2; + uint8_t CTR = 1; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MACK_tag_and_info MTI; + MTI.tag = static_cast(0xE37BC4F858); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x00; + MTI.tag_info.cop = 0x0F; + Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + + + + // Act + // ---------- + bool result_tag0 = osnma->verify_tag(t0); + + + + + + // Assert + // ---------- + //ASSERT_TRUE(result_tag0); + + // Tag3 + uint32_t TOW_Tag3 = 345660; + uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; + uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30 ; + WN = 1248; + PRNa = 2; + CTR = 3; + + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = + "111111111111111111111111111111110000000000000000000000010001001001001000" + "111000001000100111100010010111111111011110111111111001001100000100000000"; + osnma->d_osnma_data.d_nma_header.nmas = 0b10; + + MTI.tag = static_cast(0x7BB238C883); + MTI.tag_info.PRN_d = 0x02; + MTI.tag_info.ADKD = 0x04; + MTI.tag_info.cop = 0x0F; + Tag t3(MTI, TOW_Tag0, WN, PRNa, CTR); + + bool result_tag3 = osnma->verify_tag(t3); + + ASSERT_TRUE(result_tag0 && result_tag3); + +} + +TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { // Arrange // ---------- osnma->d_tesla_key_verified = false; - osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 - osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 + osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; // local_time_verification would do this operation. TODO - eliminate duplication. osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); - osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; - osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. - std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 + osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 uint32_t TOW = 345630; + + + // Act // ---------- bool result = osnma->verify_tesla_key(key, TOW); + + + + // Assert // ---------- ASSERT_TRUE(result); -} +} TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { - // initializeGoogleLog(); // Arrange // ---------- - // std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); - std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); - if (testVectors.empty()) - { +// std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); // conf. 1 + std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 + if (testVectors.empty()){ ASSERT_TRUE(false); } bool end_of_hex_stream{false}; int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES * SIZE_SUBFRAME_PAGES}; // total bytes of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240/8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; // total bytes of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; + std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; + + + // Act // ---------- // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (end_of_hex_stream == false) - { + while (end_of_hex_stream == false){ // loop over all SVs, extract a subframe - for (const TestVector& tv : testVectors) - { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; + for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); std::array hkroot{}; std::array mack{}; - byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words; // structure containing and + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words_for_OSNMA; // structure containing and - for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index - std::vector page_bytes = extract_page_bytes(tv, byte_index, SIZE_PAGE_BYTES); - if (page_bytes.empty()) - { - std::cout << "OsnmaTestVectorsSimulation: end of TestVectors \n" - << "byte_index=" << byte_index << " expected= " << 432000 / 8 << std::endl; + std::vector page_bytes = extract_page_bytes(tv,byte_index,SIZE_PAGE_BYTES); + if(page_bytes.empty()){ + std::cout<< "OsnmaTestVectorsSimulation: end of TestVectors \n" << "byte_index="< data_k(even_page.substr(2, 112)); - std::bitset<16> data_j(odd_page.substr(2, 16)); + std::bitset<112> data_k(even_page.substr(2,112)); + std::bitset<16> data_j(odd_page.substr(2,16)); std::bitset<112> shifted_data_k = data_k; - // uint8_t word_type = 0; - // for(int i = 0; i < 6; ++i) { - // word_type |= (data_k[104 + i] << i); - // } - uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word - std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; - if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + std::cout<< "OsnmaTestVectorsSimulation: received Word "<< static_cast(word_type) << std::endl; + if( (word_type >= 1 && word_type <=5) || word_type == 6 || word_type == 10) { // store raw word std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); - words[word_type] = data_combined; + words_for_OSNMA[word_type] = data_combined; } - if (word_type == DUMMY_PAGE) + if(word_type == DUMMY_PAGE) flag_dummy_page = true; + // place it into osnma object. std::bitset<40> osnmaBits(odd_page.substr(18, 40)); + // Extract bits for hkroot and mack std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); @@ -183,13 +291,12 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) byte_index += SIZE_PAGE_BYTES; } - std::cout << "----------" << std::endl; - if (end_of_hex_stream) + std::cout<< "----------" << std::endl; + if(end_of_hex_stream) break; - if (flag_dummy_page) - { + if(flag_dummy_page){ flag_dummy_page = false; - continue; // skip this SV + continue; // skip this SV } // Fill osnma object @@ -197,26 +304,26 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->mack = mack; osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; - osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; - osnmaMsg_sptr->PRN = tv.svId; // PRNa + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; + osnmaMsg_sptr->PRN = tv.svId; // PRNa // TODO - refactor this logic, currently it is split - // check if words 1--> 5 words are received => fill EphClockStatus data vector + // check if words_for_OSNMA 1--> 5 words_for_OSNMA are received => fill EphClockStatus data vector bool ephClockStatusWordsReceived = true; for (int i = 1; i <= 5; ++i) { - if (words.find(i) == words.end()) + if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) { ephClockStatusWordsReceived = false; - std::cerr << "OsnmaTestVectorsSimulation: error parsing words 1->5. " - "Word " - << i << " should be received for each subframe but was not." << std::endl; + std::cerr<< "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " + "Word "<< i << " should be received for each subframe but was not." << std::endl; } } // extract bits as needed by osnma block - if (ephClockStatusWordsReceived) + if(ephClockStatusWordsReceived) { + // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {1, {6, 120}}, @@ -226,41 +333,41 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) {5, {6, 67}}, }; - // Fill NavData bits -- Iterate over the extraction parameters // Fill NavData bits -- Iterate over the extraction parameters + // Fill NavData bits -- Iterate over the extraction parameters std::string nav_data_ADKD_0_12 = ""; - for (const auto& param : extractionParams) - { + for (const auto& param : extractionParams) { uint8_t wordKey = param.first; uint8_t start = param.second.first; uint8_t length = param.second.second; // Extract the required bits and fill osnma block - nav_data_ADKD_0_12 += words[wordKey].to_string().substr(start, length); + nav_data_ADKD_0_12 += words_for_OSNMA[wordKey].to_string().substr(start, length); } // send to osnma block bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; - if (check_size_is_ok) + if(check_size_is_ok) { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> tv.svId, nav_data_ADKD_0_12, osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) <<"): 0b" << nav_data_ADKD_0_12; osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } } // check w6 && w10 is received => fill TimingData data vector - bool timingWordsReceived = words.find(6) != words.end() && - words.find(10) != words.end(); + bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && + words_for_OSNMA.find(10) != words_for_OSNMA.end(); // extract bits as needed by osnma block - if (timingWordsReceived) - { + if(timingWordsReceived){ // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {6, {6, 99}}, - {10, {86, 42}}}; + {10, {86, 42}} + }; std::string nav_data_ADKD_4 = ""; // Fill NavData bits -- Iterate over the extraction parameters @@ -271,42 +378,42 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) uint8_t length = param.second.second; // Extract the required bits and fill osnma block - nav_data_ADKD_4 += words[wordKey].to_string().substr( - start, length); + nav_data_ADKD_4 += words_for_OSNMA[wordKey].to_string().substr(start, length); } - // send to osnma block bool check_size_is_ok = nav_data_ADKD_4.size() == 141; - if (check_size_is_ok) + if(check_size_is_ok) { - std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> tv.svId, nav_data_ADKD_4, osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) <<"): 0b" << nav_data_ADKD_4; osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } + } // Call the handler, as if it came from telemetry decoder block auto temp_obj = pmt::make_any(osnmaMsg_sptr); - osnma->msg_handler_osnma(temp_obj); // osnma entry point + osnma->msg_handler_osnma(temp_obj); // osnma entry point } - if (!end_of_hex_stream) - { - offset_byte = byte_index; // update offset for the next subframe + if(!end_of_hex_stream){ + offset_byte = byte_index; // update offset for the next subframe d_GST_SIS += DURATION_SUBFRAME; TOW = d_GST_SIS & 0x000FFFFF; - WN = (d_GST_SIS & 0xFFF00000) >> 20; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS + WN = (d_GST_SIS & 0xFFF00000) >> 20 ; + std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS << ", TOW=" << TOW << ", WN=" << WN << std::endl; } + + } @@ -316,24 +423,22 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) } - +// Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. +// Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) { std::ifstream file(filename); std::vector testVectors; - if (!file.is_open()) - { - std::cerr << "Error reading the file \"" << filename << "\" \n"; + if (!file.is_open()) { + std::cerr<<"Error reading the file \"" << filename <<"\" \n"; return testVectors; } std::string line; std::getline(file, line); - if (line != "SVID,NumNavBits,NavBitsHEX\r") - { - std::cerr << "Error parsing first line" - << "\n"; - } + if (line != "SVID,NumNavBits,NavBitsHEX\r" ){ + std::cerr<<"Error parsing first line" <<"\n"; + } while (std::getline(file, line)) { @@ -356,35 +461,29 @@ std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std: return testVectors; } - - std::vector OsnmaMsgReceiverTest::parseNavBits(const std::string& hex) { std::vector bytes; - for (unsigned int i = 0; i < hex.length() - 1; i += 2) + for (unsigned int i = 0; i < hex.length()-1; i += 2) { std::string byteString = hex.substr(i, 2); - uint8_t byte = (uint8_t)strtol(byteString.c_str(), NULL, 16); + uint8_t byte = (uint8_t) strtol(byteString.c_str(), NULL, 16); bytes.push_back(byte); } return bytes; } - - std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes) { std::string bit_string; bit_string.reserve(bytes.size() * 8); - for (const auto& byte : bytes) + for(const auto& byte : bytes) { std::bitset<8> bits(byte); bit_string += bits.to_string(); } return bit_string; } - - /** * @brief Extracts a range of bytes from a TestVector's navBits vector. * @@ -413,8 +512,6 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } - - /** * @brief Sets the time based on the given input. * @@ -438,118 +535,56 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) uint32_t sec_in_week = 7 * 24 * 60 * 60; uint32_t week_number = duration_sec.count() / sec_in_week; uint32_t time_of_week = duration_sec.count() % sec_in_week; - this->WN = week_number; - this->TOW = time_of_week + LEAP_SECONDS; + this->WN = week_number; + this->TOW = time_of_week + LEAP_SECONDS; // Return the week number and time of week as a pair // TODO: d_GST_SIS or d_receiver_time? doubt // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 - this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); + this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); + + } - - -TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) +void OsnmaMsgReceiverTest::initializeGoogleLog() { - // Arrange - // ---------- - // m0 - std::vector expected_message = { - 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, - 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, - 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, - 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, - 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00}; - - uint32_t TOW_Tag0 = 345660; - uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; - uint32_t WN = 1248; - uint32_t PRNa = 2; - uint8_t CTR = 1; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MACK_tag_and_info MTI; - MTI.tag = static_cast(0xE37BC4F858); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x00; - MTI.tag_info.cop = 0x0F; - Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - - // Act - // ---------- - auto computed_message = osnma->build_message(t0); - - - // Assert - // ---------- - ASSERT_TRUE(computed_message == expected_message); + google::InitGoogleLogging(log_name.c_str()); + FLAGS_minloglevel = 0; // INFO + FLAGS_logtostderr = 0; // add this line + FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; + if (FLAGS_log_dir.empty()) + { + std::cout << "Logging will be written at " + << std::filesystem::temp_directory_path() + << '\n' + << "Use gnss-sdr --log_dir=/path/to/log to change that.\n"; + } + else + { + try + { + const std::filesystem::path p(FLAGS_log_dir); + if (!std::filesystem::exists(p)) + { + std::cout << "The path " + << FLAGS_log_dir + << " does not exist, attempting to create it.\n"; + std::error_code ec; + if (!std::filesystem::create_directory(p, ec)) + { + std::cout << "Could not create the " << FLAGS_log_dir << " folder.\n"; + gflags::ShutDownCommandLineFlags(); + throw std::runtime_error("Could not create folder for logs"); + } + } + std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; + } + catch (const std::exception& e) + { + std::cerr << e.what() << '\n'; + std::cerr << "Could not create the " << FLAGS_log_dir << " folder.\n"; + gflags::ShutDownCommandLineFlags(); + throw; + } + } } - -TEST_F(OsnmaMsgReceiverTest, TagVerification) -{ - // Arrange - // ---------- - // Tag0 - uint32_t TOW_Tag0 = 345660; - uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; - uint32_t WN = 1248; - uint32_t PRNa = 2; - uint8_t CTR = 1; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MACK_tag_and_info MTI; - MTI.tag = static_cast(0xE37BC4F858); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x00; - MTI.tag_info.cop = 0x0F; - Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - - // Act - // ---------- - bool result_tag0 = osnma->verify_tag(t0); - - - // Assert - // ---------- - // ASSERT_TRUE(result_tag0); - - // Tag3 - uint32_t TOW_Tag3 = 345660; - uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; - uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30; - WN = 1248; - PRNa = 2; - CTR = 3; - - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 - osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = - "111111111111111111111111111111110000000000000000000000010001001001001000" - "111000001000100111100010010111111111011110111111111001001100000100000000"; - osnma->d_osnma_data.d_nma_header.nmas = 0b10; - - MTI.tag = static_cast(0x7BB238C883); - MTI.tag_info.PRN_d = 0x02; - MTI.tag_info.ADKD = 0x04; - MTI.tag_info.cop = 0x0F; - Tag t3(MTI, TOW_Tag0, WN, PRNa, CTR); - - bool result_tag3 = osnma->verify_tag(t3); - - ASSERT_TRUE(result_tag0 && result_tag3); -} From aede664b5a91a013aeadab186f2fc1373b39600e Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 3 Jul 2024 18:45:40 +0200 Subject: [PATCH 226/499] [TAS-232 ] [FEAT] verify tag m0 * add new constructor to Tag for Tag0 * minor reporting and comments. * forgot an include from fix5 merge * gitignore release folder --- .gitignore | 3 ++- src/core/libs/osnma_msg_receiver.cc | 21 +++++++------------ src/core/system_parameters/osnma_data.h | 18 ++++++++++++++-- .../osnma/osnma_msg_receiver_test.cc | 2 ++ 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index c16e1f808..dd9645f6d 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,5 @@ cmake-build-debug/ .vscode/ .vs/ Testing/ -/build/* \ No newline at end of file +/build/* +/cmake-build-release/* \ No newline at end of file diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d9726e269..7b5fbe51b 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -601,14 +601,10 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN,osnma_msg->TOW_sf0,d_osnma_data.d_nav_data); // TODO change place - // DEBUG PARSING MACK MESSAGES WHEN DSM-KROOT NOT YET AVAILABLE - // d_osnma_data.d_dsm_kroot_message.ts = 9; - // d_osnma_data.d_dsm_kroot_message.ks = 4; - // d_osnma_data.d_dsm_kroot_message.kroot = std::vector(16); + d_osnma_data.d_nav_data.init(osnma_msg); + if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 - { // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future + {// TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future read_mack_header(); d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly. d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; @@ -911,6 +907,9 @@ void osnma_msg_receiver::process_mack_message() { if (d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()) { + // add tag0 first + Tag tag0 (*mack); + d_tags_awaiting_verify.insert(std::pair(mack->TOW, tag0)); bool ret = verify_macseq(*mack); if (ret || d_flag_debug) { @@ -1001,6 +1000,7 @@ void osnma_msg_receiver::process_mack_message() } else if (it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0) { + // TODO - I dont understand logic. This needs to be reviewed. // case 1: adkd=12 and t.Tow + 300 < current TOW // case 2: adkd=0/4 and t.Tow + 30 < current TOW // case 3: any adkd and t.Tow > current TOW @@ -1087,7 +1087,6 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) // << tag.tag_id // << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase // << tag.received_tag << std::dec; - // TODO case tag0, to be verified here?, PRNd not needed for it // build message std::vector m = build_message(tag); @@ -1428,10 +1427,6 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) { applicable_sequence = sq2; } - else - { - LOG(WARNING) << "Galileo OSNMA: Mismatch in the GST verification."; - } if (mack.tag_and_info.size() != applicable_sequence.size() - 1) { LOG(WARNING) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!"; @@ -1450,7 +1445,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) else if (mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i + 1])) { LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table."; - return false; // C: suffices one incorrect to abort and not process the rest of the tags + return false; // TODO macseq shall be individual to each tag, a wrongly verified macseq should not discard the whole MACK tags } } diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index b27f6dfb3..aed9ae685 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -171,7 +171,7 @@ public: SUCCESS, FAIL, UNVERIFIED}; - Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR) + Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR) // standard tag constructor, for tags within Tag&Info field : tag_id(id_counter++), TOW(TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing WN(WN), @@ -186,7 +186,21 @@ public: skipped(0) { } - + Tag(const MACK_message& mack) // constructor for Tag0 + : tag_id(id_counter++), + TOW(mack.TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing + WN(mack.WN), + PRNa(mack.PRNa), + CTR(1), + status(UNVERIFIED), + received_tag(mack.header.tag0), + computed_tag(0), + PRN_d(mack.PRNa), // Tag0 are self-authenticating + ADKD(0), + cop(mack.header.cop), + skipped(0) + { + } const uint32_t tag_id; uint32_t TOW; uint32_t WN; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index f001bab72..f7ff50fe7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -7,6 +7,7 @@ #if USE_GLOG_AND_GFLAGS #include // for LOG +#include #else #include #endif @@ -557,6 +558,7 @@ void OsnmaMsgReceiverTest::initializeGoogleLog() FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; if (FLAGS_log_dir.empty()) { + std::cout << "Logging will be written at " << std::filesystem::temp_directory_path() << '\n' From ae225bad2bad89d7b6438efbc0582b7110f751da Mon Sep 17 00:00:00 2001 From: cl-cv Date: Tue, 2 Jul 2024 06:41:08 -0400 Subject: [PATCH 227/499] Fixed typo in collection of A0UTC parameter --- src/core/system_parameters/beidou_dnav_navigation_message.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/system_parameters/beidou_dnav_navigation_message.cc b/src/core/system_parameters/beidou_dnav_navigation_message.cc index 0444a3555..76a621de9 100644 --- a/src/core/system_parameters/beidou_dnav_navigation_message.cc +++ b/src/core/system_parameters/beidou_dnav_navigation_message.cc @@ -353,7 +353,7 @@ int32_t Beidou_Dnav_Navigation_Message::d1_subframe_decoder(std::string const& s d_DeltaT_LSF = static_cast(read_navigation_signed(subframe_bits, D1_DELTA_T_LSF)); i_WN_LSF = static_cast(read_navigation_signed(subframe_bits, D1_WN_LSF)); d_A0UTC = static_cast(read_navigation_signed(subframe_bits, D1_A0UTC)); - d_A0UTC = d_A0GPS * D1_A0GPS_LSB; + d_A0UTC = d_A0UTC * D1_A0UTC_LSB; d_A1UTC = static_cast(read_navigation_signed(subframe_bits, D1_A1UTC)); d_A1UTC = d_A1UTC * D1_A1UTC_LSB; From f46ceb0fa7df6699d585b0067e896058c17b3cc8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 9 Jul 2024 14:39:38 +0200 Subject: [PATCH 228/499] CentOS 7 reached EOL, remove from README. Fix for CentOS 9 Stream --- README.md | 26 +++----------------------- cmake/Modules/FindGFORTRAN.cmake | 1 + 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 85fb1720e..b9c64d1ff 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,6 @@ information about this open-source, software-defined GNSS receiver. - [Debian / Ubuntu](#debian--ubuntu) - [AlmaLinux](#almalinux) - [Arch Linux](#arch-linux) - - [CentOS](#centos) - [Fedora](#fedora) - [openSUSE](#opensuse) - [Rocky Linux](#rocky-linux) @@ -126,7 +125,7 @@ This section describes how to set up the compilation environment in GNU/Linux or ## GNU/Linux - Tested distributions: Ubuntu 14.04 LTS and above; Debian 9.0 "stretch" and - above; Arch Linux; CentOS 7; Fedora 26 and above; OpenSUSE 42.3 and above. + above; Arch Linux; Fedora 26 and above; OpenSUSE 42.3 and above. - Supported microprocessor architectures: - i386: Intel x86 instruction set (32-bit microprocessors). - amd64: also known as x86-64, the 64-bit version of the x86 instruction set, @@ -230,25 +229,6 @@ $ pacman -S gcc make cmake pkgconf git boost boost-libs libvolk gnuradio \ Once you have installed these packages, you can jump directly to [download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). -#### CentOS - -If you are using CentOS 7, you can install the dependencies via Extra Packages -for Enterprise Linux ([EPEL](https://fedoraproject.org/wiki/EPEL)): - -``` -$ sudo yum install wget -$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -$ sudo rpm -Uvh epel-release-latest-7.noarch.rpm -$ sudo yum install make automake gcc gcc-c++ kernel-devel libtool \ - hdf5-devel cmake git boost-devel boost-date-time boost-system \ - boost-filesystem boost-thread boost-chrono boost-serialization \ - log4cpp-devel gnuradio-devel gr-osmosdr-devel blas-devel lapack-devel \ - armadillo-devel openssl-devel libpcap-devel python-mako python-six pugixml-devel -``` - -Once you have installed these packages, you can jump directly to -[download the source code and build GNSS-SDR](#clone-gnss-sdrs-git-repository). - #### Fedora If you are using Fedora 26 or above, the required software dependencies can be @@ -400,7 +380,7 @@ or manually as explained below, and then please follow instructions on how to ``` $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint -$ sudo yum install lapack-devel blas-devel # For Fedora/CentOS/RHEL +$ sudo yum install lapack-devel blas-devel # For Fedora/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux $ wget https://sourceforge.net/projects/arma/files/armadillo-14.0.0.tar.xz @@ -455,7 +435,7 @@ v20240116 is available in your system. ``` $ sudo apt-get install libgnutls-openssl-dev # For Debian/Ubuntu/LinuxMint -$ sudo yum install openssl-devel # For Fedora/CentOS/RHEL +$ sudo yum install openssl-devel # For Fedora/RHEL $ sudo zypper install openssl-devel # For OpenSUSE $ sudo pacman -S openssl # For Arch Linux ``` diff --git a/cmake/Modules/FindGFORTRAN.cmake b/cmake/Modules/FindGFORTRAN.cmake index 89530518d..5a698ce89 100644 --- a/cmake/Modules/FindGFORTRAN.cmake +++ b/cmake/Modules/FindGFORTRAN.cmake @@ -55,6 +55,7 @@ find_library(GFORTRAN NAMES gfortran /usr/lib/gcc/sh4-linux-gnu /usr/lib/gcc/i686-redhat-linux # Fedora /usr/lib64/gcc/x86_64-redhat-linux + /usr/lib/gcc/x86_64-redhat-linux /usr/lib/gcc/armv7hl-redhat-linux-gnueabi /usr/lib/gcc/aarch64-redhat-linux /usr/lib/gcc/ppc64le-redhat-linux From f534ef859c4cd3ffe0dd01a9077f9cd8c19c87fc Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 9 Jul 2024 17:13:40 +0200 Subject: [PATCH 229/499] [TAS-212] [TEST] implement tests for DSM-PKR Verification * VerifyPublicKey, ComputeBaseLeaf, ComputeMerkleRoot * Refactored verify_dsm_pkr to allow for the new tests * add convert_from_hex function in the helper --- src/core/libs/osnma_msg_receiver.cc | 62 +++++++++------ src/core/libs/osnma_msg_receiver.h | 36 +++++---- src/core/system_parameters/gnss_crypto.h | 3 + src/core/system_parameters/osnma_helper.cc | 24 +++++- src/core/system_parameters/osnma_helper.h | 7 +- .../osnma/osnma_msg_receiver_test.cc | 78 ++++++++++++++++++- 6 files changed, 164 insertions(+), 46 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 7b5fbe51b..1d1414c45 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1027,56 +1027,70 @@ void osnma_msg_receiver::process_mack_message() } +/** + * @brief Verify received DSM-PKR message + * + * \details This method provides the functionality to verify the DSM-PKR message. The verification includes generating the base leaf + * and intermediate leafs, and comparing the computed merkle root leaf with the received one. + * \pre DSM_PKR_message correctly filled in especially the 1024 intermediate tree nodes + * \returns true if computed merkle root matches received one, false otherwise + */ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) { - // TODO create function for recursively apply hash + std::vector computed_merkle_root; // x_4_0 + std::vector base_leaf = compute_base_leaf(message); // m_i - // build base leaf m_i - std::vector m_i; - m_i.reserve(2 + message.npk.size()); - m_i.push_back((message.npkt << 4) + message.npktid); - for (uint8_t i = 0; i < message.npk.size(); i++) - { - m_i.push_back(message.npk[i]); - } - - // compute intermediate leafs' values - // std::vector x_0,x_1,x_2,x_3,x_4; LOG(INFO) << "Galileo OSNMA: DSM-PKR :: leaf provided: m_" << static_cast(message.mid); + computed_merkle_root = compute_merke_root(message, base_leaf); + + if (computed_merkle_root == d_crypto->getMerkleRoot()) + { + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: SUCCESS!." << std::endl; + return true; + } + else + { + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: FAILURE." << std::endl; + return false; + } +} +std::vector osnma_msg_receiver::compute_merke_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const +{ std::vector x_next, x_current = d_crypto->computeSHA256(m_i); for (size_t i = 0; i < 4; i++) { x_next.clear(); - bool leaf_is_on_right = ((message.mid / (1 << (i))) % 2) == 1; + bool leaf_is_on_right = ((dsm_pkr_message.mid / (1 << (i))) % 2) == 1; if (leaf_is_on_right) { // Leaf is on the right -> first the itn, then concatenate the leaf - x_next.insert(x_next.end(), &message.itn[32 * i], &message.itn[32 * i + 32]); + x_next.insert(x_next.end(), &dsm_pkr_message.itn[32 * i], &dsm_pkr_message.itn[32 * i + 32]); x_next.insert(x_next.end(), x_current.begin(), x_current.end()); } else { // Leaf is on the left -> first the leaf, then concatenate the itn x_next.insert(x_next.end(), x_current.begin(), x_current.end()); - x_next.insert(x_next.end(), &message.itn[32 * i], &message.itn[32 * i + 32]); + x_next.insert(x_next.end(), &dsm_pkr_message.itn[32 * i], &dsm_pkr_message.itn[32 * i + 32]); } // Compute the next node. x_current = d_crypto->computeSHA256(x_next); } - - if (x_current == d_crypto->getMerkleRoot()) + return x_current; +} +std::vector osnma_msg_receiver::compute_base_leaf(const DSM_PKR_message& dsm_pkr_message) const +{ // build base leaf m_i + std::vector m_i; + m_i.reserve(2 + dsm_pkr_message.npk.size()); + m_i.push_back((dsm_pkr_message.npkt << 4) + dsm_pkr_message.npktid); + for (uint8_t i = 0; i < dsm_pkr_message.npk.size(); i++) { - LOG(INFO) << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl; - return true; - } - else - { - LOG(INFO) << "Galileo OSNMA: DSM-PKR verification unsuccessful !" << std::endl; - return false; + m_i.push_back(dsm_pkr_message.npk[i]); } + return m_i; } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index aef9fd91e..8bb8eb452 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -69,26 +69,35 @@ private: void local_time_verification(const std::shared_ptr& osnma_msg); void process_dsm_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); - bool verify_dsm_pkr(DSM_PKR_message message); void read_and_process_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); void process_mack_message(); void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); - bool verify_tesla_key(std::vector& key, uint32_t TOW); + void remove_verified_tags(); + void control_tags_awaiting_verify_size(); + std::vector build_message(const Tag& tag); std::vector hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes); - void display_data();bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); + std::vector compute_base_leaf(const DSM_PKR_message& dsm_pkr_message) const; + std::vector compute_merke_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; + void display_data(); + bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); + bool verify_tesla_key(std::vector& key, uint32_t TOW); bool verify_tag(Tag& tag); bool is_next_subframe(); bool tag_has_nav_data_available(Tag& t); bool tag_has_key_available(Tag& t); + bool verify_macseq(const MACK_message& mack); + bool verify_dsm_pkr(DSM_PKR_message message); + enum tags_to_verify{all,utc,slow_eph, eph, none}; + tags_to_verify d_tags_allowed{tags_to_verify::all}; std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::vector d_macks_awaiting_MACSEQ_verification; std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW - std::unique_ptr d_dsm_reader; - std::unique_ptr d_crypto; + std::unique_ptr d_dsm_reader; // osnma parameters parser + std::unique_ptr d_crypto; // access to cryptographic functions std::unique_ptr d_helper; std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. @@ -104,27 +113,26 @@ private: bool d_flag_debug{false}; uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification TODO need really to be global var? uint32_t d_last_verified_key_GST{0}; + uint32_t d_GST_0 {}; + uint32_t d_GST_SIS {}; + std::time_t d_receiver_time {0}; uint8_t d_Lt_min {}; // minimum equivalent tag length uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing uint8_t const d_T_L{30}; // s RG Section 2.1 uint8_t const d_delta_COP{30}; // s SIS ICD Table 14 - uint32_t d_GST_0 {}; - uint32_t d_GST_SIS {}; - std::time_t d_receiver_time {0}; - enum tags_to_verify{all,utc,slow_eph, eph, none}; // TODO is this safe? I hope so - tags_to_verify d_tags_allowed{tags_to_verify::all}; + std::vector d_tags_to_verify{0,4,12}; std::vector d_validated_key{}; - void remove_verified_tags(); - void control_tags_awaiting_verify_size(); - bool verify_macseq(const MACK_message& mack); + // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); FRIEND_TEST(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation); FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); FRIEND_TEST(OsnmaMsgReceiverTest, BuildTagMessageM0); - std::vector build_message(const Tag& tag); + FRIEND_TEST(OsnmaMsgReceiverTest, VerifyPublicKey); + FRIEND_TEST(OsnmaMsgReceiverTest, ComputeBaseLeaf); + FRIEND_TEST(OsnmaMsgReceiverTest, ComputeMerkleRoot); }; diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 69df8d45d..c0de86e24 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -54,6 +54,9 @@ public: { return d_x_4_0; } + inline void setMerkleRoot(std::vector v){ + d_x_4_0 = v; + } private: void read_merkle_xml(const std::string& merkleFilePath); diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index bd469a079..2002c72ca 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -47,7 +47,7 @@ std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const * @param binaryString The binary string to be converted. * @return The vector of bytes converted from the binary string. */ -std::vector Osnma_Helper::bytes(const std::string& binaryString) { +std::vector Osnma_Helper::bytes(const std::string& binaryString) const { std::vector bytes; // Determine the size of the padding needed. @@ -68,7 +68,7 @@ std::vector Osnma_Helper::bytes(const std::string& binaryString) { return bytes; } -std::string Osnma_Helper::verification_status_str(int status) +std::string Osnma_Helper::verification_status_str(const int& status) const { switch (status) { case 0: return "SUCCESS"; @@ -77,7 +77,7 @@ std::string Osnma_Helper::verification_status_str(int status) default: return "UNKNOWN"; } } -std::string Osnma_Helper::convert_to_hex_string(const std::vector& vector) +std::string Osnma_Helper::convert_to_hex_string(const std::vector& vector) const { std::stringstream ss; ss << std::hex << std::setfill('0'); @@ -86,3 +86,21 @@ std::string Osnma_Helper::convert_to_hex_string(const std::vector& vect } return ss.str(); } + +std::vector Osnma_Helper::convert_from_hex_string(const std::string& hex_string) const +{ + std::vector result; + + std::string adjusted_hex_string = hex_string; + if (hex_string.length() % 2 != 0) { + adjusted_hex_string = "0" + hex_string; + } + + for (std::size_t i = 0; i < adjusted_hex_string.length(); i += 2) { + std::string byte_string = adjusted_hex_string.substr(i, 2); + uint8_t byte = static_cast(std::stoul(byte_string, nullptr, 16)); + result.push_back(byte); + } + + return result; +} diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index e78fdba0f..761306efc 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -28,9 +28,10 @@ public: ~Osnma_Helper() = default; uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; std::vector gst_to_uint8(uint32_t GST) const; - std::vector bytes(const std::string& binaryString); - std::string verification_status_str(int status); - std::string convert_to_hex_string(const std::vector& vector); + std::vector bytes(const std::string& binaryString) const; + std::string verification_status_str(const int& status) const; + std::string convert_to_hex_string(const std::vector& vector) const ; + std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index f7ff50fe7..6b7f280a4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -6,6 +6,8 @@ #include #if USE_GLOG_AND_GFLAGS +#include "osnma_helper.h" +#include "gnss_crypto.h" #include // for LOG #include #else @@ -25,6 +27,7 @@ struct TestVector class OsnmaMsgReceiverTest : public ::testing::Test { protected: + Osnma_Helper helper; osnma_msg_receiver_sptr osnma; OSNMA_msg osnma_msg{}; std::array nma_position_filled; @@ -59,6 +62,77 @@ public: std::vector extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes); }; +TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) +{ + // Arrange + // ---------- + std::vector computed_merkle_root; + std::vector expected_merkle_root = helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D"); + DSM_PKR_message dsm_pkr_message; + dsm_pkr_message.npkt = 0x01; + dsm_pkr_message.npktid = 0x2; + dsm_pkr_message.mid = 0x01; + std::vector base_leaf = helper.convert_from_hex_string("120303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + + std::vector vec = helper.convert_from_hex_string("7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" + "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" + "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" + "24EF508389B7D446C3E2ECE8D459FBBD3239A794906F5B1F92469C640164FD87"); + std::copy(vec.begin(), vec.end(), dsm_pkr_message.itn.begin()); + dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + + // Act + // ---------- + computed_merkle_root = osnma->compute_merke_root(dsm_pkr_message,base_leaf); + + // Assert + // ---------- + ASSERT_EQ(computed_merkle_root, expected_merkle_root); +} + +TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) +{ + // Arrange + // ---------- + std::vector expected_base_leaf = helper.convert_from_hex_string("120303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + DSM_PKR_message dsm_pkr_message; + dsm_pkr_message.npkt = 0x01; + dsm_pkr_message.npktid = 0x2; + dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + + // Act + // ---------- + std::vector computed_base_leaf = osnma->compute_base_leaf(dsm_pkr_message); + + // Assert + // ---------- + ASSERT_EQ(computed_base_leaf,expected_base_leaf); +} + +TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ // values taken from RG A.7 + // Arrange + // ---------- + osnma->d_crypto->setMerkleRoot(helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D")); + DSM_PKR_message dsm_pkr_message; + dsm_pkr_message.npkt = 0x01; + dsm_pkr_message.npktid = 0x2; + dsm_pkr_message.mid = 0x01; + std::vector vec = helper.convert_from_hex_string("7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" + "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" + "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" + "24EF508389B7D446C3E2ECE8D459FBBD3239A794906F5B1F92469C640164FD87"); + std::copy(vec.begin(), vec.end(), dsm_pkr_message.itn.begin()); + dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + + // Act + // ---------- + bool result = osnma->verify_dsm_pkr(dsm_pkr_message); + + // Assert + // ---------- + ASSERT_TRUE(result); + +} TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) { @@ -552,10 +626,10 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) } void OsnmaMsgReceiverTest::initializeGoogleLog() { - google::InitGoogleLogging(log_name.c_str()); + google::InitGoogleLogging(log_name.c_str()); // TODO - running all tests causes conflict due to being called twice FLAGS_minloglevel = 0; // INFO FLAGS_logtostderr = 0; // add this line - FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/build/src/tests/logs"; + FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/data/build/src/tests/logs"; if (FLAGS_log_dir.empty()) { From 12a2fcadbe1b686db018481ac2f92c81e1582b95 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 10 Jul 2024 14:28:16 +0200 Subject: [PATCH 230/499] Bump max version of CMake to 3.30 --- CMakeLists.txt | 2 +- .../volk_gnsssdr/CMakeLists.txt | 2 +- src/main/CMakeLists.txt | 3 +- src/tests/CMakeLists.txt | 34 +++++++++++++------ src/utils/nav-listener/CMakeLists.txt | 2 +- src/utils/rinex-tools/CMakeLists.txt | 2 +- src/utils/rinex2assist/CMakeLists.txt | 2 +- 7 files changed, 30 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b03062db2..b3284dd91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.29) +cmake_minimum_required(VERSION 2.8.12...3.30) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index a57544a7f..e567eab94 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.29) +cmake_minimum_required(VERSION 2.8.12...3.30) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel") project(volk_gnsssdr) enable_language(CXX) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 04b2a0622..c58266231 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -26,7 +26,8 @@ if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(gnss-sdr PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gnss-sdr PUBLIC -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize absl::log_sink absl::log_sink_registry) + target_link_libraries(gnss-sdr PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) + target_link_libraries(gnss-sdr INTERFACE "$") endif() if(NOT ENABLE_LOG) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index ebc9e7ab3..160a3c32d 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -623,7 +623,8 @@ if(ENABLE_UNIT_TESTING) target_link_libraries(run_tests PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(run_tests PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(run_tests PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(run_tests INTERFACE "$") endif() target_include_directories(run_tests INTERFACE @@ -773,7 +774,8 @@ if(ENABLE_FPGA) target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga INTERFACE "$") endif() target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files @@ -814,6 +816,9 @@ function(add_system_test executable) INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) target_link_libraries(${executable} PRIVATE ${OPT_LIBS_} algorithms_libs) + if(NOT ENABLE_GLOG_AND_GFLAGS) + target_link_libraries(${executable} INTERFACE "$") + endif() if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(${executable} PRIVATE -DGNURADIO_USES_STD_POINTERS=1 @@ -872,7 +877,7 @@ if(ENABLE_SYSTEM_TESTING) if(ENABLE_GLOG_AND_GFLAGS) set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) else() - set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log $ absl::log_initialize absl::log_sink absl::log_sink_registry) + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::flags absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) endif() if(NOT ENABLE_PACKAGING) add_system_test(ttff @@ -896,7 +901,7 @@ if(ENABLE_SYSTEM_TESTING) if(ENABLE_GLOG_AND_GFLAGS) set(OPT_LIBS_ ${OPT_LIBS_} Gflags::gflags Glog::glog) else() - set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log $ absl::log_initialize absl::log_sink absl::log_sink_registry) + set(OPT_LIBS_ ${OPT_LIBS_} absl::flags_parse absl::log absl::log_initialize absl::log_sink absl::log_sink_registry) endif() add_system_test(position_test CMAKE_ARGS -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> @@ -969,7 +974,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(flowgraph_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(flowgraph_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(flowgraph_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(flowgraph_test INTERFACE "$") endif() target_include_directories(flowgraph_test @@ -1026,7 +1032,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnss_block_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gnss_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(gnss_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(gnss_block_test INTERFACE "$") endif() target_include_directories(gnss_block_test @@ -1078,7 +1085,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(gnuradio_block_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(gnuradio_block_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(gnuradio_block_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(gnuradio_block_test INTERFACE "$") endif() xcode_remove_warning_duplicates(gnuradio_block_test) @@ -1114,7 +1122,8 @@ if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(matio_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(matio_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(matio_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(matio_test INTERFACE "$") endif() target_include_directories(matio_test @@ -1164,7 +1173,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(acq_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(acq_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(acq_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(acq_test INTERFACE "$") endif() target_include_directories(acq_test INTERFACE @@ -1250,7 +1260,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(trk_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(trk_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(trk_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(trk_test INTERFACE "$") endif() if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) @@ -1313,7 +1324,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(control_thread_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(control_thread_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(control_thread_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(control_thread_test INTERFACE "$") endif() xcode_remove_warning_duplicates(control_thread_test) diff --git a/src/utils/nav-listener/CMakeLists.txt b/src/utils/nav-listener/CMakeLists.txt index 048a862f4..cc86a7bf4 100644 --- a/src/utils/nav-listener/CMakeLists.txt +++ b/src/utils/nav-listener/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause -cmake_minimum_required(VERSION 3.9...3.23) +cmake_minimum_required(VERSION 3.9...3.30) project(nav-msg-listener CXX) set(CMAKE_CXX_STANDARD 11) diff --git a/src/utils/rinex-tools/CMakeLists.txt b/src/utils/rinex-tools/CMakeLists.txt index 7dd0352c6..695c369ee 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/src/utils/rinex-tools/CMakeLists.txt @@ -34,7 +34,7 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND endif() target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/src/tests/common-files) - if("${GNSSTK_VERSION}" VERSION_LESS 3.0.1) + if(GNSSTK_VERSION AND "${GNSSTK_VERSION}" VERSION_LESS 3.0.1) set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 endif() # Do not show warnings raised by GPSTk v3.0.0 diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 39f690be5..e439672bc 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -59,7 +59,7 @@ if(Boost_FOUND) add_executable(rinex2assist ${CMAKE_CURRENT_SOURCE_DIR}/main.cc) endif() - if("${GNSSTK_VERSION}" VERSION_LESS 3.0.1) + if(GNSSTK_VERSION AND "${GNSSTK_VERSION}" VERSION_LESS 3.0.1) set_property(TARGET rinex2assist PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 endif() From 389600dffc985f2182a6178f1a3eb22059c0ba5f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 10 Jul 2024 20:16:07 +0200 Subject: [PATCH 231/499] Fix building with CMake 3.30 --- src/utils/rinex2assist/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index e439672bc..e24be6823 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -19,7 +19,11 @@ if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) endif() endif() -find_package(Boost COMPONENTS iostreams serialization QUIET) +if(CMAKE_VERSION VERSION_LESS "3.30.0") + find_package(Boost COMPONENTS iostreams serialization QUIET) +else() + find_package(Boost COMPONENTS iostreams serialization) +endif() if(CMAKE_VERSION VERSION_LESS 3.5) if(NOT TARGET Boost::iostreams) add_library(Boost::iostreams IMPORTED SHARED) From 8f80007a4e529ab145e93a571ad793b9fabe32f9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 10 Jul 2024 20:37:16 +0200 Subject: [PATCH 232/499] Fix building with CMake 3.30 --- src/utils/rinex2assist/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index e24be6823..99132eade 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -51,7 +51,7 @@ find_program(UNCOMPRESS_EXECUTABLE uncompress /usr/sbin ) -if(Boost_FOUND) +if(TARGET Boost::iostreams AND TARGET Boost::serialization) message(STATUS "The rinex2assist utility tool will be built when doing '${CMAKE_MAKE_PROGRAM_PRETTY_NAME}'") if(USE_CMAKE_TARGET_SOURCES) add_executable(rinex2assist) From 20d664a8b72aa28823ee8ba375b371451c53fee0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 10 Jul 2024 21:59:33 +0200 Subject: [PATCH 233/499] Fix building with CMake 3.30 in old setups --- CMakeLists.txt | 14 ++++++++++++-- src/utils/rinex2assist/CMakeLists.txt | 10 +++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3284dd91..a782e240c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -754,8 +754,18 @@ set(BOOST_COMPONENTS atomic chrono date_time serialization system thread) if(NOT ${FILESYSTEM_FOUND}) set(BOOST_COMPONENTS ${BOOST_COMPONENTS} filesystem) endif() -find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED) - +if(CMAKE_VERSION VERSION_LESS 3.30) + find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED) +else() + find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS}) + if(NOT Boost_FOUND) + message(STATUS "Trying deprecated FindBoost Module ...") + if(POLICY CMP0167) + cmake_policy(SET CMP0167 OLD) + find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} REQUIRED COMPONENTS ${BOOST_COMPONENTS}) + endif() + endif() +endif() if(NOT Boost_FOUND) message(FATAL_ERROR "Fatal error: Boost (version >=${GNSSSDR_BOOST_MIN_VERSION}) required.") endif() diff --git a/src/utils/rinex2assist/CMakeLists.txt b/src/utils/rinex2assist/CMakeLists.txt index 99132eade..277a924b1 100644 --- a/src/utils/rinex2assist/CMakeLists.txt +++ b/src/utils/rinex2assist/CMakeLists.txt @@ -19,11 +19,19 @@ if(NOT GNSSTK_FOUND OR ENABLE_OWN_GNSSTK) endif() endif() -if(CMAKE_VERSION VERSION_LESS "3.30.0") +if(CMAKE_VERSION VERSION_LESS 3.30) find_package(Boost COMPONENTS iostreams serialization QUIET) else() find_package(Boost COMPONENTS iostreams serialization) + if(NOT TARGET Boost::iostreams) + message(STATUS "Trying deprecated FindBoost Module ...") + if(POLICY CMP0167) + cmake_policy(SET CMP0167 OLD) + find_package(Boost COMPONENTS iostreams serialization) + endif() + endif() endif() + if(CMAKE_VERSION VERSION_LESS 3.5) if(NOT TARGET Boost::iostreams) add_library(Boost::iostreams IMPORTED SHARED) From fdb6c079e9cfd69c677b776d4ef95979a0a68522 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 15 Jul 2024 17:11:18 +0200 Subject: [PATCH 234/499] [TAS-223][FEAT] discard only failed FLX tags, not all belonging to MACK Refactored the verification process of MAC sequences in the OSNMA message receiver. Added a function to selectively verify and return tags for which the verification was successful. Replaced usage of direct verification and tag addition with calls to this function. Made corresponding changes to the data structure to accommodate a counter for each tag. --- src/core/libs/osnma_msg_receiver.cc | 175 ++++++++++++++++++++---- src/core/libs/osnma_msg_receiver.h | 1 + src/core/system_parameters/osnma_data.h | 2 +- 3 files changed, 149 insertions(+), 29 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1d1414c45..74b46f7dc 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -855,6 +855,7 @@ void osnma_msg_receiver::read_mack_body() } } d_osnma_data.d_mack_message.tag_and_info[k].tag = tag; + d_osnma_data.d_mack_message.tag_and_info[k].counter = k + 2; // CTR==1 for Tag0, increases subsequently for all other tags. d_osnma_data.d_mack_message.tag_and_info[k].tag_info.PRN_d = PRN_d; d_osnma_data.d_mack_message.tag_and_info[k].tag_info.ADKD = ADKD; d_osnma_data.d_mack_message.tag_and_info[k].tag_info.cop = cop; @@ -910,36 +911,30 @@ void osnma_msg_receiver::process_mack_message() // add tag0 first Tag tag0 (*mack); d_tags_awaiting_verify.insert(std::pair(mack->TOW, tag0)); - bool ret = verify_macseq(*mack); - if (ret || d_flag_debug) +// bool ret = verify_macseq(*mack); + std::vector macseq_verified_tags = verify_macseq_new(*mack); + for (std::size_t i = 0; i < macseq_verified_tags.size(); ++i) { - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS for Mack at TOW=" << mack->TOW << ", PRN" << mack->PRNa; - for (std::size_t i = 0; i < mack->tag_and_info.size(); ++i) - { - // add tags of current mack to the verification queue - auto& tag = mack->tag_and_info[i]; - Tag t(tag, mack->TOW, mack->WN, mack->PRNa, i + 2); // tag0 (mack header) has CTR1, so first tag of MTI has CTR = 2. - d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); - LOG(INFO) << "Galileo OSNMA: Add Tag Id= " - << t.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << t.received_tag << std::dec - << ", TOW=" - << t.TOW - << ", ADKD=" - << static_cast(t.ADKD) - << ", PRNa=" - << static_cast(t.PRNa) - << ", PRNd=" - << static_cast(t.PRN_d); - } - std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; - mack = d_macks_awaiting_MACSEQ_verification.erase(mack); - } - else - { - mack = d_macks_awaiting_MACSEQ_verification.erase(mack); + // add tags of current mack to the verification queue + auto& tag_and_info = macseq_verified_tags[i]; + Tag t(tag_and_info, mack->TOW, mack->WN, mack->PRNa, tag_and_info.counter); + d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); + LOG(INFO) << "Galileo OSNMA: Add Tag Id= " + << t.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << t.received_tag << std::dec + << ", TOW=" + << t.TOW + << ", ADKD=" + << static_cast(t.ADKD) + << ", PRNa=" + << static_cast(t.PRNa) + << ", PRNd=" + << static_cast(t.PRN_d); } + std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; + mack = d_macks_awaiting_MACSEQ_verification.erase(mack); + } else { // key not yet available - keep in container until then -- might be deleted if container size exceeds max allowed @@ -1408,6 +1403,7 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() } +// TODO - remove this method /** * @brief Verifies the MACSEQ of a received MACK_message. * @@ -1458,6 +1454,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } else if (mack.tag_and_info[i].tag_info.ADKD != std::stoi(applicable_sequence[i + 1])) { + // fill index of tags failed LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table."; return false; // TODO macseq shall be individual to each tag, a wrongly verified macseq should not discard the whole MACK tags } @@ -1639,3 +1636,125 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede // LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; return K_II; } + +/** + * @brief Verifies the MAC sequence of a received MACK message. + * + * This function is responsible for verifying the MAC sequence of a received MACK message. + * It takes a reference to a constant MACK_message object as input and returns a vector containing + * the tags for which the MACSEQ verification was successful + * + * @param mack The MACK message object to verify the MAC sequence for. + * @return vector MACK_tag_and_info for which the MACSEQ was successful + */ +std::vector osnma_msg_receiver::verify_macseq_new(const MACK_message& mack) +{ + std::vector verified_tags {}; + + // MACSEQ verification + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe + std::vector sq1{}; + std::vector sq2{}; + std::vector applicable_sequence; + const auto it = OSNMA_TABLE_16.find(d_osnma_data.d_dsm_kroot_message.maclt); + if (it != OSNMA_TABLE_16.cend()) + { + sq1 = it->second.sequence1; + sq2 = it->second.sequence2; + } + + // Assign relevant sequence based on subframe time + if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. + { + applicable_sequence = sq1; + } + else if (mack.TOW % 60 >= 30) + { + applicable_sequence = sq2; + } + if (mack.tag_and_info.size() != applicable_sequence.size() - 1) + { + LOG(WARNING) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!"; + return verified_tags; + } + std::vector flxTags{}; + std::string tempADKD; + // MACLT verification + for (uint8_t i = 0; i < mack.tag_and_info.size(); i++) + { + tempADKD = applicable_sequence[i + 1]; + if (tempADKD == "FLX") + { + flxTags.push_back(i); // C: just need to save the index in the sequence + } + else if (mack.tag_and_info[i].tag_info.ADKD == std::stoi(applicable_sequence[i + 1])) + { + // fill index of tags failed + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD match against MAC Look-up table for " + "Tag=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << mack.tag_and_info[i].tag << std::dec; + verified_tags.push_back(mack.tag_and_info[i]); + } + else + { + // discard tag + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table for " + "Tag=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << mack.tag_and_info[i].tag << std::dec; + } + } + + if (flxTags.empty() /*TODO add check d_flag_check_mackseq_fixed_tags*/) + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: No FLX tags to verify."; + return verified_tags; + } + // Fixed as well as FLX Tags share first part - Eq. 22 ICD + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); // TODO d_GST_Sf left useless + m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); + m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); + m[4] = static_cast(d_GST_Sf & 0x000000FF); + // Case tags flexible - Eq. 21 ICD + for (uint8_t i = 0; i < flxTags.size(); i++) + { + m[2 * i + 5] = mack.tag_and_info[flxTags[i]].tag_info.PRN_d; + m[2 * i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | + mack.tag_and_info[flxTags[i]].tag_info.cop; + } + // compute mac + std::vector mac; + if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 + { + mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + } + else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES + { + mac = d_crypto->computeCMAC_AES(applicable_key, m); + } + // Truncate the twelve MSBits and compare with received MACSEQ + uint16_t mac_msb = 0; + if (!mac.empty()) + { + mac_msb = (mac[0] << 8) + mac[1]; + } + uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; + if (computed_macseq == mack.header.macseq) + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; + for (uint8_t i = 0; i < flxTags.size(); i++) + { + verified_tags.push_back(mack.tag_and_info[flxTags[i]]); + } + return verified_tags; + } + + else + { + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed"; + return verified_tags; + } + +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 8bb8eb452..ad397cc2f 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -80,6 +80,7 @@ private: std::vector hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes); std::vector compute_base_leaf(const DSM_PKR_message& dsm_pkr_message) const; std::vector compute_merke_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; + std::vector verify_macseq_new(const MACK_message& mack); void display_data(); bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); bool verify_tesla_key(std::vector& key, uint32_t TOW); diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index aed9ae685..105c4cbc2 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -74,7 +74,7 @@ public: MACK_tag_and_info() = default; uint64_t tag; // C: 20-40 bits MACK_tag_info tag_info; - // TODO - std::vector with complete Tag + uint32_t counter; // CTR }; class DSM_PKR_message From ef8f00f6d651961d1867eccb2e99c5cdee156428 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Jul 2024 17:19:17 +0200 Subject: [PATCH 235/499] Add a building configuration parameter -DENABLE_GNUTLS, by default to OFF, to allow the user to link against GnuTLS instead of OpenSSL (#7) --- CMakeLists.txt | 3 +++ cmake/Modules/GnssSdrCrypto.cmake | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4264195a6..97fa74039 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,8 @@ option(ENABLE_STRIP "Create stripped binaries without debugging symbols (in Rele option(Boost_USE_STATIC_LIBS "Use Boost static libs" OFF) +option(ENABLE_GNUTLS "Forces linking against GnuTLS" OFF) + if(ENABLE_PACKAGING) set(ENABLE_ARMA_NO_DEBUG ON) set(CMAKE_VERBOSE_MAKEFILE ON) @@ -3472,6 +3474,7 @@ add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and bui add_feature_info(ENABLE_GLOG_AND_GFLAGS ENABLE_GLOG_AND_GFLAGS "Forces the usage of Google glog and Gflags instead of Abseil.") add_feature_info(ENABLE_OWN_ABSEIL ENABLE_OWN_ABSEIL "Forces downloading and building Abseil. Supersedes ENABLE_OWN_GLOG.") add_feature_info(ENABLE_OWN_ARMADILLO ENABLE_OWN_ARMADILLO "Forces the downloading and building of Armadillo.") +add_feature_info(ENABLE_GNUTLS ENABLE_GNUTLS "Forces linking against GnuTLS instead of OpenSSL.") add_feature_info(ENABLE_LOG ENABLE_LOG "Enables runtime internal logging.") add_feature_info(ENABLE_ORC ENABLE_ORC "Use the Optimized Inner Loop Runtime Compiler (ORC) for building volk_gnsssdr.") add_feature_info(ENABLE_STRIP ENABLE_STRIP "Enables the generation of stripped binaries (without debugging symbols).") diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index 9649da9da..58c1c94e2 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -11,7 +11,11 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(OPENSSL_ROOT_DIR /usr/local/opt/openssl) # Trick for Homebrew endif() -find_package(OpenSSL) +unset(OPENSSL_FOUND CACHE) +unset(GnuTLS_FOUND CACHE) +if(NOT ENABLE_GNUTLS) + find_package(OpenSSL) +endif() set_package_properties(OpenSSL PROPERTIES URL "https://www.openssl.org" @@ -162,7 +166,6 @@ function(link_to_crypto_dependencies target) target_compile_definitions(${target} PUBLIC -DUSE_OPENSSL_111=1) endif() endif() - else() endif() else() # GnuTLS target_link_libraries(${target} From 1c26d43e2de1956249d87d541eba28884be56c67 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 12 Jul 2024 16:18:41 +0200 Subject: [PATCH 236/499] Add function to store the public key in a .pem file --- src/core/system_parameters/gnss_crypto.cc | 119 +++++++++++++++++- src/core/system_parameters/gnss_crypto.h | 6 +- .../osnma/gnss_crypto_test.cc | 63 ++++++++-- 3 files changed, 177 insertions(+), 11 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 055bd0382..a41159abd 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -93,7 +93,7 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer #endif if (!readPublicKeyFromCRT(certFilePath)) { - readPublicKeyFromPEM(PEMFILE_DEFAULT); + readPublicKeyFromPEM(certFilePath); } read_merkle_xml(merkleTreePath); } @@ -1142,3 +1142,120 @@ bool Gnss_Crypto::pubkey_copy(EC_KEY* src, EC_KEY** dest) } #endif #endif + + +bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const +{ + if (!have_public_key()) + { + return false; + } + std::ofstream pubKeyFile(pubKeyFilePath, std::ios::binary); + if (!pubKeyFile.is_open()) + { + LOG(INFO) << "Unable to open file: " << pubKeyFilePath; + return false; + } +#if USE_GNUTLS_FALLBACK + gnutls_datum_t pem_data; +#if HAVE_GNUTLS_PUBKEY_EXPORT2 + int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); +#else + size_t output_stata_size; + int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); +#endif + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); + return false; + } + + pubKeyFile.write((const char*)pem_data.data, pem_data.size); + pubKeyFile.close(); + gnutls_free(pem_data.data); +#else // OpenSSL + BIO* bio = BIO_new(BIO_s_mem()); + if (!bio) + { + LOG(INFO) << "OpenSSL: Failed to create BIO"; + return false; + } +#if USE_OPENSSL_3 + if (!PEM_write_bio_PUBKEY(bio, d_PublicKey)) +#else // OpenSSL 1.x + if (!PEM_write_bio_EC_PUBKEY(bio, d_PublicKey)) +#endif + { + LOG(INFO) << "OpenSSL: Failed to write public key to BIO"; + BIO_free(bio); + return false; + } + + char* bio_data; + auto bio_len = BIO_get_mem_data(bio, &bio_data); + if (bio_len <= 0) + { + LOG(INFO) << "OpenSSL: Failed to get BIO data"; + BIO_free(bio); + return false; + } + + pubKeyFile.write(bio_data, bio_len); + pubKeyFile.close(); + BIO_free(bio); +#endif + return true; +} + + +std::vector Gnss_Crypto::getPublicKey() const +{ + if (!have_public_key()) + { + return {}; + } +#if USE_GNUTLS_FALLBACK + gnutls_datum_t pem_data = {nullptr, 0}; + + int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "GnuTLS: Failed to export public key to PEM format."; + return {}; + } + std::vector output(pem_data.data, pem_data.data + pem_data.size); + + // Free the allocated memory by gnutls_pubkey_export2 + gnutls_free(pem_data.data); +#else // OpenSSL + // Create a BIO for the memory buffer + BIO* mem = BIO_new(BIO_s_mem()); + if (!mem) + { + LOG(INFO) << "OpenSSL: Failed to create BIO."; + return {}; + } +#if USE_OPENSSL_3 + if (!PEM_write_bio_PUBKEY(mem, d_PublicKey)) +#else // OpenSSL 1.x + if (!PEM_write_bio_EC_PUBKEY(mem, d_PublicKey)) +#endif + { + BIO_free(mem); + LOG(INFO) << "OpenSSL: Failed to write public key to PEM format."; + return {}; + } + + // Get the length of the data in the BIO + BUF_MEM* mem_ptr; + BIO_get_mem_ptr(mem, &mem_ptr); + + // Copy the data from the BIO to a std::vector + std::vector output(mem_ptr->length); + memcpy(output.data(), mem_ptr->data, mem_ptr->length); + + // Clean up the BIO + BIO_free(mem); +#endif + return output; +} \ No newline at end of file diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index c0de86e24..fccf1b23c 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -44,17 +44,19 @@ public: void set_public_key(const std::vector& publickey); bool have_public_key() const; bool verify_signature(const std::vector& message, const std::vector& signature) const; + bool store_public_key(const std::string& pubKeyFilePath) const; std::vector computeSHA256(const std::vector& input) const; std::vector computeSHA3_256(const std::vector& input) const; std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; std::vector getMerkleRoot(const std::vector>& merkle) const; - + std::vector getPublicKey() const; inline std::vector getMerkleRoot() const { return d_x_4_0; } - inline void setMerkleRoot(std::vector v){ + inline void setMerkleRoot(std::vector v) + { d_x_4_0 = v; } diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 87f5afbfa..5095269c7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -1,5 +1,10 @@ #include "gnss_crypto.h" +#include "gnss_sdr_filesystem.h" +#include "gnss_sdr_make_unique.h" #include +#include +#include + class GnssCryptoTest : public ::testing::Test { }; @@ -7,7 +12,7 @@ class GnssCryptoTest : public ::testing::Test TEST(GnssCryptoTest, TestComputeSHA_256) { - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world std::vector expected_output = { @@ -23,7 +28,7 @@ TEST(GnssCryptoTest, TestComputeSHA_256) TEST(GnssCryptoTest, TestComputeSHA3_256) { - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world std::vector expected_output = { @@ -39,7 +44,7 @@ TEST(GnssCryptoTest, TestComputeSHA3_256) TEST(GnssCryptoTest, VerifySignature) { - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); // RG example - import crt certificate - result: FAIL std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; @@ -61,7 +66,7 @@ TEST(GnssCryptoTest, VerifySignature) TEST(GnssCryptoTest, VerifyPubKeyImport) { - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector publicKey{// PEM 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, @@ -80,10 +85,52 @@ TEST(GnssCryptoTest, VerifyPubKeyImport) } +TEST(GnssCryptoTest, VerifyPublicKeyStorage) +{ + auto d_crypto = std::make_unique(); + + const std::string f1("./osnma_test_file1.pem"); + const std::string f2("./osnma_test_file2.pem"); + + std::vector publicKey{ + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, + 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, + 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, + 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, + 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, + 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + + d_crypto->set_public_key(publicKey); + bool result = d_crypto->store_public_key(f1); + + ASSERT_TRUE(result); + + auto d_crypto2 = std::make_unique(f1, ""); + bool result2 = d_crypto2->store_public_key(f2); + ASSERT_TRUE(result2); + + std::ifstream t(f1); + std::string content_file((std::istreambuf_iterator(t)), std::istreambuf_iterator()); + + std::ifstream t2(f2); + std::string content_file2((std::istreambuf_iterator(t2)), std::istreambuf_iterator()); + + ASSERT_EQ(content_file, content_file2); + + std::vector readkey = d_crypto2->getPublicKey(); + ASSERT_EQ(publicKey, readkey); + + errorlib::error_code ec; + ASSERT_TRUE(fs::remove(fs::path(f1), ec)); + ASSERT_TRUE(fs::remove(fs::path(f2), ec)); +} + + // Unit test for computeHMAC_SHA_256 function. TEST(GnssCryptoTest, TestComputeHMACSHA256) { - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector key = { 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, @@ -107,7 +154,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256) TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) { // key and message generated from RG A.6.5.1 - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector key = {// RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, @@ -134,7 +181,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) { // key and message generated from RG A.6.5.2 - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector key = {// RG K4 @ 345690 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, @@ -159,7 +206,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) TEST(GnssCryptoTest, TestComputeCMAC_AES) { // Tests vectors from https://datatracker.ietf.org/doc/html/rfc4493#appendix-A - std::unique_ptr d_crypto = std::make_unique(); + auto d_crypto = std::make_unique(); std::vector key = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, From d79ee8497f7ad4aaf61d812c2933a034b2c61c60 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 13 Jul 2024 07:19:32 +0200 Subject: [PATCH 237/499] Store public key when received from a DSM-PKR message --- src/core/libs/osnma_msg_receiver.cc | 1 + src/core/system_parameters/Galileo_OSNMA.h | 2 +- src/core/system_parameters/gnss_crypto.cc | 62 +++++----------------- src/core/system_parameters/gnss_crypto.h | 4 +- 4 files changed, 16 insertions(+), 53 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 74b46f7dc..43e62a738 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -568,6 +568,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_public_key_verified = true; d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); + d_crypto->store_public_key(PEMFILE_STORED); } } } diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index bc919c4b3..6032be061 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -160,7 +160,7 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-256"), 512}, {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} -const std::string PEMFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.pem"); +const std::string PEMFILE_STORED("./OSNMA_PublicKey.pem"); const std::string CRTFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); const std::string MERKLEFILE_DEFAULT("../data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index a41159abd..b7595fa59 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -94,6 +94,10 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer if (!readPublicKeyFromCRT(certFilePath)) { readPublicKeyFromPEM(certFilePath); + if (!have_public_key()) + { + readPublicKeyFromPEM(PEMFILE_STORED); + } } read_merkle_xml(merkleTreePath); } @@ -160,7 +164,7 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) // If it was not the default, maybe it is a configuration error, warn user if (merkleFilePath != MERKLEFILE_DEFAULT) { - std::cerr << "File " << merkleFilePath << " not found" << std::endl; + LOG(INFO) << "File " << merkleFilePath << " not found"; } // fill default values d_x_4_0 = convert_from_hex_str("C5B2A3BD24E819EF82B17ACE83C0E7F41D34AC9B488CB7CE4D765FDE7DCA0297"); @@ -581,12 +585,6 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) std::ifstream pemFile(pemFilePath); if (!pemFile) { - // PEM file not found - // If it was not the default, maybe it is a configuration error - if (pemFilePath != PEMFILE_DEFAULT) - { - std::cerr << "File " << pemFilePath << " not found" << std::endl; - } return; } std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); @@ -659,7 +657,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) int ret = gnutls_x509_crt_import(cert, (const gnutls_datum_t*)&buffer, GNUTLS_X509_FMT_PEM); if (ret < 0) { - std::cerr << "Failed to import certificate: " << gnutls_strerror(ret) << std::endl; + LOG(INFO) << "GnuTLS: Failed to import certificate: " << gnutls_strerror(ret); gnutls_x509_crt_deinit(cert); return false; } @@ -670,7 +668,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) ret = gnutls_pubkey_import_x509(pubkey, cert, 0); if (ret < 0) { - std::cerr << "Failed to import public key: " << gnutls_strerror(ret) << std::endl; + LOG(INFO) << "GnuTLS: Failed to import public key: " << gnutls_strerror(ret); gnutls_pubkey_deinit(pubkey); gnutls_x509_crt_deinit(cert); return false; @@ -683,7 +681,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) std::ifstream crtFile(crtFilePath, std::ios::binary); if (!crtFile.is_open()) { - std::cerr << "Unable to open file: " << crtFilePath << std::endl; + LOG(INFO) << "OpenSSL: Unable to open file: " << crtFilePath; return false; } @@ -692,13 +690,13 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); if (!bio) { - std::cerr << "Unable to create BIO for file: " << crtFilePath << std::endl; + LOG(INFO) << "OpenSSL: Unable to create BIO for file: " << crtFilePath; return false; } X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); if (!cert) { - std::cerr << "Unable to read certificate from file: " << crtFilePath << std::endl; + LOG(INFO) << "OpenSSL: Unable to read certificate from file: " << crtFilePath; BIO_free(bio); return false; } @@ -708,7 +706,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) #if USE_OPENSSL_3 if (!pubkey) { - std::cerr << "Failed to extract the public key" << std::endl; + LOG(INFO) << "OpenSSL: Failed to extract the public key"; X509_free(cert); return false; } @@ -719,7 +717,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) EVP_PKEY_free(pubkey); if (!ec_pubkey) { - std::cerr << "Failed to extract the public key" << std::endl; + LOG(INFO) << "OpenSSL: Failed to extract the public key"; X509_free(cert); return false; } @@ -873,42 +871,6 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } -std::vector Gnss_Crypto::getMerkleRoot(const std::vector>& merkle) const -{ - if (merkle.empty()) - { - return {}; - } - else if (merkle.size() == 1) - { - return this->computeSHA3_256(merkle[0]); - } - - std::vector> new_merkle = merkle; - - while (new_merkle.size() > 1) - { - if (new_merkle.size() % 2 == 1) - { - new_merkle.push_back(merkle.back()); - } - - std::vector> result; - - for (size_t i = 0; i < new_merkle.size(); i += 2) - { - std::vector var1 = this->computeSHA3_256(new_merkle[i]); - std::vector var2 = this->computeSHA3_256(new_merkle[i + 1]); - var1.insert(var1.end(), var2.begin(), var2.end()); - std::vector hash = this->computeSHA3_256(var1); - result.push_back(hash); - } - new_merkle = result; - } - return new_merkle[0]; -} - - void Gnss_Crypto::set_public_key(const std::vector& publicKey) { #if USE_GNUTLS_FALLBACK diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index fccf1b23c..95db7032a 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -45,12 +45,12 @@ public: bool have_public_key() const; bool verify_signature(const std::vector& message, const std::vector& signature) const; bool store_public_key(const std::string& pubKeyFilePath) const; + std::vector getPublicKey() const; std::vector computeSHA256(const std::vector& input) const; std::vector computeSHA3_256(const std::vector& input) const; std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; - std::vector getMerkleRoot(const std::vector>& merkle) const; - std::vector getPublicKey() const; + inline std::vector getMerkleRoot() const { return d_x_4_0; From fe36fe7a604df9fafb2fe2bdd64454a46cd660b7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 13 Jul 2024 09:12:13 +0200 Subject: [PATCH 238/499] Fix certificate reading when using GnuTLS --- src/core/system_parameters/gnss_crypto.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index b7595fa59..231c33004 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -650,11 +650,12 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) return false; } - std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); + const std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); + const gnutls_datum_t buffer_datum = {const_cast(buffer.data()), static_cast(buffer.size())}; gnutls_x509_crt_t cert; gnutls_x509_crt_init(&cert); - int ret = gnutls_x509_crt_import(cert, (const gnutls_datum_t*)&buffer, GNUTLS_X509_FMT_PEM); + int ret = gnutls_x509_crt_import(cert, &buffer_datum, GNUTLS_X509_FMT_PEM); if (ret < 0) { LOG(INFO) << "GnuTLS: Failed to import certificate: " << gnutls_strerror(ret); From a06897590b8333a4203c3b92687c82278fc4c36c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 15 Jul 2024 10:29:34 +0200 Subject: [PATCH 239/499] Add current values of the Merkle Tree by default --- src/core/system_parameters/gnss_crypto.cc | 28 +++++++++-------------- src/core/system_parameters/gnss_crypto.h | 3 +-- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 231c33004..fba8d643e 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -167,12 +167,11 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) LOG(INFO) << "File " << merkleFilePath << " not found"; } // fill default values - d_x_4_0 = convert_from_hex_str("C5B2A3BD24E819EF82B17ACE83C0E7F41D34AC9B488CB7CE4D765FDE7DCA0297"); - d_x_3_1 = convert_from_hex_str("C8314BA8084E0CA101E595E88F170012F1F5CE71EEEFAB27334283E15935E8E6"); - d_x_2_1 = convert_from_hex_str("6FB21E4DDF3F8E517A5C5B1C6D843F9236707FF11D96F9BA954BFEAA3A44E56B"); - d_x_1_1 = convert_from_hex_str("86E53A50D345FBDAD49835F3363EE4A7262DB738CBDFC399229AE2803679300D"); - d_x_0_0 = convert_from_hex_str("40CAA1D70F7B1D370219674A25721311170A49DE4E4A0CE4FE328674E01CF750"); - d_x_0_1 = convert_from_hex_str("AA1A8B68E5DB293106B5BC8806F9790E8ACF8DC2D28A6EF6C1AC7233A9813D3F"); + d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); + d_x_3_1 = convert_from_hex_str("84DE3669E6DA551292979E5B8D045787FA967C57CC23638A30237614EDD9171A"); + d_x_2_1 = convert_from_hex_str("DE73D209E4C5BCDC34CD117F2FE40FD08B110009997AD2B3291D3A2CF29943F9"); + d_x_1_1 = convert_from_hex_str("6AAFDE28017BF0744D42819CE40E3A0CDA1ECA3F7A4EA67E134E7AA714C1E843"); + d_x_0_1 = convert_from_hex_str("941BD34EA7DF668B6FC5BE75C1D93464D109BC615CB52C8124847FAFB09CBB2B"); return; } try @@ -243,25 +242,20 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) { d_x_1_1 = convert_from_hex_str(x_ji); } - if (j == 0 && i == 0) - { - d_x_0_0 = convert_from_hex_str(x_ji); - } if (j == 0 && i == 1) { - d_x_0_0 = convert_from_hex_str(x_ji); + d_x_0_1 = convert_from_hex_str(x_ji); } } } catch (const std::exception& e) { std::cerr << "Exception raised reading the " << merkleFilePath << " file: " << e.what() << '\n'; - d_x_4_0 = convert_from_hex_str("C5B2A3BD24E819EF82B17ACE83C0E7F41D34AC9B488CB7CE4D765FDE7DCA0297"); - d_x_3_1 = convert_from_hex_str("C8314BA8084E0CA101E595E88F170012F1F5CE71EEEFAB27334283E15935E8E6"); - d_x_2_1 = convert_from_hex_str("6FB21E4DDF3F8E517A5C5B1C6D843F9236707FF11D96F9BA954BFEAA3A44E56B"); - d_x_1_1 = convert_from_hex_str("86E53A50D345FBDAD49835F3363EE4A7262DB738CBDFC399229AE2803679300D"); - d_x_0_0 = convert_from_hex_str("40CAA1D70F7B1D370219674A25721311170A49DE4E4A0CE4FE328674E01CF750"); - d_x_0_1 = convert_from_hex_str("AA1A8B68E5DB293106B5BC8806F9790E8ACF8DC2D28A6EF6C1AC7233A9813D3F"); + d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); + d_x_3_1 = convert_from_hex_str("84DE3669E6DA551292979E5B8D045787FA967C57CC23638A30237614EDD9171A"); + d_x_2_1 = convert_from_hex_str("DE73D209E4C5BCDC34CD117F2FE40FD08B110009997AD2B3291D3A2CF29943F9"); + d_x_1_1 = convert_from_hex_str("6AAFDE28017BF0744D42819CE40E3A0CDA1ECA3F7A4EA67E134E7AA714C1E843"); + d_x_0_1 = convert_from_hex_str("941BD34EA7DF668B6FC5BE75C1D93464D109BC615CB52C8124847FAFB09CBB2B"); return; } std::cout << "OSNMA Merkle Tree successfully read from file " << merkleFilePath << std::endl; diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 95db7032a..b8164e0ac 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -55,7 +55,7 @@ public: { return d_x_4_0; } - inline void setMerkleRoot(std::vector v) + inline void setMerkleRoot(const std::vector& v) { d_x_4_0 = v; } @@ -82,7 +82,6 @@ private: std::vector d_x_3_1; std::vector d_x_2_1; std::vector d_x_1_1; - std::vector d_x_0_0; std::vector d_x_0_1; }; From ac7bdc919b73d2598b06eca6e24e18e854def977 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Mon, 15 Jul 2024 19:10:00 +0200 Subject: [PATCH 240/499] Decouple the FPGA DMA signal source from the AD9361 FPGA signal source. --- .../signal_source/adapters/CMakeLists.txt | 8 + .../adapters/ad9361_fpga_signal_source.cc | 779 ++++-------------- .../adapters/ad9361_fpga_signal_source.h | 30 +- .../adapters/dma_fpga_signal_source.cc | 585 +++++++++++++ .../adapters/dma_fpga_signal_source.h | 118 +++ .../signal_source/libs/fpga_buffer_monitor.cc | 27 +- .../signal_source/libs/fpga_buffer_monitor.h | 8 +- .../libs/fpga_dynamic_bit_selection.h | 1 - .../signal_source/libs/fpga_switch.cc | 15 +- .../signal_source/libs/fpga_switch.h | 4 +- src/core/receiver/gnss_block_factory.cc | 12 +- src/core/receiver/gnss_flowgraph.cc | 2 +- ...e1_pcps_ambiguous_acquisition_test_fpga.cc | 2 +- .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 2 +- .../hybrid_observables_test_fpga.cc | 2 +- .../tracking/tracking_pull-in_test_fpga.cc | 2 +- 16 files changed, 917 insertions(+), 680 deletions(-) create mode 100644 src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/dma_fpga_signal_source.h diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index e4ead311b..fa0d78809 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -41,6 +41,14 @@ if(ENABLE_AD9361) list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) endif() +if(ENABLE_FPGA) + ############################################### + # FPGA DMA source + ############################################### + list(APPEND OPT_DRIVER_SOURCES dma_fpga_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS dma_fpga_signal_source.h) +endif() + if(ENABLE_FLEXIBAND AND TELEORBIT_FOUND) list(APPEND OPT_DRIVER_SOURCES flexiband_signal_source.cc) list(APPEND OPT_DRIVER_HEADERS flexiband_signal_source.h) 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 3a3360bed..534d98912 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc @@ -26,22 +26,14 @@ #include "GPS_L1_CA.h" #include "GPS_L5.h" #include "ad9361_manager.h" -#include "command_event.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" -#include "uio_fpga.h" -#include #include // for std::max #include // for std::chrono #include // for std::floor #include // for std::exception -#include // for open, O_WRONLY -#include // for std::ifstream -#include // for std::setprecision #include // for std::cout -#include // for write -#include // fr std::vector #if USE_GLOG_AND_GFLAGS #include @@ -56,12 +48,10 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) : SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), - queue_(queue), gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), - filename0_(configuration->property(role + ".filename", empty_string)), rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", -3.0)), @@ -71,18 +61,13 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), - samples_to_skip_(0), - samples_(configuration->property(role + ".samples", static_cast(0))), freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))), freq_rf_tx_hz_(configuration->property(role + ".freq_rf_tx_hz", static_cast(GPS_L1_FREQ_HZ - GPS_L5_FREQ_HZ - freq_dds_tx_hz_))), tx_bandwidth_(configuration->property(role + ".tx_bandwidth", static_cast(500000))), Fpass_(configuration->property(role + ".Fpass", static_cast(0.0))), Fstop_(configuration->property(role + ".Fstop", static_cast(0.0))), - num_input_files_(1), - dma_buff_offset_pos_(0), in_stream_(in_stream), out_stream_(out_stream), - switch_position_(configuration->property(role + ".switch_position", 0)), item_size_(sizeof(int8_t)), enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)), filter_auto_(configuration->property(role + ".filter_auto", false)), @@ -91,20 +76,15 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con bb_dc_(configuration->property(role + ".bb_dc", true)), rx1_enable_(configuration->property(role + ".rx1_enable", true)), rx2_enable_(configuration->property(role + ".rx2_enable", true)), - enable_DMA_(false), enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), - enable_ovf_check_buffer_monitor_active_(false), + enable_ovf_check_buffer_monitor_active_(true), dump_(configuration->property(role + ".dump", false)), #if USE_GLOG_AND_GFLAGS - rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)), + rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)) #else - rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))), + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))) #endif - repeat_(configuration->property(role + ".repeat", false)) { - const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", 0.0); - const size_t header_size = configuration->property(role + ".header_size", 0); - const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || (configuration->property("Channels_1B.count", 0) > 0)); const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || @@ -126,328 +106,158 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con { filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); } -#if USE_GLOG_AND_GFLAGS - // override value with commandline flag, if present - if (FLAGS_signal_source != "-") + + switch_fpga = std::make_shared(); + switch_fpga->set_switch_position(switch_to_real_time_mode); + + std::cout << "Sample rate: " << sample_rate_ << " Sps\n"; + + // some basic checks + if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2")) { - filename0_ = FLAGS_signal_source; + std::cout << "Configuration parameter rf_port_select should take one of these values:\n"; + std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2\n"; + std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_port_select=" << default_rf_port_select << '\n'; + rf_port_select_ = default_rf_port_select; + LOG(WARNING) << "Invalid configuration value for rf_port_select parameter. Set to rf_port_select=" << default_rf_port_select; } - if (FLAGS_s != "-") + + if ((gain_mode_rx1_ != "manual") && (gain_mode_rx1_ != "slow_attack") && (gain_mode_rx1_ != "fast_attack") && (gain_mode_rx1_ != "hybrid")) { - filename0_ = FLAGS_s; + std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx1=" << default_gain_mode << '\n'; + gain_mode_rx1_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx1=" << default_gain_mode; } -#else - if (absl::GetFlag(FLAGS_signal_source) != "-") + + if ((gain_mode_rx2_ != "manual") && (gain_mode_rx2_ != "slow_attack") && (gain_mode_rx2_ != "fast_attack") && (gain_mode_rx2_ != "hybrid")) { - filename0_ = absl::GetFlag(FLAGS_signal_source); + std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx2=" << default_gain_mode << '\n'; + gain_mode_rx2_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx2 parameter. Set to gain_mode_rx2=" << default_gain_mode; } - if (absl::GetFlag(FLAGS_s) != "-") + + if (gain_mode_rx1_ == "manual") { - filename0_ = absl::GetFlag(FLAGS_s); - } -#endif - if (filename0_.empty()) - { - num_input_files_ = 2; - filename0_ = configuration->property(role + ".filename0", empty_string); - filename1_ = configuration->property(role + ".filename1", empty_string); - } - // if only one input file is specified in the configuration file then: - // if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels - // otherwise the DMA transfers the samples to the L2/L5 frequency band channels - // if more than one input file are specified then the DMA transfer the samples to both the L1 and the L2/L5 frequency channels. - if (filename1_.empty()) - { - if (enable_rx1_band) + if (rf_gain_rx1_ > 73.0 || rf_gain_rx1_ < -1.0) { - dma_buff_offset_pos_ = 2; + std::cout << "Configuration parameter rf_gain_rx1 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx1=" << rf_gain_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx1=" << default_manual_gain_rx1 << '\n'; + rf_gain_rx1_ = default_manual_gain_rx1; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx1 parameter. Set to rf_gain_rx1=" << default_manual_gain_rx1; } } - else + + if (gain_mode_rx2_ == "manual") { - dma_buff_offset_pos_ = 2; + if (rf_gain_rx2_ > 73.0 || rf_gain_rx2_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx2 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx2=" << rf_gain_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx2=" << default_manual_gain_rx2 << '\n'; + rf_gain_rx2_ = default_manual_gain_rx2; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx2 parameter. Set to rf_gain_rx2=" << default_manual_gain_rx2; + } } - if (seconds_to_skip > 0) + if ((filter_source_ != "Off") && (filter_source_ != "Auto") && (filter_source_ != "File") && (filter_source_ != "Design")) { - samples_to_skip_ = static_cast(seconds_to_skip * sample_rate_) * 2; - } - if (header_size > 0) - { - samples_to_skip_ += header_size; + std::cout << "Configuration parameter filter_source should take one of these values:\n"; + std::cout << " Off: Disable filter\n"; + std::cout << " Auto: Use auto-generated filters\n"; + std::cout << " File: User-provided filter in filter_filename parameter\n"; + std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters\n"; + std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value filter_source=Off\n"; + filter_source_ = std::string("Off"); + LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off"; } - std::string device_io_name; // Switch UIO device file - // find the uio device file corresponding to the switch. - if (find_uio_dev_file_name(device_io_name, switch_device_name, 0) < 0) + if (bandwidth_ < 200000 || bandwidth_ > 56000000) { - std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << switch_device_name << '\n'; + std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz\n"; + std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << '\n'; + bandwidth_ = default_bandwidth; + LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth; + } + + std::cout << "LO frequency : " << freq0_ << " Hz\n"; + try + { + config_ad9361_rx_local(bandwidth_, + sample_rate_, + freq0_, + freq1_, + rf_port_select_, + rx1_enable_, + rx2_enable_, + gain_mode_rx1_, + gain_mode_rx2_, + rf_gain_rx1_, + rf_gain_rx2_, + quadrature_, + rf_dc_, + bb_dc_, + filter_source_, + filter_filename_, + Fpass_, + Fstop_); + } + catch (const std::runtime_error &e) + { + std::cerr << "Exception cached when configuring the RX chain: " << e.what() << '\n'; return; } - - if (switch_position_ != 0 && switch_position_ != 2) + // LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION + if (enable_dds_lo_ == true) { - std::cout << "SignalSource.switch_position configuration parameter must be either 0: read from file(s) via DMA, or 2: read from AD9361\n"; - std::cout << "SignalSource.switch_position configuration parameter set to its default value switch_position=0 - read from file(s)\n"; - switch_position_ = 0; - } - - switch_fpga = std::make_shared(device_io_name); - switch_fpga->set_switch_position(switch_position_); - - if (switch_position_ == 0) // Inject file(s) via DMA - { - enable_DMA_ = true; - - if (samples_ == 0) // read all file + if (tx_bandwidth_ < static_cast(std::floor(static_cast(freq_dds_tx_hz_) * 1.1)) || (tx_bandwidth_ < 200000) || (tx_bandwidth_ > 1000000)) { - /*! - * BUG workaround: The GNU Radio file source does not stop the receiver after reaching the End of File. - * A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the - * valve block - */ - std::ifstream file(filename0_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); - std::ifstream::pos_type size; - - if (file.is_open()) - { - size = file.tellg(); - DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); - } - else - { - std::cerr << "SignalSource: Unable to open the samples file " << filename0_.c_str() << '\n'; - return; - } - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(16); - std::cout << "Processing file " << filename0_ << ", which contains " << static_cast(size) << " [bytes]\n"; - std::cout.precision(ss); - - if (size > 0) - { - const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; - const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; - samples_ = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms - } - - if (!filename1_.empty()) - { - std::ifstream file(filename1_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); - std::ifstream::pos_type size; - - if (file.is_open()) - { - size = file.tellg(); - DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); - } - else - { - std::cerr << "SignalSource: Unable to open the samples file " << filename1_.c_str() << '\n'; - return; - } - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(16); - std::cout << "Processing file " << filename1_ << ", which contains " << static_cast(size) << " [bytes]\n"; - std::cout.precision(ss); - - int64_t samples_rx2 = 0; - if (size > 0) - { - const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; - const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; - samples_rx2 = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms - } - samples_ = std::min(samples_, samples_rx2); - } + std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz\n"; + std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value tx_bandwidth=500000\n"; + tx_bandwidth_ = 500000; + LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000"; } - - CHECK(samples_ > 0) << "File does not contain enough samples to process."; - double signal_duration_s = (static_cast(samples_) * (1 / static_cast(sample_rate_))) / 2.0; - - DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; - std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]\n"; - - if (filename1_.empty()) + if (tx_attenuation_db_ > 0.0 || tx_attenuation_db_ < -89.75) { - DLOG(INFO) << "File source filename " << filename0_; + std::cout << "Configuration parameter tx_attenuation_db should take values between 0.0 and -89.95 in 0.25 dB steps\n"; + std::cout << "Error: provided value tx_attenuation_db=" << tx_attenuation_db_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value tx_attenuation_db=" << default_tx_attenuation_db << '\n'; + tx_attenuation_db_ = default_tx_attenuation_db; + LOG(WARNING) << "Invalid configuration value for tx_attenuation_db parameter. Set to tx_attenuation_db=" << default_tx_attenuation_db; } - else - { - DLOG(INFO) << "File source filename rx1 " << filename0_; - DLOG(INFO) << "File source filename rx2 " << filename1_; - } - DLOG(INFO) << "Samples " << samples_; - DLOG(INFO) << "Sampling frequency " << sample_rate_; - DLOG(INFO) << "Item type " << std::string("ibyte"); - DLOG(INFO) << "Item size " << item_size_; - DLOG(INFO) << "Repeat " << repeat_; - } - if (switch_position_ == 2) // Real-time via AD9361 - { - std::cout << "Sample rate: " << sample_rate_ << " Sps\n"; - - enable_ovf_check_buffer_monitor_active_ = false; // check buffer overflow and buffer monitor disabled by default - - // some basic checks - if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2")) - { - std::cout << "Configuration parameter rf_port_select should take one of these values:\n"; - std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2\n"; - std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value rf_port_select=" << default_rf_port_select << '\n'; - rf_port_select_ = default_rf_port_select; - LOG(WARNING) << "Invalid configuration value for rf_port_select parameter. Set to rf_port_select=" << default_rf_port_select; - } - - if ((gain_mode_rx1_ != "manual") && (gain_mode_rx1_ != "slow_attack") && (gain_mode_rx1_ != "fast_attack") && (gain_mode_rx1_ != "hybrid")) - { - std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:\n"; - std::cout << " manual, slow_attack, fast_attack, hybrid\n"; - std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value gain_mode_rx1=" << default_gain_mode << '\n'; - gain_mode_rx1_ = default_gain_mode; - LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx1=" << default_gain_mode; - } - - if ((gain_mode_rx2_ != "manual") && (gain_mode_rx2_ != "slow_attack") && (gain_mode_rx2_ != "fast_attack") && (gain_mode_rx2_ != "hybrid")) - { - std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:\n"; - std::cout << " manual, slow_attack, fast_attack, hybrid\n"; - std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value gain_mode_rx2=" << default_gain_mode << '\n'; - gain_mode_rx2_ = default_gain_mode; - LOG(WARNING) << "Invalid configuration value for gain_mode_rx2 parameter. Set to gain_mode_rx2=" << default_gain_mode; - } - - if (gain_mode_rx1_ == "manual") - { - if (rf_gain_rx1_ > 73.0 || rf_gain_rx1_ < -1.0) - { - std::cout << "Configuration parameter rf_gain_rx1 should take values between -1.0 and 73 dB\n"; - std::cout << "Error: provided value rf_gain_rx1=" << rf_gain_rx1_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value rf_gain_rx1=" << default_manual_gain_rx1 << '\n'; - rf_gain_rx1_ = default_manual_gain_rx1; - LOG(WARNING) << "Invalid configuration value for rf_gain_rx1 parameter. Set to rf_gain_rx1=" << default_manual_gain_rx1; - } - } - - if (gain_mode_rx2_ == "manual") - { - if (rf_gain_rx2_ > 73.0 || rf_gain_rx2_ < -1.0) - { - std::cout << "Configuration parameter rf_gain_rx2 should take values between -1.0 and 73 dB\n"; - std::cout << "Error: provided value rf_gain_rx2=" << rf_gain_rx2_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value rf_gain_rx2=" << default_manual_gain_rx2 << '\n'; - rf_gain_rx2_ = default_manual_gain_rx2; - LOG(WARNING) << "Invalid configuration value for rf_gain_rx2 parameter. Set to rf_gain_rx2=" << default_manual_gain_rx2; - } - } - - if ((filter_source_ != "Off") && (filter_source_ != "Auto") && (filter_source_ != "File") && (filter_source_ != "Design")) - { - std::cout << "Configuration parameter filter_source should take one of these values:\n"; - std::cout << " Off: Disable filter\n"; - std::cout << " Auto: Use auto-generated filters\n"; - std::cout << " File: User-provided filter in filter_filename parameter\n"; - std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters\n"; - std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value filter_source=Off\n"; - filter_source_ = std::string("Off"); - LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off"; - } - - if (bandwidth_ < 200000 || bandwidth_ > 56000000) - { - std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz\n"; - std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << '\n'; - bandwidth_ = default_bandwidth; - LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth; - } - - std::cout << "LO frequency : " << freq0_ << " Hz\n"; try { - config_ad9361_rx_local(bandwidth_, + config_ad9361_lo_local(tx_bandwidth_, sample_rate_, - freq0_, - freq1_, - rf_port_select_, - rx1_enable_, - rx2_enable_, - gain_mode_rx1_, - gain_mode_rx2_, - rf_gain_rx1_, - rf_gain_rx2_, - quadrature_, - rf_dc_, - bb_dc_, - filter_source_, - filter_filename_, - Fpass_, - Fstop_); + freq_rf_tx_hz_, + tx_attenuation_db_, + freq_dds_tx_hz_, + scale_dds_dbfs_, + phase_dds_deg_); } catch (const std::runtime_error &e) { - std::cerr << "Exception cached when configuring the RX chain: " << e.what() << '\n'; + std::cerr << "Exception cached when configuring the TX carrier: " << e.what() << '\n'; return; } - // LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION - if (enable_dds_lo_ == true) - { - if (tx_bandwidth_ < static_cast(std::floor(static_cast(freq_dds_tx_hz_) * 1.1)) || (tx_bandwidth_ < 200000) || (tx_bandwidth_ > 1000000)) - { - std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz\n"; - std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value tx_bandwidth=500000\n"; - tx_bandwidth_ = 500000; - LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000"; - } - if (tx_attenuation_db_ > 0.0 || tx_attenuation_db_ < -89.75) - { - std::cout << "Configuration parameter tx_attenuation_db should take values between 0.0 and -89.95 in 0.25 dB steps\n"; - std::cout << "Error: provided value tx_attenuation_db=" << tx_attenuation_db_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value tx_attenuation_db=" << default_tx_attenuation_db << '\n'; - tx_attenuation_db_ = default_tx_attenuation_db; - LOG(WARNING) << "Invalid configuration value for tx_attenuation_db parameter. Set to tx_attenuation_db=" << default_tx_attenuation_db; - } - try - { - config_ad9361_lo_local(tx_bandwidth_, - sample_rate_, - freq_rf_tx_hz_, - tx_attenuation_db_, - freq_dds_tx_hz_, - scale_dds_dbfs_, - phase_dds_deg_); - } - catch (const std::runtime_error &e) - { - std::cerr << "Exception cached when configuring the TX carrier: " << e.what() << '\n'; - return; - } - } - - // when the receiver is working in real-time mode via AD9361 perform buffer overflow checking, - // and if dump is enabled perform buffer monitoring - enable_ovf_check_buffer_monitor_active_ = true; - - std::string device_io_name_buffer_monitor; - - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - - // find the uio device file corresponding to the buffer monitor - if (find_uio_dev_file_name(device_io_name_buffer_monitor, buffer_monitor_device_name, 0) < 0) - { - std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << buffer_monitor_device_name << '\n'; - return; - } - - buffer_monitor_fpga = std::make_shared(device_io_name_buffer_monitor, num_freq_bands, dump_, dump_filename); - thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); } + std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + + buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); + thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); + + // dynamic bits selection if (enable_dynamic_bit_selection_) { @@ -469,53 +279,40 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() { /* cleanup and exit */ - if (switch_position_ == 0) // read samples from a file via DMA + + if (rf_shutdown_) { - std::unique_lock lock(dma_mutex); - enable_DMA_ = false; // disable the DMA - lock.unlock(); - if (thread_file_to_dma.joinable()) + std::cout << "* AD9361 Disabling RX streaming channels\n"; + if (!disable_ad9361_rx_local()) { - thread_file_to_dma.join(); + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } + if (enable_dds_lo_) + { + try + { + ad9361_disable_lo_local(); + } + catch (const std::exception &e) + { + LOG(WARNING) << "Problem shutting down the AD9361 TX stream: " << e.what(); + } } } - if (switch_position_ == 2) // Real-time via AD9361 + // disable buffer overflow checking and buffer monitoring + std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + lock_buffer_monitor.unlock(); + + if (thread_buffer_monitor.joinable()) { - if (rf_shutdown_) - { - std::cout << "* AD9361 Disabling RX streaming channels\n"; - if (!disable_ad9361_rx_local()) - { - LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; - } - if (enable_dds_lo_) - { - try - { - ad9361_disable_lo_local(); - } - catch (const std::exception &e) - { - LOG(WARNING) << "Problem shutting down the AD9361 TX stream: " << e.what(); - } - } - } - - // disable buffer overflow checking and buffer monitoring - std::unique_lock lock(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock.unlock(); - - if (thread_buffer_monitor.joinable()) - { - thread_buffer_monitor.join(); - } + thread_buffer_monitor.join(); } - std::unique_lock lock(dynamic_bit_selection_mutex); + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); bool bit_selection_enabled = enable_dynamic_bit_selection_; - lock.unlock(); + lock_dyn_bit_sel.unlock(); if (bit_selection_enabled == true) { @@ -531,290 +328,6 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() } -void Ad9361FpgaSignalSource::start() -{ - thread_file_to_dma = std::thread([&] { run_DMA_process(filename0_, filename1_, samples_to_skip_, item_size_, samples_, repeat_, dma_buff_offset_pos_, queue_); }); -} - - -void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) -{ - std::ifstream infile1; - infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); - - - // FPGA DMA control - dma_fpga = std::make_shared(); - - // open the files - try - { - infile1.open(filename0_, std::ios::binary); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception opening file " << filename0_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - - std::ifstream infile2; - if (!filename1_.empty()) - { - infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); - try - { - infile2.open(filename1_, std::ios::binary); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception opening file " << filename1_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - } - - // skip the initial samples if needed - uint64_t bytes_to_skeep = samples_to_skip * item_size; - try - { - infile1.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - - if (!filename1_.empty()) - { - try - { - infile2.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - } - - // rx signal vectors - std::vector input_samples(sample_block_size * 2); // complex samples - // pointer to DMA buffer - int8_t *dma_buffer; - int nread_elements = 0; // num bytes read from the file corresponding to frequency band 1 - bool run_DMA = true; - - // Open DMA device - if (dma_fpga->DMA_open()) - { - std::cerr << "Cannot open loop device\n"; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - dma_buffer = dma_fpga->get_buffer_address(); - - // if only one frequency band is used then clear the samples corresponding to the unused frequency band - uint32_t dma_index = 0; - if (num_input_files_ == 1) - { - // if only one file is enabled then clear the samples corresponding to the frequency band that is not used. - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - dma_buffer[dma_index + (2 - dma_buff_offset_pos)] = 0; - dma_buffer[dma_index + 1 + (2 - dma_buff_offset_pos)] = 0; - dma_index += 4; - } - } - - uint64_t nbytes_remaining = samples * item_size; - uint32_t read_buffer_size = sample_block_size * 2; // complex samples - - // run the DMA - while (run_DMA) - { - dma_index = 0; - if (nbytes_remaining < read_buffer_size) - { - read_buffer_size = nbytes_remaining; - } - nbytes_remaining = nbytes_remaining - read_buffer_size; - - // read filename 0 - try - { - infile1.read(reinterpret_cast(input_samples.data()), read_buffer_size); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << filename0_ << '\n'; - break; - } - if (infile1) - { - nread_elements = read_buffer_size; - } - else - { - // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN - nread_elements = infile1.gcount(); - } - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - // dma_buff_offset_pos is 1 for the L1 band and 0 for the other bands - dma_buffer[dma_index + dma_buff_offset_pos] = input_samples[index0]; - dma_buffer[dma_index + 1 + dma_buff_offset_pos] = input_samples[index0 + 1]; - dma_index += 4; - } - - // read filename 1 (if enabled) - if (num_input_files_ > 1) - { - dma_index = 0; - try - { - infile2.read(reinterpret_cast(input_samples.data()), read_buffer_size); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << filename1_ << '\n'; - break; - } - if (infile2) - { - nread_elements = read_buffer_size; - } - else - { - // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN - nread_elements = infile2.gcount(); - } - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - // filename2 is never the L1 band - dma_buffer[dma_index] = input_samples[index0]; - dma_buffer[dma_index + 1] = input_samples[index0 + 1]; - dma_index += 4; - } - } - - if (nread_elements > 0) - { - if (dma_fpga->DMA_write(nread_elements * 2)) - { - std::cerr << "Error: DMA could not send all the required samples\n"; - break; - } - // Throttle the DMA - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - - if (nbytes_remaining == 0) - { - if (repeat) - { - // read the file again - nbytes_remaining = samples * item_size; - read_buffer_size = sample_block_size * 2; - try - { - infile1.seekg(0); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception resetting the position of the next byte to be extracted to zero " << filename0_ << '\n'; - break; - } - - // skip the initial samples if needed - uint64_t bytes_to_skeep = samples_to_skip * item_size; - try - { - infile1.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; - break; - } - - if (!filename1_.empty()) - { - try - { - infile2.seekg(0); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception setting the position of the next byte to be extracted to zero " << filename1_ << '\n'; - break; - } - - try - { - infile2.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; - break; - } - } - } - else - { - // the input file is completely processed. Stop the receiver. - run_DMA = false; - } - } - std::unique_lock lock(dma_mutex); - if (enable_DMA_ == false) - { - run_DMA = false; - } - lock.unlock(); - } - - if (dma_fpga->DMA_close()) - { - std::cerr << "Error closing loop device " << '\n'; - } - try - { - infile1.close(); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception closing file " << filename0_ << '\n'; - } - - if (num_input_files_ > 1) - { - try - { - infile2.close(); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception closing file " << filename1_ << '\n'; - } - } - - // Stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); -} - - void Ad9361FpgaSignalSource::run_dynamic_bit_selection_process() { bool dynamic_bit_selection_active = true; 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 bedd25ad5..25f5105b0 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h @@ -53,8 +53,6 @@ public: ~Ad9361FpgaSignalSource(); - void start() override; - inline size_t item_size() override { return item_size_; @@ -66,13 +64,9 @@ public: gr::basic_block_sptr get_right_block() override; private: - const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name - const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name - const std::string buffer_monitor_device_name = std::string("buffer_monitor"); // buffer monitor device name const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); const std::string default_rf_port_select = std::string("A_BALANCED"); const std::string default_gain_mode = std::string("slow_attack"); - const std::string empty_string; const double default_tx_attenuation_db = -10.0; const double default_manual_gain_rx1 = 64.0; const double default_manual_gain_rx2 = 64.0; @@ -86,42 +80,27 @@ private: const uint32_t buffer_monitoring_initial_delay_ms = 2000; // sample block size when running in post-processing mode const int sample_block_size = 16384; - - void run_DMA_process(const std::string &filename0, - const std::string &filename1, - uint64_t &samples_to_skip, - size_t &item_size, - int64_t &samples, - bool &repeat, - uint32_t &dma_buff_offset_pos, - Concurrent_Queue *queue); + const int32_t switch_to_real_time_mode = 2; void run_dynamic_bit_selection_process(); void run_buffer_monitor_process(); - std::thread thread_file_to_dma; std::thread thread_dynamic_bit_selection; std::thread thread_buffer_monitor; std::shared_ptr switch_fpga; std::shared_ptr dynamic_bit_selection_fpga; std::shared_ptr buffer_monitor_fpga; - std::shared_ptr dma_fpga; - std::mutex dma_mutex; std::mutex dynamic_bit_selection_mutex; std::mutex buffer_monitor_mutex; - Concurrent_Queue *queue_; - std::string gain_mode_rx1_; std::string gain_mode_rx2_; std::string rf_port_select_; std::string filter_file_; std::string filter_source_; std::string filter_filename_; - std::string filename0_; - std::string filename1_; double rf_gain_rx1_; double rf_gain_rx2_; @@ -133,19 +112,14 @@ private: uint64_t freq1_; // frequency of local oscillator for ADRV9361-B (if present) uint64_t sample_rate_; uint64_t bandwidth_; - uint64_t samples_to_skip_; - int64_t samples_; uint64_t freq_dds_tx_hz_; uint64_t freq_rf_tx_hz_; uint64_t tx_bandwidth_; float Fpass_; float Fstop_; - uint32_t num_input_files_; - uint32_t dma_buff_offset_pos_; uint32_t in_stream_; uint32_t out_stream_; - int32_t switch_position_; size_t item_size_; @@ -156,12 +130,10 @@ private: bool bb_dc_; bool rx1_enable_; bool rx2_enable_; - bool enable_DMA_; bool enable_dynamic_bit_selection_; bool enable_ovf_check_buffer_monitor_active_; bool dump_; bool rf_shutdown_; - bool repeat_; }; diff --git a/src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc new file mode 100644 index 000000000..495543029 --- /dev/null +++ b/src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc @@ -0,0 +1,585 @@ +/*! + * \file dma_fpga_signal_source.cc + * \brief signal source for a DMA connected directly to FPGA accelerators. + * This source implements only the DMA control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * \author Marc Majoral, mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "dma_fpga_signal_source.h" +#include "command_event.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::chrono +#include // for open, O_WRONLY +#include // for std::ifstream +#include // for std::setprecision +#include // for std::cout +#include // fr std::vector + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +DMAFpgaSignalSource::DMAFpgaSignalSource(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "DMA_Fpga_Signal_Source"s), + queue_(queue), + filename0_(configuration->property(role + ".filename", empty_string)), + sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), + samples_to_skip_(0), + samples_(configuration->property(role + ".samples", static_cast(0))), + num_input_files_(1), + dma_buff_offset_pos_(0), + in_stream_(in_stream), + out_stream_(out_stream), + item_size_(sizeof(int8_t)), + enable_DMA_(false), + enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), + repeat_(configuration->property(role + ".repeat", false)) +{ + const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", 0.0); + const size_t header_size = configuration->property(role + ".header_size", 0); + + const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || + (configuration->property("Channels_1B.count", 0) > 0)); + const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || + (configuration->property("Channels_L5.count", 0) > 0) || + (configuration->property("Channels_5X.count", 0) > 0)); + +#if USE_GLOG_AND_GFLAGS + // override value with commandline flag, if present + if (FLAGS_signal_source != "-") + { + filename0_ = FLAGS_signal_source; + } + if (FLAGS_s != "-") + { + filename0_ = FLAGS_s; + } +#else + if (absl::GetFlag(FLAGS_signal_source) != "-") + { + filename0_ = absl::GetFlag(FLAGS_signal_source); + } + if (absl::GetFlag(FLAGS_s) != "-") + { + filename0_ = absl::GetFlag(FLAGS_s); + } +#endif + if (filename0_.empty()) + { + num_input_files_ = 2; + filename0_ = configuration->property(role + ".filename0", empty_string); + filename1_ = configuration->property(role + ".filename1", empty_string); + } + // if only one input file is specified in the configuration file then: + // if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels + // otherwise the DMA transfers the samples to the L2/L5 frequency band channels + // if more than one input file are specified then the DMA transfer the samples to both the L1 and the L2/L5 frequency channels. + if (filename1_.empty()) + { + if (enable_rx1_band) + { + dma_buff_offset_pos_ = 2; + } + } + else + { + dma_buff_offset_pos_ = 2; + } + + if (seconds_to_skip > 0) + { + samples_to_skip_ = static_cast(seconds_to_skip * sample_rate_) * 2; + } + if (header_size > 0) + { + samples_to_skip_ += header_size; + } + + switch_fpga = std::make_shared(); + switch_fpga->set_switch_position(switch_to_DMA); + + enable_DMA_ = true; + + if (samples_ == 0) // read all file + { + /*! + * BUG workaround: The GNU Radio file source does not stop the receiver after reaching the End of File. + * A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the + * valve block + */ + std::ifstream file(filename0_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); + std::ifstream::pos_type size; + + if (file.is_open()) + { + size = file.tellg(); + DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); + } + else + { + std::cerr << "SignalSource: Unable to open the samples file " << filename0_.c_str() << '\n'; + return; + } + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(16); + std::cout << "Processing file " << filename0_ << ", which contains " << static_cast(size) << " [bytes]\n"; + std::cout.precision(ss); + + if (size > 0) + { + const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; + const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; + samples_ = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms + } + + if (!filename1_.empty()) + { + std::ifstream file(filename1_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); + std::ifstream::pos_type size; + + if (file.is_open()) + { + size = file.tellg(); + DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); + } + else + { + std::cerr << "SignalSource: Unable to open the samples file " << filename1_.c_str() << '\n'; + return; + } + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(16); + std::cout << "Processing file " << filename1_ << ", which contains " << static_cast(size) << " [bytes]\n"; + std::cout.precision(ss); + + int64_t samples_rx2 = 0; + if (size > 0) + { + const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; + const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; + samples_rx2 = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms + } + samples_ = std::min(samples_, samples_rx2); + } + } + + CHECK(samples_ > 0) << "File does not contain enough samples to process."; + double signal_duration_s = (static_cast(samples_) * (1 / static_cast(sample_rate_))) / 2.0; + + DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; + std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]\n"; + + if (filename1_.empty()) + { + DLOG(INFO) << "File source filename " << filename0_; + } + else + { + DLOG(INFO) << "File source filename rx1 " << filename0_; + DLOG(INFO) << "File source filename rx2 " << filename1_; + } + DLOG(INFO) << "Samples " << samples_; + DLOG(INFO) << "Sampling frequency " << sample_rate_; + DLOG(INFO) << "Item type " << std::string("ibyte"); + DLOG(INFO) << "Item size " << item_size_; + DLOG(INFO) << "Repeat " << repeat_; + // } + + // dynamic bits selection + if (enable_dynamic_bit_selection_) + { + dynamic_bit_selection_fpga = std::make_shared(enable_rx1_band, enable_rx2_band); + thread_dynamic_bit_selection = std::thread([&] { run_dynamic_bit_selection_process(); }); + } + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +DMAFpgaSignalSource::~DMAFpgaSignalSource() +{ + std::unique_lock lock_DMA(dma_mutex); + enable_DMA_ = false; // disable the DMA + lock_DMA.unlock(); + if (thread_file_to_dma.joinable()) + { + thread_file_to_dma.join(); + } + + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bool bit_selection_enabled = enable_dynamic_bit_selection_; + lock_dyn_bit_sel.unlock(); + + if (bit_selection_enabled == true) + { + std::unique_lock lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + lock.unlock(); + + if (thread_dynamic_bit_selection.joinable()) + { + thread_dynamic_bit_selection.join(); + } + } +} + + +void DMAFpgaSignalSource::start() +{ + thread_file_to_dma = std::thread([&] { run_DMA_process(filename0_, filename1_, samples_to_skip_, item_size_, samples_, repeat_, dma_buff_offset_pos_, queue_); }); +} + + +void DMAFpgaSignalSource::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) +{ + std::ifstream infile1; + infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); + + + // FPGA DMA control + dma_fpga = std::make_shared(); + + // open the files + try + { + infile1.open(filename0_, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception opening file " << filename0_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + + std::ifstream infile2; + if (!filename1_.empty()) + { + infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); + try + { + infile2.open(filename1_, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception opening file " << filename1_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + } + + // skip the initial samples if needed + uint64_t bytes_to_skeep = samples_to_skip * item_size; + try + { + infile1.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + + if (!filename1_.empty()) + { + try + { + infile2.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + } + + // rx signal vectors + std::vector input_samples(sample_block_size * 2); // complex samples + // pointer to DMA buffer + int8_t *dma_buffer; + int nread_elements = 0; // num bytes read from the file corresponding to frequency band 1 + bool run_DMA = true; + + // Open DMA device + if (dma_fpga->DMA_open()) + { + std::cerr << "Cannot open loop device\n"; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + dma_buffer = dma_fpga->get_buffer_address(); + + // if only one frequency band is used then clear the samples corresponding to the unused frequency band + uint32_t dma_index = 0; + if (num_input_files_ == 1) + { + // if only one file is enabled then clear the samples corresponding to the frequency band that is not used. + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + dma_buffer[dma_index + (2 - dma_buff_offset_pos)] = 0; + dma_buffer[dma_index + 1 + (2 - dma_buff_offset_pos)] = 0; + dma_index += 4; + } + } + + uint64_t nbytes_remaining = samples * item_size; + uint32_t read_buffer_size = sample_block_size * 2; // complex samples + + // run the DMA + while (run_DMA) + { + dma_index = 0; + if (nbytes_remaining < read_buffer_size) + { + read_buffer_size = nbytes_remaining; + } + nbytes_remaining = nbytes_remaining - read_buffer_size; + + // read filename 0 + try + { + infile1.read(reinterpret_cast(input_samples.data()), read_buffer_size); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << filename0_ << '\n'; + break; + } + if (infile1) + { + nread_elements = read_buffer_size; + } + else + { + // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN + nread_elements = infile1.gcount(); + } + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // dma_buff_offset_pos is 1 for the L1 band and 0 for the other bands + dma_buffer[dma_index + dma_buff_offset_pos] = input_samples[index0]; + dma_buffer[dma_index + 1 + dma_buff_offset_pos] = input_samples[index0 + 1]; + dma_index += 4; + } + + // read filename 1 (if enabled) + if (num_input_files_ > 1) + { + dma_index = 0; + try + { + infile2.read(reinterpret_cast(input_samples.data()), read_buffer_size); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << filename1_ << '\n'; + break; + } + if (infile2) + { + nread_elements = read_buffer_size; + } + else + { + // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN + nread_elements = infile2.gcount(); + } + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // filename2 is never the L1 band + dma_buffer[dma_index] = input_samples[index0]; + dma_buffer[dma_index + 1] = input_samples[index0 + 1]; + dma_index += 4; + } + } + + if (nread_elements > 0) + { + if (dma_fpga->DMA_write(nread_elements * 2)) + { + std::cerr << "Error: DMA could not send all the required samples\n"; + break; + } + // Throttle the DMA + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + + if (nbytes_remaining == 0) + { + if (repeat) + { + // read the file again + nbytes_remaining = samples * item_size; + read_buffer_size = sample_block_size * 2; + try + { + infile1.seekg(0); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception resetting the position of the next byte to be extracted to zero " << filename0_ << '\n'; + break; + } + + // skip the initial samples if needed + uint64_t bytes_to_skeep = samples_to_skip * item_size; + try + { + infile1.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; + break; + } + + if (!filename1_.empty()) + { + try + { + infile2.seekg(0); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception setting the position of the next byte to be extracted to zero " << filename1_ << '\n'; + break; + } + + try + { + infile2.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; + break; + } + } + } + else + { + // the input file is completely processed. Stop the receiver. + run_DMA = false; + } + } + std::unique_lock lock_DMA(dma_mutex); + if (enable_DMA_ == false) + { + run_DMA = false; + } + lock_DMA.unlock(); + } + + if (dma_fpga->DMA_close()) + { + std::cerr << "Error closing loop device " << '\n'; + } + try + { + infile1.close(); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception closing file " << filename0_ << '\n'; + } + + if (num_input_files_ > 1) + { + try + { + infile2.close(); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception closing file " << filename1_ << '\n'; + } + } + + // Stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); +} + + +void DMAFpgaSignalSource::run_dynamic_bit_selection_process() +{ + bool dynamic_bit_selection_active = true; + + while (dynamic_bit_selection_active) + { + // setting the bit selection to the top bits + dynamic_bit_selection_fpga->bit_selection(); + std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + if (enable_dynamic_bit_selection_ == false) + { + dynamic_bit_selection_active = false; + } + lock_dyn_bit_sel.unlock(); + } +} + + +void DMAFpgaSignalSource::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void DMAFpgaSignalSource::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr DMAFpgaSignalSource::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr DMAFpgaSignalSource::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/dma_fpga_signal_source.h b/src/algorithms/signal_source/adapters/dma_fpga_signal_source.h new file mode 100644 index 000000000..b4781e0ae --- /dev/null +++ b/src/algorithms/signal_source/adapters/dma_fpga_signal_source.h @@ -0,0 +1,118 @@ +/*! + * \file dma_fpga_signal_source.h + * \brief signal source for a DMA connected directly to FPGA accelerators. + * This source implements only the DMA control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * \author Marc Majoral, mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_DMA_FPGA_SIGNAL_SOURCE_H +#define GNSS_SDR_DMA_FPGA_SIGNAL_SOURCE_H + +#include "concurrent_queue.h" +#include "fpga_dma-proxy.h" +#include "fpga_dynamic_bit_selection.h" +#include "fpga_switch.h" +#include "gnss_block_interface.h" +#include "signal_source_base.h" +#include +#include +#include +#include +#include +#include + + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + + +class ConfigurationInterface; + +class DMAFpgaSignalSource : public SignalSourceBase +{ +public: + DMAFpgaSignalSource(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); + + ~DMAFpgaSignalSource(); + + void start() override; + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name + const std::string empty_string; + const uint64_t default_bandwidth = 12500000; + // perform dynamic bit selection every 500 ms by default + const uint32_t Gain_control_period_ms = 500; + // sample block size when running in post-processing mode + const int sample_block_size = 16384; + const int32_t switch_to_DMA = 0; + + void run_DMA_process(const std::string &filename0, + const std::string &filename1, + uint64_t &samples_to_skip, + size_t &item_size, + int64_t &samples, + bool &repeat, + uint32_t &dma_buff_offset_pos, + Concurrent_Queue *queue); + + void run_dynamic_bit_selection_process(); + + std::thread thread_file_to_dma; + std::thread thread_dynamic_bit_selection; + + std::shared_ptr switch_fpga; + std::shared_ptr dynamic_bit_selection_fpga; + std::shared_ptr dma_fpga; + + std::mutex dma_mutex; + std::mutex dynamic_bit_selection_mutex; + + Concurrent_Queue *queue_; + + std::string filename0_; + std::string filename1_; + + uint64_t sample_rate_; + uint64_t samples_to_skip_; + int64_t samples_; + uint32_t num_input_files_; + uint32_t dma_buff_offset_pos_; + uint32_t in_stream_; + uint32_t out_stream_; + size_t item_size_; + + bool enable_DMA_; + bool enable_dynamic_bit_selection_; + bool repeat_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_DMA_FPGA_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 0b250d131..77ad77b00 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -25,6 +25,7 @@ #include "fpga_buffer_monitor.h" #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" +#include "uio_fpga.h" #include // for time, localtime #include // for open, O_RDWR, O_SYNC #include // for string, ofstream @@ -40,7 +41,16 @@ #endif -Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, +//Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, +// uint32_t num_freq_bands, +// bool dump, +// std::string dump_filename) +// : d_dump_filename(std::move(dump_filename)), +// d_num_freq_bands(num_freq_bands), +// d_max_buff_occ_freq_band_0(0), +// d_max_buff_occ_freq_band_1(0), +// d_dump(dump) +Fpga_buffer_monitor::Fpga_buffer_monitor( uint32_t num_freq_bands, bool dump, std::string dump_filename) @@ -50,10 +60,19 @@ Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, d_max_buff_occ_freq_band_1(0), d_dump(dump) { - // open device descriptor - if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) + std::string device_io_name; + + // find the uio device file corresponding to the buffer monitor + if (find_uio_dev_file_name(device_io_name, BUFFER_MONITOR_DEVICE_NAME, 0) < 0) { - LOG(WARNING) << "Cannot open deviceio" << device_name; + std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << BUFFER_MONITOR_DEVICE_NAME << '\n'; + return; + } + + // open device descriptor + if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1) + { + LOG(WARNING) << "Cannot open deviceio" << device_io_name; } // device memory map diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.h b/src/algorithms/signal_source/libs/fpga_buffer_monitor.h index 00b413e30..7231c5ae3 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.h +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.h @@ -45,10 +45,13 @@ public: /*! * \brief Constructor */ - explicit Fpga_buffer_monitor(const std::string& device_name, - uint32_t num_freq_bands, + explicit Fpga_buffer_monitor(uint32_t num_freq_bands, bool dump, std::string dump_filename); + // explicit Fpga_buffer_monitor(const std::string& device_name, + // uint32_t num_freq_bands, + // bool dump, + // std::string dump_filename); /*! * \brief Destructor @@ -61,6 +64,7 @@ public: void check_buffer_overflow_and_monitor_buffer_status(); private: + const std::string BUFFER_MONITOR_DEVICE_NAME = std::string("buffer_monitor"); // buffer monitor device name static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t test_register_writeval = 0x55AA; static const uint32_t num_sapmples_per_buffer_element = 2; diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h index 3f4b73a5a..53729b265 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h @@ -56,7 +56,6 @@ public: void bit_selection(void); private: - const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t Num_bits_ADC = 12; // Number of bits in the ADC diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index f2d51c2fb..2730bdf36 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -21,6 +21,7 @@ */ #include "fpga_switch.h" +#include "uio_fpga.h" #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap @@ -32,11 +33,19 @@ #include #endif -Fpga_Switch::Fpga_Switch(const std::string &device_name) +Fpga_Switch::Fpga_Switch(void) { - if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) + std::string device_io_name; // Switch UIO device file + // find the uio device file corresponding to the switch. + if (find_uio_dev_file_name(device_io_name, SWITCH_DEVICE_NAME, 0) < 0) { - LOG(WARNING) << "Cannot open deviceio" << device_name; + std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << SWITCH_DEVICE_NAME << '\n'; + return; + } + + if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1) + { + LOG(WARNING) << "Cannot open deviceio" << device_io_name; } d_map_base = reinterpret_cast(mmap(nullptr, FPGA_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index b4a73cb4f..e2610016c 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -42,8 +42,7 @@ public: /*! * \brief Constructor */ - explicit Fpga_Switch(const std::string& device_name); - + explicit Fpga_Switch(void); /*! * \brief Destructor */ @@ -55,6 +54,7 @@ public: void set_switch_position(int32_t switch_position); private: + const std::string SWITCH_DEVICE_NAME = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; static const uint32_t MAX_LENGTH_DEVICEIO_NAME = 50; diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1a48e0a7f..4d729d24a 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -128,6 +128,7 @@ #endif #if ENABLE_FPGA +#include "dma_fpga_signal_source.h" #include "galileo_e1_dll_pll_veml_tracking_fpga.h" #include "galileo_e1_pcps_ambiguous_acquisition_fpga.h" #include "galileo_e5a_dll_pll_tracking_fpga.h" @@ -811,7 +812,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif -#if AD9361_DRIVER +#if ENABLE_FPGA and AD9361_DRIVER // The AD9361_DRIVER Driver must be instantiated last. In this way, when using the FPGA, and when using the GNSS receiver // in post-processing mode, the receiver is configured and ready when the DMA starts sending samples to the receiver. else if (implementation == "Ad9361_Fpga_Signal_Source") @@ -822,6 +823,15 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif +#if ENABLE_FPGA + else if (implementation == "DMA_Fpga_Signal_Source") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } +#endif + #if ZEROMQ_DRIVER else if (implementation == "ZMQ_Signal_Source") { diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 957077eca..6fc42b4bb 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -547,7 +547,7 @@ int GNSSFlowgraph::connect_fpga_flowgraph() if (src == nullptr) { help_hint_ += " * Check implementation name for SignalSource block.\n"; - help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Fpga_Signal_Source\n"; + help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Fpga_Signal_Source or DMA_Fpga_Signal_Source\n"; return 1; } if (src->item_size() == 0) diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc index 816dbfe1a..73aab356c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc @@ -321,7 +321,7 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal() // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal 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 ee06f57ce..13058472e 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 @@ -320,7 +320,7 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal() // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal 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 9824e1d17..a55d054b1 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 @@ -638,7 +638,7 @@ bool HybridObservablesTestFpga::acquire_signal() // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index 39f87bdfa..33baeac6f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -634,7 +634,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal From fcb20cb9143b604ac46faea12b508f4cf5449516 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 17 Jul 2024 19:53:21 +0200 Subject: [PATCH 241/499] Add ECDSA P-521 signature verification algorithm --- src/core/system_parameters/gnss_crypto.cc | 119 ++++++++++++++++++ src/core/system_parameters/gnss_crypto.h | 2 + .../osnma/gnss_crypto_test.cc | 45 +++++++ 3 files changed, 166 insertions(+) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index fba8d643e..ce6231617 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -866,6 +866,125 @@ bool Gnss_Crypto::verify_signature(const std::vector& message, const st } +bool Gnss_Crypto::verify_signature_p521(const std::vector& message, const std::vector& signature) const +{ + if (!have_public_key()) + { + std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; + return false; + } + bool success = false; + + // Convert signature to DER format + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) + { + LOG(INFO) << "Failed to convert raw ECDSA signature to DER format"; + return false; + } +#if USE_GNUTLS_FALLBACK + // Compute SHA-512 hash of the message + std::vector digest(64); + gnutls_hash_hd_t hash; + if (gnutls_hash_init(&hash, GNUTLS_DIG_SHA512) != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "OpenSSL: gnutls_hash_init failed"; + return false; + } + gnutls_hash(hash, message.data(), message.size()); + gnutls_hash_deinit(hash, digest.data()); + + gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; + gnutls_datum_t signature_data = {const_cast(der_sig.data()), static_cast(der_sig.size())}; + + // Verify the ECDSA signature + int ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA512, 0, &digest_data, &signature_data); + success = (ret >= 0); + if (success) + { + LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + } + else + { + std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; + LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); + } +#else // OpenSSL + // Compute SHA-512 hash of the message + std::vector digest(SHA512_DIGEST_LENGTH); + if (!EVP_Digest(message.data(), message.size(), digest.data(), nullptr, EVP_sha512(), nullptr)) + { + LOG(INFO) << "OpenSSL: EVP_Digest failed"; + return false; + } +#if USE_OPENSSL_3 + // Verify the signature + EVP_PKEY_CTX* pctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); + if (pctx == nullptr) + { + LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_new failed"; + return false; + } + + if (EVP_PKEY_verify_init(pctx) <= 0) + { + LOG(INFO) << "OpenSSL: EVP_PKEY_verify_init failed"; + EVP_PKEY_CTX_free(pctx); + return false; + } + + if (EVP_PKEY_CTX_set_signature_md(pctx, EVP_sha512()) <= 0) + { + LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_set_signature_md failed"; + EVP_PKEY_CTX_free(pctx); + return false; + } + + int verification = EVP_PKEY_verify(pctx, der_sig.data(), der_sig.size(), digest.data(), digest.size()); + EVP_PKEY_CTX_free(pctx); + + if (verification == 1) + { + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + success = true; + } + else if (verification == 0) + { + LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; + } + else + { + LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; + } +#else // OpenSSL 1.x + const unsigned char* sig_ptr = der_sig.data(); + ECDSA_SIG* ecdsa_sig = d2i_ECDSA_SIG(nullptr, &sig_ptr, der_sig.size()); + if (ecdsa_sig == nullptr) + { + LOG(INFO) << "OpenSSL: d2i_ECDSA_SIG failed"; + return false; + } + int verification = ECDSA_do_verify(digest.data(), digest.size(), ecdsa_sig, d_PublicKey); + ECDSA_SIG_free(ecdsa_sig); + if (verification == 1) + { + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + success = true; + } + else if (verification == 0) + { + LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; + } + else + { + LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; + } +#endif +#endif + return success; +} + + void Gnss_Crypto::set_public_key(const std::vector& publicKey) { #if USE_GNUTLS_FALLBACK diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index b8164e0ac..bd0c2a64d 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -44,7 +44,9 @@ public: void set_public_key(const std::vector& publickey); bool have_public_key() const; bool verify_signature(const std::vector& message, const std::vector& signature) const; + bool verify_signature_p521(const std::vector& message, const std::vector& signature) const; bool store_public_key(const std::string& pubKeyFilePath) const; + std::vector getPublicKey() const; std::vector computeSHA256(const std::vector& input) const; std::vector computeSHA3_256(const std::vector& input) const; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 5095269c7..994256da1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -64,6 +64,51 @@ TEST(GnssCryptoTest, VerifySignature) } +TEST(GnssCryptoTest, VerifySignatureP521) +{ + std::unique_ptr d_crypto = std::make_unique(); + + // Message to be verified + std::vector message = { + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 // "Hello World" + }; + + // Public key in PEM format + std::vector publicKey = { + 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, + 0x4d, 0x49, 0x47, 0x62, 0x4d, 0x42, 0x41, 0x47, 0x42, 0x79, 0x71, 0x47, 0x53, 0x4d, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, + 0x6a, 0x41, 0x34, 0x47, 0x47, 0x41, 0x41, 0x51, 0x41, 0x6f, 0x35, 0x76, 0x77, 0x66, 0x6e, 0x47, 0x57, 0x47, 0x33, 0x44, 0x63, 0x59, 0x75, 0x2b, 0x2f, 0x61, 0x58, + 0x47, 0x32, 0x7a, 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0a, 0x48, 0x36, 0x4c, 0x76, 0x4f, 0x4c, 0x76, 0x49, 0x51, 0x6a, 0x61, 0x2b, 0x6a, 0x74, 0x57, 0x73, + 0x70, 0x4f, 0x38, 0x37, 0x6f, 0x50, 0x32, 0x4e, 0x6d, 0x72, 0x34, 0x6e, 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4d, 0x37, 0x6a, 0x49, 0x69, 0x46, 0x38, 0x47, + 0x70, 0x6b, 0x75, 0x58, 0x6a, 0x75, 0x4e, 0x7a, 0x34, 0x72, 0x61, 0x56, 0x4f, 0x65, 0x49, 0x4d, 0x42, 0x77, 0x45, 0x2b, 0x61, 0x0a, 0x30, 0x4c, 0x76, 0x7a, 0x37, + 0x69, 0x54, 0x4d, 0x5a, 0x46, 0x41, 0x41, 0x51, 0x64, 0x2b, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, + 0x5a, 0x35, 0x77, 0x30, 0x38, 0x51, 0x4f, 0x43, 0x58, 0x2f, 0x75, 0x46, 0x65, 0x2b, 0x30, 0x78, 0x52, 0x78, 0x4c, 0x64, 0x2f, 0x33, 0x36, 0x42, 0x4e, 0x74, 0x63, + 0x74, 0x69, 0x2f, 0x45, 0x4c, 0x0a, 0x4b, 0x31, 0x35, 0x67, 0x2b, 0x4b, 0x32, 0x71, 0x67, 0x2f, 0x6c, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4d, 0x2b, 0x51, 0x3d, 0x0a, + 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a}; + + // ECDSA P-521 signature + std::vector signature = { + 0x01, 0x7b, 0x59, 0xac, 0x3a, 0x03, 0x5c, 0xb4, 0x07, 0xcd, 0xc1, 0xeb, 0xbe, 0xe5, 0xa6, 0xcb, + 0xda, 0x0a, 0xff, 0x4d, 0x38, 0x61, 0x16, 0x0f, 0xb3, 0x77, 0xe5, 0x8a, 0xdc, 0xf3, 0xfd, 0x79, + 0x38, 0x1e, 0xe8, 0x08, 0x3d, 0x5d, 0xbc, 0xc2, 0x80, 0x6e, 0xe9, 0x2b, 0xc3, 0xef, 0x07, 0x3d, + 0x0c, 0x82, 0x4c, 0x9b, 0x7a, 0x5c, 0x2e, 0xd5, 0x46, 0xbd, 0x22, 0x21, 0x13, 0x8a, 0xb2, 0xca, + 0x96, 0x3d, 0x01, 0xba, 0x2a, 0xc4, 0x3f, 0xdb, 0x66, 0x3c, 0x40, 0x26, 0xd9, 0xbc, 0x26, 0xd5, 0x57, 0xd4, + 0xbd, 0x15, 0x16, 0x88, 0x21, 0x3b, 0xaa, 0x07, 0x89, 0xef, 0x29, 0x8f, 0x2f, 0x85, 0x76, 0x58, + 0x9d, 0xca, 0x00, 0xcc, 0xc8, 0x30, 0x88, 0x31, 0x99, 0xc1, 0x94, 0xb9, 0xaf, 0x91, 0xdc, 0xc4, + 0x6f, 0x19, 0x2b, 0x12, 0xa2, 0x82, 0xa5, 0x66, 0x5e, 0x4b, 0xbb, 0xdf, 0x65, 0x81, 0x52, 0x14, + 0x01, 0xd7}; + + d_crypto->set_public_key(publicKey); + bool result = d_crypto->verify_signature_p521(message, signature); + ASSERT_TRUE(result); + + std::vector wrong_signature = signature; + wrong_signature[1] = 1; + bool result2 = d_crypto->verify_signature_p521(message, wrong_signature); + ASSERT_TRUE(!result2); +} + + TEST(GnssCryptoTest, VerifyPubKeyImport) { auto d_crypto = std::make_unique(); From 659ef2f0a8fc55918710c872847575c1cb45a129 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 18 Jul 2024 07:53:53 +0200 Subject: [PATCH 242/499] Improve code formatting --- src/core/system_parameters/gnss_crypto.cc | 1083 ++++++++--------- src/core/system_parameters/gnss_crypto.h | 54 +- .../osnma/gnss_crypto_test.cc | 365 ++++-- 3 files changed, 798 insertions(+), 704 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index ce6231617..7b1d837e0 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -133,133 +133,389 @@ bool Gnss_Crypto::have_public_key() const } -std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) const +bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) const { - std::vector result; - - // Iterate over the input string in pairs - for (size_t i = 0; i < input.length(); i += 2) + std::vector digest = this->computeSHA256(message); + if (!have_public_key()) { - // Extract two hexadecimal characters from the input string - std::string hexByte = input.substr(i, 2); - - // Convert the hexadecimal string to an integer value - auto value = static_cast(std::stoul(hexByte, nullptr, 16)); - - // Append the value to the result vector - result.push_back(value); + std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; + return false; + } + bool success = false; +#if USE_GNUTLS_FALLBACK +#if HAVE_GNUTLS_SIGN_ECDSA_SHA256 + // Convert signature to DER format + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) + { + std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + return false; } - return result; + // Prepare the digest datum + gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; + gnutls_datum_t der_sig_data = {der_sig.data(), static_cast(der_sig.size())}; + + // Verify the DER-encoded signature + int ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &digest_data, &der_sig_data); + success = (ret >= 0); + if (success) + { + LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + } + else + { + std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; + LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); + } +#endif +#else // OpenSSL +#if USE_OPENSSL_3 + EVP_PKEY_CTX* ctx; + ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); + bool do_operation = true; + + if (!ctx) + { + do_operation = false; + } + // convert raw signature into DER format + size_t half_size = signature.size() / 2; + std::vector raw_r(signature.begin(), signature.begin() + half_size); + std::vector raw_s(signature.begin() + half_size, signature.end()); + + // Convert raw R and S to BIGNUMs + BIGNUM* r = BN_bin2bn(raw_r.data(), raw_r.size(), nullptr); + BIGNUM* s = BN_bin2bn(raw_s.data(), raw_s.size(), nullptr); + + ECDSA_SIG* sig = ECDSA_SIG_new(); + if (r == nullptr || s == nullptr || sig == nullptr) + { + std::cerr << "Failed to allocate memory for BIGNUMs or ECDSA_SIG" << std::endl; + return false; + } + + if (ECDSA_SIG_set0(sig, r, s) != 1) + { + std::cerr << "Failed to set R and S values in ECDSA_SIG" << std::endl; + ECDSA_SIG_free(sig); // Free the ECDSA_SIG struct as it is no longer needed + return false; + } + + std::vector derSignature; + unsigned char* derSig = nullptr; + int derSigLength = i2d_ECDSA_SIG(sig, &derSig); + + if (derSigLength <= 0) + { + std::cerr << "Failed to convert ECDSA_SIG to DER format" << std::endl; + return false; + } + + derSignature.assign(derSig, derSig + derSigLength); + + if (EVP_PKEY_verify_init(ctx) <= 0) + { + do_operation = false; + } + if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) + { + do_operation = false; + } + int verification = 0; + if (do_operation) + { + verification = EVP_PKEY_verify(ctx, derSignature.data(), derSignature.size(), digest.data(), digest.size()); + } + EVP_PKEY_CTX_free(ctx); + OPENSSL_free(derSig); + ECDSA_SIG_free(sig); + if (verification == 1) + { + success = true; + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + } + else + { + unsigned long errCode = ERR_get_error(); + char* err = ERR_error_string(errCode, nullptr); + std::cerr << "OpenSSL: OSNMA message authentication failed: " << err << std::endl; + LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; + } +#else // OpenSSL 1.x + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) + { + std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + return false; + } + int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, der_sig.data(), static_cast(der_sig.size()), d_PublicKey); + if (verification == 1) + { + success = true; + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + } + else if (verification == 0) + { + std::cerr << "OpenSSL: invalid signature found when verifying message" << std::endl; + LOG(WARNING) << "OpenSSL: invalid signature found when verifying message"; + } + else + { + std::cerr << "OpenSSL: OSNMA message authentication failed" << std::endl; + LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; + } +#endif +#endif + return success; } -void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) +bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& message, const std::vector& signature) const { - pugi::xml_document doc; - pugi::xml_parse_result result = doc.load_file(merkleFilePath.c_str()); - if (!result) + if (!have_public_key()) { - // XML file not found - // If it was not the default, maybe it is a configuration error, warn user - if (merkleFilePath != MERKLEFILE_DEFAULT) - { - LOG(INFO) << "File " << merkleFilePath << " not found"; - } - // fill default values - d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); - d_x_3_1 = convert_from_hex_str("84DE3669E6DA551292979E5B8D045787FA967C57CC23638A30237614EDD9171A"); - d_x_2_1 = convert_from_hex_str("DE73D209E4C5BCDC34CD117F2FE40FD08B110009997AD2B3291D3A2CF29943F9"); - d_x_1_1 = convert_from_hex_str("6AAFDE28017BF0744D42819CE40E3A0CDA1ECA3F7A4EA67E134E7AA714C1E843"); - d_x_0_1 = convert_from_hex_str("941BD34EA7DF668B6FC5BE75C1D93464D109BC615CB52C8124847FAFB09CBB2B"); - return; + LOG(ERROR) << "Galileo OSNMA KROOT verification error: Public key is not available"; + return false; } - try + + if (signature.size() != 132) { - pugi::xml_node root = doc.child("signalData"); - pugi::xml_node header = root.child("header"); - pugi::xml_node body = root.child("body"); - - // Accessing data from the header - pugi::xml_node galHeader = header.child("GAL-header"); - pugi::xml_node source = galHeader.child("source").child("GAL-EXT-GOC-SC-GLAd"); - pugi::xml_node destination = galHeader.child("destination").child("GAL-EXT-GOC-SC-GLAd"); - std::string issueDate = galHeader.child("issueDate").text().get(); - std::string signalVersion = galHeader.child("signalVersion").text().get(); - std::string dataVersion = galHeader.child("dataVersion").text().get(); - - LOG(INFO) << "OSNMA Merkletree - Source: " << source.child_value("mission") << " - " << source.child_value("segment") << " - " << source.child_value("element"); - LOG(INFO) << "OSNMA Merkletree - Destination: " << destination.child_value("mission") << " - " << destination.child_value("segment") << " - " << destination.child_value("element"); - LOG(INFO) << "OSNMA Merkletree - Issue Date: " << issueDate; - LOG(INFO) << "OSNMA Merkletree - Signal Version: " << signalVersion; - LOG(INFO) << "OSNMA Merkletree - Data Version: " << dataVersion; - - // Accessing data from the body - pugi::xml_node merkleTree = body.child("MerkleTree"); - - int n = std::stoi(merkleTree.child_value("N")); - std::string hashFunction = merkleTree.child_value("HashFunction"); - - LOG(INFO) << "OSNMA Merkletree - N: " << n; - LOG(INFO) << "OSNMA Merkletree - Hash Function: " << hashFunction; - - for (pugi::xml_node publicKey : merkleTree.children("PublicKey")) - { - int i = std::stoi(publicKey.child_value("i")); - std::string pkid = publicKey.child_value("PKID"); - int lengthInBits = std::stoi(publicKey.child_value("lengthInBits")); - std::string point = publicKey.child_value("point"); - std::string pkType = publicKey.child_value("PKType"); - - LOG(INFO) << "OSNMA Merkletree - Public Key: " << i; - LOG(INFO) << "OSNMA Merkletree - PKID: " << pkid; - LOG(INFO) << "OSNMA Merkletree - Length in Bits: " << lengthInBits; - LOG(INFO) << "OSNMA Merkletree - Point: " << point; - LOG(INFO) << "OSNMA Merkletree - PK Type: " << pkType; - } - for (pugi::xml_node treeNode : merkleTree.children("TreeNode")) - { - int j = std::stoi(treeNode.child_value("j")); - int i = std::stoi(treeNode.child_value("i")); - int lengthInBits = std::stoi(treeNode.child_value("lengthInBits")); - LOG(INFO) << "OSNMA Merkletree - Node length (bits): " << lengthInBits; - std::string x_ji = treeNode.child_value("x_ji"); - LOG(INFO) << "OSNMA Merkletree - Size string (bytes): " << x_ji.size(); - LOG(INFO) << "OSNMA Merkletree - m_" << j << "_" << i << " = " << x_ji; - if (j == 4 && i == 0) - { - d_x_4_0 = convert_from_hex_str(x_ji); - } - if (j == 3 && i == 1) - { - d_x_3_1 = convert_from_hex_str(x_ji); - } - if (j == 2 && i == 1) - { - d_x_2_1 = convert_from_hex_str(x_ji); - } - if (j == 1 && i == 1) - { - d_x_1_1 = convert_from_hex_str(x_ji); - } - if (j == 0 && i == 1) - { - d_x_0_1 = convert_from_hex_str(x_ji); - } - } + LOG(ERROR) << "Invalid signature length for P-521. Expected 132 bytes, got " << signature.size(); + return false; } - catch (const std::exception& e) + + std::vector der_sig; + if (!convert_raw_to_der_ecdsa(signature, der_sig)) { - std::cerr << "Exception raised reading the " << merkleFilePath << " file: " << e.what() << '\n'; - d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); - d_x_3_1 = convert_from_hex_str("84DE3669E6DA551292979E5B8D045787FA967C57CC23638A30237614EDD9171A"); - d_x_2_1 = convert_from_hex_str("DE73D209E4C5BCDC34CD117F2FE40FD08B110009997AD2B3291D3A2CF29943F9"); - d_x_1_1 = convert_from_hex_str("6AAFDE28017BF0744D42819CE40E3A0CDA1ECA3F7A4EA67E134E7AA714C1E843"); - d_x_0_1 = convert_from_hex_str("941BD34EA7DF668B6FC5BE75C1D93464D109BC615CB52C8124847FAFB09CBB2B"); - return; + LOG(ERROR) << "Failed to convert raw ECDSA signature to DER format"; + return false; } - std::cout << "OSNMA Merkle Tree successfully read from file " << merkleFilePath << std::endl; - LOG(INFO) << "OSNMA Merkle Tree successfully read from file " << merkleFilePath; + bool success = false; +#if USE_GNUTLS_FALLBACK + std::vector digest(64); + gnutls_hash_hd_t hash; + int ret = gnutls_hash_init(&hash, GNUTLS_DIG_SHA512); + if (ret != GNUTLS_E_SUCCESS) + { + LOG(ERROR) << "GnuTLS: gnutls_hash_init failed: " << gnutls_strerror(ret); + return false; + } + + gnutls_hash(hash, message.data(), message.size()); + gnutls_hash_deinit(hash, digest.data()); + + gnutls_datum_t digest_data = {digest.data(), static_cast(digest.size())}; + gnutls_datum_t signature_data = {der_sig.data(), static_cast(der_sig.size())}; + + // Verify the ECDSA signature + ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA512, 0, &digest_data, &signature_data); + + if (ret >= 0) + { + LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + success = true; + } + else + { + LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); + } +#else // OpenSSL + // Compute SHA-512 hash of the message + std::vector digest(SHA512_DIGEST_LENGTH); + if (!EVP_Digest(message.data(), message.size(), digest.data(), nullptr, EVP_sha512(), nullptr)) + { + LOG(INFO) << "OpenSSL: EVP_Digest failed"; + return false; + } +#if USE_OPENSSL_3 + // Verify the signature + EVP_PKEY_CTX* pctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); + if (pctx == nullptr) + { + LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_new failed"; + return false; + } + + if (EVP_PKEY_verify_init(pctx) <= 0) + { + LOG(INFO) << "OpenSSL: EVP_PKEY_verify_init failed"; + EVP_PKEY_CTX_free(pctx); + return false; + } + + if (EVP_PKEY_CTX_set_signature_md(pctx, EVP_sha512()) <= 0) + { + LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_set_signature_md failed"; + EVP_PKEY_CTX_free(pctx); + return false; + } + + int verification = EVP_PKEY_verify(pctx, der_sig.data(), der_sig.size(), digest.data(), digest.size()); + EVP_PKEY_CTX_free(pctx); + + if (verification == 1) + { + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + success = true; + } + else if (verification == 0) + { + LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; + } + else + { + LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; + } +#else // OpenSSL 1.x + const unsigned char* sig_ptr = der_sig.data(); + ECDSA_SIG* ecdsa_sig = d2i_ECDSA_SIG(nullptr, &sig_ptr, der_sig.size()); + if (ecdsa_sig == nullptr) + { + LOG(INFO) << "OpenSSL: d2i_ECDSA_SIG failed"; + return false; + } + int verification = ECDSA_do_verify(digest.data(), digest.size(), ecdsa_sig, d_PublicKey); + ECDSA_SIG_free(ecdsa_sig); + if (verification == 1) + { + LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + success = true; + } + else if (verification == 0) + { + LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; + } + else + { + LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; + } +#endif +#endif + return success; +} + + +bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const +{ + if (!have_public_key()) + { + return false; + } + std::ofstream pubKeyFile(pubKeyFilePath, std::ios::binary); + if (!pubKeyFile.is_open()) + { + LOG(INFO) << "Unable to open file: " << pubKeyFilePath; + return false; + } +#if USE_GNUTLS_FALLBACK + gnutls_datum_t pem_data; +#if HAVE_GNUTLS_PUBKEY_EXPORT2 + int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); +#else + size_t output_stata_size; + int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); +#endif + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); + return false; + } + + pubKeyFile.write((const char*)pem_data.data, pem_data.size); + pubKeyFile.close(); + gnutls_free(pem_data.data); +#else // OpenSSL + BIO* bio = BIO_new(BIO_s_mem()); + if (!bio) + { + LOG(INFO) << "OpenSSL: Failed to create BIO"; + return false; + } +#if USE_OPENSSL_3 + if (!PEM_write_bio_PUBKEY(bio, d_PublicKey)) +#else // OpenSSL 1.x + if (!PEM_write_bio_EC_PUBKEY(bio, d_PublicKey)) +#endif + { + LOG(INFO) << "OpenSSL: Failed to write public key to BIO"; + BIO_free(bio); + return false; + } + + char* bio_data; + auto bio_len = BIO_get_mem_data(bio, &bio_data); + if (bio_len <= 0) + { + LOG(INFO) << "OpenSSL: Failed to get BIO data"; + BIO_free(bio); + return false; + } + + pubKeyFile.write(bio_data, bio_len); + pubKeyFile.close(); + BIO_free(bio); +#endif + return true; +} + + +std::vector Gnss_Crypto::getPublicKey() const +{ + if (!have_public_key()) + { + return {}; + } +#if USE_GNUTLS_FALLBACK + gnutls_datum_t pem_data = {nullptr, 0}; + + int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "GnuTLS: Failed to export public key to PEM format."; + return {}; + } + std::vector output(pem_data.data, pem_data.data + pem_data.size); + + // Free the allocated memory by gnutls_pubkey_export2 + gnutls_free(pem_data.data); +#else // OpenSSL + // Create a BIO for the memory buffer + BIO* mem = BIO_new(BIO_s_mem()); + if (!mem) + { + LOG(INFO) << "OpenSSL: Failed to create BIO."; + return {}; + } +#if USE_OPENSSL_3 + if (!PEM_write_bio_PUBKEY(mem, d_PublicKey)) +#else // OpenSSL 1.x + if (!PEM_write_bio_EC_PUBKEY(mem, d_PublicKey)) +#endif + { + BIO_free(mem); + LOG(INFO) << "OpenSSL: Failed to write public key to PEM format."; + return {}; + } + + // Get the length of the data in the BIO + BUF_MEM* mem_ptr; + BIO_get_mem_ptr(mem, &mem_ptr); + + // Copy the data from the BIO to a std::vector + std::vector output(mem_ptr->length); + memcpy(output.data(), mem_ptr->data, mem_ptr->length); + + // Clean up the BIO + BIO_free(mem); +#endif + return output; +} + + +std::vector Gnss_Crypto::getMerkleRoot() const +{ + return d_x_4_0; } @@ -573,6 +829,152 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } +void Gnss_Crypto::set_public_key(const std::vector& publicKey) +{ +#if USE_GNUTLS_FALLBACK + gnutls_pubkey_t pubkey{}; + gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; + gnutls_pubkey_init(&pubkey); + int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); + if (ret != GNUTLS_E_SUCCESS) + { + gnutls_pubkey_deinit(pubkey); + std::cerr << "GnuTLS: error setting the public key" << std::endl; + std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; + LOG(WARNING) << "GnuTLS: error setting the OSNMA public key: " << gnutls_strerror(ret); + return; + } + pubkey_copy(pubkey, &d_PublicKey); + gnutls_pubkey_deinit(pubkey); +#else // OpenSSL + BIO* bio = nullptr; + EVP_PKEY* pkey = nullptr; + bio = BIO_new_mem_buf(const_cast(publicKey.data()), publicKey.size()); + if (!bio) + { + LOG(INFO) << "OpenSSL: Failed to create BIO for key."; + return; + } + + pkey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); + BIO_free(bio); + + if (!pkey) + { + std::cerr << "OpenSSL: error setting the OSNMA public key." << std::endl; + LOG(INFO) << "OpenSSL: error setting the OSNMA public key."; + return; + } +#if USE_OPENSSL_3 + if (!pubkey_copy(pkey, &d_PublicKey)) + { + return; + } +#else + EC_KEY* ec_pkey = EVP_PKEY_get1_EC_KEY(pkey); + if (!pubkey_copy(ec_pkey, &d_PublicKey)) + { + return; + } + EC_KEY_free(ec_pkey); +#endif // OpenSSL 1.x + EVP_PKEY_free(pkey); +#endif + LOG(INFO) << "OSNMA Public Key successfully set up."; +} + + +void Gnss_Crypto::setMerkleRoot(const std::vector& v) +{ + d_x_4_0 = v; +} + + +void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) +{ + pugi::xml_document doc; + pugi::xml_parse_result result = doc.load_file(merkleFilePath.c_str()); + if (!result) + { + // XML file not found + // If it was not the default, maybe it is a configuration error, warn user + if (merkleFilePath != MERKLEFILE_DEFAULT && !merkleFilePath.empty()) + { + LOG(INFO) << "File " << merkleFilePath << " not found"; + } + // fill default values + d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); + return; + } + try + { + pugi::xml_node root = doc.child("signalData"); + pugi::xml_node header = root.child("header"); + pugi::xml_node body = root.child("body"); + + // Accessing data from the header + pugi::xml_node galHeader = header.child("GAL-header"); + pugi::xml_node source = galHeader.child("source").child("GAL-EXT-GOC-SC-GLAd"); + pugi::xml_node destination = galHeader.child("destination").child("GAL-EXT-GOC-SC-GLAd"); + std::string issueDate = galHeader.child("issueDate").text().get(); + std::string signalVersion = galHeader.child("signalVersion").text().get(); + std::string dataVersion = galHeader.child("dataVersion").text().get(); + + LOG(INFO) << "OSNMA Merkletree - Source: " << source.child_value("mission") << " - " << source.child_value("segment") << " - " << source.child_value("element"); + LOG(INFO) << "OSNMA Merkletree - Destination: " << destination.child_value("mission") << " - " << destination.child_value("segment") << " - " << destination.child_value("element"); + LOG(INFO) << "OSNMA Merkletree - Issue Date: " << issueDate; + LOG(INFO) << "OSNMA Merkletree - Signal Version: " << signalVersion; + LOG(INFO) << "OSNMA Merkletree - Data Version: " << dataVersion; + + // Accessing data from the body + pugi::xml_node merkleTree = body.child("MerkleTree"); + + int n = std::stoi(merkleTree.child_value("N")); + std::string hashFunction = merkleTree.child_value("HashFunction"); + + LOG(INFO) << "OSNMA Merkletree - N: " << n; + LOG(INFO) << "OSNMA Merkletree - Hash Function: " << hashFunction; + + for (pugi::xml_node publicKey : merkleTree.children("PublicKey")) + { + int i = std::stoi(publicKey.child_value("i")); + std::string pkid = publicKey.child_value("PKID"); + int lengthInBits = std::stoi(publicKey.child_value("lengthInBits")); + std::string point = publicKey.child_value("point"); + std::string pkType = publicKey.child_value("PKType"); + + LOG(INFO) << "OSNMA Merkletree - Public Key: " << i; + LOG(INFO) << "OSNMA Merkletree - PKID: " << pkid; + LOG(INFO) << "OSNMA Merkletree - Length in Bits: " << lengthInBits; + LOG(INFO) << "OSNMA Merkletree - Point: " << point; + LOG(INFO) << "OSNMA Merkletree - PK Type: " << pkType; + } + for (pugi::xml_node treeNode : merkleTree.children("TreeNode")) + { + int j = std::stoi(treeNode.child_value("j")); + int i = std::stoi(treeNode.child_value("i")); + int lengthInBits = std::stoi(treeNode.child_value("lengthInBits")); + LOG(INFO) << "OSNMA Merkletree - Node length (bits): " << lengthInBits; + std::string x_ji = treeNode.child_value("x_ji"); + LOG(INFO) << "OSNMA Merkletree - Size string (bytes): " << x_ji.size(); + LOG(INFO) << "OSNMA Merkletree - m_" << j << "_" << i << " = " << x_ji; + if (j == 4 && i == 0) + { + d_x_4_0 = convert_from_hex_str(x_ji); + } + } + } + catch (const std::exception& e) + { + std::cerr << "Exception raised reading the " << merkleFilePath << " file: " << e.what() << '\n'; + d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); + return; + } + std::cout << "OSNMA Merkle Tree successfully read from file " << merkleFilePath << std::endl; + LOG(INFO) << "OSNMA Merkle Tree successfully read from file " << merkleFilePath; +} + + void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) { // Open the .pem file @@ -728,317 +1130,6 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) } -bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) const -{ - std::vector digest = this->computeSHA256(message); - if (!have_public_key()) - { - std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; - return false; - } - bool success = false; -#if USE_GNUTLS_FALLBACK -#if HAVE_GNUTLS_SIGN_ECDSA_SHA256 - // Convert signature to DER format - std::vector der_sig; - if (!convert_raw_to_der_ecdsa(signature, der_sig)) - { - std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; - return false; - } - - // Prepare the digest datum - gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; - gnutls_datum_t der_sig_data = {der_sig.data(), static_cast(der_sig.size())}; - - // Verify the DER-encoded signature - int ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA256, 0, &digest_data, &der_sig_data); - success = (ret >= 0); - if (success) - { - LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; - } - else - { - std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; - LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); - } -#endif -#else // OpenSSL -#if USE_OPENSSL_3 - EVP_PKEY_CTX* ctx; - ctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); - bool do_operation = true; - - if (!ctx) - { - do_operation = false; - } - // convert raw signature into DER format - size_t half_size = signature.size() / 2; - std::vector raw_r(signature.begin(), signature.begin() + half_size); - std::vector raw_s(signature.begin() + half_size, signature.end()); - - // Convert raw R and S to BIGNUMs - BIGNUM* r = BN_bin2bn(raw_r.data(), raw_r.size(), nullptr); - BIGNUM* s = BN_bin2bn(raw_s.data(), raw_s.size(), nullptr); - - ECDSA_SIG* sig = ECDSA_SIG_new(); - if (r == nullptr || s == nullptr || sig == nullptr) - { - std::cerr << "Failed to allocate memory for BIGNUMs or ECDSA_SIG" << std::endl; - return false; - } - - if (ECDSA_SIG_set0(sig, r, s) != 1) - { - std::cerr << "Failed to set R and S values in ECDSA_SIG" << std::endl; - ECDSA_SIG_free(sig); // Free the ECDSA_SIG struct as it is no longer needed - return false; - } - - std::vector derSignature; - unsigned char* derSig = nullptr; - int derSigLength = i2d_ECDSA_SIG(sig, &derSig); - - if (derSigLength <= 0) - { - std::cerr << "Failed to convert ECDSA_SIG to DER format" << std::endl; - return false; - } - - derSignature.assign(derSig, derSig + derSigLength); - - if (EVP_PKEY_verify_init(ctx) <= 0) - { - do_operation = false; - } - if (EVP_PKEY_CTX_set_signature_md(ctx, EVP_sha256()) <= 0) - { - do_operation = false; - } - int verification = 0; - if (do_operation) - { - verification = EVP_PKEY_verify(ctx, derSignature.data(), derSignature.size(), digest.data(), digest.size()); - } - EVP_PKEY_CTX_free(ctx); - OPENSSL_free(derSig); - ECDSA_SIG_free(sig); - if (verification == 1) - { - success = true; - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; - } - else - { - unsigned long errCode = ERR_get_error(); - char* err = ERR_error_string(errCode, nullptr); - std::cerr << "OpenSSL: OSNMA message authentication failed: " << err << std::endl; - LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; - } -#else // OpenSSL 1.x - std::vector der_sig; - if (!convert_raw_to_der_ecdsa(signature, der_sig)) - { - std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; - return false; - } - int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, der_sig.data(), static_cast(der_sig.size()), d_PublicKey); - if (verification == 1) - { - success = true; - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; - } - else if (verification == 0) - { - std::cerr << "OpenSSL: invalid signature found when verifying message" << std::endl; - LOG(WARNING) << "OpenSSL: invalid signature found when verifying message"; - } - else - { - std::cerr << "OpenSSL: OSNMA message authentication failed" << std::endl; - LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; - } -#endif -#endif - return success; -} - - -bool Gnss_Crypto::verify_signature_p521(const std::vector& message, const std::vector& signature) const -{ - if (!have_public_key()) - { - std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; - return false; - } - bool success = false; - - // Convert signature to DER format - std::vector der_sig; - if (!convert_raw_to_der_ecdsa(signature, der_sig)) - { - LOG(INFO) << "Failed to convert raw ECDSA signature to DER format"; - return false; - } -#if USE_GNUTLS_FALLBACK - // Compute SHA-512 hash of the message - std::vector digest(64); - gnutls_hash_hd_t hash; - if (gnutls_hash_init(&hash, GNUTLS_DIG_SHA512) != GNUTLS_E_SUCCESS) - { - LOG(INFO) << "OpenSSL: gnutls_hash_init failed"; - return false; - } - gnutls_hash(hash, message.data(), message.size()); - gnutls_hash_deinit(hash, digest.data()); - - gnutls_datum_t digest_data = {const_cast(digest.data()), static_cast(digest.size())}; - gnutls_datum_t signature_data = {const_cast(der_sig.data()), static_cast(der_sig.size())}; - - // Verify the ECDSA signature - int ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA512, 0, &digest_data, &signature_data); - success = (ret >= 0); - if (success) - { - LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; - } - else - { - std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; - LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); - } -#else // OpenSSL - // Compute SHA-512 hash of the message - std::vector digest(SHA512_DIGEST_LENGTH); - if (!EVP_Digest(message.data(), message.size(), digest.data(), nullptr, EVP_sha512(), nullptr)) - { - LOG(INFO) << "OpenSSL: EVP_Digest failed"; - return false; - } -#if USE_OPENSSL_3 - // Verify the signature - EVP_PKEY_CTX* pctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); - if (pctx == nullptr) - { - LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_new failed"; - return false; - } - - if (EVP_PKEY_verify_init(pctx) <= 0) - { - LOG(INFO) << "OpenSSL: EVP_PKEY_verify_init failed"; - EVP_PKEY_CTX_free(pctx); - return false; - } - - if (EVP_PKEY_CTX_set_signature_md(pctx, EVP_sha512()) <= 0) - { - LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_set_signature_md failed"; - EVP_PKEY_CTX_free(pctx); - return false; - } - - int verification = EVP_PKEY_verify(pctx, der_sig.data(), der_sig.size(), digest.data(), digest.size()); - EVP_PKEY_CTX_free(pctx); - - if (verification == 1) - { - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; - success = true; - } - else if (verification == 0) - { - LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; - } - else - { - LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; - } -#else // OpenSSL 1.x - const unsigned char* sig_ptr = der_sig.data(); - ECDSA_SIG* ecdsa_sig = d2i_ECDSA_SIG(nullptr, &sig_ptr, der_sig.size()); - if (ecdsa_sig == nullptr) - { - LOG(INFO) << "OpenSSL: d2i_ECDSA_SIG failed"; - return false; - } - int verification = ECDSA_do_verify(digest.data(), digest.size(), ecdsa_sig, d_PublicKey); - ECDSA_SIG_free(ecdsa_sig); - if (verification == 1) - { - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; - success = true; - } - else if (verification == 0) - { - LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; - } - else - { - LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; - } -#endif -#endif - return success; -} - - -void Gnss_Crypto::set_public_key(const std::vector& publicKey) -{ -#if USE_GNUTLS_FALLBACK - gnutls_pubkey_t pubkey; - gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; - gnutls_pubkey_init(&pubkey); - int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); - if (ret != GNUTLS_E_SUCCESS) - { - gnutls_pubkey_deinit(pubkey); - std::cerr << "GnuTLS: error setting the public key" << std::endl; - std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; - return; - } - pubkey_copy(pubkey, &d_PublicKey); - gnutls_pubkey_deinit(pubkey); -#else // OpenSSL - BIO* bio = nullptr; - EVP_PKEY* pkey = nullptr; - bio = BIO_new_mem_buf(const_cast(publicKey.data()), publicKey.size()); - if (!bio) - { - std::cerr << "Failed to create BIO for key \n"; - return; - } - - pkey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); - BIO_free(bio); - - if (!pkey) - { - std::cerr << "OpenSSL: error setting the OSNMA public key." << std::endl; - LOG(INFO) << "OpenSSL: error setting the OSNMA public key."; - return; - } -#if USE_OPENSSL_3 - if (!pubkey_copy(pkey, &d_PublicKey)) - { - return; - } -#else - EC_KEY* ec_pkey = EVP_PKEY_get1_EC_KEY(pkey); - if (!pubkey_copy(ec_pkey, &d_PublicKey)) - { - return; - } - EC_KEY_free(ec_pkey); -#endif // OpenSSL 1.x - EVP_PKEY_free(pkey); -#endif - LOG(INFO) << "OSNMA Public Key successfully set up."; -} - - bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const { if (raw_signature.size() % 2 != 0) @@ -1087,6 +1178,27 @@ bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signa } +std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) const +{ + std::vector result; + + // Iterate over the input string in pairs + for (size_t i = 0; i < input.length(); i += 2) + { + // Extract two hexadecimal characters from the input string + std::string hexByte = input.substr(i, 2); + + // Convert the hexadecimal string to an integer value + auto value = static_cast(std::stoul(hexByte, nullptr, 16)); + + // Append the value to the result vector + result.push_back(value); + } + + return result; +} + + #if USE_GNUTLS_FALLBACK // GnuTLS-specific functions bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) { @@ -1170,9 +1282,7 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) return true; } - -#else // OpenSSL 1.x - +#else // OpenSSL 1.x bool Gnss_Crypto::pubkey_copy(EC_KEY* src, EC_KEY** dest) { // Open a memory buffer @@ -1216,122 +1326,5 @@ bool Gnss_Crypto::pubkey_copy(EC_KEY* src, EC_KEY** dest) return true; } +#endif // OpenSSL #endif -#endif - - -bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const -{ - if (!have_public_key()) - { - return false; - } - std::ofstream pubKeyFile(pubKeyFilePath, std::ios::binary); - if (!pubKeyFile.is_open()) - { - LOG(INFO) << "Unable to open file: " << pubKeyFilePath; - return false; - } -#if USE_GNUTLS_FALLBACK - gnutls_datum_t pem_data; -#if HAVE_GNUTLS_PUBKEY_EXPORT2 - int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); -#else - size_t output_stata_size; - int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); -#endif - if (ret != GNUTLS_E_SUCCESS) - { - LOG(INFO) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); - return false; - } - - pubKeyFile.write((const char*)pem_data.data, pem_data.size); - pubKeyFile.close(); - gnutls_free(pem_data.data); -#else // OpenSSL - BIO* bio = BIO_new(BIO_s_mem()); - if (!bio) - { - LOG(INFO) << "OpenSSL: Failed to create BIO"; - return false; - } -#if USE_OPENSSL_3 - if (!PEM_write_bio_PUBKEY(bio, d_PublicKey)) -#else // OpenSSL 1.x - if (!PEM_write_bio_EC_PUBKEY(bio, d_PublicKey)) -#endif - { - LOG(INFO) << "OpenSSL: Failed to write public key to BIO"; - BIO_free(bio); - return false; - } - - char* bio_data; - auto bio_len = BIO_get_mem_data(bio, &bio_data); - if (bio_len <= 0) - { - LOG(INFO) << "OpenSSL: Failed to get BIO data"; - BIO_free(bio); - return false; - } - - pubKeyFile.write(bio_data, bio_len); - pubKeyFile.close(); - BIO_free(bio); -#endif - return true; -} - - -std::vector Gnss_Crypto::getPublicKey() const -{ - if (!have_public_key()) - { - return {}; - } -#if USE_GNUTLS_FALLBACK - gnutls_datum_t pem_data = {nullptr, 0}; - - int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); - if (ret != GNUTLS_E_SUCCESS) - { - LOG(INFO) << "GnuTLS: Failed to export public key to PEM format."; - return {}; - } - std::vector output(pem_data.data, pem_data.data + pem_data.size); - - // Free the allocated memory by gnutls_pubkey_export2 - gnutls_free(pem_data.data); -#else // OpenSSL - // Create a BIO for the memory buffer - BIO* mem = BIO_new(BIO_s_mem()); - if (!mem) - { - LOG(INFO) << "OpenSSL: Failed to create BIO."; - return {}; - } -#if USE_OPENSSL_3 - if (!PEM_write_bio_PUBKEY(mem, d_PublicKey)) -#else // OpenSSL 1.x - if (!PEM_write_bio_EC_PUBKEY(mem, d_PublicKey)) -#endif - { - BIO_free(mem); - LOG(INFO) << "OpenSSL: Failed to write public key to PEM format."; - return {}; - } - - // Get the length of the data in the BIO - BUF_MEM* mem_ptr; - BIO_get_mem_ptr(mem, &mem_ptr); - - // Copy the data from the BIO to a std::vector - std::vector output(mem_ptr->length); - memcpy(output.data(), mem_ptr->data, mem_ptr->length); - - // Clean up the BIO - BIO_free(mem); -#endif - return output; -} \ No newline at end of file diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index bd0c2a64d..117d5e0a7 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -34,33 +34,43 @@ /** \addtogroup System_Parameters * \{ */ +/*! + * \brief Class implementing cryptographic functions + * for Navigation Message Authentication + */ class Gnss_Crypto { public: - Gnss_Crypto(); - Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); - ~Gnss_Crypto(); + Gnss_Crypto(); //!< Default constructor - void set_public_key(const std::vector& publickey); - bool have_public_key() const; - bool verify_signature(const std::vector& message, const std::vector& signature) const; - bool verify_signature_p521(const std::vector& message, const std::vector& signature) const; + /*! + * Constructor with a .crt or .pem file for the ECDSA Public Key + * and a XML file for the Merkle Tree root. + * Files can be downloaded by registering at https://www.gsc-europa.eu/ + */ + Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); + ~Gnss_Crypto(); //!< Default destructor + + bool have_public_key() const; //!< Returns true if the ECDSA Public Key is already loaded + + bool verify_signature(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P256 signature (message in hex, signature in raw format) + bool verify_signature_ecdsa_p521(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P521 signature (message in hex, signature in raw format) + + /*! + * Stores the ECDSA Public Key in a .pem file, which is read in a following run if the .crt file is not found + */ bool store_public_key(const std::string& pubKeyFilePath) const; - std::vector getPublicKey() const; - std::vector computeSHA256(const std::vector& input) const; - std::vector computeSHA3_256(const std::vector& input) const; - std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; - std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; + std::vector getPublicKey() const; //!< Gets the ECDSA Public Key in PEM format + std::vector getMerkleRoot() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) - inline std::vector getMerkleRoot() const - { - return d_x_4_0; - } - inline void setMerkleRoot(const std::vector& v) - { - d_x_4_0 = v; - } + std::vector computeSHA256(const std::vector& input) const; //!< Computes SHA-256 hash + std::vector computeSHA3_256(const std::vector& input) const; //!< Computes SHA3-256 hash + std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; //!< Computes HMAC-SHA-256 message authentication code + std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; //!< Computes CMAC-AES message authentication code + + void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey in PEM format) + void setMerkleRoot(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) private: void read_merkle_xml(const std::string& merkleFilePath); @@ -81,10 +91,6 @@ private: #endif #endif std::vector d_x_4_0; - std::vector d_x_3_1; - std::vector d_x_2_1; - std::vector d_x_1_1; - std::vector d_x_0_1; }; /** \} */ diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 994256da1..bbe01d905 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -1,3 +1,21 @@ +/*! + * \file gnss_crypto_test.cc + * \brief Tests for the Gnss_Crypto class. + * \author Carles Fernandez, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + #include "gnss_crypto.h" #include "gnss_sdr_filesystem.h" #include "gnss_sdr_make_unique.h" @@ -10,119 +28,26 @@ class GnssCryptoTest : public ::testing::Test }; -TEST(GnssCryptoTest, TestComputeSHA_256) -{ - auto d_crypto = std::make_unique(); - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world - - std::vector expected_output = { - 0x18, 0x94, 0xA1, 0x9C, 0x85, 0xBA, 0x15, 0x3A, 0xCB, 0xF7, - 0x43, 0xAC, 0x4E, 0x43, 0xFC, 0x00, 0x4C, 0x89, 0x16, 0x04, 0xB2, - 0x6F, 0x8C, 0x69, 0xE1, 0xE8, 0x3E, 0xA2, 0xAF, 0xC7, 0xC4, 0x8F}; - - std::vector output = d_crypto->computeSHA256(message); - - ASSERT_EQ(expected_output, output); -} - - -TEST(GnssCryptoTest, TestComputeSHA3_256) -{ - auto d_crypto = std::make_unique(); - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world - - std::vector expected_output = { - 0xCC, 0xB8, 0xF9, 0x23, 0x5F, 0x4A, 0x93, 0x2C, 0xA0, 0xAB, - 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, - 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; - - std::vector output = d_crypto->computeSHA3_256(message); - - ASSERT_EQ(expected_output, output); -} - - -TEST(GnssCryptoTest, VerifySignature) -{ - auto d_crypto = std::make_unique(); - - // RG example - import crt certificate - result: FAIL - std::vector message = {0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; - std::vector signature = {0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - std::vector publicKey{// PEM format - 1000 bits - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, - 0x0A, - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; - - d_crypto->set_public_key(publicKey); - bool result = d_crypto->verify_signature(message, signature); - - ASSERT_TRUE(result); -} - - -TEST(GnssCryptoTest, VerifySignatureP521) -{ - std::unique_ptr d_crypto = std::make_unique(); - - // Message to be verified - std::vector message = { - 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 // "Hello World" - }; - - // Public key in PEM format - std::vector publicKey = { - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a, - 0x4d, 0x49, 0x47, 0x62, 0x4d, 0x42, 0x41, 0x47, 0x42, 0x79, 0x71, 0x47, 0x53, 0x4d, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, - 0x6a, 0x41, 0x34, 0x47, 0x47, 0x41, 0x41, 0x51, 0x41, 0x6f, 0x35, 0x76, 0x77, 0x66, 0x6e, 0x47, 0x57, 0x47, 0x33, 0x44, 0x63, 0x59, 0x75, 0x2b, 0x2f, 0x61, 0x58, - 0x47, 0x32, 0x7a, 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0a, 0x48, 0x36, 0x4c, 0x76, 0x4f, 0x4c, 0x76, 0x49, 0x51, 0x6a, 0x61, 0x2b, 0x6a, 0x74, 0x57, 0x73, - 0x70, 0x4f, 0x38, 0x37, 0x6f, 0x50, 0x32, 0x4e, 0x6d, 0x72, 0x34, 0x6e, 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4d, 0x37, 0x6a, 0x49, 0x69, 0x46, 0x38, 0x47, - 0x70, 0x6b, 0x75, 0x58, 0x6a, 0x75, 0x4e, 0x7a, 0x34, 0x72, 0x61, 0x56, 0x4f, 0x65, 0x49, 0x4d, 0x42, 0x77, 0x45, 0x2b, 0x61, 0x0a, 0x30, 0x4c, 0x76, 0x7a, 0x37, - 0x69, 0x54, 0x4d, 0x5a, 0x46, 0x41, 0x41, 0x51, 0x64, 0x2b, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, - 0x5a, 0x35, 0x77, 0x30, 0x38, 0x51, 0x4f, 0x43, 0x58, 0x2f, 0x75, 0x46, 0x65, 0x2b, 0x30, 0x78, 0x52, 0x78, 0x4c, 0x64, 0x2f, 0x33, 0x36, 0x42, 0x4e, 0x74, 0x63, - 0x74, 0x69, 0x2f, 0x45, 0x4c, 0x0a, 0x4b, 0x31, 0x35, 0x67, 0x2b, 0x4b, 0x32, 0x71, 0x67, 0x2f, 0x6c, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4d, 0x2b, 0x51, 0x3d, 0x0a, - 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4c, 0x49, 0x43, 0x20, 0x4b, 0x45, 0x59, 0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x0a}; - - // ECDSA P-521 signature - std::vector signature = { - 0x01, 0x7b, 0x59, 0xac, 0x3a, 0x03, 0x5c, 0xb4, 0x07, 0xcd, 0xc1, 0xeb, 0xbe, 0xe5, 0xa6, 0xcb, - 0xda, 0x0a, 0xff, 0x4d, 0x38, 0x61, 0x16, 0x0f, 0xb3, 0x77, 0xe5, 0x8a, 0xdc, 0xf3, 0xfd, 0x79, - 0x38, 0x1e, 0xe8, 0x08, 0x3d, 0x5d, 0xbc, 0xc2, 0x80, 0x6e, 0xe9, 0x2b, 0xc3, 0xef, 0x07, 0x3d, - 0x0c, 0x82, 0x4c, 0x9b, 0x7a, 0x5c, 0x2e, 0xd5, 0x46, 0xbd, 0x22, 0x21, 0x13, 0x8a, 0xb2, 0xca, - 0x96, 0x3d, 0x01, 0xba, 0x2a, 0xc4, 0x3f, 0xdb, 0x66, 0x3c, 0x40, 0x26, 0xd9, 0xbc, 0x26, 0xd5, 0x57, 0xd4, - 0xbd, 0x15, 0x16, 0x88, 0x21, 0x3b, 0xaa, 0x07, 0x89, 0xef, 0x29, 0x8f, 0x2f, 0x85, 0x76, 0x58, - 0x9d, 0xca, 0x00, 0xcc, 0xc8, 0x30, 0x88, 0x31, 0x99, 0xc1, 0x94, 0xb9, 0xaf, 0x91, 0xdc, 0xc4, - 0x6f, 0x19, 0x2b, 0x12, 0xa2, 0x82, 0xa5, 0x66, 0x5e, 0x4b, 0xbb, 0xdf, 0x65, 0x81, 0x52, 0x14, - 0x01, 0xd7}; - - d_crypto->set_public_key(publicKey); - bool result = d_crypto->verify_signature_p521(message, signature); - ASSERT_TRUE(result); - - std::vector wrong_signature = signature; - wrong_signature[1] = 1; - bool result2 = d_crypto->verify_signature_p521(message, wrong_signature); - ASSERT_TRUE(!result2); -} - - TEST(GnssCryptoTest, VerifyPubKeyImport) { auto d_crypto = std::make_unique(); - std::vector publicKey{// PEM - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - 0x4D, 0x46, - 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, - 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, - 0x73, 0x66, 0x78, 0x2F, 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, - 0x48, 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, 0x69, 0x79, - 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - 0x2D, 0x2D, 0x2D, 0x0A}; + // PEM format + std::vector publicKey = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, + 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, + 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, + 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, + 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, + 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, + 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, 0x73, 0x66, 0x78, 0x2F, + 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, + 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, 0x48, + 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, + 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, + 0x69, 0x79, 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, + 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, + 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; d_crypto->set_public_key(publicKey); @@ -137,14 +62,22 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) const std::string f1("./osnma_test_file1.pem"); const std::string f2("./osnma_test_file2.pem"); - std::vector publicKey{ - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, - 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, - 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, - 0x46, 0x6B, 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, 0x2B, 0x37, - 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, - 0x4C, 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, 0x3D, 0x3D, 0x0A, - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + // PEM format + std::vector publicKey = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, + 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, + 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, + 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, + 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, + 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, + 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, 0x73, 0x66, 0x78, 0x2F, + 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, + 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, 0x48, + 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, + 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, + 0x69, 0x79, 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, + 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, + 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; d_crypto->set_public_key(publicKey); bool result = d_crypto->store_public_key(f1); @@ -172,6 +105,40 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) } +TEST(GnssCryptoTest, TestComputeSHA_256) +{ + auto d_crypto = std::make_unique(); + std::vector message{ + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world + + std::vector expected_output = { + 0x18, 0x94, 0xA1, 0x9C, 0x85, 0xBA, 0x15, 0x3A, 0xCB, 0xF7, + 0x43, 0xAC, 0x4E, 0x43, 0xFC, 0x00, 0x4C, 0x89, 0x16, 0x04, 0xB2, + 0x6F, 0x8C, 0x69, 0xE1, 0xE8, 0x3E, 0xA2, 0xAF, 0xC7, 0xC4, 0x8F}; + + std::vector output = d_crypto->computeSHA256(message); + + ASSERT_EQ(expected_output, output); +} + + +TEST(GnssCryptoTest, TestComputeSHA3_256) +{ + auto d_crypto = std::make_unique(); + std::vector message{ + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world + + std::vector expected_output = { + 0xCC, 0xB8, 0xF9, 0x23, 0x5F, 0x4A, 0x93, 0x2C, 0xA0, 0xAB, + 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, + 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; + + std::vector output = d_crypto->computeSHA3_256(message); + + ASSERT_EQ(expected_output, output); +} + + // Unit test for computeHMAC_SHA_256 function. TEST(GnssCryptoTest, TestComputeHMACSHA256) { @@ -183,7 +150,9 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256) 0xEB, 0x62, 0x3E, 0x95, 0x6B, 0x2B, 0xCE, 0xA3, 0xB4, 0xD4, 0xDB, 0x31, 0xEE, 0x96, 0xAB, 0xFA}; - std::vector message{0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world con 0x0A + std::vector message{ + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // Hello world + std::vector expected_output = { 0xC3, 0x51, 0xF6, 0xFD, 0xDD, 0xC9, 0x8B, 0x41, 0xD6, 0xF4, 0x77, 0x6D, 0xAC, 0xE8, 0xE0, 0x14, @@ -201,21 +170,29 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) // key and message generated from RG A.6.5.1 auto d_crypto = std::make_unique(); - std::vector key = {// RG K4 @ 345690 + // RG K4 @ 345690 + std::vector key = { 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; - std::vector message{// m0 - 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, - 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, - 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, - 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, - 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00}; + // m0 + std::vector message = { + 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, + 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, + 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, + 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, + 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, + 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, + 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, + 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, + 0xF7, 0xFC, 0x00}; std::vector expected_output = { 0xE3, 0x7B, 0xC4, 0xF8, 0x58, 0xAE, 0x1E, 0x5C, - 0xFD, 0xC4, 0x6F, 0x05, 0x4B, 0x1F, 0x47, 0xB9, 0xD2, 0xEA, 0x61, 0xE1, - 0xEF, 0x09, 0x11, 0x5C, 0xFE, 0x70, 0x68, 0x52, 0xBF, 0xF2, 0x3A, 0x83}; + 0xFD, 0xC4, 0x6F, 0x05, 0x4B, 0x1F, 0x47, 0xB9, + 0xD2, 0xEA, 0x61, 0xE1, 0xEF, 0x09, 0x11, 0x5C, + 0xFE, 0x70, 0x68, 0x52, 0xBF, 0xF2, 0x3A, 0x83}; std::vector output = d_crypto->computeHMAC_SHA_256(key, message); @@ -228,19 +205,22 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) // key and message generated from RG A.6.5.2 auto d_crypto = std::make_unique(); - std::vector key = {// RG K4 @ 345690 + // RG K4 @ 345690 + std::vector key = { 0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; - std::vector message{ + std::vector message = { 0x02, 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x03, 0xBF, - 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x44, 0x92, 0x38, - 0x22, 0x78, 0x97, 0xFD, 0xEF, 0xF9, 0x30, 0x40}; + 0xFF, 0xFF, 0xFF, 0xC0, 0x00, 0x00, 0x44, 0x92, + 0x38, 0x22, 0x78, 0x97, 0xFD, 0xEF, 0xF9, 0x30, + 0x40}; std::vector expected_output = { - 0x7B, 0xB2, 0x38, 0xC8, 0x83, 0xC0, 0x6A, 0x2B, 0x50, 0x8F, - 0xE6, 0x3F, 0xB7, 0xF4, 0xF5, 0x4D, 0x44, 0xAB, 0xEE, 0x4D, - 0xCE, 0xB9, 0x3D, 0xCF, 0x65, 0xCB, 0x3A, 0x5B, 0x81, 0x4A, 0x34, 0xE9}; + 0x7B, 0xB2, 0x38, 0xC8, 0x83, 0xC0, 0x6A, 0x2B, + 0x50, 0x8F, 0xE6, 0x3F, 0xB7, 0xF4, 0xF5, 0x4D, + 0x44, 0xAB, 0xEE, 0x4D, 0xCE, 0xB9, 0x3D, 0xCF, + 0x65, 0xCB, 0x3A, 0x5B, 0x81, 0x4A, 0x34, 0xE9}; std::vector output = d_crypto->computeHMAC_SHA_256(key, message); @@ -268,4 +248,119 @@ TEST(GnssCryptoTest, TestComputeCMAC_AES) std::vector output = d_crypto->computeCMAC_AES(key, message); ASSERT_EQ(expected_output, output); -} \ No newline at end of file +} + + +TEST(GnssCryptoTest, VerifySignature) +{ + auto d_crypto = std::make_unique(); + + // RG example - import crt certificate + std::vector message = { + 0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, + 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, + 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; + + // ECDSA P-256 signature, raw format + std::vector signature = { + 0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, + 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, + 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, + 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, + 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, + 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, + 0x28, 0xC1, 0x77, 0xFB}; + + // PEM format + std::vector publicKey = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, + 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, + 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, + 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, + 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, + 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, + 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, + 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, + 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, + 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, + 0x2B, 0x37, 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, + 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, + 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, + 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, + 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, + 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, + 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, + 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + + d_crypto->set_public_key(publicKey); + bool result = d_crypto->verify_signature(message, signature); + ASSERT_TRUE(result); + + std::vector wrong_signature = signature; + wrong_signature[1] = 1; + bool result2 = d_crypto->verify_signature(message, wrong_signature); + ASSERT_TRUE(!result2); +} + + +TEST(GnssCryptoTest, VerifySignatureP521) +{ + std::unique_ptr d_crypto = std::make_unique(); + + // Message to be verified + std::vector message = { + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 // "Hello World" + }; + + // Public key in PEM format + std::vector publicKey = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, + 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, + 0x2D, 0x2D, 0x0A, 0x4D, 0x49, 0x47, 0x62, 0x4D, 0x42, 0x41, 0x47, 0x42, + 0x79, 0x71, 0x47, 0x53, 0x4D, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, + 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, 0x6A, 0x41, 0x34, 0x47, 0x47, 0x41, + 0x41, 0x51, 0x41, 0x6F, 0x35, 0x76, 0x77, 0x66, 0x6E, 0x47, 0x57, 0x47, + 0x33, 0x44, 0x63, 0x59, 0x75, 0x2B, 0x2F, 0x61, 0x58, 0x47, 0x32, 0x7A, + 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0A, 0x48, 0x36, 0x4C, 0x76, + 0x4F, 0x4C, 0x76, 0x49, 0x51, 0x6A, 0x61, 0x2B, 0x6A, 0x74, 0x57, 0x73, + 0x70, 0x4F, 0x38, 0x37, 0x6F, 0x50, 0x32, 0x4E, 0x6D, 0x72, 0x34, 0x6E, + 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4D, 0x37, 0x6A, 0x49, 0x69, + 0x46, 0x38, 0x47, 0x70, 0x6B, 0x75, 0x58, 0x6A, 0x75, 0x4E, 0x7A, 0x34, + 0x72, 0x61, 0x56, 0x4F, 0x65, 0x49, 0x4D, 0x42, 0x77, 0x45, 0x2B, 0x61, + 0x0A, 0x30, 0x4C, 0x76, 0x7A, 0x37, 0x69, 0x54, 0x4D, 0x5A, 0x46, 0x41, + 0x41, 0x51, 0x64, 0x2B, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, + 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, 0x5A, 0x35, 0x77, + 0x30, 0x38, 0x51, 0x4F, 0x43, 0x58, 0x2F, 0x75, 0x46, 0x65, 0x2B, 0x30, + 0x78, 0x52, 0x78, 0x4C, 0x64, 0x2F, 0x33, 0x36, 0x42, 0x4E, 0x74, 0x63, + 0x74, 0x69, 0x2F, 0x45, 0x4C, 0x0A, 0x4B, 0x31, 0x35, 0x67, 0x2B, 0x4B, + 0x32, 0x71, 0x67, 0x2F, 0x6C, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4D, 0x2B, + 0x51, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, + 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x0A}; + + // ECDSA P-521 signature, raw format + std::vector signature = { + 0x01, 0x7B, 0x59, 0xAC, 0x3A, 0x03, 0x5C, 0xB4, 0x07, 0xCD, + 0xC1, 0xEB, 0xBE, 0xE5, 0xA6, 0xCB, 0xDA, 0x0A, 0xFF, 0x4D, + 0x38, 0x61, 0x16, 0x0F, 0xB3, 0x77, 0xE5, 0x8A, 0xDC, 0xF3, + 0xFD, 0x79, 0x38, 0x1E, 0xE8, 0x08, 0x3D, 0x5D, 0xBC, 0xC2, + 0x80, 0x6E, 0xE9, 0x2B, 0xC3, 0xEF, 0x07, 0x3D, 0x0C, 0x82, + 0x4C, 0x9B, 0x7A, 0x5C, 0x2E, 0xD5, 0x46, 0xBD, 0x22, 0x21, + 0x13, 0x8A, 0xB2, 0xCA, 0x96, 0x3D, 0x01, 0xBA, 0x2A, 0xC4, + 0x3F, 0xDB, 0x66, 0x3C, 0x40, 0x26, 0xD9, 0xBC, 0x26, 0xD5, + 0x57, 0xD4, 0xBD, 0x15, 0x16, 0x88, 0x21, 0x3B, 0xAA, 0x07, + 0x89, 0xEF, 0x29, 0x8F, 0x2F, 0x85, 0x76, 0x58, 0x9D, 0xCA, + 0x00, 0xCC, 0xC8, 0x30, 0x88, 0x31, 0x99, 0xC1, 0x94, 0xB9, + 0xAF, 0x91, 0xDC, 0xC4, 0x6F, 0x19, 0x2B, 0x12, 0xA2, 0x82, + 0xA5, 0x66, 0x5E, 0x4B, 0xBB, 0xDF, 0x65, 0x81, 0x52, 0x14, + 0x01, 0xD7}; + + d_crypto->set_public_key(publicKey); + bool result = d_crypto->verify_signature_ecdsa_p521(message, signature); + ASSERT_TRUE(result); + + std::vector wrong_signature = signature; + wrong_signature[1] = 1; + bool result2 = d_crypto->verify_signature_ecdsa_p521(message, wrong_signature); + ASSERT_TRUE(!result2); +} From cb0c0d02fb72ce8d42f2167e621c7c981862f591 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 18 Jul 2024 08:43:03 +0200 Subject: [PATCH 243/499] Fix ECDSA P-521 in GnuTLS --- src/core/system_parameters/gnss_crypto.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 7b1d837e0..0e98280cf 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -309,7 +309,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag gnutls_datum_t signature_data = {der_sig.data(), static_cast(der_sig.size())}; // Verify the ECDSA signature - ret = gnutls_pubkey_verify_data2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA512, 0, &digest_data, &signature_data); + ret = gnutls_pubkey_verify_hash2(d_PublicKey, GNUTLS_SIGN_ECDSA_SHA512, 0, &digest_data, &signature_data); if (ret >= 0) { From d6871931565836b683fcda757e7f266384e63804 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 18 Jul 2024 10:49:52 +0200 Subject: [PATCH 244/499] Improve consistency of public API member function names in Gnss_Crypto --- src/core/libs/osnma_msg_receiver.cc | 28 +- src/core/system_parameters/gnss_crypto.cc | 260 +++++++++--------- src/core/system_parameters/gnss_crypto.h | 20 +- .../osnma/gnss_crypto_test.cc | 20 +- .../osnma/osnma_msg_receiver_test.cc | 2 +- 5 files changed, 165 insertions(+), 165 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 43e62a738..293058b26 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -457,11 +457,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg std::vector hash; if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. { - hash = d_crypto->computeSHA256(MSG); + hash = d_crypto->compute_SHA_256(MSG); } else if (d_osnma_data.d_dsm_kroot_message.hf == 2) { - hash = d_crypto->computeSHA3_256(MSG); + hash = d_crypto->compute_SHA3_256(MSG); } else { @@ -483,7 +483,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; local_time_verification(osnma_msg); - d_kroot_verified = d_crypto->verify_signature(message, d_osnma_data.d_dsm_kroot_message.ds); + d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); if (d_kroot_verified) { std::cout << "Galileo OSNMA: KROOT authentication successful!" << std::endl; @@ -1040,7 +1040,7 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) computed_merkle_root = compute_merke_root(message, base_leaf); - if (computed_merkle_root == d_crypto->getMerkleRoot()) + if (computed_merkle_root == d_crypto->get_merkle_root()) { LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: SUCCESS!." << std::endl; return true; @@ -1053,7 +1053,7 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) } std::vector osnma_msg_receiver::compute_merke_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const { - std::vector x_next, x_current = d_crypto->computeSHA256(m_i); + std::vector x_next, x_current = d_crypto->compute_SHA_256(m_i); for (size_t i = 0; i < 4; i++) { x_next.clear(); @@ -1073,7 +1073,7 @@ std::vector osnma_msg_receiver::compute_merke_root(const DSM_PKR_messag } // Compute the next node. - x_current = d_crypto->computeSHA256(x_next); + x_current = d_crypto->compute_SHA_256(x_next); } return x_current; } @@ -1116,11 +1116,11 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + mac = d_crypto->compute_HMAC_SHA_256(applicable_key, m); } else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { - mac = d_crypto->computeCMAC_AES(applicable_key, m); + mac = d_crypto->compute_CMAC_AES(applicable_key, m); } // truncate the computed mac: trunc(l_t, mac(K,m)) Eq. 23 ICD @@ -1484,11 +1484,11 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + mac = d_crypto->compute_HMAC_SHA_256(applicable_key, m); } else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { - mac = d_crypto->computeCMAC_AES(applicable_key, m); + mac = d_crypto->compute_CMAC_AES(applicable_key, m); } // Truncate the twelve MSBits and compare with received MACSEQ uint16_t mac_msb = 0; @@ -1598,11 +1598,11 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede std::vector hash; if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. { - hash = d_crypto->computeSHA256(msg); + hash = d_crypto->compute_SHA_256(msg); } else if (d_osnma_data.d_dsm_kroot_message.hf == 2) { - hash = d_crypto->computeSHA3_256(msg); + hash = d_crypto->compute_SHA3_256(msg); } else { @@ -1729,11 +1729,11 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ std::vector mac; if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { - mac = d_crypto->computeHMAC_SHA_256(applicable_key, m); + mac = d_crypto->compute_HMAC_SHA_256(applicable_key, m); } else if (d_osnma_data.d_dsm_kroot_message.mf == 1) // C: CMAC-AES { - mac = d_crypto->computeCMAC_AES(applicable_key, m); + mac = d_crypto->compute_CMAC_AES(applicable_key, m); } // Truncate the twelve MSBits and compare with received MACSEQ uint16_t mac_msb = 0; diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 0e98280cf..289b7e17f 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -133,9 +133,73 @@ bool Gnss_Crypto::have_public_key() const } -bool Gnss_Crypto::verify_signature(const std::vector& message, const std::vector& signature) const +bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const { - std::vector digest = this->computeSHA256(message); + if (!have_public_key()) + { + return false; + } + std::ofstream pubKeyFile(pubKeyFilePath, std::ios::binary); + if (!pubKeyFile.is_open()) + { + LOG(INFO) << "Unable to open file: " << pubKeyFilePath; + return false; + } +#if USE_GNUTLS_FALLBACK + gnutls_datum_t pem_data; +#if HAVE_GNUTLS_PUBKEY_EXPORT2 + int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); +#else + size_t output_stata_size; + int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); +#endif + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); + return false; + } + + pubKeyFile.write((const char*)pem_data.data, pem_data.size); + pubKeyFile.close(); + gnutls_free(pem_data.data); +#else // OpenSSL + BIO* bio = BIO_new(BIO_s_mem()); + if (!bio) + { + LOG(INFO) << "OpenSSL: Failed to create BIO"; + return false; + } +#if USE_OPENSSL_3 + if (!PEM_write_bio_PUBKEY(bio, d_PublicKey)) +#else // OpenSSL 1.x + if (!PEM_write_bio_EC_PUBKEY(bio, d_PublicKey)) +#endif + { + LOG(INFO) << "OpenSSL: Failed to write public key to BIO"; + BIO_free(bio); + return false; + } + + char* bio_data; + auto bio_len = BIO_get_mem_data(bio, &bio_data); + if (bio_len <= 0) + { + LOG(INFO) << "OpenSSL: Failed to get BIO data"; + BIO_free(bio); + return false; + } + + pubKeyFile.write(bio_data, bio_len); + pubKeyFile.close(); + BIO_free(bio); +#endif + return true; +} + + +bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const +{ + std::vector digest = this->compute_SHA_256(message); if (!have_public_key()) { std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; @@ -396,130 +460,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag } -bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const -{ - if (!have_public_key()) - { - return false; - } - std::ofstream pubKeyFile(pubKeyFilePath, std::ios::binary); - if (!pubKeyFile.is_open()) - { - LOG(INFO) << "Unable to open file: " << pubKeyFilePath; - return false; - } -#if USE_GNUTLS_FALLBACK - gnutls_datum_t pem_data; -#if HAVE_GNUTLS_PUBKEY_EXPORT2 - int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); -#else - size_t output_stata_size; - int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); -#endif - if (ret != GNUTLS_E_SUCCESS) - { - LOG(INFO) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); - return false; - } - - pubKeyFile.write((const char*)pem_data.data, pem_data.size); - pubKeyFile.close(); - gnutls_free(pem_data.data); -#else // OpenSSL - BIO* bio = BIO_new(BIO_s_mem()); - if (!bio) - { - LOG(INFO) << "OpenSSL: Failed to create BIO"; - return false; - } -#if USE_OPENSSL_3 - if (!PEM_write_bio_PUBKEY(bio, d_PublicKey)) -#else // OpenSSL 1.x - if (!PEM_write_bio_EC_PUBKEY(bio, d_PublicKey)) -#endif - { - LOG(INFO) << "OpenSSL: Failed to write public key to BIO"; - BIO_free(bio); - return false; - } - - char* bio_data; - auto bio_len = BIO_get_mem_data(bio, &bio_data); - if (bio_len <= 0) - { - LOG(INFO) << "OpenSSL: Failed to get BIO data"; - BIO_free(bio); - return false; - } - - pubKeyFile.write(bio_data, bio_len); - pubKeyFile.close(); - BIO_free(bio); -#endif - return true; -} - - -std::vector Gnss_Crypto::getPublicKey() const -{ - if (!have_public_key()) - { - return {}; - } -#if USE_GNUTLS_FALLBACK - gnutls_datum_t pem_data = {nullptr, 0}; - - int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); - if (ret != GNUTLS_E_SUCCESS) - { - LOG(INFO) << "GnuTLS: Failed to export public key to PEM format."; - return {}; - } - std::vector output(pem_data.data, pem_data.data + pem_data.size); - - // Free the allocated memory by gnutls_pubkey_export2 - gnutls_free(pem_data.data); -#else // OpenSSL - // Create a BIO for the memory buffer - BIO* mem = BIO_new(BIO_s_mem()); - if (!mem) - { - LOG(INFO) << "OpenSSL: Failed to create BIO."; - return {}; - } -#if USE_OPENSSL_3 - if (!PEM_write_bio_PUBKEY(mem, d_PublicKey)) -#else // OpenSSL 1.x - if (!PEM_write_bio_EC_PUBKEY(mem, d_PublicKey)) -#endif - { - BIO_free(mem); - LOG(INFO) << "OpenSSL: Failed to write public key to PEM format."; - return {}; - } - - // Get the length of the data in the BIO - BUF_MEM* mem_ptr; - BIO_get_mem_ptr(mem, &mem_ptr); - - // Copy the data from the BIO to a std::vector - std::vector output(mem_ptr->length); - memcpy(output.data(), mem_ptr->data, mem_ptr->length); - - // Clean up the BIO - BIO_free(mem); -#endif - return output; -} - - -std::vector Gnss_Crypto::getMerkleRoot() const -{ - return d_x_4_0; -} - - -std::vector Gnss_Crypto::computeSHA256(const std::vector& input) const +std::vector Gnss_Crypto::compute_SHA_256(const std::vector& input) const { std::vector output(32); // SHA256 hash size #if USE_GNUTLS_FALLBACK @@ -564,7 +505,7 @@ std::vector Gnss_Crypto::computeSHA256(const std::vector& inpu } -std::vector Gnss_Crypto::computeSHA3_256(const std::vector& input) const +std::vector Gnss_Crypto::compute_SHA3_256(const std::vector& input) const { std::vector output(32); // SHA256 hash size #if USE_GNUTLS_FALLBACK @@ -598,7 +539,7 @@ std::vector Gnss_Crypto::computeSHA3_256(const std::vector& in } -std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const +std::vector Gnss_Crypto::compute_HMAC_SHA_256(const std::vector& key, const std::vector& input) const { std::vector output(32); #if USE_GNUTLS_FALLBACK @@ -686,7 +627,7 @@ std::vector Gnss_Crypto::computeHMAC_SHA_256(const std::vector } -std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& key, const std::vector& input) const +std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& key, const std::vector& input) const { std::vector output(16); #if USE_GNUTLS_FALLBACK @@ -829,6 +770,65 @@ std::vector Gnss_Crypto::computeCMAC_AES(const std::vector& ke } +std::vector Gnss_Crypto::get_public_key() const +{ + if (!have_public_key()) + { + return {}; + } +#if USE_GNUTLS_FALLBACK + gnutls_datum_t pem_data = {nullptr, 0}; + + int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); + if (ret != GNUTLS_E_SUCCESS) + { + LOG(INFO) << "GnuTLS: Failed to export public key to PEM format."; + return {}; + } + std::vector output(pem_data.data, pem_data.data + pem_data.size); + + // Free the allocated memory by gnutls_pubkey_export2 + gnutls_free(pem_data.data); +#else // OpenSSL + // Create a BIO for the memory buffer + BIO* mem = BIO_new(BIO_s_mem()); + if (!mem) + { + LOG(INFO) << "OpenSSL: Failed to create BIO."; + return {}; + } +#if USE_OPENSSL_3 + if (!PEM_write_bio_PUBKEY(mem, d_PublicKey)) +#else // OpenSSL 1.x + if (!PEM_write_bio_EC_PUBKEY(mem, d_PublicKey)) +#endif + { + BIO_free(mem); + LOG(INFO) << "OpenSSL: Failed to write public key to PEM format."; + return {}; + } + + // Get the length of the data in the BIO + BUF_MEM* mem_ptr; + BIO_get_mem_ptr(mem, &mem_ptr); + + // Copy the data from the BIO to a std::vector + std::vector output(mem_ptr->length); + memcpy(output.data(), mem_ptr->data, mem_ptr->length); + + // Clean up the BIO + BIO_free(mem); +#endif + return output; +} + + +std::vector Gnss_Crypto::get_merkle_root() const +{ + return d_x_4_0; +} + + void Gnss_Crypto::set_public_key(const std::vector& publicKey) { #if USE_GNUTLS_FALLBACK @@ -884,7 +884,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) } -void Gnss_Crypto::setMerkleRoot(const std::vector& v) +void Gnss_Crypto::set_merkle_root(const std::vector& v) { d_x_4_0 = v; } diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 117d5e0a7..8e89f1525 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -53,24 +53,24 @@ public: bool have_public_key() const; //!< Returns true if the ECDSA Public Key is already loaded - bool verify_signature(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P256 signature (message in hex, signature in raw format) - bool verify_signature_ecdsa_p521(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P521 signature (message in hex, signature in raw format) - /*! * Stores the ECDSA Public Key in a .pem file, which is read in a following run if the .crt file is not found */ bool store_public_key(const std::string& pubKeyFilePath) const; - std::vector getPublicKey() const; //!< Gets the ECDSA Public Key in PEM format - std::vector getMerkleRoot() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) + bool verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P256 signature (message in plain hex, signature in raw format) + bool verify_signature_ecdsa_p521(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P521 signature (message in plain hex, signature in raw format) - std::vector computeSHA256(const std::vector& input) const; //!< Computes SHA-256 hash - std::vector computeSHA3_256(const std::vector& input) const; //!< Computes SHA3-256 hash - std::vector computeHMAC_SHA_256(const std::vector& key, const std::vector& input) const; //!< Computes HMAC-SHA-256 message authentication code - std::vector computeCMAC_AES(const std::vector& key, const std::vector& input) const; //!< Computes CMAC-AES message authentication code + std::vector compute_SHA_256(const std::vector& input) const; //!< Computes SHA-256 hash + std::vector compute_SHA3_256(const std::vector& input) const; //!< Computes SHA3-256 hash + std::vector compute_HMAC_SHA_256(const std::vector& key, const std::vector& input) const; //!< Computes HMAC-SHA-256 message authentication code + std::vector compute_CMAC_AES(const std::vector& key, const std::vector& input) const; //!< Computes CMAC-AES message authentication code + + std::vector get_public_key() const; //!< Gets the ECDSA Public Key in PEM format + std::vector get_merkle_root() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey in PEM format) - void setMerkleRoot(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) + void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) private: void read_merkle_xml(const std::string& merkleFilePath); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index bbe01d905..2d7355fd7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -96,7 +96,7 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) ASSERT_EQ(content_file, content_file2); - std::vector readkey = d_crypto2->getPublicKey(); + std::vector readkey = d_crypto2->get_public_key(); ASSERT_EQ(publicKey, readkey); errorlib::error_code ec; @@ -116,7 +116,7 @@ TEST(GnssCryptoTest, TestComputeSHA_256) 0x43, 0xAC, 0x4E, 0x43, 0xFC, 0x00, 0x4C, 0x89, 0x16, 0x04, 0xB2, 0x6F, 0x8C, 0x69, 0xE1, 0xE8, 0x3E, 0xA2, 0xAF, 0xC7, 0xC4, 0x8F}; - std::vector output = d_crypto->computeSHA256(message); + std::vector output = d_crypto->compute_SHA_256(message); ASSERT_EQ(expected_output, output); } @@ -133,7 +133,7 @@ TEST(GnssCryptoTest, TestComputeSHA3_256) 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; - std::vector output = d_crypto->computeSHA3_256(message); + std::vector output = d_crypto->compute_SHA3_256(message); ASSERT_EQ(expected_output, output); } @@ -159,7 +159,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256) 0xB2, 0x7A, 0xCC, 0x22, 0x00, 0xAA, 0xD2, 0x37, 0xD0, 0x79, 0x06, 0x12, 0x83, 0x40, 0xB7, 0xA6}; - std::vector output = d_crypto->computeHMAC_SHA_256(key, message); + std::vector output = d_crypto->compute_HMAC_SHA_256(key, message); ASSERT_EQ(expected_output, output); } @@ -194,7 +194,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_m0) 0xD2, 0xEA, 0x61, 0xE1, 0xEF, 0x09, 0x11, 0x5C, 0xFE, 0x70, 0x68, 0x52, 0xBF, 0xF2, 0x3A, 0x83}; - std::vector output = d_crypto->computeHMAC_SHA_256(key, message); + std::vector output = d_crypto->compute_HMAC_SHA_256(key, message); ASSERT_EQ(expected_output, output); } @@ -222,7 +222,7 @@ TEST(GnssCryptoTest, TestComputeHMACSHA256_adkd4) 0x44, 0xAB, 0xEE, 0x4D, 0xCE, 0xB9, 0x3D, 0xCF, 0x65, 0xCB, 0x3A, 0x5B, 0x81, 0x4A, 0x34, 0xE9}; - std::vector output = d_crypto->computeHMAC_SHA_256(key, message); + std::vector output = d_crypto->compute_HMAC_SHA_256(key, message); ASSERT_EQ(expected_output, output); } @@ -245,13 +245,13 @@ TEST(GnssCryptoTest, TestComputeCMAC_AES) 0x07, 0x0A, 0x16, 0xB4, 0x6B, 0x4D, 0x41, 0x44, 0xF7, 0x9B, 0xDD, 0x9D, 0xD0, 0x4A, 0x28, 0x7C}; - std::vector output = d_crypto->computeCMAC_AES(key, message); + std::vector output = d_crypto->compute_CMAC_AES(key, message); ASSERT_EQ(expected_output, output); } -TEST(GnssCryptoTest, VerifySignature) +TEST(GnssCryptoTest, VerifySignatureP256) { auto d_crypto = std::make_unique(); @@ -293,12 +293,12 @@ TEST(GnssCryptoTest, VerifySignature) 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; d_crypto->set_public_key(publicKey); - bool result = d_crypto->verify_signature(message, signature); + bool result = d_crypto->verify_signature_ecdsa_p256(message, signature); ASSERT_TRUE(result); std::vector wrong_signature = signature; wrong_signature[1] = 1; - bool result2 = d_crypto->verify_signature(message, wrong_signature); + bool result2 = d_crypto->verify_signature_ecdsa_p256(message, wrong_signature); ASSERT_TRUE(!result2); } diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 6b7f280a4..7daa43fb4 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -112,7 +112,7 @@ TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ // values taken from RG A.7 // Arrange // ---------- - osnma->d_crypto->setMerkleRoot(helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D")); + osnma->d_crypto->set_merkle_root(helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D")); DSM_PKR_message dsm_pkr_message; dsm_pkr_message.npkt = 0x01; dsm_pkr_message.npktid = 0x2; From 82973db0d65684dce5044219c332becf45a5d894 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 18 Jul 2024 14:37:02 +0200 Subject: [PATCH 245/499] Fixes for old GnuTLS --- cmake/Modules/GnssSdrCrypto.cmake | 6 + src/core/system_parameters/gnss_crypto.cc | 138 ++++++++++++---------- 2 files changed, 83 insertions(+), 61 deletions(-) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index 58c1c94e2..b1edb5982 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -117,6 +117,9 @@ else() if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_SIGN_ECDSA_SHA256") set(GNUTLS_SIGN_ECDSA_SHA256 TRUE) endif() + if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_SIGN_ECDSA_SHA512") + set(GNUTLS_SIGN_ECDSA_SHA512 TRUE) + endif() if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_DIG_SHA3_256") set(GNUTLS_DIG_SHA3_256 TRUE) endif() @@ -181,6 +184,9 @@ function(link_to_crypto_dependencies target) if(GNUTLS_SIGN_ECDSA_SHA256) target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_SIGN_ECDSA_SHA256=1) endif() + if(GNUTLS_SIGN_ECDSA_SHA512) + target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_SIGN_ECDSA_SHA512=1) + endif() if(GNUTLS_DIG_SHA3_256) target_compile_definitions(${target} PRIVATE -DHAVE_GNUTLS_DIG_SHA3_256=1) endif() diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 289b7e17f..12828cdca 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -142,7 +142,7 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const std::ofstream pubKeyFile(pubKeyFilePath, std::ios::binary); if (!pubKeyFile.is_open()) { - LOG(INFO) << "Unable to open file: " << pubKeyFilePath; + LOG(WARNING) << "Unable to open file for storing the Public Key: " << pubKeyFilePath; return false; } #if USE_GNUTLS_FALLBACK @@ -155,7 +155,7 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const #endif if (ret != GNUTLS_E_SUCCESS) { - LOG(INFO) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); + LOG(WARNING) << "GnuTLS: Failed to export public key: " << gnutls_strerror(ret); return false; } @@ -166,7 +166,7 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const BIO* bio = BIO_new(BIO_s_mem()); if (!bio) { - LOG(INFO) << "OpenSSL: Failed to create BIO"; + LOG(WARNING) << "OpenSSL: Failed to create BIO"; return false; } #if USE_OPENSSL_3 @@ -175,7 +175,7 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const if (!PEM_write_bio_EC_PUBKEY(bio, d_PublicKey)) #endif { - LOG(INFO) << "OpenSSL: Failed to write public key to BIO"; + LOG(WARNING) << "OpenSSL: Failed to write public key to BIO"; BIO_free(bio); return false; } @@ -184,7 +184,7 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const auto bio_len = BIO_get_mem_data(bio, &bio_data); if (bio_len <= 0) { - LOG(INFO) << "OpenSSL: Failed to get BIO data"; + LOG(WARNING) << "OpenSSL: Failed to get BIO data"; BIO_free(bio); return false; } @@ -202,7 +202,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag std::vector digest = this->compute_SHA_256(message); if (!have_public_key()) { - std::cerr << "Galileo OSNMA KROOT verification error: Public key is not available" << std::endl; + LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; return false; } bool success = false; @@ -212,7 +212,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag std::vector der_sig; if (!convert_raw_to_der_ecdsa(signature, der_sig)) { - std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + LOG(WARNING) << "Failed to convert raw ECDSA signature to DER format"; return false; } @@ -229,9 +229,13 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag } else { - std::cerr << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret) << std::endl; LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); } +#else + if (signature.empty()) + { + // do nothing + } #endif #else // OpenSSL #if USE_OPENSSL_3 @@ -255,13 +259,13 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag ECDSA_SIG* sig = ECDSA_SIG_new(); if (r == nullptr || s == nullptr || sig == nullptr) { - std::cerr << "Failed to allocate memory for BIGNUMs or ECDSA_SIG" << std::endl; + LOG(WARNING) << "OpenSSL: Failed to allocate memory for BIGNUMs or ECDSA_SIG"; return false; } if (ECDSA_SIG_set0(sig, r, s) != 1) { - std::cerr << "Failed to set R and S values in ECDSA_SIG" << std::endl; + LOG(WARNING) << "OpenSSL: Failed to set R and S values in ECDSA_SIG"; ECDSA_SIG_free(sig); // Free the ECDSA_SIG struct as it is no longer needed return false; } @@ -272,7 +276,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag if (derSigLength <= 0) { - std::cerr << "Failed to convert ECDSA_SIG to DER format" << std::endl; + LOG(WARNING) << "OpenSSL: Failed to convert ECDSA_SIG to DER format"; return false; } @@ -303,14 +307,13 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag { unsigned long errCode = ERR_get_error(); char* err = ERR_error_string(errCode, nullptr); - std::cerr << "OpenSSL: OSNMA message authentication failed: " << err << std::endl; LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; } #else // OpenSSL 1.x std::vector der_sig; if (!convert_raw_to_der_ecdsa(signature, der_sig)) { - std::cerr << "Failed to convert raw ECDSA signature to DER format" << std::endl; + LOG(WARNING) << "OpenSSL: Failed to convert raw ECDSA signature to DER format"; return false; } int verification = ECDSA_verify(0, digest.data(), SHA256_DIGEST_LENGTH, der_sig.data(), static_cast(der_sig.size()), d_PublicKey); @@ -321,12 +324,10 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag } else if (verification == 0) { - std::cerr << "OpenSSL: invalid signature found when verifying message" << std::endl; LOG(WARNING) << "OpenSSL: invalid signature found when verifying message"; } else { - std::cerr << "OpenSSL: OSNMA message authentication failed" << std::endl; LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; } #endif @@ -339,30 +340,31 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag { if (!have_public_key()) { - LOG(ERROR) << "Galileo OSNMA KROOT verification error: Public key is not available"; + LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; return false; } if (signature.size() != 132) { - LOG(ERROR) << "Invalid signature length for P-521. Expected 132 bytes, got " << signature.size(); + LOG(WARNING) << "Invalid signature length for P-521. Expected 132 bytes, got " << signature.size(); return false; } std::vector der_sig; if (!convert_raw_to_der_ecdsa(signature, der_sig)) { - LOG(ERROR) << "Failed to convert raw ECDSA signature to DER format"; + LOG(WARNING) << "Failed to convert raw ECDSA signature to DER format"; return false; } bool success = false; #if USE_GNUTLS_FALLBACK +#if HAVE_GNUTLS_SIGN_ECDSA_SHA512 std::vector digest(64); gnutls_hash_hd_t hash; int ret = gnutls_hash_init(&hash, GNUTLS_DIG_SHA512); if (ret != GNUTLS_E_SUCCESS) { - LOG(ERROR) << "GnuTLS: gnutls_hash_init failed: " << gnutls_strerror(ret); + LOG(WARNING) << "GnuTLS: gnutls_hash_init failed: " << gnutls_strerror(ret); return false; } @@ -384,12 +386,18 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag { LOG(WARNING) << "GnuTLS: OSNMA message authentication failed: " << gnutls_strerror(ret); } +#else + if (message.empty()) + { + // do nothing + } +#endif #else // OpenSSL // Compute SHA-512 hash of the message std::vector digest(SHA512_DIGEST_LENGTH); if (!EVP_Digest(message.data(), message.size(), digest.data(), nullptr, EVP_sha512(), nullptr)) { - LOG(INFO) << "OpenSSL: EVP_Digest failed"; + LOG(WARNING) << "OpenSSL: EVP_Digest failed"; return false; } #if USE_OPENSSL_3 @@ -397,20 +405,20 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag EVP_PKEY_CTX* pctx = EVP_PKEY_CTX_new(d_PublicKey, nullptr); if (pctx == nullptr) { - LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_new failed"; + LOG(WARNING) << "OpenSSL: EVP_PKEY_CTX_new failed"; return false; } if (EVP_PKEY_verify_init(pctx) <= 0) { - LOG(INFO) << "OpenSSL: EVP_PKEY_verify_init failed"; + LOG(WARNING) << "OpenSSL: EVP_PKEY_verify_init failed"; EVP_PKEY_CTX_free(pctx); return false; } if (EVP_PKEY_CTX_set_signature_md(pctx, EVP_sha512()) <= 0) { - LOG(INFO) << "OpenSSL: EVP_PKEY_CTX_set_signature_md failed"; + LOG(WARNING) << "OpenSSL: EVP_PKEY_CTX_set_signature_md failed"; EVP_PKEY_CTX_free(pctx); return false; } @@ -425,18 +433,18 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag } else if (verification == 0) { - LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; + LOG(WARNING) << "OpenSSL: invalid signature found when verifying message"; } else { - LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; + LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; } #else // OpenSSL 1.x const unsigned char* sig_ptr = der_sig.data(); ECDSA_SIG* ecdsa_sig = d2i_ECDSA_SIG(nullptr, &sig_ptr, der_sig.size()); if (ecdsa_sig == nullptr) { - LOG(INFO) << "OpenSSL: d2i_ECDSA_SIG failed"; + LOG(WARNING) << "OpenSSL: d2i_ECDSA_SIG failed"; return false; } int verification = ECDSA_do_verify(digest.data(), digest.size(), ecdsa_sig, d_PublicKey); @@ -448,11 +456,11 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag } else if (verification == 0) { - LOG(INFO) << "OpenSSL: invalid signature found when verifying message"; + LOG(WARNING) << "OpenSSL: invalid signature found when verifying message"; } else { - LOG(INFO) << "OpenSSL: OSNMA message authentication failed"; + LOG(WARNING) << "OpenSSL: OSNMA message authentication failed"; } #endif #endif @@ -517,6 +525,11 @@ std::vector Gnss_Crypto::compute_SHA3_256(const std::vector& i gnutls_hash_output(hashHandle, output_aux.data()); output = output_aux; gnutls_hash_deinit(hashHandle, output_aux.data()); +#else + if (input.empty()) + { + // do nothing + } #endif #else // OpenSSL #if USE_OPENSSL_3 || USE_OPENSSL_111 @@ -638,7 +651,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k int ret = gnutls_hmac_init(&hmac, GNUTLS_MAC_AES_CMAC_128, key.data(), key.size()); if (ret != GNUTLS_E_SUCCESS) { - LOG(INFO) << "OSNMA CMAC-AES: gnutls_hmac_init failed: " << gnutls_strerror(ret); + LOG(WARNING) << "OSNMA CMAC-AES: gnutls_hmac_init failed: " << gnutls_strerror(ret); return output; } @@ -646,7 +659,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k ret = gnutls_hmac(hmac, input.data(), input.size()); if (ret != GNUTLS_E_SUCCESS) { - LOG(INFO) << "OSNMA CMAC-AES: gnutls_hmac failed: " << gnutls_strerror(ret); + LOG(WARNING) << "OSNMA CMAC-AES: gnutls_hmac failed: " << gnutls_strerror(ret); gnutls_hmac_deinit(hmac, nullptr); return output; } @@ -675,14 +688,14 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k EVP_MAC* mac = EVP_MAC_fetch(nullptr, "CMAC", nullptr); if (!mac) { - LOG(INFO) << "OSNMA CMAC-AES: Failed to fetch CMAC"; + LOG(WARNING) << "OSNMA CMAC-AES: Failed to fetch CMAC"; return output; } EVP_MAC_CTX* ctx = EVP_MAC_CTX_new(mac); if (!ctx) { - LOG(INFO) << "OSNMA CMAC-AES: Failed to create CMAC context"; + LOG(WARNING) << "OSNMA CMAC-AES: Failed to create CMAC context"; return output; } @@ -696,7 +709,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k { EVP_MAC_CTX_free(ctx); EVP_MAC_free(mac); - LOG(INFO) << "OSNMA CMAC-AES: Failed to initialize CMAC context"; + LOG(WARNING) << "OSNMA CMAC-AES: Failed to initialize CMAC context"; return output; } @@ -705,7 +718,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k { EVP_MAC_CTX_free(ctx); EVP_MAC_free(mac); - LOG(INFO) << "OSNMA CMAC-AES: Failed to update CMAC context"; + LOG(WARNING) << "OSNMA CMAC-AES: Failed to update CMAC context"; return output; } @@ -714,7 +727,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k { EVP_MAC_CTX_free(ctx); EVP_MAC_free(mac); - LOG(INFO) << "OSNMA CMAC-AES: Failed to finalize CMAC"; + LOG(WARNING) << "OSNMA CMAC-AES: Failed to finalize CMAC"; return output; } @@ -731,14 +744,14 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k CMAC_CTX* cmacCtx = CMAC_CTX_new(); if (!cmacCtx) { - LOG(INFO) << "OSNMA CMAC-AES: Failed to create CMAC context"; + LOG(WARNING) << "OSNMA CMAC-AES: Failed to create CMAC context"; return output; } // Initialize the CMAC context with the key and cipher if (CMAC_Init(cmacCtx, key.data(), key.size(), EVP_aes_128_cbc(), nullptr) != 1) { - LOG(INFO) << "OSNMA CMAC-AES: MAC_Init failed"; + LOG(WARNING) << "OSNMA CMAC-AES: MAC_Init failed"; CMAC_CTX_free(cmacCtx); return output; } @@ -746,7 +759,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k // Compute the CMAC if (CMAC_Update(cmacCtx, input.data(), input.size()) != 1) { - LOG(INFO) << "OSNMA CMAC-AES: CMAC_Update failed"; + LOG(WARNING) << "OSNMA CMAC-AES: CMAC_Update failed"; CMAC_CTX_free(cmacCtx); return output; } @@ -754,7 +767,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k // Finalize the CMAC computation and retrieve the output if (CMAC_Final(cmacCtx, output.data(), &mac_length) != 1) { - LOG(INFO) << "OSNMA CMAC-AES: CMAC_Final failed"; + LOG(WARNING) << "OSNMA CMAC-AES: CMAC_Final failed"; CMAC_CTX_free(cmacCtx); return output; } @@ -778,11 +791,15 @@ std::vector Gnss_Crypto::get_public_key() const } #if USE_GNUTLS_FALLBACK gnutls_datum_t pem_data = {nullptr, 0}; - +#if HAVE_GNUTLS_PUBKEY_EXPORT2 int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); +#else + size_t output_stata_size; + int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); +#endif if (ret != GNUTLS_E_SUCCESS) { - LOG(INFO) << "GnuTLS: Failed to export public key to PEM format."; + LOG(WARNING) << "GnuTLS: Failed to export public key to PEM format."; return {}; } std::vector output(pem_data.data, pem_data.data + pem_data.size); @@ -794,7 +811,7 @@ std::vector Gnss_Crypto::get_public_key() const BIO* mem = BIO_new(BIO_s_mem()); if (!mem) { - LOG(INFO) << "OpenSSL: Failed to create BIO."; + LOG(WARNING) << "OpenSSL: Failed to create BIO."; return {}; } #if USE_OPENSSL_3 @@ -804,7 +821,7 @@ std::vector Gnss_Crypto::get_public_key() const #endif { BIO_free(mem); - LOG(INFO) << "OpenSSL: Failed to write public key to PEM format."; + LOG(WARNING) << "OpenSSL: Failed to write public key to PEM format."; return {}; } @@ -852,7 +869,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) bio = BIO_new_mem_buf(const_cast(publicKey.data()), publicKey.size()); if (!bio) { - LOG(INFO) << "OpenSSL: Failed to create BIO for key."; + LOG(WARNING) << "OpenSSL: Failed to create BIO for key."; return; } @@ -861,8 +878,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (!pkey) { - std::cerr << "OpenSSL: error setting the OSNMA public key." << std::endl; - LOG(INFO) << "OpenSSL: error setting the OSNMA public key."; + LOG(WARNING) << "OpenSSL: error setting the OSNMA public key."; return; } #if USE_OPENSSL_3 @@ -900,7 +916,7 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) // If it was not the default, maybe it is a configuration error, warn user if (merkleFilePath != MERKLEFILE_DEFAULT && !merkleFilePath.empty()) { - LOG(INFO) << "File " << merkleFilePath << " not found"; + LOG(WARNING) << "File " << merkleFilePath << " not found"; } // fill default values d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); @@ -966,7 +982,7 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) } catch (const std::exception& e) { - std::cerr << "Exception raised reading the " << merkleFilePath << " file: " << e.what() << '\n'; + LOG(INFO) << "Exception raised reading the " << merkleFilePath << " file: " << e.what(); d_x_4_0 = convert_from_hex_str("832E15EDE55655EAC6E399A539477B7C034CCE24C3C93FFC904ACD9BF842F04E"); return; } @@ -997,8 +1013,8 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) std::cerr << "GnuTLS: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import" << std::endl; - std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; - LOG(INFO) << "GnuTLS: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import"; + LOG(WARNING) << "GnuTLS: error reading the OSNMA Public Key from file " + << pemFilePath << ". Aborting import. Error " << gnutls_strerror(ret); return; } @@ -1009,7 +1025,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) BIO* bio = BIO_new_mem_buf(const_cast(pemContent.c_str()), pemContent.length()); if (!bio) { - std::cerr << "OpenSSL: error creating a BIO object with data read from file " << pemFilePath << ". Aborting import" << std::endl; + LOG(WARNING) << "OpenSSL: error creating a BIO object with data read from file " << pemFilePath << ". Aborting import."; return; } #if USE_OPENSSL_3 @@ -1021,7 +1037,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) if (d_PublicKey == nullptr) { std::cerr << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import" << std::endl; - LOG(INFO) << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import"; + LOG(WARNING) << "OpenSSL: error reading the OSNMA Public Key from file " << pemFilePath << ". Aborting import."; return; } #endif @@ -1039,7 +1055,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { // CRT file not found // If it was not the default, maybe it is a configuration error - if (crtFilePath != CRTFILE_DEFAULT) + if (crtFilePath != CRTFILE_DEFAULT && !crtFilePath.empty()) { std::cerr << "File " << crtFilePath << " not found" << std::endl; } @@ -1054,7 +1070,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) int ret = gnutls_x509_crt_import(cert, &buffer_datum, GNUTLS_X509_FMT_PEM); if (ret < 0) { - LOG(INFO) << "GnuTLS: Failed to import certificate: " << gnutls_strerror(ret); + LOG(WARNING) << "GnuTLS: Failed to import certificate: " << gnutls_strerror(ret); gnutls_x509_crt_deinit(cert); return false; } @@ -1065,7 +1081,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) ret = gnutls_pubkey_import_x509(pubkey, cert, 0); if (ret < 0) { - LOG(INFO) << "GnuTLS: Failed to import public key: " << gnutls_strerror(ret); + LOG(WARNING) << "GnuTLS: Failed to import public key: " << gnutls_strerror(ret); gnutls_pubkey_deinit(pubkey); gnutls_x509_crt_deinit(cert); return false; @@ -1078,7 +1094,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) std::ifstream crtFile(crtFilePath, std::ios::binary); if (!crtFile.is_open()) { - LOG(INFO) << "OpenSSL: Unable to open file: " << crtFilePath; + LOG(WARNING) << "OpenSSL: Unable to open file: " << crtFilePath; return false; } @@ -1087,13 +1103,13 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); if (!bio) { - LOG(INFO) << "OpenSSL: Unable to create BIO for file: " << crtFilePath; + LOG(WARNING) << "OpenSSL: Unable to create BIO for file: " << crtFilePath; return false; } X509* cert = PEM_read_bio_X509(bio, nullptr, nullptr, nullptr); if (!cert) { - LOG(INFO) << "OpenSSL: Unable to read certificate from file: " << crtFilePath; + LOG(WARNING) << "OpenSSL: Unable to read certificate from file: " << crtFilePath; BIO_free(bio); return false; } @@ -1103,7 +1119,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) #if USE_OPENSSL_3 if (!pubkey) { - LOG(INFO) << "OpenSSL: Failed to extract the public key"; + LOG(WARNING) << "OpenSSL: Failed to extract the public key"; X509_free(cert); return false; } @@ -1114,7 +1130,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) EVP_PKEY_free(pubkey); if (!ec_pubkey) { - LOG(INFO) << "OpenSSL: Failed to extract the public key"; + LOG(WARNING) << "OpenSSL: Failed to extract the public key"; X509_free(cert); return false; } @@ -1134,7 +1150,7 @@ bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signa { if (raw_signature.size() % 2 != 0) { - std::cerr << "Invalid raw ECDSA signature size" << std::endl; + LOG(WARNING) << "Invalid raw ECDSA signature size"; return false; } From d24c35854a3b72352038fa1d9d31f79ca249eec6 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 18 Jul 2024 16:33:25 +0200 Subject: [PATCH 246/499] Add the MAX2771_EVKIT FPGA signal source and the ENABLE_FPGA_MAX2771_EVKIT flag to enable it. --- CMakeLists.txt | 3 + .../signal_source/adapters/CMakeLists.txt | 10 +- .../max2771_evkit_fpga_signal_source.cc | 468 ++++++++++++++++++ .../max2771_evkit_fpga_signal_source.h | 163 ++++++ .../signal_source/libs/CMakeLists.txt | 13 +- .../signal_source/libs/fpga_spidev.cc | 131 +++++ .../signal_source/libs/fpga_spidev.h | 61 +++ src/core/receiver/CMakeLists.txt | 4 + src/core/receiver/gnss_block_factory.cc | 15 +- 9 files changed, 862 insertions(+), 6 deletions(-) create mode 100644 src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h create mode 100644 src/algorithms/signal_source/libs/fpga_spidev.cc create mode 100644 src/algorithms/signal_source/libs/fpga_spidev.h diff --git a/CMakeLists.txt b/CMakeLists.txt index a782e240c..dc0d2b2f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,8 @@ option(ENABLE_AD936X_SDR "Enable the use of AD936X front-ends using libiio, requ option(ENABLE_AD9361 "Enable the use of AD9361 direct to FPGA hardware, requires libiio" OFF) +option(ENABLE_FPGA_MAX2771_EVKIT "Enable the use of MAX2771 EVKIT direct to FPGA hardware" OFF) + option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF) option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNU Radio driver" OFF) @@ -3552,6 +3554,7 @@ add_feature_info(ENABLE_LIMESDR ENABLE_LIMESDR "Enables Limesdr_Signal_Source. R add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio and libad9361-dev.") add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.") add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio and libad9361-dev.") +add_feature_info(ENABLE_FPGA_MAX2771_EVKIT ENABLE_FPGA_MAX2771_EVKIT "Enables MAX2771_evkit_fpga_signal_source for devices with the MAX2771 chipset.") add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Iio_Signal_Source to access AD936X front-ends using libiio. Requires libiio and libad9361-dev.") add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.") add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.") diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index fa0d78809..ce9629ea0 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -41,6 +41,14 @@ if(ENABLE_AD9361) list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) endif() +if(ENABLE_FPGA_MAX2771_EVKIT) + ############################################### + # MAX2771 EVKIT DIRECT TO FPGA Hardware + ############################################### + list(APPEND OPT_DRIVER_SOURCES max2771_evkit_fpga_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS max2771_evkit_fpga_signal_source.h) +endif() + if(ENABLE_FPGA) ############################################### # FPGA DMA source @@ -159,7 +167,7 @@ target_include_directories(signal_source_adapters ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_FPGA OR ENABLE_AD9361 OR ENABLE_FPGA_MAX2771_EVKIT) target_link_libraries(signal_source_adapters PUBLIC signal_source_libs diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc new file mode 100644 index 000000000..65771233f --- /dev/null +++ b/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc @@ -0,0 +1,468 @@ +/*! + * \file max2771_evkit_fpga_signal_source.cc + * \brief Signal source for the MAX2771EVKIT evaluation board connected directly + * to FPGA accelerators. + * This source implements only the MAX2771 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "max2771_evkit_fpga_signal_source.h" +#include "GPS_L1_CA.h" +#include "GPS_L2C.h" +#include "GPS_L5.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::max +#include // for std::chrono +#include // for std::floor +#include // for std::exception +#include // for std::cout + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +MAX2771EVKITFpgaSignalSource::MAX2771EVKITFpgaSignalSource(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), + freq_(configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ))), + sample_rate_(configuration->property(role + ".sampling_frequency", default_sampling_rate)), + in_stream_(in_stream), + out_stream_(out_stream), + bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), + filter_order_(configuration->property(role + ".filter_order", default_filter_order)), + gain_in_(configuration->property(role + ".PGA_gain", default_PGA_gain_value)), + item_size_(sizeof(int8_t)), + chipen_(true), + if_filter_gain_(configuration->property(role + ".enable_IF_filter_gain", true)), + LNA_active_(configuration->property(role + ".LNA_active", false)), + enable_agc_(configuration->property(role + ".enable_AGC", true)), + enable_ovf_check_buffer_monitor_active_(true), + dump_(configuration->property(role + ".dump", false)), +#if USE_GLOG_AND_GFLAGS + rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)) +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))) +#endif +{ + // some basic checks + if (freq_ != GPS_L1_FREQ_HZ and freq_ != GPS_L2_FREQ_HZ and freq_ != GPS_L5_FREQ_HZ) + { + std::cout << "Configuration parameter freq should take values " << GPS_L1_FREQ_HZ << ", " << GPS_L2_FREQ_HZ << ", or " << GPS_L5_FREQ_HZ << "\n"; + std::cout << "Error: provided value freq = " << freq_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value freq = " << GPS_L1_FREQ_HZ << '\n'; + LOG(WARNING) << "Invalid configuration value for freq parameter. Set to freq = " << GPS_L1_FREQ_HZ; + freq_ = GPS_L1_FREQ_HZ; + } + if (sample_rate_ != 4092000 and sample_rate_ != 8184000 and sample_rate_ != 16368000 and sample_rate_ != 32736000) + { + std::cout << "Configuration parameter sampling_frequency should take values 4092000, 8184000, 16368000, or 32736000\n"; + std::cout << "Error: provided value sampling_frequency = " << sample_rate_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value sampling_frequency = " << default_sampling_rate << '\n'; + LOG(WARNING) << "Invalid configuration value for sampling_frequency parameter. Set to sampling_frequency = " << default_sampling_rate; + sample_rate_ = default_sampling_rate; + } + if (bandwidth_ != 2500000 and bandwidth_ != 4200000 and bandwidth_ != 8700000 and bandwidth_ != 16400000 and bandwidth_ != 23400000 and bandwidth_ != 36000000) + { + std::cout << "Configuration parameter bandwidth can only take the following values: 2500000, 4200000, 8700000, 16400000, 23400000, and 36000000 Hz\n"; + std::cout << "Error: provided value bandwidth = " << bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value bandwidth = " << default_bandwidth << '\n'; + LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth = " << default_bandwidth; + bandwidth_ = default_bandwidth; + } + if (filter_order_ != 3 and filter_order_ != 5) + { + std::cout << "Configuration parameter filter_order should take values 3 or 5\n"; + std::cout << "Error: provided value filter_order = " << filter_order_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value filter_order = " << default_filter_order << '\n'; + LOG(WARNING) << "Invalid configuration value for filter_order parameter. Set to filter_order = " << default_filter_order; + filter_order_ = default_filter_order; + } + if (gain_in_ > max_PGA_gain_value) + { + std::cout << "Configuration parameter PGA_gain should be up to " << max_PGA_gain_value << "\n"; + std::cout << "Error: provided value PGA_gain = " << gain_in_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value PGA_gain = " << default_PGA_gain_value << '\n'; + LOG(WARNING) << "Invalid configuration value for PGA_gain parameter. Set to PGA_gain = " << default_PGA_gain_value; + gain_in_ = default_PGA_gain_value; + } + + std::vector register_values = setup_regs(); + + spidev_fpga = std::make_shared(); + + if (spidev_fpga->SPI_open()) + { + std::cerr << "Cannot open SPI device\n"; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + + if (configure(register_values)) + { + std::cerr << "Error configuring the MAX2771 device " << '\n'; + } + + if (spidev_fpga->SPI_close()) + { + std::cerr << "Error closing SPI device " << '\n'; + } + + std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + + buffer_monitor_fpga = std::make_shared(NUM_FREQ_BANDS, dump_, dump_filename); + thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + +std::vector MAX2771EVKITFpgaSignalSource::setup_regs(void) +{ + std::vector register_values = std::vector(MAX2771_NUM_REGS); + + + uint32_t LNA_mode = (LNA_active_) ? 0x0 : 0x2; + + uint32_t Filter_Bandwidth; + + switch (bandwidth_) + { + case 2500000: + Filter_Bandwidth = 0x0; + break; + case 4200000: + Filter_Bandwidth = 0x2; + break; + case 8700000: + Filter_Bandwidth = 0x1; + break; + case 16400000: + Filter_Bandwidth = 0x7; + break; + case 23400000: + Filter_Bandwidth = 0x3; + break; + case 36000000: + Filter_Bandwidth = 0x4; + break; + default: + Filter_Bandwidth = 0x0; // default bandwidth + } + + uint32_t chipen_select = (chipen_) ? 0x1 : 0x0; + uint32_t Filter_order_sel = (filter_order_ == 5) ? 0x0 : 0x1; + uint32_t IF_filter_gain_sel = (if_filter_gain_) ? 0x1 : 0x0; + + register_values[0] = // configuration 1 register + (chipen_select << 31) + + (IDLE << 30) + + (0x8 << 26) + // reserved + (0x8 << 22) + // reserved + (0x2 << 20) + // reserved + (0x1 << 18) + // reserved + (MIXPOLE << 17) + + (LNA_mode << 15) + + (MIXERMODE << 13) + + (FCEN << 6) + + (Filter_Bandwidth << 3) + + (Filter_order_sel << 2) + + (FCENX << 1) + + IF_filter_gain_sel; + + uint32_t AGC_mode = (enable_agc_) ? 0x0 : 0x2; + + register_values[1] = // configuration 2 register + (0x0 << 31) + // reserved + (0x1 << 29) + // reserved + (ANAIMON << 28) + + (IQEN << 27) + + (GAINREF << 15) + + (SPI_SDIO_CONFIG << 13) + + (AGC_mode << 11) + + (FORMAT << 9) + + (BITS << 6) + + (DRVCFG << 4) + + (0x1 << 3) + // reserved + (0x0 << 2) + // reserved + DIEID; + + register_values[2] = // configuration 3 register + (0x0 << 28) + //reserved + (gain_in_ << 22) + + (0x1 << 21) + // reserved + (HILOADEN << 20) + + (0x1 << 19) + // reserved + (0x1 << 18) + // reserved + (0x1 << 17) + // reserved + (0x1 << 16) + // reserved + (FHIPEN << 15) + + (0x0 << 14) + // reserved + (PGAIEN << 13) + + (PGAQEN << 12) + + (STRMEN << 11) + + (STRMSTART << 10) + + (STRMSTOP << 9) + + (0x7 << 6) + // reserved + (STRMBITS << 4) + + (STAMPEN << 3) + + (TIMESYNCEN << 2) + + (DATASYNCEN << 1) + + STRMRST; + + uint32_t clock_out_div_ratio; + + switch (sample_rate_) + { + case 4092000: + clock_out_div_ratio = 0x1; // XTAL frequency /4 + break; + case 8184000: + clock_out_div_ratio = 0x2; // XTAL frequency /2 + break; + case 16368000: + clock_out_div_ratio = 0x3; // XTAL frequency + break; + case 32736000: + clock_out_div_ratio = 0x0; // XTAL Frequency x2 + break; + default: + clock_out_div_ratio = 0x1; // default XTAL frequency + } + + register_values[3] = // PLL configuration register + (clock_out_div_ratio << 29) + + (LOBAND << 28) + + (0x1 << 27) + // reserved + (0x0 << 26) + // reserved + (0x0 << 25) + // reserved + (REFOUTEN << 24) + + (0x1 << 23) + // reserved + (0x0 << 21) + // reserved + (IXTAL << 19) + + (0x10 << 14) + // reserved + (0x0 << 13) + // reserved + (0x0 << 10) + //reserved + (ICP << 9) + + (0x0 << 8) + // reserved + (0x0 << 7) + // reserved + (0x0 << 4) + // reserved + (INT_PLL << 3) + + (PWRSAV << 2) + + (0x0 << 1) + // reserved + 0x0; // reserved + + uint32_t freq_sel; + switch (freq_) + { + case static_cast(GPS_L1_FREQ_HZ): + freq_sel = 0x604; + break; + case static_cast(GPS_L2_FREQ_HZ): + freq_sel = 0x4B0; + break; + case static_cast(GPS_L5_FREQ_HZ): + freq_sel = 0x47E; + break; + default: + freq_sel = 0x604; + } + //uint32_t freq_sel = (freq_ == GPS_L1_FREQ_HZ) ? 0x604 : + register_values[4] = // PLL integer division register + (0x0 << 28) + //reserved + (freq_sel << 13) + + (RDIV << 3) + + 0x0; // reserved + + register_values[5] = // PLL fractional division register + (0x0 << 28) + // reserved + (FDIV << 8) + + (0x7 << 4) + // reserved + (0x0 << 3) + // reserved + (0x0 << 2) + // reserved + (0x0 << 1) + // reserved + 0x0; // reserved + + register_values[6] = // DSP interface register + (0x0 << 28) + // reserved + 0x8000000; // reserved + + register_values[7] = // clock configuration 1 register + (0x0 << 29) + // reserved + (EXTADCCLK << 28) + + (REFCLK_L_CNT << 16) + + (REFCLK_M_CNT << 4) + + (FCLKIN << 3) + + (ADCCLK << 2) + + (0x1 << 1) + //reserved + MODE; + + register_values[8] = TEST_MODE_1_REG_VAL; // test mode 1 register + + register_values[9] = TEST_MODE_2_REG_VAL; // test mode 2 register + + register_values[10] = // clock configuration 2 register + (0x0 << 29) + // reserved + (0x0 << 28) + // reserved + (ADCCLK_L_CNT << 16) + + (ADCCLK_M_CNT << 4) + + (PRE_FRACDIV_SEL << 3) + + (CLKOUT_SEL << 2) + + 0x0; // reserved + + return register_values; +} + + +bool MAX2771EVKITFpgaSignalSource::configure(std::vector register_values) +{ + // write the registers + std::cerr << "Configuring MAX2771 registers" << std::endl; + uint32_t status = 0; + for (uint32_t k = 0; k < register_values.size(); k++) + { + status = spidev_fpga->write_reg32(k, register_values[k]); + if (status) + { + std::cerr << "Error writing the MAX2771 registers" << std::endl; + break; + } + } + + // Read the registers and verify that the values are correctly written + std::vector reg_read = std::vector(register_values.size()); + + for (uint8_t n = 0; n < register_values.size(); ++n) + { + status = spidev_fpga->read_reg32(n, ®_read[n]); + if (status) + { + std::cerr << "Error reading the MAX2771 registers" << std::endl; + return status; + } + else + { + if (reg_read[n] != register_values[n]) + { + std::cerr << "Error: Failed to verify the MAX2771 registers " << std::endl; + return -1; + } + } + } + + return 0; +} + +MAX2771EVKITFpgaSignalSource::~MAX2771EVKITFpgaSignalSource() +{ + /* cleanup and exit */ + + if (rf_shutdown_) + { + chipen_ = false; + std::cout << "* MAX2771 Disabling RX streaming channels\n"; + std::vector register_values = setup_regs(); + + if (spidev_fpga->SPI_open()) + { + std::cerr << "Cannot open SPI device\n"; + return; + } + + + if (configure(register_values)) + { + std::cerr << "Error disabling the MAX2771 device " << '\n'; + } + + if (spidev_fpga->SPI_close()) + { + std::cerr << "Error closing SPI device " << '\n'; + } + } + + // disable buffer overflow checking and buffer monitoring + std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + lock_buffer_monitor.unlock(); + + if (thread_buffer_monitor.joinable()) + { + thread_buffer_monitor.join(); + } +} + + +void MAX2771EVKITFpgaSignalSource::run_buffer_monitor_process() +{ + bool enable_ovf_check_buffer_monitor_active = true; + + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitoring_initial_delay_ms)); + + while (enable_ovf_check_buffer_monitor_active) + { + buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); + std::unique_lock lock(buffer_monitor_mutex); + if (enable_ovf_check_buffer_monitor_active_ == false) + { + enable_ovf_check_buffer_monitor_active = false; + } + lock.unlock(); + } +} + + +void MAX2771EVKITFpgaSignalSource::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void MAX2771EVKITFpgaSignalSource::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr MAX2771EVKITFpgaSignalSource::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr MAX2771EVKITFpgaSignalSource::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h b/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h new file mode 100644 index 000000000..dc1e3c674 --- /dev/null +++ b/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h @@ -0,0 +1,163 @@ +/*! + * \file max2771_evkit_fpga_signal_source.h + * \brief Signal source for the MAX2771EVKIT evaluation board connected directly + * to FPGA accelerators. + * This source implements only the MAX2771 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_MAX2771_EVKIT_FPGA_SIGNAL_SOURCE_H +#define GNSS_SDR_MAX2771_EVKIT_FPGA_SIGNAL_SOURCE_H + +#include "command_event.h" +#include "concurrent_queue.h" +#include "fpga_buffer_monitor.h" +#include "fpga_spidev.h" +#include "gnss_block_interface.h" +#include "signal_source_base.h" +#include // for pmt::pmt_t +#include // for fixed-width integer types +#include // for smart pointers +#include // for mutex +#include // for strings +#include // for threads + + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + + +class ConfigurationInterface; + +class MAX2771EVKITFpgaSignalSource : public SignalSourceBase +{ +public: + MAX2771EVKITFpgaSignalSource(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); + + ~MAX2771EVKITFpgaSignalSource(); + + std::vector setup_regs(void); + + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); + const uint64_t default_bandwidth = 2500000; + const uint32_t default_filter_order = 5; + const uint64_t default_sampling_rate = 4092000; + const uint32_t default_PGA_gain_value = 0x3A; // default PGA gain when AGC is off + // max PGA gain value + const uint32_t max_PGA_gain_value = 0x3F; + // check buffer overflow and perform buffer monitoring every 1s by default + const uint32_t buffer_monitor_period_ms = 1000; + // buffer overflow and buffer monitoring initial delay + const uint32_t buffer_monitoring_initial_delay_ms = 2000; + // MAX2771 number of configuration registers + const uint32_t MAX2771_NUM_REGS = 11; + // MAX2771 configuration register fields + const uint32_t NUM_FREQ_BANDS = 1; + const uint32_t IDLE = 0x0; // Idle mode disabled + const uint32_t MIXPOLE = 0x0; // set the passive filter pole at mixer output at 13 MHz. + const uint32_t MIXERMODE = 0x0; // L1 band enabled + const uint32_t FCEN = 0x58; // Center frequency not used when in low-pass filter mode. Set to default value. + const uint32_t FCENX = 0x0; // POlyphase filter selection set to Lowpass filter + const uint32_t ANAIMON = 0x0; // analog monitor disabled + const uint32_t IQEN = 0x1; // I and Q channels enable + const uint32_t GAINREF = 0xAA; // AGC Gain ref + const uint32_t SPI_SDIO_CONFIG = 0x0; // SPI SDIO config when tri-stated: nothing applied + const uint32_t FORMAT = 0x1; // sign and magnitude + const uint32_t BITS = 0x2; // number of bits in the ADC = 2 + const uint32_t DRVCFG = 0x0; // output driver configuration = CMOS Logic + const uint32_t DIEID = 0x0; // identifies version of IC + const uint32_t HILOADEN = 0x0; // disable output driver for high loads + const uint32_t FHIPEN = 0x1; // enable highpass coupling between filter and PGA. + const uint32_t PGAIEN = 0x1; // I-Channel PGA Enable + const uint32_t PGAQEN = 0x1; // Q-Channel PGA Enable + const uint32_t STRMEN = 0x0; // disable DSP interface for serial streaming of data + const uint32_t STRMSTART = 0x0; // the rising edge of this bit enables data streaming to the output, clock, data, sync and frame sync outputs. + const uint32_t STRMSTOP = 0x0; // the rising edge of this bit disables data streaming to the output, clock, data sync and frame sync outputs. + const uint32_t STRMBITS = 0x1; // number of bits to be streamed: I MSB, I LSB + const uint32_t STAMPEN = 0x1; // enable frame number insertion + const uint32_t TIMESYNCEN = 0x1; // enable the output of the time sync pulses at all times when streaming is enabled. + const uint32_t DATASYNCEN = 0x0; // disable the sync pulses at the DATASYNC output + const uint32_t STRMRST = 0x0; // counter reset not active + const uint32_t LOBAND = 0x0; // L1 band + const uint32_t REFOUTEN = 0x1; // Output clock buffer enable + const uint32_t IXTAL = 0x1; // XTAL osscillator/buffer set to normal current + const uint32_t ICP = 0x0; // charge pump current selection set to 0.5 mA + const uint32_t INT_PLL = 0x1; // PLL mode set to integer-N PLL + const uint32_t PWRSAV = 0x0; // PLL power save mode disabled + const uint32_t RDIV = 0x10; // Set the PLL reference division ratio such that the L1 band is tuned to 1575.42 Mhz + const uint32_t FDIV = 0x80000; // PLL fractional division ratio not used. Set to default value + const uint32_t EXTADCCLK = 0x0; // use internally generated clock + const uint32_t REFCLK_L_CNT = 0x100; // set the L counter of the reference clock configuration to its default value + const uint32_t REFCLK_M_CNT = 0x61B; // set the M counter of the reference clock configuration to its default value + const uint32_t FCLKIN = 0x0; // fractional clock divider set to default value + const uint32_t ADCCLK = 0x0; // ADC clock selection set to reference clock divider/multiplier + const uint32_t MODE = 0x0; // DSP interface mode selection + const uint32_t ADCCLK_L_CNT = 0x100; // set the L counter of the ADC clock configuration to its default value + const uint32_t ADCCLK_M_CNT = 0x61B; // set the M counter of the ADC clock configuration to its default value + const uint32_t PRE_FRACDIV_SEL = 0x0; // bypass fractional clock divider + const uint32_t CLKOUT_SEL = 0x1; // CLKOUT selection set to ADC clock + // MAX2771 configuration register registers + const uint32_t TEST_MODE_1_REG_VAL = 0x01E0F401; // reserved + const uint32_t TEST_MODE_2_REG_VAL = 0x00000002; + + bool configure(std::vector register_values); + void run_buffer_monitor_process(); + + + std::thread thread_buffer_monitor; + + std::shared_ptr buffer_monitor_fpga; + std::shared_ptr spidev_fpga; + + std::mutex buffer_monitor_mutex; + + uint64_t freq_; // frequency of local oscillator + uint64_t sample_rate_; + + uint32_t in_stream_; + uint32_t out_stream_; + uint32_t bandwidth_; // 2500000, 4200000, 8700000, 16400000, 23400000, 36000000 + uint32_t filter_order_; //3, 5 + uint32_t gain_in_; // 0 to 0x3F + + size_t item_size_; // 1 + + bool chipen_; // chip enable + bool if_filter_gain_; // true, false + bool LNA_active_; // true, false + bool enable_agc_; // true, false + bool enable_ovf_check_buffer_monitor_active_; + bool dump_; + bool rf_shutdown_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_MAX2771_EVKIT_FPGA_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 2b0eb6a86..2d28981a4 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -12,17 +12,24 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.h) endif() -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_FPGA_MAX2771_EVKIT) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.h) +endif() + +if(ENABLE_FPGA) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_switch.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_switch.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dynamic_bit_selection.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dynamic_bit_selection.h) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dma-proxy.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) endif() +if(ENABLE_AD9361 OR ENABLE_FPGA_MAX2771_EVKIT) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) +endif() if(ENABLE_PLUTOSDR) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.cc) diff --git a/src/algorithms/signal_source/libs/fpga_spidev.cc b/src/algorithms/signal_source/libs/fpga_spidev.cc new file mode 100644 index 000000000..f90cf4ac9 --- /dev/null +++ b/src/algorithms/signal_source/libs/fpga_spidev.cc @@ -0,0 +1,131 @@ +/*! + * \file fpga_spidev.cc + * \brief FPGA SPI control. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "fpga_spidev.h" +#include // for memset() +#include // for open(), O_RDWR +#include // for std::cerr +#include // spidev driver +#include // for ioctl() +#include // for close() + + +int Fpga_spidev::SPI_open() +{ + if ((d_fd = open(SPI_DEVICE_NAME.c_str(), O_RDWR)) < 0) + { + std::cerr << "Failed to open the " << SPI_DEVICE_NAME << " device file \n"; + return -1; + } + + int ret; + int32_t mode = 0; + + ret = ioctl(d_fd, SPI_IOC_WR_MODE32, &mode); + if (ret == -1) + { + std::cerr << "can't set spi mode\n"; + return -1; + } + + ret = ioctl(d_fd, SPI_IOC_RD_MODE32, &mode); // le digo al spi "algo" + if (ret == -1) + { + std::cerr << "can't set spi mode\n"; + return -1; + } + + return 0; +} + +int Fpga_spidev::write_reg32(char addr, uint32_t data) +{ + uint8_t data_buffer[2]; + uint8_t recv_buffer[4]; + int res = 0; + struct spi_ioc_transfer xfer[2]; + memset(xfer, 0, sizeof(xfer)); + xfer[0].bits_per_word = 8; + xfer[0].speed_hz = SPI_SPEED; + xfer[1].bits_per_word = 8; + xfer[1].speed_hz = SPI_SPEED; + + memset(&recv_buffer, 0, sizeof(recv_buffer)); + memset(&data_buffer, 0, sizeof(data_buffer)); + + data_buffer[1] = addr << 4 | 0 << 3; + xfer[0].tx_buf = (unsigned long)data_buffer; + xfer[0].len = 2; + + // Would use memcpy but 'data' is in little endian + ((char*)recv_buffer)[0] = ((char*)&data)[3]; + ((char*)recv_buffer)[1] = ((char*)&data)[2]; + ((char*)recv_buffer)[2] = ((char*)&data)[1]; + ((char*)recv_buffer)[3] = ((char*)&data)[0]; + + xfer[1].tx_buf = (unsigned long)recv_buffer; + xfer[1].len = 4; + res = ioctl(d_fd, SPI_IOC_MESSAGE(2), xfer); + if (res < 0) + { + std::cout << "Error sending SPI message\n"; + return res; + } + return 0; +} + +int Fpga_spidev::read_reg32(uint8_t addr, uint32_t* copy_to) +{ + uint8_t data_buffer[2]; + uint8_t recv_buffer[4]; + int res; + struct spi_ioc_transfer xfer[2]; + memset(xfer, 0, sizeof(xfer)); + xfer[0].bits_per_word = 8; + xfer[0].speed_hz = SPI_SPEED; + xfer[1].bits_per_word = 8; + xfer[1].speed_hz = SPI_SPEED; + + memset(&recv_buffer, 0, sizeof(recv_buffer)); + memset(&data_buffer, 0, sizeof(data_buffer)); + + data_buffer[1] = addr << 4 | 1 << 3; + xfer[0].tx_buf = (unsigned long)data_buffer; + xfer[0].len = 2; + + xfer[1].rx_buf = (unsigned long)recv_buffer; + xfer[1].len = 4; + res = ioctl(d_fd, SPI_IOC_MESSAGE(2), xfer); + if (res < 0) + { + std::cout << "Error sending SPI message\n"; + return res; + } + + // the register data is received in the reverse order + uint32_t tmp_result = 0; + for (uint32_t k = 0; k < 4; ++k) + { + tmp_result = tmp_result + ((recv_buffer[3 - k]) << 8 * k); + } + *copy_to = tmp_result; + + return 0; +} + +int Fpga_spidev::SPI_close() const +{ + return close(d_fd); +} diff --git a/src/algorithms/signal_source/libs/fpga_spidev.h b/src/algorithms/signal_source/libs/fpga_spidev.h new file mode 100644 index 000000000..5fbe2f41c --- /dev/null +++ b/src/algorithms/signal_source/libs/fpga_spidev.h @@ -0,0 +1,61 @@ +/*! + * \file fpga_spidev.h + * \brief FPGA SPI control. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FPGA_SPIDEV_H +#define GNSS_SDR_FPGA_SPIDEV_H + +#include + +class Fpga_spidev +{ +public: + /*! + * \brief Default constructor. + */ + Fpga_spidev() = default; + + /*! + * \brief Default destructor. + */ + ~Fpga_spidev() = default; + + /*! + * \brief write a register through the SPI. + */ + int write_reg32(char addr, uint32_t data); + + /*! + * \brief read a register through the SPI. + */ + int read_reg32(uint8_t addr, uint32_t* copy_to); + /*! + * \brief Open the SPI device driver. + */ + int SPI_open(void); + + /*! + * \brief Close the SPI device driver + */ + int SPI_close(void) const; + +private: + static const uint32_t SPI_SPEED = 250000; + const std::string SPI_DEVICE_NAME = std::string("/dev/spidev2.0"); // Switch UIO device name + + int d_fd; +}; + + +#endif // GNSS_SDR_FPGA_SPIDEV_H diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 0dfc09a84..3b2b6f46e 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -98,6 +98,10 @@ if(ENABLE_AD9361) target_compile_definitions(core_receiver PRIVATE -DAD9361_DRIVER=1) endif() +if(ENABLE_FPGA_MAX2771_EVKIT) + target_compile_definitions(core_receiver PRIVATE -DFPGA_MAX2771_EVKIT_DRIVER=1) +endif() + if(ENABLE_OSMOSDR) if(GROSMOSDR_FOUND) target_compile_definitions(core_receiver PRIVATE -DOSMOSDR_DRIVER=1) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 4d729d24a..1ad7424eb 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -171,6 +171,10 @@ #include "ad9361_fpga_signal_source.h" #endif +#if FPGA_MAX2771_EVKIT_DRIVER +#include "max2771_evkit_fpga_signal_source.h" +#endif + #if LIMESDR_DRIVER #include "limesdr_signal_source.h" #endif @@ -813,8 +817,6 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and AD9361_DRIVER - // The AD9361_DRIVER Driver must be instantiated last. In this way, when using the FPGA, and when using the GNSS receiver - // in post-processing mode, the receiver is configured and ready when the DMA starts sending samples to the receiver. else if (implementation == "Ad9361_Fpga_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, @@ -823,6 +825,15 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif +#if ENABLE_FPGA and FPGA_MAX2771_EVKIT_DRIVER + else if (implementation == "MAX2771_evkit_Fpga_Signal_Source") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } +#endif + #if ENABLE_FPGA else if (implementation == "DMA_Fpga_Signal_Source") { From 9567e95e33f440003adac86200bbf1e458f6e13f Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Fri, 19 Jul 2024 10:11:44 +0200 Subject: [PATCH 247/499] Adjust cross-compilation flags to properly support FPGA signal sources --- CMakeLists.txt | 6 ++++++ src/algorithms/signal_source/adapters/CMakeLists.txt | 2 +- src/algorithms/signal_source/libs/CMakeLists.txt | 2 +- src/core/libs/CMakeLists.txt | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dc0d2b2f4..38dda0390 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3348,6 +3348,12 @@ if(ENABLE_AD9361 OR ENABLE_FMCOMMS2) endif() endif() +############################################## +# Check FPGA-related signal sources +############################################## +if((ENABLE_AD9361 OR ENABLE_FPGA_MAX2771_EVKIT) AND NOT ENABLE_FPGA) + message(FATAL_ERROR "ENABLE_AD9361 and ENABLE_FPGA_MAX2771_EVKIT can only be set when ENABLE_FPGA is also set.") +endif() ############################################## diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index ce9629ea0..4b246c7b1 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -167,7 +167,7 @@ target_include_directories(signal_source_adapters ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(ENABLE_FPGA OR ENABLE_AD9361 OR ENABLE_FPGA_MAX2771_EVKIT) +if(ENABLE_FPGA) target_link_libraries(signal_source_adapters PUBLIC signal_source_libs diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 2d28981a4..0e02ec084 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -120,7 +120,7 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR) endif() endif() -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_FPGA) target_link_libraries(signal_source_libs PUBLIC algorithms_libs diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 7b4f4f703..fb8230fdc 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -52,7 +52,7 @@ if(ENABLE_FPGA) ) endif() -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_FPGA) set(CORE_LIBS_SOURCES ${CORE_LIBS_SOURCES} uio_fpga.cc From 4b715866b598ea3ef18b97949b1d35e038035a05 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Fri, 19 Jul 2024 12:06:53 +0200 Subject: [PATCH 248/499] fix signal source names for consistency --- .../signal_source/adapters/CMakeLists.txt | 8 +++---- ...al_source.cc => fpga_dma_signal_source.cc} | 24 +++++++++---------- ...gnal_source.h => fpga_dma_signal_source.h} | 14 +++++------ ...cc => fpga_max2771_evkit_signal_source.cc} | 24 +++++++++---------- ...e.h => fpga_max2771_evkit_signal_source.h} | 14 +++++------ src/core/receiver/gnss_block_factory.cc | 12 +++++----- src/core/receiver/gnss_flowgraph.cc | 2 +- 7 files changed, 49 insertions(+), 49 deletions(-) rename src/algorithms/signal_source/adapters/{dma_fpga_signal_source.cc => fpga_dma_signal_source.cc} (97%) rename src/algorithms/signal_source/adapters/{dma_fpga_signal_source.h => fpga_dma_signal_source.h} (91%) rename src/algorithms/signal_source/adapters/{max2771_evkit_fpga_signal_source.cc => fpga_max2771_evkit_signal_source.cc} (95%) rename src/algorithms/signal_source/adapters/{max2771_evkit_fpga_signal_source.h => fpga_max2771_evkit_signal_source.h} (95%) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 4b246c7b1..c26446e0e 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -45,16 +45,16 @@ if(ENABLE_FPGA_MAX2771_EVKIT) ############################################### # MAX2771 EVKIT DIRECT TO FPGA Hardware ############################################### - list(APPEND OPT_DRIVER_SOURCES max2771_evkit_fpga_signal_source.cc) - list(APPEND OPT_DRIVER_HEADERS max2771_evkit_fpga_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES fpga_max2771_evkit_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS fpga_max2771_evkit_signal_source.h) endif() if(ENABLE_FPGA) ############################################### # FPGA DMA source ############################################### - list(APPEND OPT_DRIVER_SOURCES dma_fpga_signal_source.cc) - list(APPEND OPT_DRIVER_HEADERS dma_fpga_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES fpga_dma_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS fpga_dma_signal_source.h) endif() if(ENABLE_FLEXIBAND AND TELEORBIT_FOUND) diff --git a/src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/fpga_dma_signal_source.cc similarity index 97% rename from src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc rename to src/algorithms/signal_source/adapters/fpga_dma_signal_source.cc index 495543029..0f575ea16 100644 --- a/src/algorithms/signal_source/adapters/dma_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fpga_dma_signal_source.cc @@ -1,5 +1,5 @@ /*! - * \file dma_fpga_signal_source.cc + * \file fpga_dma_signal_source.cc * \brief signal source for a DMA connected directly to FPGA accelerators. * This source implements only the DMA control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -16,7 +16,7 @@ * ----------------------------------------------------------------------------- */ -#include "dma_fpga_signal_source.h" +#include "fpga_dma_signal_source.h" #include "command_event.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" @@ -37,10 +37,10 @@ using namespace std::string_literals; -DMAFpgaSignalSource::DMAFpgaSignalSource(const ConfigurationInterface *configuration, +FPGADMASignalSource::FPGADMASignalSource(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "DMA_Fpga_Signal_Source"s), + : SignalSourceBase(configuration, role, "FPGA_DMA_Signal_Source"s), queue_(queue), filename0_(configuration->property(role + ".filename", empty_string)), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), @@ -223,7 +223,7 @@ DMAFpgaSignalSource::DMAFpgaSignalSource(const ConfigurationInterface *configura } -DMAFpgaSignalSource::~DMAFpgaSignalSource() +FPGADMASignalSource::~FPGADMASignalSource() { std::unique_lock lock_DMA(dma_mutex); enable_DMA_ = false; // disable the DMA @@ -251,13 +251,13 @@ DMAFpgaSignalSource::~DMAFpgaSignalSource() } -void DMAFpgaSignalSource::start() +void FPGADMASignalSource::start() { thread_file_to_dma = std::thread([&] { run_DMA_process(filename0_, filename1_, samples_to_skip_, item_size_, samples_, repeat_, dma_buff_offset_pos_, queue_); }); } -void DMAFpgaSignalSource::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) +void FPGADMASignalSource::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) { std::ifstream infile1; infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -535,7 +535,7 @@ void DMAFpgaSignalSource::run_DMA_process(const std::string &filename0_, const s } -void DMAFpgaSignalSource::run_dynamic_bit_selection_process() +void FPGADMASignalSource::run_dynamic_bit_selection_process() { bool dynamic_bit_selection_active = true; @@ -554,7 +554,7 @@ void DMAFpgaSignalSource::run_dynamic_bit_selection_process() } -void DMAFpgaSignalSource::connect(gr::top_block_sptr top_block) +void FPGADMASignalSource::connect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -563,7 +563,7 @@ void DMAFpgaSignalSource::connect(gr::top_block_sptr top_block) } -void DMAFpgaSignalSource::disconnect(gr::top_block_sptr top_block) +void FPGADMASignalSource::disconnect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -572,14 +572,14 @@ void DMAFpgaSignalSource::disconnect(gr::top_block_sptr top_block) } -gr::basic_block_sptr DMAFpgaSignalSource::get_left_block() +gr::basic_block_sptr FPGADMASignalSource::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; return {}; } -gr::basic_block_sptr DMAFpgaSignalSource::get_right_block() +gr::basic_block_sptr FPGADMASignalSource::get_right_block() { return {}; } diff --git a/src/algorithms/signal_source/adapters/dma_fpga_signal_source.h b/src/algorithms/signal_source/adapters/fpga_dma_signal_source.h similarity index 91% rename from src/algorithms/signal_source/adapters/dma_fpga_signal_source.h rename to src/algorithms/signal_source/adapters/fpga_dma_signal_source.h index b4781e0ae..8679aec12 100644 --- a/src/algorithms/signal_source/adapters/dma_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/fpga_dma_signal_source.h @@ -1,5 +1,5 @@ /*! - * \file dma_fpga_signal_source.h + * \file fpga_dma_signal_source.h * \brief signal source for a DMA connected directly to FPGA accelerators. * This source implements only the DMA control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -16,8 +16,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_DMA_FPGA_SIGNAL_SOURCE_H -#define GNSS_SDR_DMA_FPGA_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_FPGA_DMA_SIGNAL_SOURCE_H +#define GNSS_SDR_FPGA_DMA_SIGNAL_SOURCE_H #include "concurrent_queue.h" #include "fpga_dma-proxy.h" @@ -41,14 +41,14 @@ class ConfigurationInterface; -class DMAFpgaSignalSource : public SignalSourceBase +class FPGADMASignalSource : public SignalSourceBase { public: - DMAFpgaSignalSource(const ConfigurationInterface *configuration, + FPGADMASignalSource(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~DMAFpgaSignalSource(); + ~FPGADMASignalSource(); void start() override; @@ -115,4 +115,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_DMA_FPGA_SIGNAL_SOURCE_H +#endif // GNSS_SDR_FPGA_DMA_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.cc similarity index 95% rename from src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc rename to src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.cc index 65771233f..bb4b6b11e 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.cc @@ -1,5 +1,5 @@ /*! - * \file max2771_evkit_fpga_signal_source.cc + * \file fpga_max2771_evkit_signal_source.cc * \brief Signal source for the MAX2771EVKIT evaluation board connected directly * to FPGA accelerators. * This source implements only the MAX2771 control. It is NOT compatible with @@ -16,7 +16,7 @@ * ----------------------------------------------------------------------------- */ -#include "max2771_evkit_fpga_signal_source.h" +#include "fpga_max2771_evkit_signal_source.h" #include "GPS_L1_CA.h" #include "GPS_L2C.h" #include "GPS_L5.h" @@ -38,10 +38,10 @@ using namespace std::string_literals; -MAX2771EVKITFpgaSignalSource::MAX2771EVKITFpgaSignalSource(const ConfigurationInterface *configuration, +FPGAMAX2771EVKITSignalSource::FPGAMAX2771EVKITSignalSource(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), + : SignalSourceBase(configuration, role, "FPGA_MAX2771_EVKIT_Signal_Source"s), freq_(configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ))), sample_rate_(configuration->property(role + ".sampling_frequency", default_sampling_rate)), in_stream_(in_stream), @@ -141,7 +141,7 @@ MAX2771EVKITFpgaSignalSource::MAX2771EVKITFpgaSignalSource(const ConfigurationIn } } -std::vector MAX2771EVKITFpgaSignalSource::setup_regs(void) +std::vector FPGAMAX2771EVKITSignalSource::setup_regs(void) { std::vector register_values = std::vector(MAX2771_NUM_REGS); @@ -338,7 +338,7 @@ std::vector MAX2771EVKITFpgaSignalSource::setup_regs(void) } -bool MAX2771EVKITFpgaSignalSource::configure(std::vector register_values) +bool FPGAMAX2771EVKITSignalSource::configure(std::vector register_values) { // write the registers std::cerr << "Configuring MAX2771 registers" << std::endl; @@ -377,7 +377,7 @@ bool MAX2771EVKITFpgaSignalSource::configure(std::vector register_valu return 0; } -MAX2771EVKITFpgaSignalSource::~MAX2771EVKITFpgaSignalSource() +FPGAMAX2771EVKITSignalSource::~FPGAMAX2771EVKITSignalSource() { /* cleanup and exit */ @@ -417,7 +417,7 @@ MAX2771EVKITFpgaSignalSource::~MAX2771EVKITFpgaSignalSource() } -void MAX2771EVKITFpgaSignalSource::run_buffer_monitor_process() +void FPGAMAX2771EVKITSignalSource::run_buffer_monitor_process() { bool enable_ovf_check_buffer_monitor_active = true; @@ -437,7 +437,7 @@ void MAX2771EVKITFpgaSignalSource::run_buffer_monitor_process() } -void MAX2771EVKITFpgaSignalSource::connect(gr::top_block_sptr top_block) +void FPGAMAX2771EVKITSignalSource::connect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -446,7 +446,7 @@ void MAX2771EVKITFpgaSignalSource::connect(gr::top_block_sptr top_block) } -void MAX2771EVKITFpgaSignalSource::disconnect(gr::top_block_sptr top_block) +void FPGAMAX2771EVKITSignalSource::disconnect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -455,14 +455,14 @@ void MAX2771EVKITFpgaSignalSource::disconnect(gr::top_block_sptr top_block) } -gr::basic_block_sptr MAX2771EVKITFpgaSignalSource::get_left_block() +gr::basic_block_sptr FPGAMAX2771EVKITSignalSource::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; return {}; } -gr::basic_block_sptr MAX2771EVKITFpgaSignalSource::get_right_block() +gr::basic_block_sptr FPGAMAX2771EVKITSignalSource::get_right_block() { return {}; } diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h b/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.h similarity index 95% rename from src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h rename to src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.h index dc1e3c674..a7a44dd0c 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.h @@ -1,5 +1,5 @@ /*! - * \file max2771_evkit_fpga_signal_source.h + * \file fpga_max2771_evkit_signal_source.h * \brief Signal source for the MAX2771EVKIT evaluation board connected directly * to FPGA accelerators. * This source implements only the MAX2771 control. It is NOT compatible with @@ -16,8 +16,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_MAX2771_EVKIT_FPGA_SIGNAL_SOURCE_H -#define GNSS_SDR_MAX2771_EVKIT_FPGA_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_FPGA_MAX2771_EVKIT_SIGNAL_SOURCE_H +#define GNSS_SDR_FPGA_MAX2771_EVKIT_SIGNAL_SOURCE_H #include "command_event.h" #include "concurrent_queue.h" @@ -41,14 +41,14 @@ class ConfigurationInterface; -class MAX2771EVKITFpgaSignalSource : public SignalSourceBase +class FPGAMAX2771EVKITSignalSource : public SignalSourceBase { public: - MAX2771EVKITFpgaSignalSource(const ConfigurationInterface *configuration, + FPGAMAX2771EVKITSignalSource(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~MAX2771EVKITFpgaSignalSource(); + ~FPGAMAX2771EVKITSignalSource(); std::vector setup_regs(void); @@ -160,4 +160,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_MAX2771_EVKIT_FPGA_SIGNAL_SOURCE_H +#endif // GNSS_SDR_FPGA_MAX2771_EVKIT_SIGNAL_SOURCE_H diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1ad7424eb..6aa49b761 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -128,7 +128,7 @@ #endif #if ENABLE_FPGA -#include "dma_fpga_signal_source.h" +#include "fpga_dma_signal_source.h" #include "galileo_e1_dll_pll_veml_tracking_fpga.h" #include "galileo_e1_pcps_ambiguous_acquisition_fpga.h" #include "galileo_e5a_dll_pll_tracking_fpga.h" @@ -172,7 +172,7 @@ #endif #if FPGA_MAX2771_EVKIT_DRIVER -#include "max2771_evkit_fpga_signal_source.h" +#include "fpga_max2771_evkit_signal_source.h" #endif #if LIMESDR_DRIVER @@ -826,18 +826,18 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and FPGA_MAX2771_EVKIT_DRIVER - else if (implementation == "MAX2771_evkit_Fpga_Signal_Source") + else if (implementation == "FPGA_MAX2771_EVKIT_Signal_Source") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } #endif #if ENABLE_FPGA - else if (implementation == "DMA_Fpga_Signal_Source") + else if (implementation == "FPGA_DMA_Signal_Source") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 6fc42b4bb..f17686b3d 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -547,7 +547,7 @@ int GNSSFlowgraph::connect_fpga_flowgraph() if (src == nullptr) { help_hint_ += " * Check implementation name for SignalSource block.\n"; - help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Fpga_Signal_Source or DMA_Fpga_Signal_Source\n"; + help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Fpga_Signal_Source or Fpga_DMA_2Signal_Source\n"; return 1; } if (src->item_size() == 0) From 0f8f4ddb8b6a1ef703ebbddeb8df6d044e710ded Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 20 Jul 2024 07:41:15 +0200 Subject: [PATCH 249/499] Bump google benchmark to 1.8.5 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a782e240c..120505397 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,7 +356,7 @@ set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.4") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.5") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) From 1a2cbe45067c0d84db68f9dac3d9118c19f9c2fd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 20 Jul 2024 21:25:53 +0200 Subject: [PATCH 250/499] Code cleaning --- src/core/libs/osnma_msg_receiver.cc | 272 +++++++++++------- src/core/libs/osnma_msg_receiver.h | 108 ++++--- src/core/system_parameters/osnma_data.h | 2 +- .../osnma/osnma_msg_receiver_test.cc | 4 +- 4 files changed, 227 insertions(+), 159 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 293058b26..e73f74ad4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -3,14 +3,15 @@ * \brief GNU Radio block that processes Galileo OSNMA data received from * Galileo E1B telemetry blocks. After successful decoding, sends the content to * the PVT block. - * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es + * \author Carles Fernandez-Prades, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de * * ----------------------------------------------------------------------------- * * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -24,12 +25,13 @@ #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" #include // for gr::io_signature::make -#include #include #include -#include +#include // for std::setfill +#include // for std::hex, std::uppercase #include -#include +#include // for std::accumulate +#include // std::stringstream #include // for typeid #include @@ -101,14 +103,14 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) const auto sat = Gnss_Satellite(std::string("Galileo"), nma_msg->PRN); // TODO remove if unneeded std::ostringstream output_message; - output_message << "Galileo OSNMA: complete OSNMA message received starting at " + output_message << "Galileo OSNMA: data received starting at " << "WN=" << nma_msg->WN_sf0 << ", TOW=" << nma_msg->TOW_sf0 << ", from satellite " << sat; - LOG(WARNING) << output_message.str(); + LOG(INFO) << output_message.str(); std::cout << output_message.str() << std::endl; process_osnma_message(nma_msg); @@ -119,33 +121,32 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); uint32_t PRNa = std::get<0>(*inav_data); std::string nav_data = std::get<1>(*inav_data); - ; uint32_t TOW = std::get<2>(*inav_data); // iono data => 549 bits, utc data, 141 bits. if (nav_data.size() == 549) { -// LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " -// << "TOW_sf=" << TOW; + // LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " + // << "TOW_sf=" << TOW; d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = nav_data; } else if (nav_data.size() == 141) { -// LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " -// << "TOW_sf=" << TOW; + // LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " + // << "TOW_sf=" << TOW; d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; } else - LOG(WARNING) << "osnma_msg_receiver incorrect navData parsing!"; + LOG(WARNING) << "Galileo OSNMA: osnma_msg_receiver incorrect navData parsing!"; } else { - LOG(WARNING) << "osnma_msg_receiver received an unknown object type!"; + LOG(WARNING) << "Galileo OSNMA: osnma_msg_receiver received an unknown object type!"; } } catch (const wht::bad_any_cast& e) { - LOG(WARNING) << "osnma_msg_receiver Bad any_cast: " << e.what(); + LOG(WARNING) << "Galileo OSNMA: osnma_msg_receiver Bad any_cast: " << e.what(); } // Send the resulting decoded NMA data (if available) to PVT @@ -155,7 +156,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); d_new_data = false; // d_osnma_data = OSNMA_data(); - DLOG(INFO) << "NMA info sent to the PVT block through the OSNMA_to_PVT async message port"; + DLOG(INFO) << "Galileo OSNMA: NMA info sent to the PVT block through the OSNMA_to_PVT async message port"; } } @@ -172,7 +173,9 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 if (d_osnma_data.d_dsm_kroot_message.towh_k != 0) - local_time_verification(osnma_msg); + { + local_time_verification(osnma_msg); + } read_and_process_mack_block(osnma_msg); // only process them if at least 3 available. } @@ -203,8 +206,6 @@ void osnma_msg_receiver::read_dsm_header(uint8_t dsm_header) { d_osnma_data.d_dsm_header.dsm_id = d_dsm_reader->get_dsm_id(dsm_header); d_osnma_data.d_dsm_header.dsm_block_id = d_dsm_reader->get_dsm_block_id(dsm_header); // BID -// LOG(INFO) << "OSNMA: DSM_ID=" << static_cast(d_osnma_data.d_dsm_header.dsm_id); -// LOG(INFO) << "OSNMA: DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id); LOG(INFO) << "Galileo OSNMA: Received block DSM_BID=" << static_cast(d_osnma_data.d_dsm_header.dsm_block_id) << " with DSM_ID " << static_cast(d_osnma_data.d_dsm_header.dsm_id); } @@ -246,7 +247,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = number_of_blocks; - LOG(INFO) << "OSNMA: number_of_blocks=" << static_cast(number_of_blocks); + LOG(INFO) << "Galileo OSNMA: number of blocks in this message: " << static_cast(number_of_blocks); if (number_of_blocks == 0) { // Something is wrong, start over @@ -289,8 +290,10 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } available_blocks << "]"; LOG(INFO) << available_blocks.str(); + std::cout << available_blocks.str() << std::endl; } + /** * @brief Function to verify the local time based on GST_SIS and GST_0 * @@ -323,7 +326,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; // TODO set flag to false to avoid processing dsm and MACK messages @@ -334,7 +337,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; + LOG(WARNING) << "Galileo OSNMA: ( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; } else { @@ -342,7 +345,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; + LOG(WARNING) << "Galileo OSNMA: ( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; } } @@ -391,7 +394,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (d_osnma_data.d_dsm_header.dsm_id < 12) { // Parse Kroot message - LOG(INFO) << "OSNMA: DSM-KROOT message received."; + LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received."; d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg); d_osnma_data.d_dsm_kroot_message.cidkr = d_dsm_reader->get_cidkr(dsm_msg); @@ -483,7 +486,14 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; local_time_verification(osnma_msg); - d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); + if(l_ds_bits == 512) + { + d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); + } + else if(l_ds_bits == 1056) + { + d_kroot_verified = d_crypto->verify_signature_ecdsa_p521(message, d_osnma_data.d_dsm_kroot_message.ds); + } if (d_kroot_verified) { std::cout << "Galileo OSNMA: KROOT authentication successful!" << std::endl; @@ -495,6 +505,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else { LOG(WARNING) << "Galileo OSNMA: KROOT authentication failed."; + std::cerr << "Galileo OSNMA: KROOT authentication failed." << std::endl; } } else @@ -506,7 +517,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { - LOG(WARNING) << "Galileo OSNMA: DSM-PKR message received."; + LOG(INFO) << "Galileo OSNMA: DSM-PKR message received."; // Save DSM-PKR message d_osnma_data.d_dsm_pkr_message.nb_dp = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_pkr_message.mid = d_dsm_reader->get_mid(dsm_msg); @@ -530,7 +541,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg uint32_t l_dp_bytes = dsm_msg.size(); if (d_osnma_data.d_dsm_pkr_message.npkt == 4) { - LOG(WARNING) << "OSNMA: OAM received"; + LOG(WARNING) << "Galileo OSNMA: OAM received"; l_npk_bytes = l_dp_bytes - 130; // bytes } @@ -576,8 +587,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else { // Reserved message? - LOG(WARNING) << "OSNMA Reserved message received"; - // d_osnma_data = OSNMA_data(); + LOG(WARNING) << "Galileo OSNMA: Reserved message received"; + std::cerr << "Galileo OSNMA: Reserved message received" << std::endl; } d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; } @@ -883,15 +894,16 @@ void osnma_msg_receiver::process_mack_message() { if (d_kroot_verified == false && d_tesla_key_verified == false) { - LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed. " - << ", " - << "No Kroot nor TESLA key available"; + LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed, " + << "no Kroot nor TESLA key available."; if (!d_flag_debug) { return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. } else - LOG(WARNING) << "But it will be processed for debugging purposes."; + { + LOG(WARNING) << "Galileo OSNMA: But it will be processed for debugging purposes."; + } } // verify tesla key and add it to the container of verified keys if successful if (d_tesla_keys.find(d_osnma_data.d_nav_data.TOW_sf0) == d_tesla_keys.end()) // check if already available => no need to verify @@ -933,12 +945,13 @@ void osnma_msg_receiver::process_mack_message() << ", PRNd=" << static_cast(t.PRN_d); } - std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; + LOG(INFO) << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size(); mack = d_macks_awaiting_MACSEQ_verification.erase(mack); } else - { // key not yet available - keep in container until then -- might be deleted if container size exceeds max allowed + { + // key not yet available - keep in container until then -- might be deleted if container size exceeds max allowed ++mack; } } @@ -960,18 +973,24 @@ void osnma_msg_receiver::process_mack_message() if (ret) { it.second.status = Tag::SUCCESS; - LOG(WARNING) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " - << it.second.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << it.second.received_tag << std::dec - << ", TOW=" - << it.second.TOW - << ", ADKD=" - << static_cast(it.second.ADKD) - << ", PRNa=" - << static_cast(it.second.PRNa) - << ", PRNd=" - << static_cast(it.second.PRN_d); + LOG(INFO) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d); + std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) << std::endl; } /* TODO notify PVT via pmt * have_new_data() true @@ -980,7 +999,7 @@ void osnma_msg_receiver::process_mack_message() else { it.second.status = Tag::FAIL; - LOG(WARNING) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id=" + LOG(WARNING) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id=" << it.second.tag_id << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase << it.second.received_tag << std::dec @@ -992,6 +1011,12 @@ void osnma_msg_receiver::process_mack_message() << static_cast(it.second.PRNa) << ", PRNd=" << static_cast(it.second.PRN_d); + std::cerr << "Galileo OSNMA: Tag verification :: FAILURE for tag ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) << std::endl; } } else if (it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0) @@ -1031,27 +1056,29 @@ void osnma_msg_receiver::process_mack_message() * \pre DSM_PKR_message correctly filled in especially the 1024 intermediate tree nodes * \returns true if computed merkle root matches received one, false otherwise */ -bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message) +bool osnma_msg_receiver::verify_dsm_pkr(const DSM_PKR_message& message) const { - std::vector computed_merkle_root; // x_4_0 - std::vector base_leaf = compute_base_leaf(message); // m_i - - LOG(INFO) << "Galileo OSNMA: DSM-PKR :: leaf provided: m_" << static_cast(message.mid); - - computed_merkle_root = compute_merke_root(message, base_leaf); + const auto base_leaf = get_merkle_tree_leaves(message); // m_i + const auto computed_merkle_root = compute_merkle_root(message, base_leaf); // x_4_0 + const auto msg_id = static_cast(message.mid); + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: leaf provided for Message ID " << msg_id; if (computed_merkle_root == d_crypto->get_merkle_root()) { - LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: SUCCESS!." << std::endl; + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: SUCCESS."; + std::cout << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: SUCCESS." << std::endl; return true; } else { - LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: FAILURE." << std::endl; + LOG(WARNING) << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: FAILURE."; + std::cerr << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: FAILURE." << std::endl; return false; } } -std::vector osnma_msg_receiver::compute_merke_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const + + +std::vector osnma_msg_receiver::compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const { std::vector x_next, x_current = d_crypto->compute_SHA_256(m_i); for (size_t i = 0; i < 4; i++) @@ -1077,12 +1104,16 @@ std::vector osnma_msg_receiver::compute_merke_root(const DSM_PKR_messag } return x_current; } -std::vector osnma_msg_receiver::compute_base_leaf(const DSM_PKR_message& dsm_pkr_message) const -{ // build base leaf m_i + + +std::vector osnma_msg_receiver::get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const +{ + // build base leaf m_i according to OSNMA SIS ICD v1.1, section 6.2 DSM-PKR Verification std::vector m_i; - m_i.reserve(2 + dsm_pkr_message.npk.size()); + const size_t size_npk = dsm_pkr_message.npk.size(); + m_i.reserve(1 + size_npk); m_i.push_back((dsm_pkr_message.npkt << 4) + dsm_pkr_message.npktid); - for (uint8_t i = 0; i < dsm_pkr_message.npk.size(); i++) + for (size_t i = 0; i < size_npk; i++) { m_i.push_back(dsm_pkr_message.npk[i]); } @@ -1090,13 +1121,13 @@ std::vector osnma_msg_receiver::compute_base_leaf(const DSM_PKR_message } -bool osnma_msg_receiver::verify_tag(Tag& tag) +bool osnma_msg_receiver::verify_tag(const Tag& tag) { // Debug -// LOG(INFO) << "Galileo OSNMA: Tag verification :: Start for tag Id= " -// << tag.tag_id -// << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase -// << tag.received_tag << std::dec; + // LOG(INFO) << "Galileo OSNMA: Tag verification :: Start for tag Id= " + // << tag.tag_id + // << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + // << tag.received_tag << std::dec; // build message std::vector m = build_message(tag); @@ -1105,14 +1136,13 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) if (tag.ADKD == 0 || tag.ADKD == 4) { applicable_key = d_tesla_keys[tag.TOW + 30]; -// LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 30); + // LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 30); + } + else // ADKD 12 + { + applicable_key = d_tesla_keys[tag.TOW + 330]; + // LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 330); } - else // ADKD 12 - { - applicable_key = d_tesla_keys[tag.TOW + 330]; -// LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 330); - } - if (d_osnma_data.d_dsm_kroot_message.mf == 0) // C: HMAC-SHA-256 { @@ -1164,7 +1194,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) { - std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id= " + LOG(INFO) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" << tag.tag_id << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase << tag.received_tag << std::dec @@ -1175,6 +1205,14 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) << ", PRNa=" << static_cast(tag.PRNa) << ", PRNd=" + << static_cast(tag.PRN_d); + std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" + << tag.tag_id + << ", ADKD=" + << static_cast(tag.ADKD) + << ", PRNa=" + << static_cast(tag.PRNa) + << ", PRNd=" << static_cast(tag.PRN_d) << std::endl; return true; } @@ -1186,7 +1224,9 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) { std::vector m; if (tag.CTR != 1) - m.push_back(static_cast(tag.PRN_d)); + { + m.push_back(static_cast(tag.PRN_d)); + } m.push_back(static_cast(tag.PRNa)); // TODO: maybe here I have to use d_receiver_time instead of d_GST_SIS which is what I am computing uint32_t GST = d_helper->compute_gst(tag.WN, tag.TOW); @@ -1204,15 +1244,17 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; -// LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; + // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else if (tag.ADKD == 4) { applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; -// LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; + // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else - LOG(WARNING) << "Galileo OSNMA :: Tag verification :: unknown ADKD"; + { + LOG(WARNING) << "Galileo OSNMA: Tag verification :: unknown ADKD"; + } // convert std::string to vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); @@ -1309,14 +1351,16 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO } if (computed_key == d_validated_key && num_of_hashes_needed > 0) { - LOG(WARNING) << "Galileo OSNMA:: TESLA key verification :: SUCCESS!"; + LOG(INFO) << "Galileo OSNMA: TESLA key verification :: SUCCESS!"; + std::cout << "Galileo OSNMA: TESLA key verification :: SUCCESS!" << std::endl; d_tesla_keys.insert(std::pair>(TOW, key)); d_tesla_key_verified = true; d_last_verified_key_GST = d_receiver_time; } else if (num_of_hashes_needed > 0) { - LOG(WARNING) << "Galileo OSNMA:: TESLA key verification :: FAILED"; + LOG(WARNING) << "Galileo OSNMA: TESLA key verification :: FAILED"; + std::cerr << "Galileo OSNMA: TESLA key verification :: FAILED" << std::endl; if (d_flag_debug) { d_tesla_keys.insert(std::pair>(TOW, key)); @@ -1375,9 +1419,11 @@ void osnma_msg_receiver::remove_verified_tags() it = d_tags_awaiting_verify.erase(it); } else - ++it; + { + ++it; + } } - std::cout << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size() << std::endl; + LOG(INFO) << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size(); } @@ -1394,11 +1440,11 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() while (d_tags_awaiting_verify.size() > 500) { auto it = d_tags_awaiting_verify.begin(); - LOG(WARNING) << "Galileo OSNMA: Tag verification :: DELETED tag due to exceeding buffer size. " - << "Tag Id= " << it->second.tag_id - << ", TOW=" << it->first - << ", ADKD=" << static_cast(it->second.ADKD) - << ", from satellite " << it->second.PRNa; + LOG(INFO) << "Galileo OSNMA: Tag verification :: DELETED tag due to exceeding buffer size. " + << "Tag Id= " << it->second.tag_id + << ", TOW=" << it->first + << ", ADKD=" << static_cast(it->second.ADKD) + << ", from satellite " << it->second.PRNa; d_tags_awaiting_verify.erase(it); } } @@ -1463,7 +1509,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) if (flxTags.empty()) { - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD matches MAC Look-up table."; + LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD matches MAC Look-up table."; return true; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD @@ -1499,7 +1545,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; if (computed_macseq == mack.header.macseq) { - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; + LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; return true; } @@ -1511,7 +1557,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } -bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) +bool osnma_msg_receiver::tag_has_nav_data_available(const Tag& t) { auto prn_it = d_satellite_nav_data.find(t.PRN_d); if (prn_it != d_satellite_nav_data.end()) @@ -1540,7 +1586,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(Tag& t) } -bool osnma_msg_receiver::tag_has_key_available(Tag& t) +bool osnma_msg_receiver::tag_has_key_available(const Tag& t) { // check adkd of tag // if adkd = 0 or 4 => look for d_tesla_keys[t.TOW+30] @@ -1572,7 +1618,6 @@ bool osnma_msg_receiver::tag_has_key_available(Tag& t) std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes) { - auto start = std::chrono::high_resolution_clock::now(); std::vector K_II = key; std::vector K_I; // result of the recursive hash operations std::vector msg; @@ -1624,20 +1669,26 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede // check that the final time matches the Kroot time bool check; if (!d_tesla_key_verified) - check = GST_SFi + 30 == d_GST_0 - 30; + { + check = GST_SFi + 30 == d_GST_0 - 30; + } else - check = GST_SFi + 30 == d_last_verified_key_GST; + { + check = GST_SFi + 30 == d_last_verified_key_GST; + } if (!check) - LOG(WARNING) << "Galileo OSNMA: TESLA verification error. Kroot time mismatch!"; // ICD. Eq. 18 + { + LOG(WARNING) << "Galileo OSNMA: TESLA key chain verification error: KROOT time mismatch!"; // ICD. Eq. 18 + std::cerr << "Galileo OSNMA: TESLA key chain verification error: KROOT time mismatch!" << std::endl; + } else - LOG(INFO) << "Galileo OSNMA: TESLA verification. Kroot time matches!"; // ICD. Eq. 18 - // compare computed current key against received key - auto end = std::chrono::high_resolution_clock::now(); - std::chrono::duration elapsed = end - start; -// LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) took " << elapsed.count() << " seconds."; + { + LOG(INFO) << "Galileo OSNMA: TESLA key chain verification: KROOT time matches."; // ICD. Eq. 18 + } return K_II; } + /** * @brief Verifies the MAC sequence of a received MACK message. * @@ -1650,7 +1701,7 @@ std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_neede */ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_message& mack) { - std::vector verified_tags {}; + std::vector verified_tags{}; // MACSEQ verification d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. @@ -1692,23 +1743,23 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ else if (mack.tag_and_info[i].tag_info.ADKD == std::stoi(applicable_sequence[i + 1])) { // fill index of tags failed - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD match against MAC Look-up table for " - "Tag=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << mack.tag_and_info[i].tag << std::dec; + LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: ADKD match against MAC Look-up table for Tag=0x" + << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << mack.tag_and_info[i].tag << std::dec; verified_tags.push_back(mack.tag_and_info[i]); } else { // discard tag - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table for " - "Tag=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << mack.tag_and_info[i].tag << std::dec; + LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table for Tag=0x" + << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << mack.tag_and_info[i].tag << std::dec; } } if (flxTags.empty() /*TODO add check d_flag_check_mackseq_fixed_tags*/) { - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: No FLX tags to verify."; + LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: No FLX tags to verify."; return verified_tags; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD @@ -1744,7 +1795,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ uint16_t computed_macseq = (mac_msb & 0xFFF0) >> 4; if (computed_macseq == mack.header.macseq) { - LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; + LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; for (uint8_t i = 0; i < flxTags.size(); i++) { verified_tags.push_back(mack.tag_and_info[flxTags[i]]); @@ -1757,5 +1808,4 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed"; return verified_tags; } - } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index ad397cc2f..148b1266e 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -3,14 +3,15 @@ * \brief GNU Radio block that processes Galileo OSNMA data received from * Galileo E1B telemetry blocks. After successful decoding, sends the content to * the PVT block. - * \author Carles Fernandez-Prades, 2023. cfernandez(at)cttc.es + * \author Carles Fernandez-Prades, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de * * ----------------------------------------------------------------------------- * * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -18,20 +19,23 @@ #ifndef GNSS_SDR_OSNMA_MSG_RECEIVER_H #define GNSS_SDR_OSNMA_MSG_RECEIVER_H -#define FRIEND_TEST(test_case_name, test_name)\ -friend class test_case_name##_##test_name##_Test + +#define FRIEND_TEST(test_case_name, test_name) \ + friend class test_case_name##_##test_name##_Test #include "galileo_inav_message.h" // for OSNMA_msg #include "gnss_block_interface.h" // for gnss_shared_ptr #include "gnss_sdr_make_unique.h" // for std::make:unique in C++11 -#include "osnma_data.h" // for OSNMA_data -#include -#include // for gr::block -#include // for pmt::pmt_t -#include // for std::array -#include // for std::shared_ptr -#include -#include +#include "osnma_data.h" // for OSNMA_data structures +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::array +#include // for uint8_t +#include // for std::time_t +#include // for std::map, std::multimap +#include // for std::shared_ptr +#include // for std::string +#include // for std::vector /** \addtogroup Core * \{ */ @@ -73,58 +77,72 @@ private: void read_mack_header(); void read_mack_body(); void process_mack_message(); - void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData &data); + void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data); void remove_verified_tags(); void control_tags_awaiting_verify_size(); - std::vector build_message(const Tag& tag); - std::vector hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes); - std::vector compute_base_leaf(const DSM_PKR_message& dsm_pkr_message) const; - std::vector compute_merke_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; - std::vector verify_macseq_new(const MACK_message& mack); void display_data(); + bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); bool verify_tesla_key(std::vector& key, uint32_t TOW); - bool verify_tag(Tag& tag); + bool verify_tag(const Tag& tag); bool is_next_subframe(); - bool tag_has_nav_data_available(Tag& t); - bool tag_has_key_available(Tag& t); + bool tag_has_nav_data_available(const Tag& t); + bool tag_has_key_available(const Tag& t); bool verify_macseq(const MACK_message& mack); - bool verify_dsm_pkr(DSM_PKR_message message); + bool verify_dsm_pkr(const DSM_PKR_message& message) const; - enum tags_to_verify{all,utc,slow_eph, eph, none}; - tags_to_verify d_tags_allowed{tags_to_verify::all}; - std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). - std::map> d_tesla_keys; // tesla keys over time, sorted by TOW + std::vector get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const; + std::vector compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; + std::vector build_message(const Tag& tag); + std::vector hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes); + std::vector verify_macseq_new(const MACK_message& mack); + + std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). + std::map> d_tesla_keys; // tesla keys over time, sorted by TOW + std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW + + std::vector d_tags_to_verify{0, 4, 12}; + std::vector d_validated_key{}; std::vector d_macks_awaiting_MACSEQ_verification; - std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW - std::unique_ptr d_dsm_reader; // osnma parameters parser - std::unique_ptr d_crypto; // access to cryptographic functions - std::unique_ptr d_helper; - std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. + std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. std::array, 16> d_dsm_id_received{}; std::array d_number_of_blocks{}; - std::array d_mack_message{}; // C: 480 b + std::array d_mack_message{}; // C: 480 b + + std::unique_ptr d_dsm_reader; // osnma parameters parser + std::unique_ptr d_crypto; // access to cryptographic functions + std::unique_ptr d_helper; OSNMA_data d_osnma_data{}; + + enum tags_to_verify + { + all, + utc, + slow_eph, + eph, + none + }; + tags_to_verify d_tags_allowed{tags_to_verify::all}; + std::time_t d_receiver_time{0}; + + uint32_t d_GST_Sf{}; // C: used for MACSEQ and Tesla Key verification TODO need really to be global var? + uint32_t d_last_verified_key_GST{0}; + uint32_t d_GST_0{}; + uint32_t d_GST_SIS{}; + + uint8_t d_Lt_min{}; // minimum equivalent tag length + uint8_t d_Lt_verified_eph{0}; // verified tag bits - ephemeris + uint8_t d_Lt_verified_utc{0}; // verified tag bits - timing + uint8_t const d_T_L{30}; // s RG Section 2.1 + uint8_t const d_delta_COP{30}; // s SIS ICD Table 14 + bool d_new_data{false}; bool d_public_key_verified{false}; bool d_kroot_verified{false}; bool d_tesla_key_verified{false}; bool d_flag_debug{false}; - uint32_t d_GST_Sf {}; // C: used for MACSEQ and Tesla Key verification TODO need really to be global var? - uint32_t d_last_verified_key_GST{0}; - uint32_t d_GST_0 {}; - uint32_t d_GST_SIS {}; - std::time_t d_receiver_time {0}; - uint8_t d_Lt_min {}; // minimum equivalent tag length - uint8_t d_Lt_verified_eph {0}; // verified tag bits - ephemeris - uint8_t d_Lt_verified_utc {0}; // verified tag bits - timing - uint8_t const d_T_L{30}; // s RG Section 2.1 - uint8_t const d_delta_COP{30}; // s SIS ICD Table 14 - - std::vector d_tags_to_verify{0,4,12}; - std::vector d_validated_key{}; // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 105c4cbc2..484fa0162 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -82,7 +82,7 @@ class DSM_PKR_message public: DSM_PKR_message() = default; - std::array itn; // bitset<1024> + std::array itn{}; // bitset<1024> std::vector npk; std::vector p_dp; uint8_t nb_dp{}; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 7daa43fb4..d0df27a3b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -83,7 +83,7 @@ TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) // Act // ---------- - computed_merkle_root = osnma->compute_merke_root(dsm_pkr_message,base_leaf); + computed_merkle_root = osnma->compute_merkle_root(dsm_pkr_message, base_leaf); // Assert // ---------- @@ -102,7 +102,7 @@ TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) // Act // ---------- - std::vector computed_base_leaf = osnma->compute_base_leaf(dsm_pkr_message); + std::vector computed_base_leaf = osnma->get_merkle_tree_leaves(dsm_pkr_message); // Assert // ---------- From 2378fb4fbc7868b85f5352764b804cf32add83e9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 20 Jul 2024 21:44:06 +0200 Subject: [PATCH 251/499] Fix for CMake 3.30 --- src/tests/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 80aebc3dc..d7bbab2ee 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1387,7 +1387,8 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_link_libraries(osnma_msg_receiver_test PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(osnma_msg_receiver_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) else() - target_link_libraries(osnma_msg_receiver_test PRIVATE absl::flags absl::flags_parse absl::log $ absl::log_initialize) + target_link_libraries(osnma_msg_receiver_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) + target_link_libraries(osnma_msg_receiver_test INTERFACE "$") endif() xcode_remove_warning_duplicates(osnma_msg_receiver_test) # TODO - unsure if needed From c5c58c8d1db9dc753c1449d5c313191aa9adf669 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Jul 2024 08:24:12 +0200 Subject: [PATCH 252/499] Fix defects detected by clang-tidy --- src/core/libs/osnma_msg_receiver.cc | 23 ++++++++++++----------- src/core/libs/osnma_msg_receiver.h | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e73f74ad4..8a12c6d42 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -137,7 +137,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; } else - LOG(WARNING) << "Galileo OSNMA: osnma_msg_receiver incorrect navData parsing!"; + { + LOG(WARNING) << "Galileo OSNMA: osnma_msg_receiver incorrect navData parsing!"; + } } else { @@ -276,7 +278,7 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ } else { - for (uint8_t k = 0; k < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; k++) + for (uint16_t k = 0; k < d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id]; k++) { if (d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id][k] == 0) { @@ -926,10 +928,9 @@ void osnma_msg_receiver::process_mack_message() d_tags_awaiting_verify.insert(std::pair(mack->TOW, tag0)); // bool ret = verify_macseq(*mack); std::vector macseq_verified_tags = verify_macseq_new(*mack); - for (std::size_t i = 0; i < macseq_verified_tags.size(); ++i) + for (auto & tag_and_info : macseq_verified_tags) { // add tags of current mack to the verification queue - auto& tag_and_info = macseq_verified_tags[i]; Tag t(tag_and_info, mack->TOW, mack->WN, mack->PRNa, tag_and_info.counter); d_tags_awaiting_verify.insert(std::pair(mack->TOW, t)); LOG(INFO) << "Galileo OSNMA: Add Tag Id= " @@ -1080,7 +1081,8 @@ bool osnma_msg_receiver::verify_dsm_pkr(const DSM_PKR_message& message) const std::vector osnma_msg_receiver::compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const { - std::vector x_next, x_current = d_crypto->compute_SHA_256(m_i); + std::vector x_next; + std::vector x_current = d_crypto->compute_SHA_256(m_i); for (size_t i = 0; i < 4; i++) { x_next.clear(); @@ -1345,7 +1347,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO // truncate hash std::vector computed_key; computed_key.reserve(key.size()); - for (uint16_t i = 0; i < key.size(); i++) + for (size_t i = 0; i < key.size(); i++) { computed_key.push_back(hash[i]); } @@ -1520,7 +1522,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); m[4] = static_cast(d_GST_Sf & 0x000000FF); // Case tags flexible - Eq. 21 ICD - for (uint8_t i = 0; i < flxTags.size(); i++) + for (size_t i = 0; i < flxTags.size(); i++) { m[2 * i + 5] = mack.tag_and_info[flxTags[i]].tag_info.PRN_d; m[2 * i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | @@ -1548,7 +1550,6 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; return true; } - else { LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed"; @@ -1616,7 +1617,7 @@ bool osnma_msg_receiver::tag_has_key_available(const Tag& t) } -std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes) +std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes) { std::vector K_II = key; std::vector K_I; // result of the recursive hash operations @@ -1796,9 +1797,9 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ if (computed_macseq == mack.header.macseq) { LOG(INFO) << "Galileo OSNMA: MACSEQ verification :: SUCCESS :: FLX tags verification OK"; - for (uint8_t i = 0; i < flxTags.size(); i++) + for (uint8_t flxTag : flxTags) { - verified_tags.push_back(mack.tag_and_info[flxTags[i]]); + verified_tags.push_back(mack.tag_and_info[flxTag]); } return verified_tags; } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 148b1266e..f5881af07 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -94,7 +94,7 @@ private: std::vector get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const; std::vector compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; std::vector build_message(const Tag& tag); - std::vector hash_chain(uint32_t num_of_hashes_needed, std::vector key, uint32_t GST_SFi, const uint8_t lk_bytes); + std::vector hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes); std::vector verify_macseq_new(const MACK_message& mack); std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). From 8fd6e4dc4015b175e9102abc9ccee64437dbde60 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Jul 2024 09:46:28 +0200 Subject: [PATCH 253/499] Improve const correctness --- src/core/libs/osnma_msg_receiver.cc | 75 +++++++++++++++++++++-------- src/core/libs/osnma_msg_receiver.h | 13 ++--- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 8a12c6d42..0688af6e9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1123,7 +1123,7 @@ std::vector osnma_msg_receiver::get_merkle_tree_leaves(const DSM_PKR_me } -bool osnma_msg_receiver::verify_tag(const Tag& tag) +bool osnma_msg_receiver::verify_tag(const Tag& tag) const { // Debug // LOG(INFO) << "Galileo OSNMA: Tag verification :: Start for tag Id= " @@ -1137,12 +1137,28 @@ bool osnma_msg_receiver::verify_tag(const Tag& tag) std::vector applicable_key; if (tag.ADKD == 0 || tag.ADKD == 4) { - applicable_key = d_tesla_keys[tag.TOW + 30]; + const auto it = d_tesla_keys.find(tag.TOW + 30); + if(it != d_tesla_keys.cend()) + { + applicable_key = it->second; + } + else + { + return false; + } // LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 30); } else // ADKD 12 { - applicable_key = d_tesla_keys[tag.TOW + 330]; + const auto it = d_tesla_keys.find(tag.TOW + 330); + if(it != d_tesla_keys.cend()) + { + applicable_key = it->second; + } + else + { + return false; + } // LOG(INFO) << "|---> Galileo OSNMA :: applicable key: 0x" << d_helper->convert_to_hex_string(applicable_key) << "TOW="<(tag.TOW + 330); } @@ -1222,7 +1238,7 @@ bool osnma_msg_receiver::verify_tag(const Tag& tag) } -std::vector osnma_msg_receiver::build_message(const Tag& tag) +std::vector osnma_msg_receiver::build_message(const Tag& tag) const { std::vector m; if (tag.CTR != 1) @@ -1245,12 +1261,28 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) std::vector applicable_nav_data_bytes; if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. { - applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].ephemeris_iono_vector_2; + const auto it = d_satellite_nav_data.find(tag.PRN_d); + if (it != d_satellite_nav_data.cend()) + { + const auto it2 = it->second.find(tag.TOW - 30); + if (it2 != it->second.cend()) + { + applicable_nav_data = it2->second.ephemeris_iono_vector_2; + } + } // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else if (tag.ADKD == 4) { - applicable_nav_data = d_satellite_nav_data[tag.PRN_d][tag.TOW - 30].utc_vector_2; + const auto it = d_satellite_nav_data.find(tag.PRN_d); + if (it != d_satellite_nav_data.cend()) + { + const auto it2 = it->second.find(tag.TOW - 30); + if (it2 != it->second.cend()) + { + applicable_nav_data = it2->second.utc_vector_2; + } + } // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else @@ -1327,10 +1359,10 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO uint32_t GST_SFi = d_receiver_time - 30; // GST of target key is to be used. std::vector hash; const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; - // std::vector validated_key; + std::vector validated_key; if (d_tesla_key_verified) { // have to go up to last verified key - d_validated_key = d_tesla_keys.rbegin()->second; + validated_key = d_tesla_keys.rbegin()->second; num_of_hashes_needed = (d_receiver_time - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key"; @@ -1338,7 +1370,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO } else { // have to go until Kroot - d_validated_key = d_osnma_data.d_dsm_kroot_message.kroot; + validated_key = d_osnma_data.d_dsm_kroot_message.kroot; num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 IC LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) need to be performed up to Kroot"; @@ -1351,7 +1383,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO { computed_key.push_back(hash[i]); } - if (computed_key == d_validated_key && num_of_hashes_needed > 0) + if (computed_key == validated_key && num_of_hashes_needed > 0) { LOG(INFO) << "Galileo OSNMA: TESLA key verification :: SUCCESS!"; std::cout << "Galileo OSNMA: TESLA key verification :: SUCCESS!" << std::endl; @@ -1494,7 +1526,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) std::vector flxTags{}; std::string tempADKD; // MACLT verification - for (uint8_t i = 0; i < mack.tag_and_info.size(); i++) + for (size_t i = 0; i < mack.tag_and_info.size(); i++) { tempADKD = applicable_sequence[i + 1]; if (tempADKD == "FLX") @@ -1558,14 +1590,14 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } -bool osnma_msg_receiver::tag_has_nav_data_available(const Tag& t) +bool osnma_msg_receiver::tag_has_nav_data_available(const Tag& t) const { auto prn_it = d_satellite_nav_data.find(t.PRN_d); if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map //LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; - std::map& tow_map = prn_it->second; + std::map tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW - 30); if (tow_it != tow_map.end()) { @@ -1587,7 +1619,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(const Tag& t) } -bool osnma_msg_receiver::tag_has_key_available(const Tag& t) +bool osnma_msg_receiver::tag_has_key_available(const Tag& t) const { // check adkd of tag // if adkd = 0 or 4 => look for d_tesla_keys[t.TOW+30] @@ -1617,7 +1649,7 @@ bool osnma_msg_receiver::tag_has_key_available(const Tag& t) } -std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes) +std::vector osnma_msg_receiver::hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes) const { std::vector K_II = key; std::vector K_I; // result of the recursive hash operations @@ -1705,8 +1737,13 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ std::vector verified_tags{}; // MACSEQ verification - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. - std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe + d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received. + std::vector applicable_key; + const auto key_it = d_tesla_keys.find(mack.TOW + 30); // current tesla key ie transmitted in the next subframe + if (key_it != d_tesla_keys.cend()) + { + applicable_key = key_it->second; + } std::vector sq1{}; std::vector sq2{}; std::vector applicable_sequence; @@ -1734,7 +1771,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ std::vector flxTags{}; std::string tempADKD; // MACLT verification - for (uint8_t i = 0; i < mack.tag_and_info.size(); i++) + for (size_t i = 0; i < mack.tag_and_info.size(); i++) { tempADKD = applicable_sequence[i + 1]; if (tempADKD == "FLX") @@ -1771,7 +1808,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); m[4] = static_cast(d_GST_Sf & 0x000000FF); // Case tags flexible - Eq. 21 ICD - for (uint8_t i = 0; i < flxTags.size(); i++) + for (size_t i = 0; i < flxTags.size(); i++) { m[2 * i + 5] = mack.tag_and_info[flxTags[i]].tag_info.PRN_d; m[2 * i + 6] = mack.tag_and_info[flxTags[i]].tag_info.ADKD << 4 | diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index f5881af07..7ecbe7428 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -82,19 +82,17 @@ private: void control_tags_awaiting_verify_size(); void display_data(); - bool verify_tag(MACK_tag_and_info tag_and_info, OSNMA_data applicable_OSNMA, uint8_t tag_position, const std::vector& applicable_key, NavData applicable_NavData); bool verify_tesla_key(std::vector& key, uint32_t TOW); - bool verify_tag(const Tag& tag); - bool is_next_subframe(); - bool tag_has_nav_data_available(const Tag& t); - bool tag_has_key_available(const Tag& t); + bool verify_tag(const Tag& tag) const; + bool tag_has_nav_data_available(const Tag& t) const; + bool tag_has_key_available(const Tag& t) const; bool verify_macseq(const MACK_message& mack); bool verify_dsm_pkr(const DSM_PKR_message& message) const; std::vector get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const; std::vector compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; - std::vector build_message(const Tag& tag); - std::vector hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes); + std::vector build_message(const Tag& tag) const; + std::vector hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes) const; std::vector verify_macseq_new(const MACK_message& mack); std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). @@ -102,7 +100,6 @@ private: std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW std::vector d_tags_to_verify{0, 4, 12}; - std::vector d_validated_key{}; std::vector d_macks_awaiting_MACSEQ_verification; std::array, 16> d_dsm_message{}; // structure for recording DSM blocks, when filled it sends them to parse and resets itself. From d0a1825c24b937b99faeb1c99836c1b3c00bfb1a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Jul 2024 12:52:06 +0200 Subject: [PATCH 254/499] Fix defects detected by clang-tidy --- src/core/system_parameters/gnss_crypto.cc | 4 +- src/core/system_parameters/osnma_helper.cc | 71 ++++++++++++++-------- 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 12828cdca..9ff183ed3 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -305,7 +305,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag } else { - unsigned long errCode = ERR_get_error(); + uint64_t errCode = ERR_get_error(); char* err = ERR_error_string(errCode, nullptr); LOG(WARNING) << "OpenSSL: OSNMA message authentication failed: " << err; } @@ -1273,7 +1273,7 @@ bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) // Read the data from the memory buffer char* bio_data; - long data_len = BIO_get_mem_data(mem_bio, &bio_data); + int64_t data_len = BIO_get_mem_data(mem_bio, &bio_data); // Create a new memory buffer and load the data into it BIO* mem_bio2 = BIO_new_mem_buf(bio_data, data_len); diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 2002c72ca..6a7876f02 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -1,17 +1,17 @@ /*! -* \file osnma_helper.h -* \brief Class for auxiliary osnma functions -* \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- + * \file osnma_helper.h + * \brief Class for auxiliary osnma functions + * \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- */ #include "osnma_helper.h" @@ -26,6 +26,7 @@ uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const return GST; } + std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const { std::vector res; @@ -37,6 +38,7 @@ std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const return res; } + /** * @brief Convert a binary string to a vector of bytes. * @@ -47,7 +49,8 @@ std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const * @param binaryString The binary string to be converted. * @return The vector of bytes converted from the binary string. */ -std::vector Osnma_Helper::bytes(const std::string& binaryString) const { +std::vector Osnma_Helper::bytes(const std::string& binaryString) const +{ std::vector bytes; // Determine the size of the padding needed. @@ -55,12 +58,14 @@ std::vector Osnma_Helper::bytes(const std::string& binaryString) const std::string padded_binary = binaryString; - if (padding_size != 0) { - padding_size = 8 - padding_size; // Compute padding size + if (padding_size != 0) + { + padding_size = 8 - padding_size; // Compute padding size padded_binary.append(padding_size, '0'); // Append zeros to the binary string } - for (size_t i = 0; i < padded_binary.size(); i += 8) { + for (size_t i = 0; i < padded_binary.size(); i += 8) + { uint8_t byte = std::bitset<8>(padded_binary.substr(i, 8)).to_ulong(); bytes.push_back(byte); } @@ -68,37 +73,49 @@ std::vector Osnma_Helper::bytes(const std::string& binaryString) const return bytes; } + std::string Osnma_Helper::verification_status_str(const int& status) const { - switch (status) { - case 0: return "SUCCESS"; - case 1: return "FAIL"; - case 2: return "UNVERIFIED"; - default: return "UNKNOWN"; - } + switch (status) + { + case 0: + return "SUCCESS"; + case 1: + return "FAIL"; + case 2: + return "UNVERIFIED"; + default: + return "UNKNOWN"; + } } + + std::string Osnma_Helper::convert_to_hex_string(const std::vector& vector) const { std::stringstream ss; ss << std::hex << std::setfill('0'); - for (auto byte : vector) { + for (auto byte : vector) + { ss << std::setw(2) << static_cast(byte); } return ss.str(); } + std::vector Osnma_Helper::convert_from_hex_string(const std::string& hex_string) const { std::vector result; std::string adjusted_hex_string = hex_string; - if (hex_string.length() % 2 != 0) { + if (hex_string.length() % 2 != 0) + { adjusted_hex_string = "0" + hex_string; } - for (std::size_t i = 0; i < adjusted_hex_string.length(); i += 2) { + for (std::size_t i = 0; i < adjusted_hex_string.length(); i += 2) + { std::string byte_string = adjusted_hex_string.substr(i, 2); - uint8_t byte = static_cast(std::stoul(byte_string, nullptr, 16)); + auto byte = static_cast(std::stoul(byte_string, nullptr, 16)); result.push_back(byte); } From 6ae7684ba7e60adab9ea79fc8dc6c05630318a8b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 22 Jul 2024 12:59:54 +0200 Subject: [PATCH 255/499] Fix const correctness --- src/core/system_parameters/osnma_helper.cc | 2 +- src/core/system_parameters/osnma_helper.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 6a7876f02..f8650ed3f 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -74,7 +74,7 @@ std::vector Osnma_Helper::bytes(const std::string& binaryString) const } -std::string Osnma_Helper::verification_status_str(const int& status) const +std::string Osnma_Helper::verification_status_str(int status) const { switch (status) { diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 761306efc..686ef5e99 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -29,7 +29,7 @@ public: uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString) const; - std::string verification_status_str(const int& status) const; + std::string verification_status_str(int status) const; std::string convert_to_hex_string(const std::vector& vector) const ; std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto }; From 39f94dcbe69559fb235d161b90467ee292a864e5 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Jul 2024 11:16:45 +0200 Subject: [PATCH 256/499] Code cleaning --- .../galileo_telemetry_decoder_gs.cc | 28 +- .../galileo_telemetry_decoder_gs.h | 3 - src/core/libs/osnma_msg_receiver.cc | 111 +++-- src/core/libs/osnma_msg_receiver.h | 4 +- .../system_parameters/galileo_inav_message.cc | 30 +- .../system_parameters/galileo_inav_message.h | 14 +- src/core/system_parameters/osnma_data.cc | 207 +++------- src/core/system_parameters/osnma_data.h | 62 ++- src/core/system_parameters/osnma_helper.h | 4 +- .../osnma/osnma_msg_receiver_test.cc | 379 +++++++++--------- 10 files changed, 360 insertions(+), 482 deletions(-) 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 a84db6946..4fe185501 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 @@ -369,6 +369,8 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // 1. De-interleave std::vector page_part_symbols_soft_value(frame_length); deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_soft_value.data()); + bool flag_osnma_adkd_4_gst = false; + bool flag_osnma_adkd_4_utc = false; // 2. Viterbi decoder // 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder) @@ -441,33 +443,31 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // 4. Push the new navigation data to the queues // extract OSNMA bits, reset container. bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; - if(check_size_is_ok) + if (check_size_is_ok) { - std::cout << "Galileo OSNMA: new ADKD=0/12 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW5() - 25 <>( // < PRNd , navDataBits, TOW_Sosf> + DLOG(INFO) << "Galileo OSNMA: new ADKD=0/12 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW5() - 25; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> d_satellite.get_PRN(), d_inav_nav.get_osnma_adkd_0_12_nav_bits(), d_inav_nav.get_TOW5() - 25); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); - LOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d="<< static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) <<")";//: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); + DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" << static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); d_inav_nav.reset_osnma_nav_bits_adkd0_12(); } check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; - if(check_size_is_ok) + if (check_size_is_ok) { - std::cout << "Galileo OSNMA: new ADKD=4 navData from " << d_satellite <<" at TOW_sf=" << d_inav_nav.get_TOW6() - 5 <>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe + DLOG(INFO) << "Galileo OSNMA: new ADKD=4 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW6() - 5; + const auto tmp_obj = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe d_satellite.get_PRN(), d_inav_nav.get_osnma_adkd_4_nav_bits(), d_inav_nav.get_TOW6() - 5); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - LOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d="<< static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) <<")";//: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); + DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" << static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); d_inav_nav.reset_osnma_nav_bits_adkd4(); } - if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) { // get object for this SV (mandatory) @@ -499,8 +499,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); d_first_eph_sent = true; // do not send reduced CED anymore, since we have the full ephemeris set - -// d_flag_osnma_adkd_0_12 = true; // W1-> W5 available } else { @@ -586,7 +584,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_delta_t = tmp_obj->A_0G + tmp_obj->A_1G * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G), 64.0))); DLOG(INFO) << "delta_t=" << d_delta_t << "[s]"; - d_flag_osnma_adkd_4_utc = true; + flag_osnma_adkd_4_utc = true; } if (d_inav_nav.have_new_almanac() == true) // flag_almanac_4 tells if W10 available. @@ -621,11 +619,11 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms; DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); - d_flag_osnma_adkd_4_gst = true; + flag_osnma_adkd_4_gst = true; } // get osnma message if the needed nav data is available - bool adkd_4_nav_data_available = d_flag_osnma_adkd_4_utc && d_flag_osnma_adkd_4_gst; // supposition: data did not change bt. flags reset and now. + bool adkd_4_nav_data_available = flag_osnma_adkd_4_utc && flag_osnma_adkd_4_gst; // supposition: data did not change bt. flags reset and now. // bool adkd_4_nav_data_available = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; // newApproach: let decoder decide when block starts and let it fill the data, and just check for length if(adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) 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 4b1725e8a..a6391a2e0 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 @@ -155,9 +155,6 @@ private: bool d_there_are_e1_channels; bool d_there_are_e6_channels; bool d_use_ced; - bool d_flag_osnma_adkd_0_12; // flag to indicate if the ephemeris is complete for OSNMA processing - bool d_flag_osnma_adkd_4_gst; // flag to indicate if the GST conversion parameters are complete for OSNMA processing - bool d_flag_osnma_adkd_4_utc; // flag to indicate if the iono correction and time is complete for OSNMA processing }; diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 0688af6e9..701f358c9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -25,13 +25,15 @@ #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" #include // for gr::io_signature::make +#include #include #include #include // for std::setfill #include // for std::hex, std::uppercase #include -#include // for std::accumulate -#include // std::stringstream +#include // for std::accumulate +#include // std::stringstream +#include #include // for typeid #include @@ -104,12 +106,12 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) std::ostringstream output_message; output_message << "Galileo OSNMA: data received starting at " - << "WN=" - << nma_msg->WN_sf0 - << ", TOW=" - << nma_msg->TOW_sf0 - << ", from satellite " - << sat; + << "WN=" + << nma_msg->WN_sf0 + << ", TOW=" + << nma_msg->TOW_sf0 + << ", from satellite " + << sat; LOG(INFO) << output_message.str(); std::cout << output_message.str() << std::endl; @@ -126,15 +128,15 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // iono data => 549 bits, utc data, 141 bits. if (nav_data.size() == 549) { - // LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " + // LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 OSNMA_NavData, PRN_d (" << PRNa << ") " // << "TOW_sf=" << TOW; - d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = nav_data; + d_satellite_nav_data[PRNa][TOW].set_ephemeris_iono_data(nav_data); } else if (nav_data.size() == 141) { - // LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " + // LOG(INFO) << "Galileo OSNMA: received ADKD=4 OSNMA_NavData, PRN_d (" << PRNa << ") " // << "TOW_sf=" << TOW; - d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; + d_satellite_nav_data[PRNa][TOW].set_utc_data(nav_data); } else { @@ -488,11 +490,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; local_time_verification(osnma_msg); - if(l_ds_bits == 512) + if (l_ds_bits == 512) { d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); } - else if(l_ds_bits == 1056) + else if (l_ds_bits == 1056) { d_kroot_verified = d_crypto->verify_signature_ecdsa_p521(message, d_osnma_data.d_dsm_kroot_message.ds); } @@ -614,11 +616,11 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN; // FIXME this is ugly. d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; @@ -626,7 +628,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr no need to verify + if (d_tesla_keys.find(d_osnma_data.d_nav_data.get_tow_sf0()) == d_tesla_keys.end()) // check if already available => no need to verify { - bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.TOW_sf0); + bool retV = verify_tesla_key(d_osnma_data.d_mack_message.key, d_osnma_data.d_nav_data.get_tow_sf0()); if (retV) { - d_tesla_keys.insert(std::pair>(d_osnma_data.d_nav_data.TOW_sf0, d_osnma_data.d_mack_message.key)); + d_tesla_keys.insert(std::pair>(d_osnma_data.d_nav_data.get_tow_sf0(), d_osnma_data.d_mack_message.key)); } } @@ -924,11 +926,11 @@ void osnma_msg_receiver::process_mack_message() if (d_tesla_keys.find(mack->TOW + 30) != d_tesla_keys.end()) { // add tag0 first - Tag tag0 (*mack); + Tag tag0(*mack); d_tags_awaiting_verify.insert(std::pair(mack->TOW, tag0)); -// bool ret = verify_macseq(*mack); + // bool ret = verify_macseq(*mack); std::vector macseq_verified_tags = verify_macseq_new(*mack); - for (auto & tag_and_info : macseq_verified_tags) + for (auto& tag_and_info : macseq_verified_tags) { // add tags of current mack to the verification queue Tag t(tag_and_info, mack->TOW, mack->WN, mack->PRNa, tag_and_info.counter); @@ -948,7 +950,6 @@ void osnma_msg_receiver::process_mack_message() } LOG(INFO) << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size(); mack = d_macks_awaiting_MACSEQ_verification.erase(mack); - } else { @@ -969,7 +970,7 @@ void osnma_msg_receiver::process_mack_message() /* TODO - take into account: * - COP: if * - ADKD type - * - NavData the tag verifies (min. number of bits verified to consider NavData OK) + * - OSNMA_NavData the tag verifies (min. number of bits verified to consider OSNMA_NavData OK) * */ if (ret) { @@ -1020,7 +1021,7 @@ void osnma_msg_receiver::process_mack_message() << static_cast(it.second.PRN_d) << std::endl; } } - else if (it.second.TOW > d_osnma_data.d_nav_data.TOW_sf0) + else if (it.second.TOW > d_osnma_data.d_nav_data.get_tow_sf0()) { // TODO - I dont understand logic. This needs to be reviewed. // case 1: adkd=12 and t.Tow + 300 < current TOW @@ -1059,7 +1060,7 @@ void osnma_msg_receiver::process_mack_message() */ bool osnma_msg_receiver::verify_dsm_pkr(const DSM_PKR_message& message) const { - const auto base_leaf = get_merkle_tree_leaves(message); // m_i + const auto base_leaf = get_merkle_tree_leaves(message); // m_i const auto computed_merkle_root = compute_merkle_root(message, base_leaf); // x_4_0 const auto msg_id = static_cast(message.mid); LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: leaf provided for Message ID " << msg_id; @@ -1110,7 +1111,7 @@ std::vector osnma_msg_receiver::compute_merkle_root(const DSM_PKR_messa std::vector osnma_msg_receiver::get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const { - // build base leaf m_i according to OSNMA SIS ICD v1.1, section 6.2 DSM-PKR Verification + // build base leaf m_i according to OSNMA SIS ICD v1.1, section 6.2 DSM-PKR Verification std::vector m_i; const size_t size_npk = dsm_pkr_message.npk.size(); m_i.reserve(1 + size_npk); @@ -1138,7 +1139,7 @@ bool osnma_msg_receiver::verify_tag(const Tag& tag) const if (tag.ADKD == 0 || tag.ADKD == 4) { const auto it = d_tesla_keys.find(tag.TOW + 30); - if(it != d_tesla_keys.cend()) + if (it != d_tesla_keys.cend()) { applicable_key = it->second; } @@ -1151,7 +1152,7 @@ bool osnma_msg_receiver::verify_tag(const Tag& tag) const else // ADKD 12 { const auto it = d_tesla_keys.find(tag.TOW + 330); - if(it != d_tesla_keys.cend()) + if (it != d_tesla_keys.cend()) { applicable_key = it->second; } @@ -1212,26 +1213,6 @@ bool osnma_msg_receiver::verify_tag(const Tag& tag) const // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) { - LOG(INFO) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" - << tag.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << tag.received_tag << std::dec - << ", TOW=" - << tag.TOW - << ", ADKD=" - << static_cast(tag.ADKD) - << ", PRNa=" - << static_cast(tag.PRNa) - << ", PRNd=" - << static_cast(tag.PRN_d); - std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" - << tag.tag_id - << ", ADKD=" - << static_cast(tag.ADKD) - << ", PRNa=" - << static_cast(tag.PRNa) - << ", PRNd=" - << static_cast(tag.PRN_d) << std::endl; return true; } return false; @@ -1267,7 +1248,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) const const auto it2 = it->second.find(tag.TOW - 30); if (it2 != it->second.cend()) { - applicable_nav_data = it2->second.ephemeris_iono_vector_2; + applicable_nav_data = it2->second.get_ephemeris_iono_data(); } } // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; @@ -1280,10 +1261,10 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) const const auto it2 = it->second.find(tag.TOW - 30); if (it2 != it->second.cend()) { - applicable_nav_data = it2->second.utc_vector_2; + applicable_nav_data = it2->second.get_utc_data(); } } - // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; + // LOG(INFO) << "|---> Galileo OSNMA :: applicable OSNMA_NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; } else { @@ -1292,7 +1273,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) const // convert std::string to vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); - // Convert and add NavData bytes into the message, taking care of that NMAS has only 2 bits + // Convert and add OSNMA_NavData bytes into the message, taking care of that NMAS has only 2 bits for (uint8_t byte : applicable_nav_data_bytes) { m.back() |= (byte >> 2); // First take the 6 MSB bits of byte and add to m @@ -1322,7 +1303,7 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) const } -void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) +void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const OSNMA_NavData& data) { // control size of container while (d_satellite_nav_data[SV_ID].size() >= 25) @@ -1596,8 +1577,8 @@ bool osnma_msg_receiver::tag_has_nav_data_available(const Tag& t) const if (prn_it != d_satellite_nav_data.end()) { // PRN was found, check if TOW exists in inner map - //LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; - std::map tow_map = prn_it->second; + // LOG(INFO) << "Galileo OSNMA: hasData = true " << std::endl; + std::map tow_map = prn_it->second; auto tow_it = tow_map.find(t.TOW - 30); if (tow_it != tow_map.end()) { @@ -1612,7 +1593,7 @@ bool osnma_msg_receiver::tag_has_nav_data_available(const Tag& t) const else { // PRN was not found - //LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; + // LOG(INFO) << "Galileo OSNMA: hasData = false " << std::endl; return false; } return false; @@ -1631,7 +1612,7 @@ bool osnma_msg_receiver::tag_has_key_available(const Tag& t) const auto it = d_tesla_keys.find(t.TOW + 30); if (it != d_tesla_keys.end()) { - //LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; + // LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } @@ -1640,11 +1621,11 @@ bool osnma_msg_receiver::tag_has_key_available(const Tag& t) const auto it = d_tesla_keys.find(t.TOW + 330); if (it != d_tesla_keys.end()) { - //LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; + // LOG(INFO) << "Galileo OSNMA: hasKey = true " << std::endl; return true; } } - //LOG(INFO) << "Galileo OSNMA: hasKey = false "; + // LOG(INFO) << "Galileo OSNMA: hasKey = false "; return false; } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 7ecbe7428..40ac73e78 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -77,7 +77,7 @@ private: void read_mack_header(); void read_mack_body(); void process_mack_message(); - void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data); + void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const OSNMA_NavData& data); void remove_verified_tags(); void control_tags_awaiting_verify_size(); void display_data(); @@ -95,7 +95,7 @@ private: std::vector hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes) const; std::vector verify_macseq_new(const MACK_message& mack); - std::map> d_satellite_nav_data; // map holding NavData sorted by SVID (first key) and TOW (second key). + std::map> d_satellite_nav_data; // map holding OSNMA_NavData sorted by SVID (first key) and TOW (second key). std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index a8509db23..c5ddcbfaa 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -185,7 +185,7 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even if (page_position_in_inav_subframe != 255) { if (page_position_in_inav_subframe == 0) - { // TODO - is it redundant? receiving Word 2 already resets this + { // TODO - is it redundant? receiving Word 2 already resets this nma_position_filled = std::array{}; nma_msg.mack = std::array{}; nma_msg.hkroot = std::array{}; @@ -215,6 +215,7 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even } } + // C: tells if W1-->W4 available from same blcok bool Galileo_Inav_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class { @@ -349,6 +350,7 @@ bool Galileo_Inav_Message::have_new_ephemeris() // Check if we have a new ephem return false; } + // C: tells if W5 is available bool Galileo_Inav_Message::have_new_iono_and_GST() // Check if we have a new iono data set stored in the galileo navigation class { @@ -361,6 +363,7 @@ bool Galileo_Inav_Message::have_new_iono_and_GST() // Check if we have a new io return false; } + // C: tells if W6 is available bool Galileo_Inav_Message::have_new_utc_model() // Check if we have a new utc data set stored in the galileo navigation class { @@ -373,13 +376,14 @@ bool Galileo_Inav_Message::have_new_utc_model() // Check if we have a new utc d return false; } + // flag_almanac_4 tells if W10 available. bool Galileo_Inav_Message::have_new_almanac() // Check if we have a new almanac data set stored in the galileo navigation class { -// if(flag_almanac_4) -// { -// flag_adkd_4_complete = true; -// } + // if(flag_almanac_4) + // { + // flag_adkd_4_complete = true; + // } if ((flag_almanac_1 == true) and (flag_almanac_2 == true) and (flag_almanac_3 == true) and (flag_almanac_4 == true)) { // All Almanac data have been received @@ -618,7 +622,7 @@ void Galileo_Inav_Message::read_page_1(const std::bitset& DLOG(INFO) << "A_1= " << A_1; flag_ephemeris_1 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_1 = data_bits.to_string().substr(6,120); + nav_bits_word_1 = data_bits.to_string().substr(6, 120); } @@ -640,7 +644,7 @@ void Galileo_Inav_Message::read_page_2(const std::bitset& DLOG(INFO) << "iDot_2= " << iDot_2; flag_ephemeris_2 = true; DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_2 = data_bits.to_string().substr(6,120); + nav_bits_word_2 = data_bits.to_string().substr(6, 120); } @@ -1058,7 +1062,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) flag_utc_model = true; // set to false externally flag_TOW_set = true; // set to false externally DLOG(INFO) << "flag_tow_set" << flag_TOW_set; - nav_bits_word_6 = data_jk_bits.to_string().substr(6, 99); + nav_bits_word_6 = data_jk_bits.to_string().substr(6, 99); break; case 7: // Word type 7: Almanac for SVID1 (1/2), almanac reference time and almanac reference week number @@ -1417,7 +1421,7 @@ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 25;//- 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start TODO review + int32_t TOW_sf0 = TOW_5 - 25; //- 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start TODO review if (TOW_sf0 < 0) { TOW_sf0 += 604800; @@ -1442,17 +1446,23 @@ bool Galileo_Inav_Message::have_new_nma() return false; } } + + std::string Galileo_Inav_Message::get_osnma_adkd_4_nav_bits() { nav_bits_adkd_4 = nav_bits_word_6 + nav_bits_word_10; return nav_bits_adkd_4; } + + std::string Galileo_Inav_Message::get_osnma_adkd_0_12_nav_bits() { nav_bits_adkd_0_12 = nav_bits_word_1 + nav_bits_word_2 + nav_bits_word_3 + nav_bits_word_4 + nav_bits_word_5; return nav_bits_adkd_0_12; } + + void Galileo_Inav_Message::reset_osnma_nav_bits_adkd0_12() { nav_bits_word_1 = ""; @@ -1461,6 +1471,8 @@ void Galileo_Inav_Message::reset_osnma_nav_bits_adkd0_12() nav_bits_word_4 = ""; nav_bits_word_5 = ""; } + + void Galileo_Inav_Message::reset_osnma_nav_bits_adkd4() { nav_bits_word_6 = ""; diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index a4cc6a31a..2ecb8aa53 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -49,17 +49,15 @@ public: std::array mack{}; std::array hkroot{}; uint32_t PRN{}; - uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already + uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already uint32_t TOW_sf0{}; - std::vector EphemerisClockAndStatusData {}; // TODO _2 rename and substitute this + std::vector EphemerisClockAndStatusData{}; // TODO _2 rename and substitute this std::string EphemerisClockAndStatusData_2{}; - std::vector TimingData {}; + std::vector TimingData{}; std::string TimingData_2{}; - Galileo_Ephemeris EphemerisData {}; - Galileo_Iono IonoData {}; - Galileo_Utc_Model UtcModelData {}; - - + Galileo_Ephemeris EphemerisData{}; + Galileo_Iono IonoData{}; + Galileo_Utc_Model UtcModelData{}; }; /*! diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 49051b7be..91a32a1f3 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -1,172 +1,55 @@ /*! -* \file osnma_data.cc -* \brief Class for Galileo OSNMA data storage -* \author Carles Fernandez-Prades, 2020-2023 cfernandez(at)cttc.es -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ - -#include "osnma_data.h" -#include -#include - -/** - * @brief Constructs a NavData object with the given osnma_msg. - * \details Packs the ephemeris, iono and utc data from the current subframe into the NavData structure. It also gets the PRNa and the GST. - * @param osnma_msg The shared pointer to the OSNMA_msg object. + * \file osnma_data.cc + * \brief Class for Galileo OSNMA data storage + * \author Carles Fernandez-Prades, 2020-2023 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- */ +#include "osnma_data.h" + uint32_t Tag::id_counter = 0; -void NavData::init(const std::shared_ptr &osnma_msg) + + +void OSNMA_NavData::init(const std::shared_ptr& osnma_msg) { - EphemerisData = osnma_msg->EphemerisData; - IonoData = osnma_msg->IonoData; - UtcData = osnma_msg->UtcModelData; - generate_eph_iono_vector(); - generate_utc_vector(); - PRNa = osnma_msg->PRN; - WN_sf0 = osnma_msg->WN_sf0; - TOW_sf0 = osnma_msg->TOW_sf0; - - // new parsing, directly parsing bits -// ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; -// utc_vector_2 = osnma_msg->TimingData_2; -}; -void NavData::generate_eph_iono_vector() -{ - ephemeris_iono_vector.clear(); - uint64_t bit_buffer = 0; // variable to store the bits to be extracted, it can contain bits from different variables - int bit_count = 0; // Number of bits in the buffer, i.e. to be extracted - - // create structure to hold the variables to store into the vector along with their bit size - std::vector> variables = { - // data from word type 1 - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - {static_cast(&EphemerisData.toe), sizeof(EphemerisData.toe) * 8}, - {static_cast(&EphemerisData.M_0), sizeof(EphemerisData.M_0) * 8}, - {static_cast(&EphemerisData.ecc), sizeof(EphemerisData.ecc) * 8}, - {static_cast(&EphemerisData.sqrtA), sizeof(EphemerisData.sqrtA) * 8}, - // data from word type 2 - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - {static_cast(&EphemerisData.OMEGA_0), sizeof(EphemerisData.OMEGA_0) * 8}, - {static_cast(&EphemerisData.i_0), sizeof(EphemerisData.i_0) * 8}, - {static_cast(&EphemerisData.omega), sizeof(EphemerisData.omega) * 8}, - {static_cast(&EphemerisData.idot), sizeof(EphemerisData.idot) * 8}, - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - // data from word type 3 - {static_cast(&EphemerisData.OMEGAdot), sizeof(EphemerisData.OMEGAdot) * 8}, - {static_cast(&EphemerisData.delta_n), sizeof(EphemerisData.delta_n) * 8}, - {static_cast(&EphemerisData.Cuc), sizeof(EphemerisData.Cuc) * 8}, - {static_cast(&EphemerisData.Cus), sizeof(EphemerisData.Cus) * 8}, - {static_cast(&EphemerisData.Crc), sizeof(EphemerisData.Crc) * 8}, - {static_cast(&EphemerisData.Crs), sizeof(EphemerisData.Crs) * 8}, - {static_cast(&EphemerisData.SISA), sizeof(EphemerisData.SISA) * 8}, - // data from word type 4 - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - {static_cast(&EphemerisData.PRN), sizeof(EphemerisData.PRN) * 8}, - {static_cast(&EphemerisData.Cic), sizeof(EphemerisData.Cic) * 8}, - {static_cast(&EphemerisData.Cis), sizeof(EphemerisData.Cis) * 8}, - {static_cast(&EphemerisData.toe), sizeof(EphemerisData.toe) * 8}, - {static_cast(&EphemerisData.af0), sizeof(EphemerisData.af0) * 8}, - {static_cast(&EphemerisData.af1), sizeof(EphemerisData.af1) * 8}, - {static_cast(&EphemerisData.af2), sizeof(EphemerisData.af2) * 8}, - // data from word type 5 - {static_cast(&IonoData.ai0), sizeof(IonoData.ai0) * 8}, - {static_cast(&IonoData.ai1), sizeof(IonoData.ai1) * 8}, - {static_cast(&IonoData.ai2), sizeof(IonoData.ai2) * 8}, - {static_cast(&IonoData.Region1_flag), sizeof(IonoData.Region1_flag) * 8}, - {static_cast(&IonoData.Region2_flag), sizeof(IonoData.Region2_flag) * 8}, - {static_cast(&IonoData.Region3_flag), sizeof(IonoData.Region3_flag) * 8}, - {static_cast(&IonoData.Region4_flag), sizeof(IonoData.Region4_flag) * 8}, - {static_cast(&IonoData.Region5_flag), sizeof(IonoData.Region5_flag) * 8}, - {static_cast(&EphemerisData.BGD_E1E5a), sizeof(EphemerisData.BGD_E1E5a) * 8}, - {static_cast(&EphemerisData.BGD_E1E5b), sizeof(EphemerisData.BGD_E1E5b) * 8}, - {static_cast(&EphemerisData.E5b_HS), sizeof(EphemerisData.E5b_HS) * 8}, - {static_cast(&EphemerisData.E1B_HS), sizeof(EphemerisData.E1B_HS) * 8}, - {static_cast(&EphemerisData.E5b_DVS), sizeof(EphemerisData.E5b_DVS) * 8}, - {static_cast(&EphemerisData.E1B_DVS), sizeof(EphemerisData.E1B_DVS) * 8}, - }; - - for (auto& var : variables) - { - // extract the bits from the variable - uint64_t binary_representation; - memcpy(&binary_representation, var.first, var.second / 8); - - // Append the bits to the buffer and update the bit count - bit_buffer = (bit_buffer << var.second) | binary_representation; - bit_count += var.second; - // While there are 8 or more bits in the buffer - while (bit_count >= 8) - { - // Extract the 8 bits starting from last bit position and add them to the vector - uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; - ephemeris_iono_vector.push_back(extracted_bits); - - // Remove the extracted bits from the buffer - bit_count -= 8; - bit_buffer = bit_buffer & ~(0xFF << bit_count); - } - - } - - // If there are any bits left in the buffer, add them to the vector - if (bit_count > 0) - { - ephemeris_iono_vector.push_back(static_cast(bit_buffer)); - } + d_TOW_sf0 = osnma_msg->TOW_sf0; } -void NavData::generate_utc_vector() + +std::string OSNMA_NavData::get_ephemeris_iono_data() const { - utc_vector.clear(); - uint64_t bit_buffer = 0; - int bit_count = 0; - - std::vector> variables = { - {static_cast(&UtcData.A0), sizeof(UtcData.A0) * 8}, - {static_cast(&UtcData.A1), sizeof(UtcData.A1) * 8}, - {static_cast(&UtcData.Delta_tLS), sizeof(UtcData.Delta_tLS) * 8}, - {static_cast(&UtcData.tot), sizeof(UtcData.tot) * 8}, - {static_cast(&UtcData.WNot), sizeof(UtcData.WNot) * 8}, - {static_cast(&UtcData.WN_LSF), sizeof(UtcData.WN_LSF) * 8}, - {static_cast(&UtcData.DN), sizeof(UtcData.DN) * 8}, - {static_cast(&UtcData.Delta_tLSF), sizeof(UtcData.Delta_tLSF) * 8}, - {static_cast(&UtcData.A_0G), sizeof(UtcData.A_0G) * 8}, - {static_cast(&UtcData.A_1G), sizeof(UtcData.A_1G) * 8}, - {static_cast(&UtcData.t_0G), sizeof(UtcData.t_0G) * 8}, - {static_cast(&UtcData.WN_0G), sizeof(UtcData.WN_0G) * 8}, - }; - - for (auto& var : variables) - { - uint64_t binary_representation; - memcpy(&binary_representation, var.first, var.second / 8); - - bit_buffer = (bit_buffer << var.second) | binary_representation; - bit_count += var.second; - - while (bit_count >= 8) - { - uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; - utc_vector.push_back(extracted_bits); - - bit_count -= 8; - bit_buffer = bit_buffer & ~(0xFF << bit_count); - } - } - - if (bit_count > 0) - { - utc_vector.push_back(static_cast(bit_buffer)); - } + return d_ephemeris_iono; } + +std::string OSNMA_NavData::get_utc_data() const +{ + return d_utc; +} + + +uint32_t OSNMA_NavData::get_tow_sf0() const +{ + return d_TOW_sf0; +} + + +void OSNMA_NavData::set_ephemeris_iono_data(const std::string& iono_data) +{ + d_ephemeris_iono = iono_data; +} + + +void OSNMA_NavData::set_utc_data(const std::string& utc_data) +{ + d_utc = utc_data; +} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 484fa0162..910ee3e2d 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -18,12 +18,10 @@ #ifndef GNSS_SDR_OSNMA_DATA_H #define GNSS_SDR_OSNMA_DATA_H -#include "galileo_ephemeris.h" -#include "galileo_inav_message.h" -#include "galileo_iono.h" -#include "galileo_utc_model.h" +#include "galileo_inav_message.h" // for OSNMA_msg #include #include +#include #include #include @@ -72,9 +70,9 @@ class MACK_tag_and_info { public: MACK_tag_and_info() = default; - uint64_t tag; // C: 20-40 bits + uint64_t tag; // C: 20-40 bits MACK_tag_info tag_info; - uint32_t counter; // CTR + uint32_t counter; // CTR }; class DSM_PKR_message @@ -107,7 +105,7 @@ public: uint8_t reserved1{}; uint8_t hf{}; uint8_t mf{}; - uint8_t ks{}; // key size, in bits + uint8_t ks{}; // key size, in bits uint8_t ts{}; uint8_t maclt{}; uint8_t reserved{}; @@ -121,31 +119,26 @@ public: MACK_header header; std::vector tag_and_info; std::vector key; - uint32_t TOW; // TODO duplicated variable, also in NavData + uint32_t TOW; // TODO duplicated variable, also in OSNMA_NavData uint32_t WN; uint32_t PRNa; }; -class NavData +class OSNMA_NavData { public: - NavData()=default; - void init(const std::shared_ptr &osnma_msg); - std::vector ephemeris_iono_vector{}; - std::string ephemeris_iono_vector_2{}; - std::vector utc_vector{}; - std::string utc_vector_2{}; - uint32_t PRNa{}; - uint32_t WN_sf0{}; - uint32_t TOW_sf0{}; + OSNMA_NavData() = default; + void init(const std::shared_ptr& osnma_msg); + std::string get_ephemeris_iono_data() const; + std::string get_utc_data() const; + uint32_t get_tow_sf0() const; + void set_ephemeris_iono_data(const std::string& iono_data); + void set_utc_data(const std::string& utc_data); + private: - Galileo_Ephemeris EphemerisData; - Galileo_Iono IonoData; - Galileo_Utc_Model UtcData; - void generate_eph_iono_vector(); // TODO pass data directly fro Telemetry Decoder (if bits are in the needed order) - void generate_utc_vector(); // TODO - - + std::string d_ephemeris_iono; + std::string d_utc; + uint32_t d_TOW_sf0{}; }; /*! @@ -161,19 +154,22 @@ public: DSM_PKR_message d_dsm_pkr_message; DSM_KROOT_message d_dsm_kroot_message; MACK_message d_mack_message; - NavData d_nav_data; + OSNMA_NavData d_nav_data; }; + class Tag { public: - enum e_verification_status{ + enum e_verification_status + { SUCCESS, FAIL, - UNVERIFIED}; - Tag(const MACK_tag_and_info& MTI, uint32_t TOW,uint32_t WN, uint32_t PRNa,uint8_t CTR) // standard tag constructor, for tags within Tag&Info field + UNVERIFIED + }; + Tag(const MACK_tag_and_info& MTI, uint32_t TOW, uint32_t WN, uint32_t PRNa, uint8_t CTR) // standard tag constructor, for tags within Tag&Info field : tag_id(id_counter++), - TOW(TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing + TOW(TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, OSNMA_NavData missing WN(WN), PRNa(PRNa), CTR(CTR), @@ -186,16 +182,16 @@ public: skipped(0) { } - Tag(const MACK_message& mack) // constructor for Tag0 + Tag(const MACK_message& mack) // constructor for Tag0 : tag_id(id_counter++), - TOW(mack.TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, NavData missing + TOW(mack.TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, OSNMA_NavData missing WN(mack.WN), PRNa(mack.PRNa), CTR(1), status(UNVERIFIED), received_tag(mack.header.tag0), computed_tag(0), - PRN_d(mack.PRNa), // Tag0 are self-authenticating + PRN_d(mack.PRNa), // Tag0 are self-authenticating ADKD(0), cop(mack.header.cop), skipped(0) diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 686ef5e99..07a3c457f 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -30,8 +30,8 @@ public: std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString) const; std::string verification_status_str(int status) const; - std::string convert_to_hex_string(const std::vector& vector) const ; - std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto + std::string convert_to_hex_string(const std::vector& vector) const; + std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index d0df27a3b..5f1efcee3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -1,13 +1,31 @@ +/*! + * \file osmna_msg_receiver_testt.cc + * \brief Tests for the osnma_msg_receiver class. + * \author Carles Fernandez, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "gnss_crypto.h" +#include "osnma_helper.h" +#include "osnma_msg_receiver.h" #include #include #include #include -#include #include #if USE_GLOG_AND_GFLAGS -#include "osnma_helper.h" -#include "gnss_crypto.h" #include // for LOG #include #else @@ -21,11 +39,18 @@ struct TestVector std::vector navBits; }; + // TODO - parametrize class for different configurations (config_1, config_2, etc.. potentially 5 or 6 more) an make sure wont affect current TEST_F // note: until the test is parametrized for configuration 1 and 2, in order to change between them you have to comment/uncomment the respective calls in this test, identified with comments // conf. 1/2 // log_name, input_time, crtFilePath, merkleFilePath, testVectors class OsnmaMsgReceiverTest : public ::testing::Test { +public: + static std::vector parseNavBits(const std::string& hex); + static std::vector readTestVectorsFromFile(const std::string& filename); + std::string bytes_to_str(const std::vector& bytes); + std::vector extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes); + protected: Osnma_Helper helper; osnma_msg_receiver_sptr osnma; @@ -34,38 +59,31 @@ protected: uint32_t d_GST_SIS{}; uint32_t TOW{}; uint32_t WN{}; - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0; //13 + 5; + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + const uint32_t LEAP_SECONDS = 0; // 13 + 5; void set_time(std::tm& input); -// std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; - std::string log_name {"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; + // std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; + std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; void initializeGoogleLog(); void SetUp() override { initializeGoogleLog(); -// std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 + // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); -// std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.crt"; // conf. 1 -// std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; - std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 + // std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.crt"; // conf. 1 + // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); } - -public: - - static std::vector parseNavBits(const std::string& hex); - static std::vector readTestVectorsFromFile(const std::string& filename); - std::string bytes_to_str(const std::vector& bytes); - std::vector extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes); }; + TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) { // Arrange - // ---------- std::vector computed_merkle_root; std::vector expected_merkle_root = helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D"); DSM_PKR_message dsm_pkr_message; @@ -73,8 +91,8 @@ TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) dsm_pkr_message.npktid = 0x2; dsm_pkr_message.mid = 0x01; std::vector base_leaf = helper.convert_from_hex_string("120303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); - - std::vector vec = helper.convert_from_hex_string("7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" + std::vector vec = helper.convert_from_hex_string( + "7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" "24EF508389B7D446C3E2ECE8D459FBBD3239A794906F5B1F92469C640164FD87"); @@ -82,18 +100,16 @@ TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); // Act - // ---------- computed_merkle_root = osnma->compute_merkle_root(dsm_pkr_message, base_leaf); // Assert - // ---------- ASSERT_EQ(computed_merkle_root, expected_merkle_root); } + TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) { // Arrange - // ---------- std::vector expected_base_leaf = helper.convert_from_hex_string("120303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); DSM_PKR_message dsm_pkr_message; dsm_pkr_message.npkt = 0x01; @@ -101,63 +117,68 @@ TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); // Act - // ---------- std::vector computed_base_leaf = osnma->get_merkle_tree_leaves(dsm_pkr_message); // Assert - // ---------- - ASSERT_EQ(computed_base_leaf,expected_base_leaf); + ASSERT_EQ(computed_base_leaf, expected_base_leaf); } -TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ // values taken from RG A.7 + +TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey) +{ + // values taken from RG A.7 // Arrange - // ---------- osnma->d_crypto->set_merkle_root(helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D")); DSM_PKR_message dsm_pkr_message; dsm_pkr_message.npkt = 0x01; dsm_pkr_message.npktid = 0x2; dsm_pkr_message.mid = 0x01; - std::vector vec = helper.convert_from_hex_string("7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" - "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" - "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" - "24EF508389B7D446C3E2ECE8D459FBBD3239A794906F5B1F92469C640164FD87"); + std::vector vec = helper.convert_from_hex_string( + "7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" + "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" + "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" + "24EF508389B7D446C3E2ECE8D459FBBD3239A794906F5B1F92469C640164FD87"); std::copy(vec.begin(), vec.end(), dsm_pkr_message.itn.begin()); dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); // Act - // ---------- bool result = osnma->verify_dsm_pkr(dsm_pkr_message); // Assert - // ---------- ASSERT_TRUE(result); - } + TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) { // Arrange - // ---------- - // m0 - std::vector expected_message = { + std::vector expected_message = { 0x02, 0x4E, 0x05, 0x46, 0x3C, 0x01, 0x83, 0xA5, 0x91, 0x05, 0x1D, 0x69, 0x25, 0x80, 0x07, 0x6B, 0x3E, 0xEA, 0x81, 0x41, 0xBF, 0x03, 0xAD, 0xCB, 0x5A, 0xAD, 0xB2, 0x77, 0xAF, 0x6F, 0xCF, 0x21, 0xFB, 0x98, 0xFF, 0x7E, 0x83, 0xAF, 0xFC, 0x37, 0x02, 0x03, 0xB0, 0xD8, 0xE1, 0x0E, 0xB1, 0x4D, 0x11, 0x18, 0xE6, 0xB0, 0xE8, 0x20, 0x01, 0xA0, 0x00, 0xE5, 0x91, 0x00, 0x06, 0xD3, 0x1F, 0x00, - 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00 - }; + 0x02, 0x68, 0x05, 0x4A, 0x02, 0xC2, 0x26, 0x07, 0xF7, 0xFC, 0x00}; uint32_t TOW_Tag0 = 345660; uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; uint32_t WN = 1248; uint32_t PRNa = 2; uint8_t CTR = 1; - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_ephemeris_iono_data( + "000011101001011001000100000101000111010110100100100101100000000000" + "011101101011001111101110101010000001010000011011111100000011101011" + "011100101101011010101011011011001001110111101011110110111111001111" + "001000011111101110011000111111110111111010000011101011111111110000" + "110111000000100000001110110000110110001110000100001110101100010100" + "110100010001000110001110011010110000111010000010000000000001101000" + "000000000011100101100100010000000000000110110100110001111100000000" + "000000100110100000000101010010100000001011000010001001100000011111" + "110111111111000000000"); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MACK_tag_and_info MTI; @@ -167,34 +188,39 @@ TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) MTI.tag_info.cop = 0x0F; Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - // Act - // ---------- auto computed_message = osnma->build_message(t0); - // Assert - // ---------- ASSERT_TRUE(computed_message == expected_message); - } -TEST_F(OsnmaMsgReceiverTest, TagVerification) { + +TEST_F(OsnmaMsgReceiverTest, TagVerification) +{ // Arrange - // ---------- // Tag0 uint32_t TOW_Tag0 = 345660; uint32_t TOW_NavData = TOW_Tag0 - 30; - uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30 ; + uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; uint32_t WN = 1248; uint32_t PRNa = 2; uint8_t CTR = 1; - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].ephemeris_iono_vector_2 = "000011101001011001000100000101000111010110100100100101100000000000011101101011001111101110101010000001010000011011111100000011101011011100101101011010101011011011001001110111101011110110111111001111001000011111101110011000111111110111111010000011101011111111110000110111000000100000001110110000110110001110000100001110101100010100110100010001000110001110011010110000111010000010000000000001101000000000000011100101100100010000000000000110110100110001111100000000000000100110100000000101010010100000001011000010001001100000011111110111111111000000000"; + osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_ephemeris_iono_data(""); + osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_ephemeris_iono_data( + "000011101001011001000100000101000111010110100100100101100000000000" + "011101101011001111101110101010000001010000011011111100000011101011" + "011100101101011010101011011011001001110111101011110110111111001111" + "001000011111101110011000111111110111111010000011101011111111110000" + "110111000000100000001110110000110110001110000100001110101100010100" + "110100010001000110001110011010110000111010000010000000000001101000" + "000000000011100101100100010000000000000110110100110001111100000000" + "000000100110100000000101010010100000001011000010001001100000011111" + "110111111111000000000"); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MACK_tag_and_info MTI; @@ -204,34 +230,25 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { MTI.tag_info.cop = 0x0F; Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - // Act - // ---------- bool result_tag0 = osnma->verify_tag(t0); - - - - // Assert - // ---------- - //ASSERT_TRUE(result_tag0); // Tag3 uint32_t TOW_Tag3 = 345660; uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; - uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30 ; + uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30; WN = 1248; PRNa = 2; CTR = 3; - osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit - osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].utc_vector_2 = + osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_utc_data( "111111111111111111111111111111110000000000000000000000010001001001001000" - "111000001000100111100010010111111111011110111111111001001100000100000000"; + "111000001000100111100010010111111111011110111111111001001100000100000000"); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MTI.tag = static_cast(0x7BB238C883); @@ -243,90 +260,78 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { bool result_tag3 = osnma->verify_tag(t3); ASSERT_TRUE(result_tag0 && result_tag3); - } -TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { + +TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) +{ // Arrange - // ---------- osnma->d_tesla_key_verified = false; - osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 - osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 + osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; // local_time_verification would do this operation. TODO - eliminate duplication. osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); - osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; - osnma->d_tesla_keys.insert((std::pair>(345600,{0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. - std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 + osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 uint32_t TOW = 345630; - - - // Act - // ---------- bool result = osnma->verify_tesla_key(key, TOW); - - - - // Assert - // ---------- ASSERT_TRUE(result); - } + TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) { // Arrange - // ---------- -// std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/16_AUG_2023_GST_05_00_01.csv"); // conf. 1 - std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 - if (testVectors.empty()){ + std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 + if (testVectors.empty()) + { ASSERT_TRUE(false); } bool end_of_hex_stream{false}; int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240/8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int SIZE_SUBFRAME_BYTES{SIZE_PAGE_BYTES*SIZE_SUBFRAME_PAGES}; // total bytes of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; - std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; - - - - + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; // Act - // ---------- - // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (end_of_hex_stream == false){ + while (end_of_hex_stream == false) + { // loop over all SVs, extract a subframe - for(const TestVector& tv : testVectors) { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) "<< tv.svId << std::endl; + for (const TestVector& tv : testVectors) + { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; auto osnmaMsg_sptr = std::make_shared(); std::array hkroot{}; std::array mack{}; - byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words_for_OSNMA; // structure containing and + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words_for_OSNMA; // structure containing and - for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe { // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index - std::vector page_bytes = extract_page_bytes(tv,byte_index,SIZE_PAGE_BYTES); - if(page_bytes.empty()){ - std::cout<< "OsnmaTestVectorsSimulation: end of TestVectors \n" << "byte_index="< data_k(even_page.substr(2,112)); - std::bitset<16> data_j(odd_page.substr(2,16)); + std::bitset<112> data_k(even_page.substr(2, 112)); + std::bitset<16> data_j(odd_page.substr(2, 16)); std::bitset<112> shifted_data_k = data_k; - uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word - std::cout<< "OsnmaTestVectorsSimulation: received Word "<< static_cast(word_type) << std::endl; - if( (word_type >= 1 && word_type <=5) || word_type == 6 || word_type == 10) + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; + if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) { // store raw word std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); words_for_OSNMA[word_type] = data_combined; } - if(word_type == DUMMY_PAGE) + if (word_type == DUMMY_PAGE) flag_dummy_page = true; // place it into osnma object. @@ -370,12 +376,13 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) byte_index += SIZE_PAGE_BYTES; } - std::cout<< "----------" << std::endl; - if(end_of_hex_stream) + std::cout << "----------" << std::endl; + if (end_of_hex_stream) break; - if(flag_dummy_page){ + if (flag_dummy_page) + { flag_dummy_page = false; - continue; // skip this SV + continue; // skip this SV } // Fill osnma object @@ -383,8 +390,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) osnmaMsg_sptr->mack = mack; osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; - osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20 ; - osnmaMsg_sptr->PRN = tv.svId; // PRNa + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; + osnmaMsg_sptr->PRN = tv.svId; // PRNa // TODO - refactor this logic, currently it is split @@ -395,14 +402,14 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) { ephClockStatusWordsReceived = false; - std::cerr<< "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " - "Word "<< i << " should be received for each subframe but was not." << std::endl; + std::cerr << "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " + "Word " + << i << " should be received for each subframe but was not." << std::endl; } } // extract bits as needed by osnma block - if(ephClockStatusWordsReceived) + if (ephClockStatusWordsReceived) { - // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {1, {6, 120}}, @@ -414,7 +421,8 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) // Fill NavData bits -- Iterate over the extraction parameters std::string nav_data_ADKD_0_12 = ""; - for (const auto& param : extractionParams) { + for (const auto& param : extractionParams) + { uint8_t wordKey = param.first; uint8_t start = param.second.first; uint8_t length = param.second.second; @@ -424,16 +432,16 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) } // send to osnma block bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; - if(check_size_is_ok) + if (check_size_is_ok) { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " + << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> tv.svId, nav_data_ADKD_0_12, osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) <<"): 0b" << nav_data_ADKD_0_12; + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); - } } @@ -441,12 +449,12 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && words_for_OSNMA.find(10) != words_for_OSNMA.end(); // extract bits as needed by osnma block - if(timingWordsReceived){ + if (timingWordsReceived) + { // Define the starting position and length of bits to extract for each word std::map> extractionParams = { {6, {6, 99}}, - {10, {86, 42}} - }; + {10, {86, 42}}}; std::string nav_data_ADKD_4 = ""; // Fill NavData bits -- Iterate over the extraction parameters @@ -461,63 +469,62 @@ TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) } // send to osnma block bool check_size_is_ok = nav_data_ADKD_4.size() == 141; - if(check_size_is_ok) + if (check_size_is_ok) { - std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 <>( // < PRNd , navDataBits, TOW_Sosf> + std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " + << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> tv.svId, nav_data_ADKD_4, osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d="<< static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) <<"): 0b" << nav_data_ADKD_4; + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); - } - } // Call the handler, as if it came from telemetry decoder block auto temp_obj = pmt::make_any(osnmaMsg_sptr); - osnma->msg_handler_osnma(temp_obj); // osnma entry point + osnma->msg_handler_osnma(temp_obj); // osnma entry point } - - if(!end_of_hex_stream){ - offset_byte = byte_index; // update offset for the next subframe + if (!end_of_hex_stream) + { + offset_byte = byte_index; // update offset for the next subframe d_GST_SIS += DURATION_SUBFRAME; TOW = d_GST_SIS & 0x000FFFFF; - WN = (d_GST_SIS & 0xFFF00000) >> 20 ; - std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS + WN = (d_GST_SIS & 0xFFF00000) >> 20; + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS << ", TOW=" << TOW << ", WN=" << WN << std::endl; } - - } - - // Assert - // ---------- // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) } + // Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. // Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) { std::ifstream file(filename); std::vector testVectors; - if (!file.is_open()) { - std::cerr<<"Error reading the file \"" << filename <<"\" \n"; + if (!file.is_open()) + { + std::cerr << "Error reading the file \"" << filename << "\" \n"; return testVectors; } std::string line; std::getline(file, line); - if (line != "SVID,NumNavBits,NavBitsHEX\r" ){ - std::cerr<<"Error parsing first line" <<"\n"; - } + if (line != "SVID,NumNavBits,NavBitsHEX\r") + { + std::cerr << "Error parsing first line" + << "\n"; + } while (std::getline(file, line)) { @@ -540,29 +547,35 @@ std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std: return testVectors; } + + std::vector OsnmaMsgReceiverTest::parseNavBits(const std::string& hex) { std::vector bytes; - for (unsigned int i = 0; i < hex.length()-1; i += 2) + for (unsigned int i = 0; i < hex.length() - 1; i += 2) { std::string byteString = hex.substr(i, 2); - uint8_t byte = (uint8_t) strtol(byteString.c_str(), NULL, 16); + uint8_t byte = (uint8_t)strtol(byteString.c_str(), NULL, 16); bytes.push_back(byte); } return bytes; } + + std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes) { std::string bit_string; bit_string.reserve(bytes.size() * 8); - for(const auto& byte : bytes) + for (const auto& byte : bytes) { std::bitset<8> bits(byte); bit_string += bits.to_string(); } return bit_string; } + + /** * @brief Extracts a range of bytes from a TestVector's navBits vector. * @@ -591,6 +604,8 @@ std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& return extracted_bytes; } + + /** * @brief Sets the time based on the given input. * @@ -614,25 +629,24 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) uint32_t sec_in_week = 7 * 24 * 60 * 60; uint32_t week_number = duration_sec.count() / sec_in_week; uint32_t time_of_week = duration_sec.count() % sec_in_week; - this->WN = week_number; - this->TOW = time_of_week + LEAP_SECONDS; + this->WN = week_number; + this->TOW = time_of_week + LEAP_SECONDS; // Return the week number and time of week as a pair // TODO: d_GST_SIS or d_receiver_time? doubt // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 - this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); - - + this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); } + + void OsnmaMsgReceiverTest::initializeGoogleLog() { - google::InitGoogleLogging(log_name.c_str()); // TODO - running all tests causes conflict due to being called twice - FLAGS_minloglevel = 0; // INFO - FLAGS_logtostderr = 0; // add this line + google::InitGoogleLogging(log_name.c_str()); // TODO - running all tests causes conflict due to being called twice + FLAGS_minloglevel = 0; // INFO + FLAGS_logtostderr = 0; // add this line FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/data/build/src/tests/logs"; if (FLAGS_log_dir.empty()) { - std::cout << "Logging will be written at " << std::filesystem::temp_directory_path() << '\n' @@ -667,4 +681,3 @@ void OsnmaMsgReceiverTest::initializeGoogleLog() } } } - From 49eb854b162f9a3f9406d2ccd32fb0ee2401eac6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Jul 2024 16:51:59 +0200 Subject: [PATCH 257/499] Fix formatting --- cmake/Modules/GnssSdrCrypto.cmake | 2 +- .../galileo_telemetry_decoder_gs.cc | 17 ++++++----- src/core/libs/osnma_msg_receiver.h | 4 +-- src/core/system_parameters/Galileo_OSNMA.h | 3 +- src/core/system_parameters/osnma_data.cc | 2 +- src/core/system_parameters/osnma_data.h | 2 +- src/core/system_parameters/osnma_helper.h | 28 +++++++++---------- 7 files changed, 28 insertions(+), 30 deletions(-) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index b1edb5982..5286c6d01 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -127,7 +127,7 @@ else() set(GNUTLS_HMAC_INIT_WITH_DIGEST TRUE) endif() if("${gnutls_gnutls_file_contents}" MATCHES "GNUTLS_MAC_AES_CMAC_128") - set(GNUTLS_MAC_AES_CMAC_128 TRUE) + set(GNUTLS_MAC_AES_CMAC_128 TRUE) endif() file(READ "${GNUTLS_INCLUDE_DIR}/gnutls/abstract.h" gnutls_abstract_file_contents) if("${gnutls_abstract_file_contents}" MATCHES "gnutls_pubkey_export2") 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 4fe185501..156194544 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 @@ -45,6 +45,7 @@ #include // for std::numeric_limits #include // for std::map #include // for std::out_of_range +#include // for std::tuple #include // for typeid #include // for std::pair @@ -468,7 +469,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.reset_osnma_nav_bits_adkd4(); } - if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) + if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_ephemeris()); @@ -503,7 +504,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in else { // If we still do not have ephemeris, check if we have a reduced CED - if ((d_band == '1') && d_use_ced && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) // C: W16 has some Eph. params, uneeded for OSNMa I guess + if ((d_band == '1') && d_use_ced && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) // C: W16 has some Eph. params, uneeded for OSNMa I guess { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_reduced_ced()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); @@ -519,7 +520,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } } - if (d_inav_nav.have_new_iono_and_GST() == true) // C: W5 + if (d_inav_nav.have_new_iono_and_GST() == true) // C: W5 { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_iono()); @@ -550,7 +551,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } } - if (d_inav_nav.have_new_utc_model() == true) // C: tells if W6 is available + if (d_inav_nav.have_new_utc_model() == true) // C: tells if W6 is available { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_utc_model()); @@ -587,7 +588,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in flag_osnma_adkd_4_utc = true; } - if (d_inav_nav.have_new_almanac() == true) // flag_almanac_4 tells if W10 available. + if (d_inav_nav.have_new_almanac() == true) // flag_almanac_4 tells if W10 available. { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_almanac()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); @@ -623,19 +624,17 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in } // get osnma message if the needed nav data is available - bool adkd_4_nav_data_available = flag_osnma_adkd_4_utc && flag_osnma_adkd_4_gst; // supposition: data did not change bt. flags reset and now. + bool adkd_4_nav_data_available = flag_osnma_adkd_4_utc && flag_osnma_adkd_4_gst; // supposition: data did not change bt. flags reset and now. // bool adkd_4_nav_data_available = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; // newApproach: let decoder decide when block starts and let it fill the data, and just check for length - if(adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) + if (adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) { } auto newOSNMA = d_inav_nav.have_new_nma(); if (d_band == '1' && newOSNMA) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_osnma_msg()); - this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 40ac73e78..c554f861a 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -96,8 +96,8 @@ private: std::vector verify_macseq_new(const MACK_message& mack); std::map> d_satellite_nav_data; // map holding OSNMA_NavData sorted by SVID (first key) and TOW (second key). - std::map> d_tesla_keys; // tesla keys over time, sorted by TOW - std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW + std::map> d_tesla_keys; // tesla keys over time, sorted by TOW + std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW std::vector d_tags_to_verify{0, 4, 12}; std::vector d_macks_awaiting_MACSEQ_verification; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 6032be061..09f615e08 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -193,8 +193,7 @@ const std::unordered_map OSNMA_TABLE_16 = { {38, {2, 5, {"00S", "FLX", "04S", "FLX", "12S"}, {"00S", "FLX", "FLX", "12S", "FLX"}}}, {39, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "00E", "12S"}}}, {40, {2, 4, {"00S", "00E", "04S", "12S"}, {"00S", "00E", "00E", "12E"}}}, - {41, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "FLX", "12S"}}} -}; + {41, {2, 4, {"00S", "FLX", "04S", "FLX"}, {"00S", "FLX", "FLX", "12S"}}}}; /** \} */ /** \} */ diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 91a32a1f3..1e37ed26f 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -39,7 +39,7 @@ std::string OSNMA_NavData::get_utc_data() const uint32_t OSNMA_NavData::get_tow_sf0() const { - return d_TOW_sf0; + return d_TOW_sf0; } diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 910ee3e2d..cbdaa9c9a 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -182,7 +182,7 @@ public: skipped(0) { } - Tag(const MACK_message& mack) // constructor for Tag0 + explicit Tag(const MACK_message& mack) // constructor for Tag0 : tag_id(id_counter++), TOW(mack.TOW), // TODO missing for build_message WN for GST computation, CTR, NMAS, OSNMA_NavData missing WN(mack.WN), diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 07a3c457f..1e0eae235 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -1,18 +1,18 @@ /*! -* \file osnma_helper.h -* \brief Class for auxiliary osnma functions -* \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ + * \file osnma_helper.h + * \brief Class for auxiliary osnma functions + * \author Carles Fernandez-Prades, 2024 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ #ifndef GNSS_SDR_OSNMA_HELPER_H #define GNSS_SDR_OSNMA_HELPER_H From 5b06bc34bcf6b5e3b28409d36e2a263255283b1c Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 23 Jul 2024 17:03:06 +0200 Subject: [PATCH 258/499] Detect if the spidev driver is installed when the ENABLE_MAX2771 flag is set. Detect if the DMA proxy driver is installed when the ENABLE_DMA_PROXY flag is set. Check if ENABLE_FPGA is set when either ENABLE_MAX2771 or ENABLE_DMA_PROXY is set. --- CMakeLists.txt | 112 ++++++++++++++++-- .../signal_source/adapters/CMakeLists.txt | 4 +- .../signal_source/libs/CMakeLists.txt | 7 +- src/core/receiver/CMakeLists.txt | 8 +- src/core/receiver/gnss_block_factory.cc | 11 +- 5 files changed, 125 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38dda0390..f69d38126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,7 +44,9 @@ option(ENABLE_AD936X_SDR "Enable the use of AD936X front-ends using libiio, requ option(ENABLE_AD9361 "Enable the use of AD9361 direct to FPGA hardware, requires libiio" OFF) -option(ENABLE_FPGA_MAX2771_EVKIT "Enable the use of MAX2771 EVKIT direct to FPGA hardware" OFF) +option(ENABLE_MAX2771 "Enable the use of MAX2771 direct to FPGA hardware, requires the spidev driver" OFF) + +option(ENABLE_DMA_PROXY "Enable the use of the DMA direct to FPGA hardware, requires the DMA Proxy driver" OFF) option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF) @@ -3348,12 +3350,107 @@ if(ENABLE_AD9361 OR ENABLE_FMCOMMS2) endif() endif() -############################################## -# Check FPGA-related signal sources -############################################## -if((ENABLE_AD9361 OR ENABLE_FPGA_MAX2771_EVKIT) AND NOT ENABLE_FPGA) - message(FATAL_ERROR "ENABLE_AD9361 and ENABLE_FPGA_MAX2771_EVKIT can only be set when ENABLE_FPGA is also set.") + + +##################################################################### +# Check signal sources related to FPGA only. +##################################################################### +if(ENABLE_MAX2771 AND NOT ENABLE_FPGA) + message(STATUS "The SPIdev driver is enabled, but the FPGA is not enabled. The FPGA is required when using the SPIdev driver.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "ENABLE_MAX2771 can only be set when ENABLE_FPGA is also set.") + endif() endif() +if(ENABLE_DMA_PROXY AND NOT ENABLE_FPGA) + message(STATUS "The DMA Proxy driver is enabled, but the FPGA is not enabled. The FPGA is required when using the DMA Proxy driver.") + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "ENABLE_DMA_PROXY can only be set when ENABLE_FPGA is also set.") + endif() +endif() + + + +##################################################################### +# spidev driver - OPTIONAL +# Linux kernel driver that provides user-space access to Serial +# Peripheral Interface) +##################################################################### +if(ENABLE_MAX2771) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + find_program(STRINGS_EXECUTABLE strings) + if (NOT STRINGS_EXECUTABLE) + message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") + message(STATUS " You can try to install it by typing:") + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(STATUS " sudo yum install binutils") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(STATUS " sudo zypper install binutils") + else() + message(STATUS " sudo apt-get install binutils") + endif() + endif() + message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") + endif() + set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") + if (EXISTS "${DTB_FILE}") + message(STATUS "Found DTB file: ${DTB_FILE}") + # Run the strings command and grep for "spidev" + execute_process( + COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} + COMMAND grep "spidev" + OUTPUT_VARIABLE GREP_OUTPUT + RESULT_VARIABLE GREP_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if (GREP_RESULT EQUAL 0) + message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") + else() + message(STATUS "SPIdev driver not found, its installation is required.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") + endif() + endif() + else() + message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") + endif() +endif() + + + +##################################################################### +# DMA Proxy driver - OPTIONAL +# Simplified and efficient interface for user-space applications +# to leverage DMA capabilities for Xilinx FPGA and SoC systems +##################################################################### +if(ENABLE_DMA_PROXY) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + if (EXISTS "${DMA_PROXY_FILE}") + message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") + else() + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "DMA Proxy driver is required for building gnss-sdr with -DENABLE_DMA_PROXY=ON.") + endif() + endif() +endif() + ############################################## @@ -3560,7 +3657,8 @@ add_feature_info(ENABLE_LIMESDR ENABLE_LIMESDR "Enables Limesdr_Signal_Source. R add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio and libad9361-dev.") add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.") add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio and libad9361-dev.") -add_feature_info(ENABLE_FPGA_MAX2771_EVKIT ENABLE_FPGA_MAX2771_EVKIT "Enables MAX2771_evkit_fpga_signal_source for devices with the MAX2771 chipset.") +add_feature_info(ENABLE_MAX2771 ENABLE_MAX2771 "Enables FPGA_MAX2771_EVKIT_Signal_Source for devices with the MAX2771 chipset. Requires the spidev driver") +add_feature_info(ENABLE_DMA_PROXY ENABLE_DMA_PROXY "Enables DMA Signal_Source. Requires the DMA Proxy driver") add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Iio_Signal_Source to access AD936X front-ends using libiio. Requires libiio and libad9361-dev.") add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.") add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.") diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index c26446e0e..ac31f19f0 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -41,7 +41,7 @@ if(ENABLE_AD9361) list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) endif() -if(ENABLE_FPGA_MAX2771_EVKIT) +if(ENABLE_MAX2771) ############################################### # MAX2771 EVKIT DIRECT TO FPGA Hardware ############################################### @@ -49,7 +49,7 @@ if(ENABLE_FPGA_MAX2771_EVKIT) list(APPEND OPT_DRIVER_HEADERS fpga_max2771_evkit_signal_source.h) endif() -if(ENABLE_FPGA) +if(ENABLE_DMA_PROXY) ############################################### # FPGA DMA source ############################################### diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 0e02ec084..93b4fba96 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -12,7 +12,7 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.h) endif() -if(ENABLE_FPGA_MAX2771_EVKIT) +if(ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.h) endif() @@ -22,11 +22,14 @@ if(ENABLE_FPGA) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_switch.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dynamic_bit_selection.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dynamic_bit_selection.h) +endif() + +if(ENABLE_DMA_PROXY) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dma-proxy.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) endif() -if(ENABLE_AD9361 OR ENABLE_FPGA_MAX2771_EVKIT) +if(ENABLE_AD9361 OR ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) endif() diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 3b2b6f46e..cacef7f6f 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -98,8 +98,12 @@ if(ENABLE_AD9361) target_compile_definitions(core_receiver PRIVATE -DAD9361_DRIVER=1) endif() -if(ENABLE_FPGA_MAX2771_EVKIT) - target_compile_definitions(core_receiver PRIVATE -DFPGA_MAX2771_EVKIT_DRIVER=1) +if(ENABLE_MAX2771) + target_compile_definitions(core_receiver PRIVATE -DMAX2771_DRIVER=1) +endif() + +if(ENABLE_DMA_PROXY) + target_compile_definitions(core_receiver PRIVATE -DDMA_PROXY_DRIVER=1) endif() if(ENABLE_OSMOSDR) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 6aa49b761..3e9f62021 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -128,7 +128,6 @@ #endif #if ENABLE_FPGA -#include "fpga_dma_signal_source.h" #include "galileo_e1_dll_pll_veml_tracking_fpga.h" #include "galileo_e1_pcps_ambiguous_acquisition_fpga.h" #include "galileo_e5a_dll_pll_tracking_fpga.h" @@ -171,10 +170,14 @@ #include "ad9361_fpga_signal_source.h" #endif -#if FPGA_MAX2771_EVKIT_DRIVER +#if MAX2771_DRIVER #include "fpga_max2771_evkit_signal_source.h" #endif +#if DMA_PROXY_DRIVER +#include "fpga_dma_signal_source.h" +#endif + #if LIMESDR_DRIVER #include "limesdr_signal_source.h" #endif @@ -825,7 +828,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif -#if ENABLE_FPGA and FPGA_MAX2771_EVKIT_DRIVER +#if ENABLE_FPGA and MAX2771_DRIVER else if (implementation == "FPGA_MAX2771_EVKIT_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, @@ -834,7 +837,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif -#if ENABLE_FPGA +#if ENABLE_FPGA and DMA_PROXY_DRIVER else if (implementation == "FPGA_DMA_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, From 70315ecfae59373402d997aefb40ae8d0014427b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Jul 2024 17:32:47 +0200 Subject: [PATCH 259/499] Fix formatting --- src/tests/single_test_main.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/single_test_main.cc b/src/tests/single_test_main.cc index c0a6e1dee..27dc60c17 100644 --- a/src/tests/single_test_main.cc +++ b/src/tests/single_test_main.cc @@ -18,8 +18,8 @@ #include "concurrent_map.h" #include "concurrent_queue.h" -#include "gps_acq_assist.h" #include "gnss_sdr_flags.h" +#include "gps_acq_assist.h" #include #include #include From f2acb7dc2f324da92838eb5c00c02424daa5b8b4 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 24 Jul 2024 11:02:44 +0200 Subject: [PATCH 260/499] fix FPGA signal source names for consistency --- .../signal_source/adapters/CMakeLists.txt | 12 +++++----- ...source.cc => ad9361_signal_source_fpga.cc} | 22 ++++++++--------- ...l_source.h => ad9361_signal_source_fpga.h} | 14 +++++------ ...al_source.cc => dma_signal_source_fpga.cc} | 24 +++++++++---------- ...gnal_source.h => dma_signal_source_fpga.h} | 14 +++++------ ...cc => max2771_evkit_signal_source_fpga.cc} | 24 +++++++++---------- ...e.h => max2771_evkit_signal_source_fpga.h} | 14 +++++------ src/core/receiver/gnss_block_factory.cc | 18 +++++++------- src/core/receiver/gnss_flowgraph.cc | 2 +- 9 files changed, 72 insertions(+), 72 deletions(-) rename src/algorithms/signal_source/adapters/{ad9361_fpga_signal_source.cc => ad9361_signal_source_fpga.cc} (96%) rename src/algorithms/signal_source/adapters/{ad9361_fpga_signal_source.h => ad9361_signal_source_fpga.h} (92%) rename src/algorithms/signal_source/adapters/{fpga_dma_signal_source.cc => dma_signal_source_fpga.cc} (97%) rename src/algorithms/signal_source/adapters/{fpga_dma_signal_source.h => dma_signal_source_fpga.h} (91%) rename src/algorithms/signal_source/adapters/{fpga_max2771_evkit_signal_source.cc => max2771_evkit_signal_source_fpga.cc} (95%) rename src/algorithms/signal_source/adapters/{fpga_max2771_evkit_signal_source.h => max2771_evkit_signal_source_fpga.h} (95%) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index ac31f19f0..dd058f437 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -37,24 +37,24 @@ if(ENABLE_AD9361) ############################################### # AD9361 DIRECT TO FPGA Hardware ############################################### - list(APPEND OPT_DRIVER_SOURCES ad9361_fpga_signal_source.cc) - list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES ad9361_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS ad9361_signal_source_fpga.h) endif() if(ENABLE_MAX2771) ############################################### # MAX2771 EVKIT DIRECT TO FPGA Hardware ############################################### - list(APPEND OPT_DRIVER_SOURCES fpga_max2771_evkit_signal_source.cc) - list(APPEND OPT_DRIVER_HEADERS fpga_max2771_evkit_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES max2771_evkit_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS max2771_evkit_signal_source_fpga.h) endif() if(ENABLE_DMA_PROXY) ############################################### # FPGA DMA source ############################################### - list(APPEND OPT_DRIVER_SOURCES fpga_dma_signal_source.cc) - list(APPEND OPT_DRIVER_HEADERS fpga_dma_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES dma_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS dma_signal_source_fpga.h) endif() if(ENABLE_FLEXIBAND AND TELEORBIT_FOUND) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.cc similarity index 96% rename from src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc rename to src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.cc index 534d98912..d745cdd55 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.cc @@ -1,5 +1,5 @@ /*! - * \file ad9361_fpga_signal_source.cc + * \file ad9361_signal_source_fpga.cc * \brief signal source for Analog Devices front-end AD9361 connected directly * to FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with @@ -22,7 +22,7 @@ * ----------------------------------------------------------------------------- */ -#include "ad9361_fpga_signal_source.h" +#include "ad9361_signal_source_fpga.h" #include "GPS_L1_CA.h" #include "GPS_L5.h" #include "ad9361_manager.h" @@ -44,10 +44,10 @@ using namespace std::string_literals; -Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *configuration, +Ad9361SignalSourceFPGA::Ad9361SignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), + : SignalSourceBase(configuration, role, "Ad9361_Signal_Source_Fpga"s), gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), @@ -276,7 +276,7 @@ Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *con } -Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() +Ad9361SignalSourceFPGA::~Ad9361SignalSourceFPGA() { /* cleanup and exit */ @@ -328,7 +328,7 @@ Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() } -void Ad9361FpgaSignalSource::run_dynamic_bit_selection_process() +void Ad9361SignalSourceFPGA::run_dynamic_bit_selection_process() { bool dynamic_bit_selection_active = true; @@ -347,7 +347,7 @@ void Ad9361FpgaSignalSource::run_dynamic_bit_selection_process() } -void Ad9361FpgaSignalSource::run_buffer_monitor_process() +void Ad9361SignalSourceFPGA::run_buffer_monitor_process() { bool enable_ovf_check_buffer_monitor_active = true; @@ -367,7 +367,7 @@ void Ad9361FpgaSignalSource::run_buffer_monitor_process() } -void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block) +void Ad9361SignalSourceFPGA::connect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -376,7 +376,7 @@ void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block) } -void Ad9361FpgaSignalSource::disconnect(gr::top_block_sptr top_block) +void Ad9361SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -385,14 +385,14 @@ void Ad9361FpgaSignalSource::disconnect(gr::top_block_sptr top_block) } -gr::basic_block_sptr Ad9361FpgaSignalSource::get_left_block() +gr::basic_block_sptr Ad9361SignalSourceFPGA::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; return {}; } -gr::basic_block_sptr Ad9361FpgaSignalSource::get_right_block() +gr::basic_block_sptr Ad9361SignalSourceFPGA::get_right_block() { return {}; } diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.h similarity index 92% rename from src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h rename to src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.h index 25f5105b0..c8fce2110 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.h @@ -1,5 +1,5 @@ /*! - * \file ad9361_fpga_signal_source.h + * \file ad9361_signal_source_fpga.h * \brief signal source for Analog Devices front-end AD9361 connected directly * to FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with @@ -18,8 +18,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H -#define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_AD9361_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_AD9361_SIGNAL_SOURCE_FPGA_H #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" @@ -44,14 +44,14 @@ class ConfigurationInterface; -class Ad9361FpgaSignalSource : public SignalSourceBase +class Ad9361SignalSourceFPGA : public SignalSourceBase { public: - Ad9361FpgaSignalSource(const ConfigurationInterface *configuration, + Ad9361SignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~Ad9361FpgaSignalSource(); + ~Ad9361SignalSourceFPGA(); inline size_t item_size() override { @@ -139,4 +139,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H +#endif // GNSS_SDR_AD9361_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/fpga_dma_signal_source.cc b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc similarity index 97% rename from src/algorithms/signal_source/adapters/fpga_dma_signal_source.cc rename to src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc index 0f575ea16..40b4c5f8a 100644 --- a/src/algorithms/signal_source/adapters/fpga_dma_signal_source.cc +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc @@ -1,5 +1,5 @@ /*! - * \file fpga_dma_signal_source.cc + * \file dma_signal_source_fpga.cc * \brief signal source for a DMA connected directly to FPGA accelerators. * This source implements only the DMA control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -16,7 +16,7 @@ * ----------------------------------------------------------------------------- */ -#include "fpga_dma_signal_source.h" +#include "dma_signal_source_fpga.h" #include "command_event.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" @@ -37,10 +37,10 @@ using namespace std::string_literals; -FPGADMASignalSource::FPGADMASignalSource(const ConfigurationInterface *configuration, +DMASignalSourceFPGA::DMASignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "FPGA_DMA_Signal_Source"s), + : SignalSourceBase(configuration, role, "DMA_Signal_Source_Fpga"s), queue_(queue), filename0_(configuration->property(role + ".filename", empty_string)), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), @@ -223,7 +223,7 @@ FPGADMASignalSource::FPGADMASignalSource(const ConfigurationInterface *configura } -FPGADMASignalSource::~FPGADMASignalSource() +DMASignalSourceFPGA::~DMASignalSourceFPGA() { std::unique_lock lock_DMA(dma_mutex); enable_DMA_ = false; // disable the DMA @@ -251,13 +251,13 @@ FPGADMASignalSource::~FPGADMASignalSource() } -void FPGADMASignalSource::start() +void DMASignalSourceFPGA::start() { thread_file_to_dma = std::thread([&] { run_DMA_process(filename0_, filename1_, samples_to_skip_, item_size_, samples_, repeat_, dma_buff_offset_pos_, queue_); }); } -void FPGADMASignalSource::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) +void DMASignalSourceFPGA::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) { std::ifstream infile1; infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); @@ -535,7 +535,7 @@ void FPGADMASignalSource::run_DMA_process(const std::string &filename0_, const s } -void FPGADMASignalSource::run_dynamic_bit_selection_process() +void DMASignalSourceFPGA::run_dynamic_bit_selection_process() { bool dynamic_bit_selection_active = true; @@ -554,7 +554,7 @@ void FPGADMASignalSource::run_dynamic_bit_selection_process() } -void FPGADMASignalSource::connect(gr::top_block_sptr top_block) +void DMASignalSourceFPGA::connect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -563,7 +563,7 @@ void FPGADMASignalSource::connect(gr::top_block_sptr top_block) } -void FPGADMASignalSource::disconnect(gr::top_block_sptr top_block) +void DMASignalSourceFPGA::disconnect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -572,14 +572,14 @@ void FPGADMASignalSource::disconnect(gr::top_block_sptr top_block) } -gr::basic_block_sptr FPGADMASignalSource::get_left_block() +gr::basic_block_sptr DMASignalSourceFPGA::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; return {}; } -gr::basic_block_sptr FPGADMASignalSource::get_right_block() +gr::basic_block_sptr DMASignalSourceFPGA::get_right_block() { return {}; } diff --git a/src/algorithms/signal_source/adapters/fpga_dma_signal_source.h b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.h similarity index 91% rename from src/algorithms/signal_source/adapters/fpga_dma_signal_source.h rename to src/algorithms/signal_source/adapters/dma_signal_source_fpga.h index 8679aec12..efbad3b23 100644 --- a/src/algorithms/signal_source/adapters/fpga_dma_signal_source.h +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.h @@ -1,5 +1,5 @@ /*! - * \file fpga_dma_signal_source.h + * \file dma_signal_source_fpga.h * \brief signal source for a DMA connected directly to FPGA accelerators. * This source implements only the DMA control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -16,8 +16,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_FPGA_DMA_SIGNAL_SOURCE_H -#define GNSS_SDR_FPGA_DMA_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_DMA_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_DMA_SIGNAL_SOURCE_FPGA_H #include "concurrent_queue.h" #include "fpga_dma-proxy.h" @@ -41,14 +41,14 @@ class ConfigurationInterface; -class FPGADMASignalSource : public SignalSourceBase +class DMASignalSourceFPGA : public SignalSourceBase { public: - FPGADMASignalSource(const ConfigurationInterface *configuration, + DMASignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~FPGADMASignalSource(); + ~DMASignalSourceFPGA(); void start() override; @@ -115,4 +115,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_FPGA_DMA_SIGNAL_SOURCE_H +#endif // GNSS_SDR_DMA_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc similarity index 95% rename from src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.cc rename to src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc index bb4b6b11e..251995a67 100644 --- a/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.cc +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -1,5 +1,5 @@ /*! - * \file fpga_max2771_evkit_signal_source.cc + * \file max2771_evkit_signal_source_fpga.cc * \brief Signal source for the MAX2771EVKIT evaluation board connected directly * to FPGA accelerators. * This source implements only the MAX2771 control. It is NOT compatible with @@ -16,7 +16,7 @@ * ----------------------------------------------------------------------------- */ -#include "fpga_max2771_evkit_signal_source.h" +#include "max2771_evkit_signal_source_fpga.h" #include "GPS_L1_CA.h" #include "GPS_L2C.h" #include "GPS_L5.h" @@ -38,10 +38,10 @@ using namespace std::string_literals; -FPGAMAX2771EVKITSignalSource::FPGAMAX2771EVKITSignalSource(const ConfigurationInterface *configuration, +MAX2771EVKITSignalSourceFPGA::MAX2771EVKITSignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "FPGA_MAX2771_EVKIT_Signal_Source"s), + : SignalSourceBase(configuration, role, "MAX2771_EVKIT_Signal_Source_Fpga"s), freq_(configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ))), sample_rate_(configuration->property(role + ".sampling_frequency", default_sampling_rate)), in_stream_(in_stream), @@ -141,7 +141,7 @@ FPGAMAX2771EVKITSignalSource::FPGAMAX2771EVKITSignalSource(const ConfigurationIn } } -std::vector FPGAMAX2771EVKITSignalSource::setup_regs(void) +std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) { std::vector register_values = std::vector(MAX2771_NUM_REGS); @@ -338,7 +338,7 @@ std::vector FPGAMAX2771EVKITSignalSource::setup_regs(void) } -bool FPGAMAX2771EVKITSignalSource::configure(std::vector register_values) +bool MAX2771EVKITSignalSourceFPGA::configure(std::vector register_values) { // write the registers std::cerr << "Configuring MAX2771 registers" << std::endl; @@ -377,7 +377,7 @@ bool FPGAMAX2771EVKITSignalSource::configure(std::vector register_valu return 0; } -FPGAMAX2771EVKITSignalSource::~FPGAMAX2771EVKITSignalSource() +MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() { /* cleanup and exit */ @@ -417,7 +417,7 @@ FPGAMAX2771EVKITSignalSource::~FPGAMAX2771EVKITSignalSource() } -void FPGAMAX2771EVKITSignalSource::run_buffer_monitor_process() +void MAX2771EVKITSignalSourceFPGA::run_buffer_monitor_process() { bool enable_ovf_check_buffer_monitor_active = true; @@ -437,7 +437,7 @@ void FPGAMAX2771EVKITSignalSource::run_buffer_monitor_process() } -void FPGAMAX2771EVKITSignalSource::connect(gr::top_block_sptr top_block) +void MAX2771EVKITSignalSourceFPGA::connect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -446,7 +446,7 @@ void FPGAMAX2771EVKITSignalSource::connect(gr::top_block_sptr top_block) } -void FPGAMAX2771EVKITSignalSource::disconnect(gr::top_block_sptr top_block) +void MAX2771EVKITSignalSourceFPGA::disconnect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -455,14 +455,14 @@ void FPGAMAX2771EVKITSignalSource::disconnect(gr::top_block_sptr top_block) } -gr::basic_block_sptr FPGAMAX2771EVKITSignalSource::get_left_block() +gr::basic_block_sptr MAX2771EVKITSignalSourceFPGA::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; return {}; } -gr::basic_block_sptr FPGAMAX2771EVKITSignalSource::get_right_block() +gr::basic_block_sptr MAX2771EVKITSignalSourceFPGA::get_right_block() { return {}; } diff --git a/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.h b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h similarity index 95% rename from src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.h rename to src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h index a7a44dd0c..f254a8078 100644 --- a/src/algorithms/signal_source/adapters/fpga_max2771_evkit_signal_source.h +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h @@ -1,5 +1,5 @@ /*! - * \file fpga_max2771_evkit_signal_source.h + * \file max2771_evkit_signal_source_fpga.h * \brief Signal source for the MAX2771EVKIT evaluation board connected directly * to FPGA accelerators. * This source implements only the MAX2771 control. It is NOT compatible with @@ -16,8 +16,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_FPGA_MAX2771_EVKIT_SIGNAL_SOURCE_H -#define GNSS_SDR_FPGA_MAX2771_EVKIT_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_MAX2771_EVKIT_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_MAX2771_EVKIT_SIGNAL_SOURCE_FPGA_H #include "command_event.h" #include "concurrent_queue.h" @@ -41,14 +41,14 @@ class ConfigurationInterface; -class FPGAMAX2771EVKITSignalSource : public SignalSourceBase +class MAX2771EVKITSignalSourceFPGA : public SignalSourceBase { public: - FPGAMAX2771EVKITSignalSource(const ConfigurationInterface *configuration, + MAX2771EVKITSignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~FPGAMAX2771EVKITSignalSource(); + ~MAX2771EVKITSignalSourceFPGA(); std::vector setup_regs(void); @@ -160,4 +160,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_FPGA_MAX2771_EVKIT_SIGNAL_SOURCE_H +#endif // GNSS_SDR_MAX2771_EVKIT_SIGNAL_SOURCE_FPGA_H diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 3e9f62021..428aebaad 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -167,15 +167,15 @@ #endif #if AD9361_DRIVER -#include "ad9361_fpga_signal_source.h" +#include "ad9361_signal_source_fpga.h" #endif #if MAX2771_DRIVER -#include "fpga_max2771_evkit_signal_source.h" +#include "max2771_evkit_signal_source_fpga.h" #endif #if DMA_PROXY_DRIVER -#include "fpga_dma_signal_source.h" +#include "dma_signal_source_fpga.h" #endif #if LIMESDR_DRIVER @@ -820,27 +820,27 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and AD9361_DRIVER - else if (implementation == "Ad9361_Fpga_Signal_Source") + else if (implementation == "Ad9361_Signal_Source_Fpga") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } #endif #if ENABLE_FPGA and MAX2771_DRIVER - else if (implementation == "FPGA_MAX2771_EVKIT_Signal_Source") + else if (implementation == "MAX2771_EVKIT_Signal_Source_Fpga") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } #endif #if ENABLE_FPGA and DMA_PROXY_DRIVER - else if (implementation == "FPGA_DMA_Signal_Source") + else if (implementation == "DMA_Signal_Source_Fpga") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index f17686b3d..ee902964b 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -547,7 +547,7 @@ int GNSSFlowgraph::connect_fpga_flowgraph() if (src == nullptr) { help_hint_ += " * Check implementation name for SignalSource block.\n"; - help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Fpga_Signal_Source or Fpga_DMA_2Signal_Source\n"; + help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Signal_Source_Fpga or Fpga_DMA_2Signal_Source\n"; return 1; } if (src->item_size() == 0) From 468e840eb1592cd6598d01572d0e728e637b8bf6 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 24 Jul 2024 13:22:03 +0200 Subject: [PATCH 261/499] Fix FPGA-related CMakefile flags --- src/algorithms/signal_source/adapters/CMakeLists.txt | 2 +- src/algorithms/signal_source/libs/CMakeLists.txt | 4 ++-- src/core/libs/CMakeLists.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index dd058f437..9b9100f76 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -167,7 +167,7 @@ target_include_directories(signal_source_adapters ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(ENABLE_FPGA) +if(ENABLE_FPGA OR ENABLE_AD9361) target_link_libraries(signal_source_adapters PUBLIC signal_source_libs diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 93b4fba96..3506dc4f7 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -29,7 +29,7 @@ if(ENABLE_DMA_PROXY) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) endif() -if(ENABLE_AD9361 OR ENABLE_MAX2771) +if((ENABLE_FPGA AND ENABLE_AD9361) OR ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) endif() @@ -123,7 +123,7 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR) endif() endif() -if(ENABLE_FPGA) +if(ENABLE_FPGA OR ENABLE_AD9361) target_link_libraries(signal_source_libs PUBLIC algorithms_libs diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index fb8230fdc..7b4f4f703 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -52,7 +52,7 @@ if(ENABLE_FPGA) ) endif() -if(ENABLE_FPGA) +if(ENABLE_FPGA OR ENABLE_AD9361) set(CORE_LIBS_SOURCES ${CORE_LIBS_SOURCES} uio_fpga.cc From ef3afccfbc05a6f46597f3a0c2ff492df330c50f Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 24 Jul 2024 15:28:07 +0200 Subject: [PATCH 262/499] make cpplint happy --- .../adapters/dma_signal_source_fpga.cc | 13 +++++++------ .../adapters/max2771_evkit_signal_source_fpga.cc | 12 ++++++------ .../adapters/max2771_evkit_signal_source_fpga.h | 2 +- .../signal_source/libs/fpga_buffer_monitor.cc | 9 --------- src/algorithms/signal_source/libs/fpga_switch.h | 2 +- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc index 40b4c5f8a..a560fd419 100644 --- a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc @@ -21,12 +21,13 @@ #include "configuration_interface.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" -#include // for std::chrono -#include // for open, O_WRONLY -#include // for std::ifstream -#include // for std::setprecision -#include // for std::cout -#include // fr std::vector +#include // for std::min +#include // for std::chrono +#include // for open, O_WRONLY +#include // for std::ifstream +#include // for std::setprecision +#include // for std::cout +#include // fr std::vector #if USE_GLOG_AND_GFLAGS #include diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc index 251995a67..032b6b052 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -28,7 +28,7 @@ #include // for std::floor #include // for std::exception #include // for std::cout - +#include // for std::vector #if USE_GLOG_AND_GFLAGS #include #else @@ -212,7 +212,7 @@ std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) DIEID; register_values[2] = // configuration 3 register - (0x0 << 28) + //reserved + (0x0 << 28) + // reserved (gain_in_ << 22) + (0x1 << 21) + // reserved (HILOADEN << 20) + @@ -266,7 +266,7 @@ std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) (IXTAL << 19) + (0x10 << 14) + // reserved (0x0 << 13) + // reserved - (0x0 << 10) + //reserved + (0x0 << 10) + // reserved (ICP << 9) + (0x0 << 8) + // reserved (0x0 << 7) + // reserved @@ -291,9 +291,9 @@ std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) default: freq_sel = 0x604; } - //uint32_t freq_sel = (freq_ == GPS_L1_FREQ_HZ) ? 0x604 : + register_values[4] = // PLL integer division register - (0x0 << 28) + //reserved + (0x0 << 28) + // reserved (freq_sel << 13) + (RDIV << 3) + 0x0; // reserved @@ -318,7 +318,7 @@ std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) (REFCLK_M_CNT << 4) + (FCLKIN << 3) + (ADCCLK << 2) + - (0x1 << 1) + //reserved + (0x1 << 1) + // reserved MODE; register_values[8] = TEST_MODE_1_REG_VAL; // test mode 1 register diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h index f254a8078..ecc251daf 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h @@ -143,7 +143,7 @@ private: uint32_t in_stream_; uint32_t out_stream_; uint32_t bandwidth_; // 2500000, 4200000, 8700000, 16400000, 23400000, 36000000 - uint32_t filter_order_; //3, 5 + uint32_t filter_order_; // 3, 5 uint32_t gain_in_; // 0 to 0x3F size_t item_size_; // 1 diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 77ad77b00..1f56afbf4 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -41,15 +41,6 @@ #endif -//Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, -// uint32_t num_freq_bands, -// bool dump, -// std::string dump_filename) -// : d_dump_filename(std::move(dump_filename)), -// d_num_freq_bands(num_freq_bands), -// d_max_buff_occ_freq_band_0(0), -// d_max_buff_occ_freq_band_1(0), -// d_dump(dump) Fpga_buffer_monitor::Fpga_buffer_monitor( uint32_t num_freq_bands, bool dump, diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index e2610016c..8a46c214d 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -42,7 +42,7 @@ public: /*! * \brief Constructor */ - explicit Fpga_Switch(void); + Fpga_Switch(void); /*! * \brief Destructor */ From 2df08c48fa1114207f9547aa27e8232f2db50a6f Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 24 Jul 2024 15:55:26 +0200 Subject: [PATCH 263/499] make cpplint happy --- .../signal_source/adapters/max2771_evkit_signal_source_fpga.cc | 1 - .../signal_source/adapters/max2771_evkit_signal_source_fpga.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc index 032b6b052..180680a1c 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -28,7 +28,6 @@ #include // for std::floor #include // for std::exception #include // for std::cout -#include // for std::vector #if USE_GLOG_AND_GFLAGS #include #else diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h index ecc251daf..3008aa384 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h @@ -31,6 +31,7 @@ #include // for mutex #include // for strings #include // for threads +#include // for std::vector /** \addtogroup Signal_Source From dadbbdf5d477a95da8d0f93a2c1e5a9e632c5264 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 24 Jul 2024 16:35:19 +0200 Subject: [PATCH 264/499] make cmakelint happy --- CMakeLists.txt | 116 ++++++++++++++++++++++++------------------------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f69d38126..28754eb5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3356,19 +3356,19 @@ endif() # Check signal sources related to FPGA only. ##################################################################### if(ENABLE_MAX2771 AND NOT ENABLE_FPGA) - message(STATUS "The SPIdev driver is enabled, but the FPGA is not enabled. The FPGA is required when using the SPIdev driver.") - if(ENABLE_PACKAGING) - set(ENABLE_MAX2771 OFF) - else() - message(FATAL_ERROR "ENABLE_MAX2771 can only be set when ENABLE_FPGA is also set.") + message(STATUS "The SPIdev driver is enabled, but the FPGA is not enabled. The FPGA is required when using the SPIdev driver.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "ENABLE_MAX2771 can only be set when ENABLE_FPGA is also set.") endif() endif() if(ENABLE_DMA_PROXY AND NOT ENABLE_FPGA) - message(STATUS "The DMA Proxy driver is enabled, but the FPGA is not enabled. The FPGA is required when using the DMA Proxy driver.") - if(ENABLE_PACKAGING) - set(ENABLE_DMA_PROXY OFF) - else() - message(FATAL_ERROR "ENABLE_DMA_PROXY can only be set when ENABLE_FPGA is also set.") + message(STATUS "The DMA Proxy driver is enabled, but the FPGA is not enabled. The FPGA is required when using the DMA Proxy driver.") + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "ENABLE_DMA_PROXY can only be set when ENABLE_FPGA is also set.") endif() endif() @@ -3380,13 +3380,13 @@ endif() # Peripheral Interface) ##################################################################### if(ENABLE_MAX2771) - if(DEFINED ENV{SDKTARGETSYSROOT}) - set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) - else() - set(TARGET_ROOTFS_PATH "") - endif() - find_program(STRINGS_EXECUTABLE strings) - if (NOT STRINGS_EXECUTABLE) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + find_program(STRINGS_EXECUTABLE strings) + if(NOT STRINGS_EXECUTABLE) message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") message(STATUS " You can try to install it by typing:") if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") @@ -3398,32 +3398,32 @@ if(ENABLE_MAX2771) message(STATUS " sudo apt-get install binutils") endif() endif() - message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") - endif() - set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") - if (EXISTS "${DTB_FILE}") - message(STATUS "Found DTB file: ${DTB_FILE}") - # Run the strings command and grep for "spidev" - execute_process( - COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} - COMMAND grep "spidev" - OUTPUT_VARIABLE GREP_OUTPUT - RESULT_VARIABLE GREP_RESULT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if (GREP_RESULT EQUAL 0) - message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") - else() - message(STATUS "SPIdev driver not found, its installation is required.") - if(ENABLE_PACKAGING) - set(ENABLE_MAX2771 OFF) - else() - message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") - endif() - endif() - else() - message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") - endif() + message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") + endif() + set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") + if(EXISTS "${DTB_FILE}") + message(STATUS "Found DTB file: ${DTB_FILE}") + # Run the strings command and grep for "spidev" + execute_process( + COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} + COMMAND grep "spidev" + OUTPUT_VARIABLE GREP_OUTPUT + RESULT_VARIABLE GREP_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(GREP_RESULT EQUAL 0) + message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") + else() + message(STATUS "SPIdev driver not found, its installation is required.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") + endif() + endif() + else() + message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") + endif() endif() @@ -3434,21 +3434,21 @@ endif() # to leverage DMA capabilities for Xilinx FPGA and SoC systems ##################################################################### if(ENABLE_DMA_PROXY) - if(DEFINED ENV{SDKTARGETSYSROOT}) - set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) - else() - set(TARGET_ROOTFS_PATH "") - endif() - set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") - if (EXISTS "${DMA_PROXY_FILE}") - message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") - else() - if(ENABLE_PACKAGING) - set(ENABLE_DMA_PROXY OFF) - else() - message(FATAL_ERROR "DMA Proxy driver is required for building gnss-sdr with -DENABLE_DMA_PROXY=ON.") - endif() - endif() + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + if(EXISTS "${DMA_PROXY_FILE}") + message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") + else() + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "DMA Proxy driver is required for building gnss-sdr with -DENABLE_DMA_PROXY=ON.") + endif() + endif() endif() From fe9ebb70f1cc8ce60d339a9a9acc8135b9fa0524 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 24 Jul 2024 19:05:31 +0200 Subject: [PATCH 265/499] Fix building local Armadillo with old CMake --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 120505397..638a5e08d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,6 +361,10 @@ set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) # Downgrade versions if requirements are not met +if(CMAKE_VERSION VERSION_LESS "3.5") + set(GNSSSDR_ARMADILLO_LOCAL_VERSION "12.8.x") +endif() + if(CMAKE_VERSION VERSION_LESS "3.22") set(GNSSSDR_GLOG_LOCAL_VERSION "0.6.0") endif() From 8ff339671b26e00df1b7304a24b1a5e8d5b44c17 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 24 Jul 2024 20:39:40 +0200 Subject: [PATCH 266/499] Code cleaning --- .../galileo_telemetry_decoder_gs.cc | 8 ++++++-- src/core/system_parameters/galileo_inav_message.cc | 5 ----- src/core/system_parameters/galileo_inav_message.h | 10 ++++++++-- src/core/system_parameters/gnss_crypto.cc | 14 +++++++------- 4 files changed, 21 insertions(+), 16 deletions(-) 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 156194544..e83bfb05c 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 @@ -452,7 +452,9 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.get_osnma_adkd_0_12_nav_bits(), d_inav_nav.get_TOW5() - 25); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); - DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" << static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); + DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" + << static_cast(d_satellite.get_PRN()) + << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); d_inav_nav.reset_osnma_nav_bits_adkd0_12(); } @@ -465,7 +467,9 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.get_osnma_adkd_4_nav_bits(), d_inav_nav.get_TOW6() - 5); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" << static_cast(d_satellite.get_PRN()) << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); + DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" + << static_cast(d_satellite.get_PRN()) + << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); d_inav_nav.reset_osnma_nav_bits_adkd4(); } diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index c5ddcbfaa..ab62b684c 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -380,10 +380,6 @@ bool Galileo_Inav_Message::have_new_utc_model() // Check if we have a new utc d // flag_almanac_4 tells if W10 available. bool Galileo_Inav_Message::have_new_almanac() // Check if we have a new almanac data set stored in the galileo navigation class { - // if(flag_almanac_4) - // { - // flag_adkd_4_complete = true; - // } if ((flag_almanac_1 == true) and (flag_almanac_2 == true) and (flag_almanac_3 == true) and (flag_almanac_4 == true)) { // All Almanac data have been received @@ -1451,7 +1447,6 @@ bool Galileo_Inav_Message::have_new_nma() std::string Galileo_Inav_Message::get_osnma_adkd_4_nav_bits() { nav_bits_adkd_4 = nav_bits_word_6 + nav_bits_word_10; - return nav_bits_adkd_4; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 2ecb8aa53..820478c77 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -141,15 +141,21 @@ public: * @brief Retrieves the OSNMA ADKD 4 NAV bits. Resets the string. */ std::string get_osnma_adkd_4_nav_bits(); + + /* + * @brief Resets the OSNMA ADKD 4 NAV bits. + */ void reset_osnma_nav_bits_adkd4(); - bool flag_adkd_4_complete{false}; /* * @brief Retrieves the OSNMA ADKD 0/12 NAV bits. Resets the string. */ std::string get_osnma_adkd_0_12_nav_bits(); + + /* + * @brief Resets the OSNMA ADKD 0/12 NAV bits. + */ void reset_osnma_nav_bits_adkd0_12(); - bool flag_adkd_0_12_complete{false}; inline bool get_flag_CRC_test() const { diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 9ff183ed3..fa47720b1 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -225,7 +225,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag success = (ret >= 0); if (success) { - LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + DLOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; } else { @@ -301,7 +301,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag if (verification == 1) { success = true; - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + DLOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; } else { @@ -320,7 +320,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag if (verification == 1) { success = true; - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + DLOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; } else if (verification == 0) { @@ -379,7 +379,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag if (ret >= 0) { - LOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; + DLOG(INFO) << "GnuTLS: OSNMA signature authenticated successfully"; success = true; } else @@ -428,7 +428,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag if (verification == 1) { - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + DLOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; success = true; } else if (verification == 0) @@ -451,7 +451,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag ECDSA_SIG_free(ecdsa_sig); if (verification == 1) { - LOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; + DLOG(INFO) << "OpenSSL: OSNMA signature authenticated successfully"; success = true; } else if (verification == 0) @@ -896,7 +896,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) #endif // OpenSSL 1.x EVP_PKEY_free(pkey); #endif - LOG(INFO) << "OSNMA Public Key successfully set up."; + DLOG(INFO) << "OSNMA Public Key successfully set up."; } From 8a208d57d8132a93e4e7d08a5d02645fb6ad1f4d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 24 Jul 2024 21:02:39 +0200 Subject: [PATCH 267/499] Add benchmarks for cryptographic functions --- src/tests/benchmarks/CMakeLists.txt | 9 +- src/tests/benchmarks/benchmark_crypto.cc | 213 +++++++++++++++++++++++ 2 files changed, 218 insertions(+), 4 deletions(-) create mode 100644 src/tests/benchmarks/benchmark_crypto.cc diff --git a/src/tests/benchmarks/CMakeLists.txt b/src/tests/benchmarks/CMakeLists.txt index 28bddd050..74607d1a1 100644 --- a/src/tests/benchmarks/CMakeLists.txt +++ b/src/tests/benchmarks/CMakeLists.txt @@ -109,11 +109,12 @@ if(ENABLE_GLOG_AND_GFLAGS) set(EXTRA_BENCHMARK_DEPENDENCIES "Gflags::gflags;Glog::glog") endif() -add_benchmark(benchmark_copy) -add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) -add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) -add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_atan2 Gnuradio::runtime) +add_benchmark(benchmark_copy) +add_benchmark(benchmark_crypto core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) if(has_std_plus_void) target_compile_definitions(benchmark_detector PRIVATE -DCOMPILER_HAS_STD_PLUS_VOID=1) diff --git a/src/tests/benchmarks/benchmark_crypto.cc b/src/tests/benchmarks/benchmark_crypto.cc new file mode 100644 index 000000000..43d5f1035 --- /dev/null +++ b/src/tests/benchmarks/benchmark_crypto.cc @@ -0,0 +1,213 @@ +/*! + * \file benchmark_crypto.cc + * \brief Benchmarks for cryptographic functions + * \author Carles Fernandez-Prades, 2024. cfernandez(at)cttc.es + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "gnss_crypto.h" +#include + +void bm_SHA_256(benchmark::State& state) +{ + auto d_crypto = std::make_unique(); + + std::vector message{ + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; + + while (state.KeepRunning()) + { + std::vector output = d_crypto->compute_SHA_256(message); + } +} + + +void bm_SHA3_256(benchmark::State& state) +{ + auto d_crypto = std::make_unique(); + + std::vector message{ + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; + + while (state.KeepRunning()) + { + std::vector output = d_crypto->compute_SHA3_256(message); + } +} + + +void bm_HMAC_SHA_256(benchmark::State& state) +{ + auto d_crypto = std::make_unique(); + + std::vector key = { + 0x24, 0x24, 0x3B, 0x76, 0xF9, 0x14, 0xB1, 0xA7, + 0x7D, 0x48, 0xE7, 0xF1, 0x48, 0x0C, 0xC2, 0x98, + 0xEB, 0x62, 0x3E, 0x95, 0x6B, 0x2B, 0xCE, 0xA3, + 0xB4, 0xD4, 0xDB, 0x31, 0xEE, 0x96, 0xAB, 0xFA}; + + std::vector message{ + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; + + while (state.KeepRunning()) + { + std::vector output = d_crypto->compute_HMAC_SHA_256(key, message); + } +} + + +void bm_CMAC_AES(benchmark::State& state) +{ + auto d_crypto = std::make_unique(); + + std::vector key = { + 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, + 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C}; + + std::vector message{ + 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, + 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A}; + + while (state.KeepRunning()) + { + std::vector output = d_crypto->compute_CMAC_AES(key, message); + } +} + + +void bm_verify_ecdsa_p256(benchmark::State& state) +{ + auto d_crypto = std::make_unique(); + + // RG example - import crt certificate + std::vector message = { + 0x82, 0x10, 0x49, 0x22, 0x04, 0xE0, 0x60, 0x61, 0x0B, 0xDF, + 0x26, 0xD7, 0x7B, 0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, + 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; + + // ECDSA P-256 signature, raw format + std::vector signature = { + 0xF8, 0xCD, 0x88, 0x29, 0x9F, 0xA4, 0x60, 0x58, 0x00, 0x20, + 0x7B, 0xFE, 0xBE, 0xAC, 0x55, 0x02, 0x40, 0x53, 0xF3, 0x0F, + 0x7C, 0x69, 0xB3, 0x5C, 0x15, 0xE6, 0x08, 0x00, 0xAC, 0x3B, + 0x6F, 0xE3, 0xED, 0x06, 0x39, 0x95, 0x2F, 0x7B, 0x02, 0x8D, + 0x86, 0x86, 0x74, 0x45, 0x96, 0x1F, 0xFE, 0x94, 0xFB, 0x22, + 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, + 0x28, 0xC1, 0x77, 0xFB}; + + // PEM format + std::vector publicKey = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, + 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, + 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, + 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, + 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, + 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, + 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, + 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, + 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, + 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, + 0x2B, 0x37, 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, + 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, + 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, + 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, + 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, + 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, + 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, + 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + + d_crypto->set_public_key(publicKey); + + while (state.KeepRunning()) + { + bool output = d_crypto->verify_signature_ecdsa_p256(message, signature); + if (output) + { + // Avoid unused-but-set-variable warning + } + } +} + + +void bm_verify_ecdsa_p521(benchmark::State& state) +{ + std::unique_ptr d_crypto = std::make_unique(); + + // Message to be verified + std::vector message = { + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64}; + + // Public key in PEM format + std::vector publicKey = { + 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, + 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, + 0x2D, 0x2D, 0x0A, 0x4D, 0x49, 0x47, 0x62, 0x4D, 0x42, 0x41, 0x47, 0x42, + 0x79, 0x71, 0x47, 0x53, 0x4D, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, + 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, 0x6A, 0x41, 0x34, 0x47, 0x47, 0x41, + 0x41, 0x51, 0x41, 0x6F, 0x35, 0x76, 0x77, 0x66, 0x6E, 0x47, 0x57, 0x47, + 0x33, 0x44, 0x63, 0x59, 0x75, 0x2B, 0x2F, 0x61, 0x58, 0x47, 0x32, 0x7A, + 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0A, 0x48, 0x36, 0x4C, 0x76, + 0x4F, 0x4C, 0x76, 0x49, 0x51, 0x6A, 0x61, 0x2B, 0x6A, 0x74, 0x57, 0x73, + 0x70, 0x4F, 0x38, 0x37, 0x6F, 0x50, 0x32, 0x4E, 0x6D, 0x72, 0x34, 0x6E, + 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4D, 0x37, 0x6A, 0x49, 0x69, + 0x46, 0x38, 0x47, 0x70, 0x6B, 0x75, 0x58, 0x6A, 0x75, 0x4E, 0x7A, 0x34, + 0x72, 0x61, 0x56, 0x4F, 0x65, 0x49, 0x4D, 0x42, 0x77, 0x45, 0x2B, 0x61, + 0x0A, 0x30, 0x4C, 0x76, 0x7A, 0x37, 0x69, 0x54, 0x4D, 0x5A, 0x46, 0x41, + 0x41, 0x51, 0x64, 0x2B, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, + 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, 0x5A, 0x35, 0x77, + 0x30, 0x38, 0x51, 0x4F, 0x43, 0x58, 0x2F, 0x75, 0x46, 0x65, 0x2B, 0x30, + 0x78, 0x52, 0x78, 0x4C, 0x64, 0x2F, 0x33, 0x36, 0x42, 0x4E, 0x74, 0x63, + 0x74, 0x69, 0x2F, 0x45, 0x4C, 0x0A, 0x4B, 0x31, 0x35, 0x67, 0x2B, 0x4B, + 0x32, 0x71, 0x67, 0x2F, 0x6C, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4D, 0x2B, + 0x51, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, + 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, + 0x2D, 0x2D, 0x2D, 0x0A}; + + // ECDSA P-521 signature, raw format + std::vector signature = { + 0x01, 0x7B, 0x59, 0xAC, 0x3A, 0x03, 0x5C, 0xB4, 0x07, 0xCD, + 0xC1, 0xEB, 0xBE, 0xE5, 0xA6, 0xCB, 0xDA, 0x0A, 0xFF, 0x4D, + 0x38, 0x61, 0x16, 0x0F, 0xB3, 0x77, 0xE5, 0x8A, 0xDC, 0xF3, + 0xFD, 0x79, 0x38, 0x1E, 0xE8, 0x08, 0x3D, 0x5D, 0xBC, 0xC2, + 0x80, 0x6E, 0xE9, 0x2B, 0xC3, 0xEF, 0x07, 0x3D, 0x0C, 0x82, + 0x4C, 0x9B, 0x7A, 0x5C, 0x2E, 0xD5, 0x46, 0xBD, 0x22, 0x21, + 0x13, 0x8A, 0xB2, 0xCA, 0x96, 0x3D, 0x01, 0xBA, 0x2A, 0xC4, + 0x3F, 0xDB, 0x66, 0x3C, 0x40, 0x26, 0xD9, 0xBC, 0x26, 0xD5, + 0x57, 0xD4, 0xBD, 0x15, 0x16, 0x88, 0x21, 0x3B, 0xAA, 0x07, + 0x89, 0xEF, 0x29, 0x8F, 0x2F, 0x85, 0x76, 0x58, 0x9D, 0xCA, + 0x00, 0xCC, 0xC8, 0x30, 0x88, 0x31, 0x99, 0xC1, 0x94, 0xB9, + 0xAF, 0x91, 0xDC, 0xC4, 0x6F, 0x19, 0x2B, 0x12, 0xA2, 0x82, + 0xA5, 0x66, 0x5E, 0x4B, 0xBB, 0xDF, 0x65, 0x81, 0x52, 0x14, + 0x01, 0xD7}; + + d_crypto->set_public_key(publicKey); + + while (state.KeepRunning()) + { + bool output = d_crypto->verify_signature_ecdsa_p521(message, signature); + if (output) + { + // Avoid unused-but-set-variable warning + } + } +} + + +BENCHMARK(bm_SHA_256); +BENCHMARK(bm_SHA3_256); +BENCHMARK(bm_HMAC_SHA_256); +BENCHMARK(bm_CMAC_AES); +BENCHMARK(bm_verify_ecdsa_p256); +BENCHMARK(bm_verify_ecdsa_p521); + +BENCHMARK_MAIN(); From 40cc8de587700bef1c0cc6f8d6ed0e2499860a85 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 25 Jul 2024 09:44:21 +0200 Subject: [PATCH 268/499] make clang-format happy --- .../signal_source/adapters/dma_signal_source_fpga.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc index a560fd419..bba301459 100644 --- a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc @@ -123,11 +123,6 @@ DMASignalSourceFPGA::DMASignalSourceFPGA(const ConfigurationInterface *configura if (samples_ == 0) // read all file { - /*! - * BUG workaround: The GNU Radio file source does not stop the receiver after reaching the End of File. - * A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the - * valve block - */ std::ifstream file(filename0_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); std::ifstream::pos_type size; From 8566eca92fecb9208cb681caaf79a75a7ec5f004 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 23 Jul 2024 20:53:05 +0200 Subject: [PATCH 269/499] [TAS-238][FEAT] Implement Tag accumulation * New class: osnma_nav_data_manager => manages navigation data coming to osnma * navigation data is grouped now avoiding duplication => a NavData entry has now TOW_start and TOW_end * tag accumulation: now, navigation data has verified_bits field, which shows how many tags have verified that data. unless L_T_min achieved, validation is not considered successful --- src/core/libs/osnma_msg_receiver.cc | 164 ++++++------- src/core/libs/osnma_msg_receiver.h | 9 +- src/core/system_parameters/CMakeLists.txt | 2 + src/core/system_parameters/osnma_data.cc | 167 +++---------- src/core/system_parameters/osnma_data.h | 38 +-- .../osnma_nav_data_manager.cc | 226 ++++++++++++++++++ .../osnma_nav_data_manager.h | 41 ++++ .../osnma/osnma_msg_receiver_test.cc | 31 +-- 8 files changed, 409 insertions(+), 269 deletions(-) create mode 100644 src/core/system_parameters/osnma_nav_data_manager.cc create mode 100644 src/core/system_parameters/osnma_nav_data_manager.h diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 0688af6e9..b1d83b3d9 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -24,6 +24,7 @@ #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" +#include "osnma_nav_data_manager.h" // TODO - all these repeated includes, is it good practice to include them in the source file? #include // for gr::io_signature::make #include #include @@ -72,6 +73,7 @@ osnma_msg_receiver::osnma_msg_receiver( d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(crtFilePath, merkleFilePath); d_helper = std::make_unique(); + d_nav_data_manager = std::make_unique(); // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -114,8 +116,8 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) std::cout << output_message.str() << std::endl; process_osnma_message(nma_msg); - } - else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) + } // OSNMA frame received + else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received { // TODO - PRNa is a typo here, I think for d_satellite_nav_data, is PRN_d the name to use const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); @@ -123,23 +125,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) std::string nav_data = std::get<1>(*inav_data); uint32_t TOW = std::get<2>(*inav_data); - // iono data => 549 bits, utc data, 141 bits. - if (nav_data.size() == 549) - { - // LOG(INFO) << "Galileo OSNMA: received ADKD=0/12 navData, PRN_d (" << PRNa << ") " - // << "TOW_sf=" << TOW; - d_satellite_nav_data[PRNa][TOW].ephemeris_iono_vector_2 = nav_data; - } - else if (nav_data.size() == 141) - { - // LOG(INFO) << "Galileo OSNMA: received ADKD=4 navData, PRN_d (" << PRNa << ") " - // << "TOW_sf=" << TOW; - d_satellite_nav_data[PRNa][TOW].utc_vector_2 = nav_data; - } - else - { - LOG(WARNING) << "Galileo OSNMA: osnma_msg_receiver incorrect navData parsing!"; - } + d_nav_data_manager->add_navigation_data(nav_data,PRNa,TOW); } else { @@ -614,8 +600,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrTOW_sf0; if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 {// TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future @@ -963,7 +948,7 @@ void osnma_msg_receiver::process_mack_message() for (auto& it : d_tags_awaiting_verify) { bool ret; - if (tag_has_key_available(it.second) && tag_has_nav_data_available(it.second)) + if (tag_has_key_available(it.second) && d_nav_data_manager->have_nav_data(it.second))//tag_has_nav_data_available(it.second)) { ret = verify_tag(it.second); /* TODO - take into account: @@ -1043,6 +1028,17 @@ void osnma_msg_receiver::process_mack_message() } } + uint8_t tag_size = 0; + const auto it = OSNMA_TABLE_11.find(d_osnma_data.d_dsm_kroot_message.ts); + if (it != OSNMA_TABLE_11.cend()) + { + tag_size = it->second; + } + d_nav_data_manager->update_nav_data(d_tags_awaiting_verify, tag_size); + auto data_to_send = d_nav_data_manager->get_verified_data(); + d_nav_data_manager->print_status(); + send_data_to_pvt(data_to_send); + remove_verified_tags(); control_tags_awaiting_verify_size(); // remove the oldest tags if size is too big. @@ -1123,7 +1119,7 @@ std::vector osnma_msg_receiver::get_merkle_tree_leaves(const DSM_PKR_me } -bool osnma_msg_receiver::verify_tag(const Tag& tag) const +bool osnma_msg_receiver::verify_tag(Tag& tag) const { // Debug // LOG(INFO) << "Galileo OSNMA: Tag verification :: Start for tag Id= " @@ -1209,36 +1205,25 @@ bool osnma_msg_receiver::verify_tag(const Tag& tag) const computed_mac += static_cast(mac[4]); } + tag.computed_tag = computed_mac; // update with computed value // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) { - LOG(INFO) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" - << tag.tag_id - << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase - << tag.received_tag << std::dec - << ", TOW=" - << tag.TOW - << ", ADKD=" - << static_cast(tag.ADKD) - << ", PRNa=" - << static_cast(tag.PRNa) - << ", PRNd=" - << static_cast(tag.PRN_d); - std::cout << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" - << tag.tag_id - << ", ADKD=" - << static_cast(tag.ADKD) - << ", PRNa=" - << static_cast(tag.PRNa) - << ", PRNd=" - << static_cast(tag.PRN_d) << std::endl; return true; } return false; } -std::vector osnma_msg_receiver::build_message(const Tag& tag) const +/** + * \brief generates the message for computing the tag + * \remarks It also sets some parameters to the Tag object, based on the verification process. + * + * \param tag The tag containing the information to be included in the message. + * + * \return The built OSNMA message as a vector of uint8_t. + */ +std::vector osnma_msg_receiver::build_message(Tag& tag) const { std::vector m; if (tag.CTR != 1) @@ -1257,40 +1242,9 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) const m.push_back(two_bits_nmas); // Add applicable NavData bits to message - std::string applicable_nav_data; - std::vector applicable_nav_data_bytes; - if (tag.ADKD == 0 || tag.ADKD == 12) // note: for ADKD=12 still the same logic applies. Only the Key selection is shifted 10 Subframes into the future. - { - const auto it = d_satellite_nav_data.find(tag.PRN_d); - if (it != d_satellite_nav_data.cend()) - { - const auto it2 = it->second.find(tag.TOW - 30); - if (it2 != it->second.cend()) - { - applicable_nav_data = it2->second.ephemeris_iono_vector_2; - } - } - // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; - } - else if (tag.ADKD == 4) - { - const auto it = d_satellite_nav_data.find(tag.PRN_d); - if (it != d_satellite_nav_data.cend()) - { - const auto it2 = it->second.find(tag.TOW - 30); - if (it2 != it->second.cend()) - { - applicable_nav_data = it2->second.utc_vector_2; - } - } - // LOG(INFO) << "|---> Galileo OSNMA :: applicable NavData (PRN_d="<< static_cast(tag.PRN_d) << ", TOW=" << tag.TOW - 30 <<"): 0b" << applicable_nav_data; - } - else - { - LOG(WARNING) << "Galileo OSNMA: Tag verification :: unknown ADKD"; - } - // convert std::string to vector - applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); + std::string applicable_nav_data = d_nav_data_manager->get_navigation_data(tag); + std::vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); + tag.nav_data = applicable_nav_data; // update tag with applicable data // Convert and add NavData bytes into the message, taking care of that NMAS has only 2 bits for (uint8_t byte : applicable_nav_data_bytes) @@ -1322,17 +1276,17 @@ std::vector osnma_msg_receiver::build_message(const Tag& tag) const } -void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) -{ - // control size of container - while (d_satellite_nav_data[SV_ID].size() >= 25) - { - d_satellite_nav_data[SV_ID].erase(d_satellite_nav_data[SV_ID].begin()); - } - // d_osnma_data[TOW] = crypto; // crypto - d_satellite_nav_data[SV_ID][TOW] = data; // nav - // std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; -} +//void osnma_msg_receiver::add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data) +//{ +// // control size of container +// while (d_satellite_nav_data[SV_ID].size() >= 25) +// { +// d_satellite_nav_data[SV_ID].erase(d_satellite_nav_data[SV_ID].begin()); +// } +// // d_osnma_data[TOW] = crypto; // crypto +// d_satellite_nav_data[SV_ID][TOW] = data; // nav +// // std::cout << "Galileo OSNMA: added element, size is " << d_satellite_nav_data[SV_ID].size() << std::endl; +//} void osnma_msg_receiver::display_data() @@ -1411,6 +1365,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO * @brief Removes the tags that have been verified from the multimap d_tags_awaiting_verify. * * This function iterates through the multimap d_tags_awaiting_verify, and removes the tags that have a status of SUCCESS or FAIL. + * \remarks it also prints the current unverified tags */ void osnma_msg_receiver::remove_verified_tags() { @@ -1458,9 +1413,25 @@ void osnma_msg_receiver::remove_verified_tags() } } LOG(INFO) << "Galileo OSNMA: d_tags_awaiting_verify :: size: " << d_tags_awaiting_verify.size(); + for (const auto& it : d_tags_awaiting_verify) + { + LOG(INFO) << "Galileo OSNMA: Tag verification :: status tag Id=" + << it.second.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << it.second.received_tag << std::dec + << ", TOW=" + << it.second.TOW + << ", ADKD=" + << static_cast(it.second.ADKD) + << ", PRNa=" + << static_cast(it.second.PRNa) + << ", PRNd=" + << static_cast(it.second.PRN_d) + << ", status= " + << d_helper->verification_status_str(it.second.status); + } } - /** * @brief Control the size of the tags awaiting verification multimap. * @@ -1847,3 +1818,16 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ return verified_tags; } } +void osnma_msg_receiver::send_data_to_pvt(std::vector data) +{ + if (!data.empty()) + { + for (size_t i = 0; i < data.size(); i++) + { + const auto tmp_obj = std::make_shared(data[i]); + this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj)); + } + + } + +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 7ecbe7428..dd8d6ebf3 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -27,6 +27,7 @@ #include "gnss_block_interface.h" // for gnss_shared_ptr #include "gnss_sdr_make_unique.h" // for std::make:unique in C++11 #include "osnma_data.h" // for OSNMA_data structures +#include "osnma_nav_data_manager.h" #include // for gr::block #include // for pmt::pmt_t #include // for std::array @@ -77,13 +78,14 @@ private: void read_mack_header(); void read_mack_body(); void process_mack_message(); - void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data); +// void add_satellite_data(uint32_t SV_ID, uint32_t TOW, const NavData& data); void remove_verified_tags(); void control_tags_awaiting_verify_size(); void display_data(); + void send_data_to_pvt(std::vector); bool verify_tesla_key(std::vector& key, uint32_t TOW); - bool verify_tag(const Tag& tag) const; + bool verify_tag(Tag& tag) const; bool tag_has_nav_data_available(const Tag& t) const; bool tag_has_key_available(const Tag& t) const; bool verify_macseq(const MACK_message& mack); @@ -91,7 +93,7 @@ private: std::vector get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const; std::vector compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; - std::vector build_message(const Tag& tag) const; + std::vector build_message(Tag& tag) const; std::vector hash_chain(uint32_t num_of_hashes_needed, const std::vector& key, uint32_t GST_SFi, const uint8_t lk_bytes) const; std::vector verify_macseq_new(const MACK_message& mack); @@ -110,6 +112,7 @@ private: std::unique_ptr d_dsm_reader; // osnma parameters parser std::unique_ptr d_crypto; // access to cryptographic functions std::unique_ptr d_helper; + std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data OSNMA_data d_osnma_data{}; diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 055ff256e..5e42732c7 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -32,6 +32,7 @@ set(SYSTEM_PARAMETERS_SOURCES osnma_data.cc osnma_dsm_reader.cc osnma_helper.cc + osnma_nav_data_manager.cc ) set(SYSTEM_PARAMETERS_HEADERS @@ -98,6 +99,7 @@ set(SYSTEM_PARAMETERS_HEADERS osnma_data.h osnma_dsm_reader.h osnma_helper.h + osnma_nav_data_manager.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 49051b7be..14382e21a 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -25,148 +25,37 @@ */ uint32_t Tag::id_counter = 0; -void NavData::init(const std::shared_ptr &osnma_msg) +uint32_t NavData::id_counter = 0; + +bool NavData::add_nav_data(std::string nav_data) { - EphemerisData = osnma_msg->EphemerisData; - IonoData = osnma_msg->IonoData; - UtcData = osnma_msg->UtcModelData; - generate_eph_iono_vector(); - generate_utc_vector(); - PRNa = osnma_msg->PRN; - WN_sf0 = osnma_msg->WN_sf0; - TOW_sf0 = osnma_msg->TOW_sf0; - - // new parsing, directly parsing bits -// ephemeris_iono_vector_2 = osnma_msg->EphemerisClockAndStatusData_2; -// utc_vector_2 = osnma_msg->TimingData_2; -}; -void NavData::generate_eph_iono_vector() -{ - ephemeris_iono_vector.clear(); - uint64_t bit_buffer = 0; // variable to store the bits to be extracted, it can contain bits from different variables - int bit_count = 0; // Number of bits in the buffer, i.e. to be extracted - - // create structure to hold the variables to store into the vector along with their bit size - std::vector> variables = { - // data from word type 1 - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - {static_cast(&EphemerisData.toe), sizeof(EphemerisData.toe) * 8}, - {static_cast(&EphemerisData.M_0), sizeof(EphemerisData.M_0) * 8}, - {static_cast(&EphemerisData.ecc), sizeof(EphemerisData.ecc) * 8}, - {static_cast(&EphemerisData.sqrtA), sizeof(EphemerisData.sqrtA) * 8}, - // data from word type 2 - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - {static_cast(&EphemerisData.OMEGA_0), sizeof(EphemerisData.OMEGA_0) * 8}, - {static_cast(&EphemerisData.i_0), sizeof(EphemerisData.i_0) * 8}, - {static_cast(&EphemerisData.omega), sizeof(EphemerisData.omega) * 8}, - {static_cast(&EphemerisData.idot), sizeof(EphemerisData.idot) * 8}, - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - // data from word type 3 - {static_cast(&EphemerisData.OMEGAdot), sizeof(EphemerisData.OMEGAdot) * 8}, - {static_cast(&EphemerisData.delta_n), sizeof(EphemerisData.delta_n) * 8}, - {static_cast(&EphemerisData.Cuc), sizeof(EphemerisData.Cuc) * 8}, - {static_cast(&EphemerisData.Cus), sizeof(EphemerisData.Cus) * 8}, - {static_cast(&EphemerisData.Crc), sizeof(EphemerisData.Crc) * 8}, - {static_cast(&EphemerisData.Crs), sizeof(EphemerisData.Crs) * 8}, - {static_cast(&EphemerisData.SISA), sizeof(EphemerisData.SISA) * 8}, - // data from word type 4 - {static_cast(&EphemerisData.IOD_nav), sizeof(EphemerisData.IOD_nav) * 8}, - {static_cast(&EphemerisData.PRN), sizeof(EphemerisData.PRN) * 8}, - {static_cast(&EphemerisData.Cic), sizeof(EphemerisData.Cic) * 8}, - {static_cast(&EphemerisData.Cis), sizeof(EphemerisData.Cis) * 8}, - {static_cast(&EphemerisData.toe), sizeof(EphemerisData.toe) * 8}, - {static_cast(&EphemerisData.af0), sizeof(EphemerisData.af0) * 8}, - {static_cast(&EphemerisData.af1), sizeof(EphemerisData.af1) * 8}, - {static_cast(&EphemerisData.af2), sizeof(EphemerisData.af2) * 8}, - // data from word type 5 - {static_cast(&IonoData.ai0), sizeof(IonoData.ai0) * 8}, - {static_cast(&IonoData.ai1), sizeof(IonoData.ai1) * 8}, - {static_cast(&IonoData.ai2), sizeof(IonoData.ai2) * 8}, - {static_cast(&IonoData.Region1_flag), sizeof(IonoData.Region1_flag) * 8}, - {static_cast(&IonoData.Region2_flag), sizeof(IonoData.Region2_flag) * 8}, - {static_cast(&IonoData.Region3_flag), sizeof(IonoData.Region3_flag) * 8}, - {static_cast(&IonoData.Region4_flag), sizeof(IonoData.Region4_flag) * 8}, - {static_cast(&IonoData.Region5_flag), sizeof(IonoData.Region5_flag) * 8}, - {static_cast(&EphemerisData.BGD_E1E5a), sizeof(EphemerisData.BGD_E1E5a) * 8}, - {static_cast(&EphemerisData.BGD_E1E5b), sizeof(EphemerisData.BGD_E1E5b) * 8}, - {static_cast(&EphemerisData.E5b_HS), sizeof(EphemerisData.E5b_HS) * 8}, - {static_cast(&EphemerisData.E1B_HS), sizeof(EphemerisData.E1B_HS) * 8}, - {static_cast(&EphemerisData.E5b_DVS), sizeof(EphemerisData.E5b_DVS) * 8}, - {static_cast(&EphemerisData.E1B_DVS), sizeof(EphemerisData.E1B_DVS) * 8}, - }; - - for (auto& var : variables) - { - // extract the bits from the variable - uint64_t binary_representation; - memcpy(&binary_representation, var.first, var.second / 8); - - // Append the bits to the buffer and update the bit count - bit_buffer = (bit_buffer << var.second) | binary_representation; - bit_count += var.second; - // While there are 8 or more bits in the buffer - while (bit_count >= 8) + if (nav_data.size() == 549) { - // Extract the 8 bits starting from last bit position and add them to the vector - uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; - ephemeris_iono_vector.push_back(extracted_bits); - - // Remove the extracted bits from the buffer - bit_count -= 8; - bit_buffer = bit_buffer & ~(0xFF << bit_count); + ephemeris_iono_vector_2 = nav_data; + std::bitset<10> bits(nav_data.substr(0,10)); + IOD_nav = static_cast(bits.to_ulong()); + return true; } - - } - - // If there are any bits left in the buffer, add them to the vector - if (bit_count > 0) - { - ephemeris_iono_vector.push_back(static_cast(bit_buffer)); - } + else if (nav_data.size() == 141) + { + utc_vector_2 = nav_data; + return true; + } + return false; } - -void NavData::generate_utc_vector() +std::string NavData::get_utc_data() const { - utc_vector.clear(); - uint64_t bit_buffer = 0; - int bit_count = 0; - - std::vector> variables = { - {static_cast(&UtcData.A0), sizeof(UtcData.A0) * 8}, - {static_cast(&UtcData.A1), sizeof(UtcData.A1) * 8}, - {static_cast(&UtcData.Delta_tLS), sizeof(UtcData.Delta_tLS) * 8}, - {static_cast(&UtcData.tot), sizeof(UtcData.tot) * 8}, - {static_cast(&UtcData.WNot), sizeof(UtcData.WNot) * 8}, - {static_cast(&UtcData.WN_LSF), sizeof(UtcData.WN_LSF) * 8}, - {static_cast(&UtcData.DN), sizeof(UtcData.DN) * 8}, - {static_cast(&UtcData.Delta_tLSF), sizeof(UtcData.Delta_tLSF) * 8}, - {static_cast(&UtcData.A_0G), sizeof(UtcData.A_0G) * 8}, - {static_cast(&UtcData.A_1G), sizeof(UtcData.A_1G) * 8}, - {static_cast(&UtcData.t_0G), sizeof(UtcData.t_0G) * 8}, - {static_cast(&UtcData.WN_0G), sizeof(UtcData.WN_0G) * 8}, - }; - - for (auto& var : variables) - { - uint64_t binary_representation; - memcpy(&binary_representation, var.first, var.second / 8); - - bit_buffer = (bit_buffer << var.second) | binary_representation; - bit_count += var.second; - - while (bit_count >= 8) - { - uint8_t extracted_bits = (bit_buffer >> (bit_count - 8)) & 0xFF; - utc_vector.push_back(extracted_bits); - - bit_count -= 8; - bit_buffer = bit_buffer & ~(0xFF << bit_count); - } - } - - if (bit_count > 0) - { - utc_vector.push_back(static_cast(bit_buffer)); - } + return utc_vector_2; +} +std::string NavData::get_ephemeris_data() const +{ + return ephemeris_iono_vector_2; +} +/** + * Updates the last TOW the NavData bits were received. + * @param TOW + */ +void NavData::update_last_received_timestamp(uint32_t TOW) +{ + last_received_TOW = TOW; } - diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 484fa0162..57e4b7012 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -129,23 +129,28 @@ public: class NavData { public: - NavData()=default; - void init(const std::shared_ptr &osnma_msg); - std::vector ephemeris_iono_vector{}; - std::string ephemeris_iono_vector_2{}; - std::vector utc_vector{}; - std::string utc_vector_2{}; - uint32_t PRNa{}; - uint32_t WN_sf0{}; - uint32_t TOW_sf0{}; + NavData(): nav_data_id(id_counter++){ + + } + bool have_this_bits(std::string nav_data); + bool add_nav_data(std::string nav_data); + void update_last_received_timestamp(uint32_t TOW); + const uint32_t nav_data_id; + uint32_t verified_bits{0}; + uint32_t TOW_sf0{0}; + uint32_t last_received_TOW{0}; + uint32_t IOD_nav{0}; + std::string get_utc_data() const; + std::string get_ephemeris_data() const; + bool verified{false}; + uint32_t PRNd{0}; + uint32_t ADKD{}; private: - Galileo_Ephemeris EphemerisData; - Galileo_Iono IonoData; - Galileo_Utc_Model UtcData; - void generate_eph_iono_vector(); // TODO pass data directly fro Telemetry Decoder (if bits are in the needed order) - void generate_utc_vector(); // TODO + std::string ephemeris_iono_vector_2{}; + std::string utc_vector_2{}; + uint32_t static id_counter; }; /*! @@ -202,20 +207,19 @@ public: { } const uint32_t tag_id; + uint32_t static id_counter; uint32_t TOW; uint32_t WN; uint32_t PRNa; uint8_t CTR; e_verification_status status; uint64_t received_tag; - - uint32_t static id_counter; uint64_t computed_tag; - uint8_t PRN_d; uint8_t ADKD; uint8_t cop; uint32_t skipped; + std::string nav_data; }; /** \} */ /** \} */ diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/system_parameters/osnma_nav_data_manager.cc new file mode 100644 index 000000000..c8c979306 --- /dev/null +++ b/src/core/system_parameters/osnma_nav_data_manager.cc @@ -0,0 +1,226 @@ +// +// Created by cgm on 23/07/24. +// + +#include "osnma_nav_data_manager.h" +#if USE_GLOG_AND_GFLAGS +#include // for DLOG +#else +#include +#endif + +/** + * @brief Adds the navigation data bits to the container holding NavData objects. + * + * @param nav_bits The navigation bits. + * @param PRNd The satellite ID. + * @param TOW The TOW of the received data. + */ +void OSNMA_nav_data_Manager::add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) +{ + if(not have_nav_data(nav_bits, PRNd, TOW)) + { + _satellite_nav_data[PRNd][TOW].add_nav_data(nav_bits); + _satellite_nav_data[PRNd][TOW].PRNd = PRNd; + _satellite_nav_data[PRNd][TOW].TOW_sf0 = TOW; + } +} +/** + * @brief loops over the verified tags and updates the navigation data tag length + */ +void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size) +{ + // loop through all tags + for (const auto& tag : tags_verified) + { + // if tag status is verified, look for corresponding navData and add increase verified tag bits. + if (tag.second.status == Tag::e_verification_status::SUCCESS) + { + if(have_PRNd_nav_data(tag.second.PRN_d)) + { + std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; + for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + { + std::string nav_data; + if(tag.second.ADKD == 0 || tag.second.ADKD == 12){ + nav_data = tow_it->second.get_ephemeris_data(); + } + else if(tag.second.ADKD == 4){ + nav_data = tow_it->second.get_utc_data(); + } + // find associated navData + if (tag.second.nav_data == nav_data){ + _satellite_nav_data[tag.second.PRN_d][tow_it->first].verified_bits += tag_size; + } + } + } + } + } +} +bool OSNMA_nav_data_Manager::have_PRNd_nav_data(uint32_t PRNd) +{ + // check if have data from PRNd in _satellite_nav_data + return _satellite_nav_data.find(PRNd) != _satellite_nav_data.end(); +} +std::vector OSNMA_nav_data_Manager::get_verified_data() +{ + std::vector result; + for (const auto& prna : _satellite_nav_data) + { + for (const auto& tow_navdata : prna.second) + { + if (tow_navdata.second.verified_bits >= L_t_min) + { + result.push_back(tow_navdata.second); + _satellite_nav_data[prna.first][tow_navdata.first].verified = true; + } + } + } + return result; +} +bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD) +{ + if (ADKD == 0 || ADKD == 12) + { + const auto it = _satellite_nav_data.find(PRNd); + if (it != _satellite_nav_data.cend()) + { + const auto it2 = it->second.find(TOW); + if (it2 != it->second.cend() && it->second[TOW].get_ephemeris_data() != "") + { + return true; + } + } + } + else if (ADKD == 4) + { + const auto it = _satellite_nav_data.find(PRNd); + if (it != _satellite_nav_data.cend()) + { + const auto it2 = it->second.find(TOW); + if (it2 != it->second.cend() && it->second[TOW].get_utc_data() != "") + { + return true; + } + } + } + return false; +} +/** + * @brief returns NavData object. + * @remarks assumes it exists (called have_nav_data before), otherwise undefined behavior + * TODO - maybe add const promise and use find() instead? this is kinda sensitive topic. + */ +std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) +{ + auto prn_it = _satellite_nav_data.find(tag.PRN_d); + if (prn_it == _satellite_nav_data.end()){ + return ""; + } + + // satellite was found, check if TOW exists in inner map + std::map tow_map = prn_it->second; + for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + { + // Check if current key (TOW) fulfills condition + if ((tag.TOW - 30 * tag.cop) <= tow_it->first && tow_it->first <= tag.TOW - 30) + { + if(tag.ADKD == 0 || tag.ADKD == 12) + { + if(tow_it->second.get_ephemeris_data() != ""){ + return tow_it->second.get_ephemeris_data(); + } + } + else if(tag.ADKD == 4) + { + if(tow_it->second.get_utc_data() != ""){ + return tow_it->second.get_utc_data(); + } + } + } + } + return ""; +} +/** + * @brief Checks if the navData bits are already present. In case affirmative, it updates the NavData 'last received' timestamp + * @remarks e.g.: a SV may repeat the bits over several subframes. In that case, need to save them only once. + * @param nav_bits + * @param PRNd + * @return + */ +bool OSNMA_nav_data_Manager::have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) +{ + if(_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ + for (auto& data_timestamp : _satellite_nav_data[PRNd]) + { + if(nav_bits.size() == EPH_SIZE){ + if(data_timestamp.second.get_ephemeris_data() == nav_bits){ + data_timestamp.second.update_last_received_timestamp(TOW); + return true; + } + } + else if(nav_bits.size() == UTC_SIZE){ + if(data_timestamp.second.get_utc_data() == nav_bits){ + data_timestamp.second.update_last_received_timestamp(TOW); + return true; + } + } + } + } + return false; +} +/** + * @brief Checks if there is a NavData element within the COP time interval for a Tag t + * @param t Tag object + * @return True if the needed navigation data for the tag is available (oldest possible NavData available) + */ +bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const +{ + auto prn_it = _satellite_nav_data.find(t.PRN_d); + if (prn_it == _satellite_nav_data.end()){ + return false; + } + // satellite was found, check if TOW exists in inner map + std::map tow_map = prn_it->second; + for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + { + // Check if current key (TOW) fulfills condition + if (t.TOW - 30 * t.cop <= tow_it->first && tow_it->first <= t.TOW - 30) + { + if(t.ADKD == 0 || t.ADKD == 12) + { + if(tow_it->second.get_ephemeris_data() != ""){ + return true; + } + } + else if(t.ADKD == 4) + { + if(tow_it->second.get_utc_data() != ""){ + return true; + } + } + + } + } + return false; +} +void OSNMA_nav_data_Manager::print_status() +{ + for (const auto& satellite : _satellite_nav_data){ + LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first; + auto& tow_data = satellite.second; + for (const auto& nav_data : tow_data) + LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase + << std::bitset<10>(nav_data.second.IOD_nav) + << ", TOW_start=" + << nav_data.second.TOW_sf0 + << ", TOW_last=" + << nav_data.second.last_received_TOW + << ", l_t=" + << nav_data.second.verified_bits + << ", PRNd=" + << nav_data.second.PRNd + << ", verified=" + << nav_data.second.verified; + } +} diff --git a/src/core/system_parameters/osnma_nav_data_manager.h b/src/core/system_parameters/osnma_nav_data_manager.h new file mode 100644 index 000000000..9471a14a8 --- /dev/null +++ b/src/core/system_parameters/osnma_nav_data_manager.h @@ -0,0 +1,41 @@ +// +// Created by cgm on 23/07/24. +// + +#ifndef GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H +#define GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H + +#include "osnma_data.h" // NavData +#include // uint32_t +#include +#include + +/** + * @class OSNMA_nav_data_Manager + * @brief Class for managing OSNMA navigation data + * @details It does good stuff + * @remarks throw it whatever, it will improve it. Does good stuff + */ +class OSNMA_nav_data_Manager{ +public: + OSNMA_nav_data_Manager() = default; + bool have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); + bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); + bool have_nav_data(const Tag& t) const; + void add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list + std::string get_navigation_data(const Tag& t); + + void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); + std::vector get_verified_data(); + void print_status(); +private: + bool have_PRNd_nav_data(uint32_t PRNd); + + std::map> _satellite_nav_data{}; // NavData sorted by [PRNd][TOW_start] + const uint32_t L_t_min{40}; + const uint16_t EPH_SIZE{549}; + const uint16_t UTC_SIZE{141}; + const uint16_t MAX_ALLOWED_SIZE{150}; // arbitrary maximum for the navigation data container + +}; +#endif // GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index d0df27a3b..d741dfbf6 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -64,6 +64,7 @@ public: TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) { + // input data taken from Receiver Guidelines v1.3, A.7 // Arrange // ---------- std::vector computed_merkle_root; @@ -74,6 +75,7 @@ TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) dsm_pkr_message.mid = 0x01; std::vector base_leaf = helper.convert_from_hex_string("120303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + // ITN std::vector vec = helper.convert_from_hex_string("7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" @@ -92,6 +94,7 @@ TEST_F(OsnmaMsgReceiverTest, ComputeMerkleRoot) TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) { + // input data taken from Receiver Guidelines v1.3, A.7 // Arrange // ---------- std::vector expected_base_leaf = helper.convert_from_hex_string("120303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); @@ -109,7 +112,9 @@ TEST_F(OsnmaMsgReceiverTest, ComputeBaseLeaf) ASSERT_EQ(computed_base_leaf,expected_base_leaf); } -TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ // values taken from RG A.7 +TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ + + // input data taken from Receiver Guidelines v1.3, A.7 // Arrange // ---------- osnma->d_crypto->set_merkle_root(helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D")); @@ -126,7 +131,7 @@ TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ // values taken from RG A.7 // Act // ---------- - bool result = osnma->verify_dsm_pkr(dsm_pkr_message); + bool result = osnma->verify_dsm_pkr(dsm_pkr_message); // TODO - refactor method so that output is more than a boolean. // Assert // ---------- @@ -136,6 +141,7 @@ TEST_F(OsnmaMsgReceiverTest, VerifyPublicKey){ // values taken from RG A.7 TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) { + // input data taken from Receiver Guidelines v1.3, A.6.5.1 // Arrange // ---------- // m0 @@ -181,6 +187,7 @@ TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) } TEST_F(OsnmaMsgReceiverTest, TagVerification) { + // input data taken from Receiver Guidelines v1.3, A.6.5.1 // Arrange // ---------- // Tag0 @@ -204,20 +211,10 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { MTI.tag_info.cop = 0x0F; Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); - - // Act // ---------- bool result_tag0 = osnma->verify_tag(t0); - - - - - // Assert - // ---------- - //ASSERT_TRUE(result_tag0); - // Tag3 uint32_t TOW_Tag3 = 345660; uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; @@ -247,6 +244,7 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) { } TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { + // input data taken from Receiver Guidelines v1.3, A.5.2 // Arrange // ---------- osnma->d_tesla_key_verified = false; @@ -262,16 +260,9 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) { std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 uint32_t TOW = 345630; - - - // Act // ---------- - bool result = osnma->verify_tesla_key(key, TOW); - - - - + bool result = osnma->verify_tesla_key(key, TOW); // TODO - refactor so that output is not a boolean. Or use last_verified_tesla_key? // Assert // ---------- From e0506eaf9b08f3d76a893a5761684eff9a6bbd6b Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 25 Jul 2024 16:00:43 +0200 Subject: [PATCH 270/499] Consider CI/CD comments (x2) --- src/core/libs/osnma_msg_receiver.cc | 19 +++--- src/core/libs/osnma_msg_receiver.h | 2 +- src/core/system_parameters/osnma_data.cc | 2 +- src/core/system_parameters/osnma_data.h | 6 +- .../osnma_nav_data_manager.cc | 58 +++++++++++-------- .../osnma_nav_data_manager.h | 30 +++++++--- .../osnma/osnma_msg_receiver_test.cc | 37 ++++++------ 7 files changed, 88 insertions(+), 66 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f01414ad4..49ee685bf 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -24,7 +24,7 @@ #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" -#include "osnma_nav_data_manager.h" // TODO - all these repeated includes, is it good practice to include them in the source file? +#include "osnma_nav_data_manager.h" // TODO - all these repeated includes, is it good practice to include them in the source file? #include // for gr::io_signature::make #include #include @@ -118,16 +118,15 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) std::cout << output_message.str() << std::endl; process_osnma_message(nma_msg); - } // OSNMA frame received - else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received + } // OSNMA frame received + else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received { // TODO - PRNa is a typo here, I think for d_satellite_nav_data, is PRN_d the name to use const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); uint32_t PRNa = std::get<0>(*inav_data); std::string nav_data = std::get<1>(*inav_data); uint32_t TOW = std::get<2>(*inav_data); - - d_nav_data_manager->add_navigation_data(nav_data,PRNa,TOW); + d_nav_data_manager->add_navigation_data(nav_data, PRNa,TOW); } else { @@ -605,7 +604,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrTOW_sf0); if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 - {// TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future + { // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future read_mack_header(); d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly. d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; @@ -949,7 +948,7 @@ void osnma_msg_receiver::process_mack_message() for (auto& it : d_tags_awaiting_verify) { bool ret; - if (tag_has_key_available(it.second) && d_nav_data_manager->have_nav_data(it.second))//tag_has_nav_data_available(it.second)) + if (tag_has_key_available(it.second) && d_nav_data_manager->have_nav_data(it.second)) // tag_has_nav_data_available(it.second)) { ret = verify_tag(it.second); /* TODO - take into account: @@ -1206,7 +1205,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) const computed_mac += static_cast(mac[4]); } - tag.computed_tag = computed_mac; // update with computed value + tag.computed_tag = computed_mac; // update with computed value // Compare computed tag with received one truncated if (tag.received_tag == computed_mac) { @@ -1245,7 +1244,7 @@ std::vector osnma_msg_receiver::build_message(Tag& tag) const // Add applicable NavData bits to message std::string applicable_nav_data = d_nav_data_manager->get_navigation_data(tag); std::vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); - tag.nav_data = applicable_nav_data; // update tag with applicable data + tag.nav_data = applicable_nav_data; // update tag with applicable data // Convert and add OSNMA_NavData bytes into the message, taking care of that NMAS has only 2 bits for (uint8_t byte : applicable_nav_data_bytes) @@ -1814,7 +1813,5 @@ void osnma_msg_receiver::send_data_to_pvt(std::vector data) const auto tmp_obj = std::make_shared(data[i]); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj)); } - } - } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 19fc9a4a3..53931d2cc 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -111,7 +111,7 @@ private: std::unique_ptr d_dsm_reader; // osnma parameters parser std::unique_ptr d_crypto; // access to cryptographic functions std::unique_ptr d_helper; - std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data + std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data OSNMA_data d_osnma_data{}; diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index aef0f9e10..d19a30cab 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -24,7 +24,7 @@ bool OSNMA_NavData::add_nav_data(std::string nav_data) if (nav_data.size() == 549) { d_ephemeris_iono = nav_data; - std::bitset<10> bits(nav_data.substr(0,10)); + std::bitset<10> bits(nav_data.substr(0, 10)); IOD_nav = static_cast(bits.to_ulong()); return true; } diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 72fa0fa37..46b54dcfe 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -127,9 +127,7 @@ public: class OSNMA_NavData { public: - OSNMA_NavData(): nav_data_id(id_counter++){ - - } + OSNMA_NavData(): nav_data_id(id_counter++){} bool have_this_bits(std::string nav_data); bool add_nav_data(std::string nav_data); void update_last_received_timestamp(uint32_t TOW); @@ -141,6 +139,8 @@ public: uint32_t IOD_nav{0}; std::string get_utc_data() const; std::string get_ephemeris_data() const; + void set_ephemeris_data(std::string value) {d_ephemeris_iono = value;} + void set_utc_data(std::string value) {d_utc = value;} bool verified{false}; uint32_t PRNd{0}; uint32_t ADKD{}; diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/system_parameters/osnma_nav_data_manager.cc index c792239ec..5b42e799d 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.cc +++ b/src/core/system_parameters/osnma_nav_data_manager.cc @@ -1,10 +1,23 @@ -// -// Created by cgm on 23/07/24. -// +/*! +* \file osnma_nav_data_manager.cc +* \brief Class for Galileo OSNMA navigation data management +* \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- +*/ #include "osnma_nav_data_manager.h" #if USE_GLOG_AND_GFLAGS #include // for DLOG +#include #else #include #endif @@ -18,7 +31,7 @@ */ void OSNMA_nav_data_Manager::add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) { - if(not have_nav_data(nav_bits, PRNd, TOW)) + if (not have_nav_data(nav_bits, PRNd, TOW)) { _satellite_nav_data[PRNd][TOW].add_nav_data(nav_bits); _satellite_nav_data[PRNd][TOW].PRNd = PRNd; @@ -36,16 +49,16 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& // if tag status is verified, look for corresponding OSNMA_NavData and add increase verified tag bits. if (tag.second.status == Tag::e_verification_status::SUCCESS) { - if(have_PRNd_nav_data(tag.second.PRN_d)) + if (have_PRNd_nav_data(tag.second.PRN_d)) { std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset { std::string nav_data; - if(tag.second.ADKD == 0 || tag.second.ADKD == 12){ + if (tag.second.ADKD == 0 || tag.second.ADKD == 12){ nav_data = tow_it->second.get_ephemeris_data(); } - else if(tag.second.ADKD == 4){ + else if (tag.second.ADKD == 4){ nav_data = tow_it->second.get_utc_data(); } // find associated OSNMA_NavData @@ -120,20 +133,20 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition if ((tag.TOW - 30 * tag.cop) <= tow_it->first && tow_it->first <= tag.TOW - 30) { - if(tag.ADKD == 0 || tag.ADKD == 12) + if (tag.ADKD == 0 || tag.ADKD == 12) { - if(tow_it->second.get_ephemeris_data() != ""){ + if (tow_it->second.get_ephemeris_data() != ""){ return tow_it->second.get_ephemeris_data(); } } else if(tag.ADKD == 4) { - if(tow_it->second.get_utc_data() != ""){ + if (tow_it->second.get_utc_data() != ""){ return tow_it->second.get_utc_data(); } } @@ -150,17 +163,17 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) */ bool OSNMA_nav_data_Manager::have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) { - if(_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ + if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ for (auto& data_timestamp : _satellite_nav_data[PRNd]) { - if(nav_bits.size() == EPH_SIZE){ - if(data_timestamp.second.get_ephemeris_data() == nav_bits){ + if (nav_bits.size() == EPH_SIZE){ + if (data_timestamp.second.get_ephemeris_data() == nav_bits){ data_timestamp.second.update_last_received_timestamp(TOW); return true; } } - else if(nav_bits.size() == UTC_SIZE){ - if(data_timestamp.second.get_utc_data() == nav_bits){ + else if (nav_bits.size() == UTC_SIZE){ + if (data_timestamp.second.get_utc_data() == nav_bits){ data_timestamp.second.update_last_received_timestamp(TOW); return true; } @@ -182,24 +195,23 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const } // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition if (t.TOW - 30 * t.cop <= tow_it->first && tow_it->first <= t.TOW - 30) { - if(t.ADKD == 0 || t.ADKD == 12) + if (t.ADKD == 0 || t.ADKD == 12) { - if(tow_it->second.get_ephemeris_data() != ""){ + if (tow_it->second.get_ephemeris_data() != ""){ return true; } } - else if(t.ADKD == 4) + else if (t.ADKD == 4) { - if(tow_it->second.get_utc_data() != ""){ + if (tow_it->second.get_utc_data() != ""){ return true; } } - } } return false; diff --git a/src/core/system_parameters/osnma_nav_data_manager.h b/src/core/system_parameters/osnma_nav_data_manager.h index cfea6ca94..2101bef3a 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.h +++ b/src/core/system_parameters/osnma_nav_data_manager.h @@ -1,13 +1,26 @@ -// -// Created by cgm on 23/07/24. -// +/*! +* \file osnma_nav_data_manager.h +* \brief Class for Galileo OSNMA navigation data management +* \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- +*/ #ifndef GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H #define GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H -#include "osnma_data.h" // NavData -#include // uint32_t +#include "osnma_data.h" // NavData +#include // uint32_t #include +#include #include /** @@ -22,7 +35,7 @@ public: bool have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); bool have_nav_data(const Tag& t) const; - void add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list + void add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list std::string get_navigation_data(const Tag& t); void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); @@ -31,11 +44,10 @@ public: private: bool have_PRNd_nav_data(uint32_t PRNd); - std::map> _satellite_nav_data{}; // NavData sorted by [PRNd][TOW_start] + std::map> _satellite_nav_data{}; // NavData sorted by [PRNd][TOW_start] const uint32_t L_t_min{40}; const uint16_t EPH_SIZE{549}; const uint16_t UTC_SIZE{141}; - const uint16_t MAX_ALLOWED_SIZE{150}; // arbitrary maximum for the navigation data container - + const uint16_t MAX_ALLOWED_SIZE{150}; // arbitrary maximum for the navigation data container }; #endif // GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 08873dc47..c67b2b208 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -63,7 +63,7 @@ protected: const uint32_t LEAP_SECONDS = 0; // 13 + 5; void set_time(std::tm& input); // std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; - std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; + std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; // TODO - google::InitGoogleLogging(log_name.c_str()); but cannot be called twice void initializeGoogleLog(); void SetUp() override @@ -174,7 +174,7 @@ TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDB, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_ephemeris_iono_data( + osnma->d_nav_data_manager->add_navigation_data( "000011101001011001000100000101000111010110100100100101100000000000" "011101101011001111101110101010000001010000011011111100000011101011" "011100101101011010101011011011001001110111101011110110111111001111" @@ -183,7 +183,8 @@ TEST_F(OsnmaMsgReceiverTest, BuildTagMessageM0) "110100010001000110001110011010110000111010000010000000000001101000" "000000000011100101100100010000000000000110110100110001111100000000" "000000100110100000000101010010100000001011000010001001100000011111" - "110111111111000000000"); + "110111111111000000000", + PRNa, TOW_NavData); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MACK_tag_and_info MTI; @@ -216,17 +217,16 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_ephemeris_iono_data(""); - osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_ephemeris_iono_data( - "000011101001011001000100000101000111010110100100100101100000000000" - "011101101011001111101110101010000001010000011011111100000011101011" - "011100101101011010101011011011001001110111101011110110111111001111" - "001000011111101110011000111111110111111010000011101011111111110000" - "110111000000100000001110110000110110001110000100001110101100010100" - "110100010001000110001110011010110000111010000010000000000001101000" - "000000000011100101100100010000000000000110110100110001111100000000" - "000000100110100000000101010010100000001011000010001001100000011111" - "110111111111000000000"); + osnma->d_nav_data_manager->add_navigation_data( + "000011101001011001000100000101000111010110100100100101100000000000" + "011101101011001111101110101010000001010000011011111100000011101011" + "011100101101011010101011011011001001110111101011110110111111001111" + "001000011111101110011000111111110111111010000011101011111111110000" + "110111000000100000001110110000110110001110000100001110101100010100" + "110100010001000110001110011010110000111010000010000000000001101000" + "000000000011100101100100010000000000000110110100110001111100000000" + "000000100110100000000101010010100000001011000010001001100000011111" + "110111111111000000000", PRNa, TOW_NavData); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MACK_tag_and_info MTI; @@ -252,9 +252,10 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit osnma->d_tesla_keys[TOW_Key_Tag3] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; - osnma->d_satellite_nav_data[PRNa][TOW_NavData].set_utc_data( + osnma->d_nav_data_manager->add_navigation_data( "111111111111111111111111111111110000000000000000000000010001001001001000" - "111000001000100111100010010111111111011110111111111001001100000100000000"); + "111000001000100111100010010111111111011110111111111001001100000100000" + , PRNa, TOW_NavData); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MTI.tag = static_cast(0x7BB238C883); @@ -648,10 +649,10 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) void OsnmaMsgReceiverTest::initializeGoogleLog() { - google::InitGoogleLogging(log_name.c_str()); // TODO - running all tests causes conflict due to being called twice + // google::InitGoogleLogging(log_name.c_str()); FLAGS_minloglevel = 0; // INFO FLAGS_logtostderr = 0; // add this line - FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/data/build/src/tests/logs"; + // FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/data/logs"; if (FLAGS_log_dir.empty()) { std::cout << "Logging will be written at " From 3cc12e9b66b303a6ed15b058f787b62b66bc8eae Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 25 Jul 2024 21:40:43 +0200 Subject: [PATCH 271/499] Add basic infrastructure for the GNSS-SDR.osnma_mode=strict mode --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 11 ++++++ .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 38 +++++++++++++++---- .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 1 + src/algorithms/PVT/libs/pvt_conf.h | 1 + 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index bdd1f97c6..e964cf5a6 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -919,6 +919,17 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Use unhealthy satellites pvt_output_parameters.use_unhealthy_sats = configuration->property(role + ".use_unhealthy_sats", pvt_output_parameters.use_unhealthy_sats); + // OSNMA + if (gal_1B_count > 0) + { + std::string osnma_mode = configuration->property("GNSS-SDR.osnma_mode", std::string("")); + bool enable_osnma = configuration->property("GNSS-SDR.osnma_enable", true); + if (enable_osnma && osnma_mode == "strict") + { + pvt_output_parameters.osnma_strict = true; + } + } + // make PVT object pvt_ = rtklib_make_pvt_gs(in_streams_, pvt_output_parameters, rtk); DLOG(INFO) << "pvt(" << pvt_->unique_id() << ")"; diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 20982d650..109b935c7 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -185,7 +185,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_an_printer_enabled(conf_.an_output_enabled), d_log_timetag(conf_.log_source_timetag), d_use_has_corrections(conf_.use_has_corrections), - d_use_unhealthy_sats(conf_.use_unhealthy_sats) + d_use_unhealthy_sats(conf_.use_unhealthy_sats), + d_osnma_strict(conf_.osnma_strict) { // Send feedback message to observables block with the receiver clock offset this->message_port_register_out(pmt::mp("pvt_to_observables")); @@ -1652,10 +1653,18 @@ void rtklib_pvt_gs::msg_handler_osnma(const pmt::pmt_t& msg) { try { + // Still not sure about what we should receive here. + // It should be a structure with the list of PRNs authenticated (NavData and utcData, + // so with ADKD0 and ADKD12 validated), their corresponding TOW at the beginning + // of the authenticated subframe, and maybe the COP. const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code(); if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { // Act according to NMA data + if (d_osnma_strict) + { + // TODO + } } } catch (const wht::bad_any_cast& e) @@ -2023,7 +2032,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item bool store_valid_observable = false; - if (tmp_eph_iter_gps != d_internal_pvt_solver->gps_ephemeris_map.cend()) + if (!d_osnma_strict && tmp_eph_iter_gps != d_internal_pvt_solver->gps_ephemeris_map.cend()) { const uint32_t prn_aux = tmp_eph_iter_gps->second.PRN; if ((prn_aux == in[i][epoch].PRN) && (std::string(in[i][epoch].Signal, 2) == std::string("1C")) && (d_use_unhealthy_sats || (tmp_eph_iter_gps->second.SV_health == 0))) @@ -2039,10 +2048,18 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item ((std::string(in[i][epoch].Signal, 2) == std::string("5X")) && (d_use_unhealthy_sats || ((tmp_eph_iter_gal->second.E5a_DVS == false) && (tmp_eph_iter_gal->second.E5a_HS == 0)))) || ((std::string(in[i][epoch].Signal, 2) == std::string("7X")) && (d_use_unhealthy_sats || ((tmp_eph_iter_gal->second.E5b_DVS == false) && (tmp_eph_iter_gal->second.E5b_HS == 0)))))) { - store_valid_observable = true; + if (d_osnma_strict && ((std::string(in[i][epoch].Signal, 2) == std::string("1B")) || ((std::string(in[i][epoch].Signal, 2) == std::string("7X"))))) + { + // Pick up only authenticated satellites + // TODO + } + else + { + store_valid_observable = true; + } } } - if (tmp_eph_iter_cnav != d_internal_pvt_solver->gps_cnav_ephemeris_map.cend()) + if (!d_osnma_strict && tmp_eph_iter_cnav != d_internal_pvt_solver->gps_cnav_ephemeris_map.cend()) { const uint32_t prn_aux = tmp_eph_iter_cnav->second.PRN; if ((prn_aux == in[i][epoch].PRN) && (((std::string(in[i][epoch].Signal, 2) == std::string("2S")) || (std::string(in[i][epoch].Signal, 2) == std::string("L5"))))) @@ -2050,7 +2067,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item store_valid_observable = true; } } - if (tmp_eph_iter_glo_gnav != d_internal_pvt_solver->glonass_gnav_ephemeris_map.cend()) + if (!d_osnma_strict && tmp_eph_iter_glo_gnav != d_internal_pvt_solver->glonass_gnav_ephemeris_map.cend()) { const uint32_t prn_aux = tmp_eph_iter_glo_gnav->second.PRN; if ((prn_aux == in[i][epoch].PRN) && ((std::string(in[i][epoch].Signal, 2) == std::string("1G")) || (std::string(in[i][epoch].Signal, 2) == std::string("2G")))) @@ -2058,7 +2075,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item store_valid_observable = true; } } - if (tmp_eph_iter_bds_dnav != d_internal_pvt_solver->beidou_dnav_ephemeris_map.cend()) + if (!d_osnma_strict && tmp_eph_iter_bds_dnav != d_internal_pvt_solver->beidou_dnav_ephemeris_map.cend()) { const uint32_t prn_aux = tmp_eph_iter_bds_dnav->second.PRN; if ((prn_aux == in[i][epoch].PRN) && (((std::string(in[i][epoch].Signal, 2) == std::string("B1")) || (std::string(in[i][epoch].Signal, 2) == std::string("B3"))) && (d_use_unhealthy_sats || (tmp_eph_iter_bds_dnav->second.SV_health == 0)))) @@ -2068,7 +2085,14 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } if (std::string(in[i][epoch].Signal, 2) == std::string("E6")) { - store_valid_observable = true; + if (d_osnma_strict) + { + // TODO + } + else + { + store_valid_observable = true; + } } if (store_valid_observable) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 96c527e25..4acc14728 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -280,6 +280,7 @@ private: bool d_log_timetag; bool d_use_has_corrections; bool d_use_unhealthy_sats; + bool d_osnma_strict; }; diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index 37d9b5aac..19d0a2e8d 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -95,6 +95,7 @@ public: bool use_e6_for_pvt = true; bool use_has_corrections = true; bool use_unhealthy_sats = false; + bool osnma_strict = false; // PVT KF parameters bool enable_pvt_kf = false; From 06e0c4b63ad9b036ea899fefc3d6276c2838216c Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Fri, 26 Jul 2024 18:03:21 +0200 Subject: [PATCH 272/499] [TAS-247][FEAT][Kroot] enable hotstart with last known Kroot * Kroot is now saved into binary file if successfuly verified. * on startup, file is checked first. * This should enable a much quicker TTFAF --- src/core/libs/osnma_msg_receiver.cc | 22 ++++-- src/core/libs/osnma_msg_receiver.h | 9 +-- src/core/receiver/gnss_flowgraph.cc | 3 +- src/core/system_parameters/Galileo_OSNMA.h | 1 + src/core/system_parameters/gnss_crypto.cc | 67 ++++++++++++++++++- src/core/system_parameters/gnss_crypto.h | 14 +++- .../osnma/osnma_msg_receiver_test.cc | 4 +- 7 files changed, 102 insertions(+), 18 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 49ee685bf..27130600f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -60,22 +60,26 @@ namespace wht = std; #endif -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath) +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath) { - return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath)); + return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath, rootKeyFilePath)); } -osnma_msg_receiver::osnma_msg_receiver( - const std::string& crtFilePath, - const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", +osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath) : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); - d_crypto = std::make_unique(crtFilePath, merkleFilePath); + d_crypto = std::make_unique(crtFilePath, merkleFilePath, rootKeyFilePath); d_helper = std::make_unique(); d_nav_data_manager = std::make_unique(); + + if(d_crypto->have_root_key()){ + d_kroot = d_crypto->get_root_key(); + d_kroot_verified = true; + } + // register OSNMA input message port from telemetry blocks this->message_port_register_in(pmt::mp("OSNMA_from_TLM")); // register OSNMA output message port to PVT block @@ -126,7 +130,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) uint32_t PRNa = std::get<0>(*inav_data); std::string nav_data = std::get<1>(*inav_data); uint32_t TOW = std::get<2>(*inav_data); - d_nav_data_manager->add_navigation_data(nav_data, PRNa,TOW); + d_nav_data_manager->add_navigation_data(nav_data, PRNa, TOW); } else { @@ -490,6 +494,10 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); + // Save Kroot into a permanent storage + d_crypto->store_root_key(ROOTKEYFILE_DEFAULT); + d_kroot = d_osnma_data.d_dsm_kroot_message.kroot; + d_crypto->set_root_key(d_kroot); } else { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 53931d2cc..412296f12 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -50,7 +50,7 @@ class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath); /*! * \brief GNU Radio block that receives asynchronous OSNMA messages @@ -63,8 +63,8 @@ class osnma_msg_receiver : public gr::block public: ~osnma_msg_receiver() = default; //!< Default destructor private: - friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); - osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath); + friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath); + osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); @@ -100,6 +100,7 @@ private: std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW + std::vector d_kroot; // last available stored root key std::vector d_tags_to_verify{0, 4, 12}; std::vector d_macks_awaiting_MACSEQ_verification; @@ -110,7 +111,7 @@ private: std::unique_ptr d_dsm_reader; // osnma parameters parser std::unique_ptr d_crypto; // access to cryptographic functions - std::unique_ptr d_helper; + std::unique_ptr d_helper; // helper class with auxiliary functions std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data OSNMA_data d_osnma_data{}; diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index af1795ee0..035d690dc 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -126,7 +126,8 @@ void GNSSFlowgraph::init() enable_osnma_rx_ = true; const auto certFilePath = configuration_->property("GNSS-SDR.osnma_public_key", CRTFILE_DEFAULT); const auto merKleTreePath = configuration_->property("GNSS-SDR.osnma_merkletree", MERKLEFILE_DEFAULT); - osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath); + const auto rootKeyPath = configuration_->property("GNSS-SDR.osnma_root_key", ROOTKEYFILE_DEFAULT); + osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath, rootKeyPath); } else { diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 09f615e08..08a14c93e 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -163,6 +163,7 @@ const std::unordered_map OSNMA_TABLE_15 = { const std::string PEMFILE_STORED("./OSNMA_PublicKey.pem"); const std::string CRTFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); const std::string MERKLEFILE_DEFAULT("../data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); +const std::string ROOTKEYFILE_DEFAULT("../data/OSNMA_RootKey.bin"); class Mack_lookup { diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index fa47720b1..e31a76acc 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -75,7 +75,7 @@ Gnss_Crypto::Gnss_Crypto() } -Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath) +Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath, const std::string& rootKeyFilePath) { #if USE_GNUTLS_FALLBACK gnutls_global_init(); @@ -100,6 +100,7 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer } } read_merkle_xml(merkleTreePath); + read_root_key(rootKeyFilePath); } @@ -122,7 +123,10 @@ Gnss_Crypto::~Gnss_Crypto() #endif } - +bool Gnss_Crypto::have_root_key() const +{ + return !d_kroot.empty(); +} bool Gnss_Crypto::have_public_key() const { #if USE_GNUTLS_FALLBACK @@ -196,6 +200,22 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const return true; } +bool Gnss_Crypto::store_root_key(const std::string& rootKeyFilePath) const +{ + if (!have_root_key()) + { + return false; + } + std::ofstream file(rootKeyFilePath, std::ios::binary | std::ios::out); + + if (!file) { + return false; + } + + file.write(reinterpret_cast(d_kroot.data()), d_kroot.size()); + + return file.good(); +} bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const { @@ -845,6 +865,10 @@ std::vector Gnss_Crypto::get_merkle_root() const return d_x_4_0; } +std::vector Gnss_Crypto::get_root_key() const +{ + return d_kroot; +} void Gnss_Crypto::set_public_key(const std::vector& publicKey) { @@ -899,12 +923,15 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) DLOG(INFO) << "OSNMA Public Key successfully set up."; } - void Gnss_Crypto::set_merkle_root(const std::vector& v) { d_x_4_0 = v; } +void Gnss_Crypto::set_root_key(const std::vector& root_key) +{ + d_kroot = root_key; +} void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) { @@ -1145,6 +1172,40 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) return true; } +/** + * \brief Reads the TESLA root key from a file and stores it. + * \param rootKeyFilePath The file path of the TESLA root key. + * \return True if the root key was successfully read and stored, false otherwise. + */ +bool Gnss_Crypto::read_root_key(const std::string& rootKeyFilePath) +{ + std::ifstream file(rootKeyFilePath, std::ios::binary | std::ios::in); + + if (!file) { + LOG(WARNING) << "Unable to open file: " << rootKeyFilePath; + return false; + } + + // Determine file size + file.seekg(0, std::ios::end); + std::streamsize size = file.tellg(); + file.seekg(0, std::ios::beg); + + if (size == 0) { + LOG(WARNING) << "File is empty: " << rootKeyFilePath; + return false; + } + + // Resize the vector and read file + d_kroot.resize(size); + if (!file.read(reinterpret_cast(d_kroot.data()), size)) { + LOG(WARNING) << "Failed to read the file: " << rootKeyFilePath; + return false; + } + std::cout << "OSNMA TESLA Root Key successfully read from file " << rootKeyFilePath << std::endl; + LOG(INFO) << "OSNMA TESLA Root Key successfully read from file " << rootKeyFilePath; + return true; +} bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const { diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 8e89f1525..6ff60650c 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -48,15 +48,22 @@ public: * and a XML file for the Merkle Tree root. * Files can be downloaded by registering at https://www.gsc-europa.eu/ */ - Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); + Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath, const std::string& rootKeyFilePath); ~Gnss_Crypto(); //!< Default destructor + bool have_root_key() const; //!< Returns true if the TESLA root key is already loaded bool have_public_key() const; //!< Returns true if the ECDSA Public Key is already loaded /*! * Stores the ECDSA Public Key in a .pem file, which is read in a following run if the .crt file is not found */ bool store_public_key(const std::string& pubKeyFilePath) const; + /*! + * Stores the TESLA root key in a plaintext file, which is read in a following run for a faster TTFAF. + * @param kroot TESLA root key + * @return true if successful + */ + bool store_root_key(const std::string& rootKeyFilePath) const; bool verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P256 signature (message in plain hex, signature in raw format) bool verify_signature_ecdsa_p521(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P521 signature (message in plain hex, signature in raw format) @@ -68,13 +75,15 @@ public: std::vector get_public_key() const; //!< Gets the ECDSA Public Key in PEM format std::vector get_merkle_root() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) + std::vector get_root_key() const; //!< Gets the TESLA root key in binary format void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey in PEM format) void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) - + void set_root_key(const std::vector& root_key); //!< Sets the TESLA root key private: void read_merkle_xml(const std::string& merkleFilePath); void readPublicKeyFromPEM(const std::string& pemFilePath); + bool read_root_key(const std::string& rootKeyFilePath); bool readPublicKeyFromCRT(const std::string& crtFilePath); bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; std::vector convert_from_hex_str(const std::string& input) const; @@ -91,6 +100,7 @@ private: #endif #endif std::vector d_x_4_0; + std::vector d_kroot; }; /** \} */ diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index c67b2b208..1d2c628ae 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -24,6 +24,7 @@ #include #include #include +#include "Galileo_OSNMA.h" #if USE_GLOG_AND_GFLAGS #include // for LOG @@ -76,7 +77,8 @@ protected: // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + std::string rootKeyFilePath = ROOTKEYFILE_DEFAULT; + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath, ROOTKEYFILE_DEFAULT); } }; From ec127089ab19a090d682933f71e3ad1477654eee Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Jul 2024 18:09:25 +0200 Subject: [PATCH 273/499] Fix building of OSNMA tests --- src/core/libs/osnma_msg_receiver.h | 2 +- src/tests/CMakeLists.txt | 60 +-- src/tests/test_main.cc | 3 +- .../osnma/osnma_msg_receiver_test.cc | 417 +---------------- .../osnma/osnma_test_vectors.cc | 423 ++++++++++++++++++ 5 files changed, 453 insertions(+), 452 deletions(-) create mode 100644 src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 412296f12..cda571321 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -146,12 +146,12 @@ private: // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); - FRIEND_TEST(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation); FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); FRIEND_TEST(OsnmaMsgReceiverTest, BuildTagMessageM0); FRIEND_TEST(OsnmaMsgReceiverTest, VerifyPublicKey); FRIEND_TEST(OsnmaMsgReceiverTest, ComputeBaseLeaf); FRIEND_TEST(OsnmaMsgReceiverTest, ComputeMerkleRoot); + FRIEND_TEST(OsnmaTestVectors, OsnmaTestVectorsSimulation); }; diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index d7bbab2ee..deca361e3 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -550,6 +550,18 @@ if(ENABLE_UNIT_TESTING_EXTRA) EXPECTED_HASH MD5=066d0d8434a8bc81e161778b7c34cc07 ) endif() + if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip) + message(STATUS "Downloading file: Test_vectors.zip") + file(DOWNLOAD https://www.gsc-europa.eu/sites/default/files/sites/all/files/Test_vectors.zip + ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip + SHOW_PROGRESS + EXPECTED_HASH MD5=8158aebee735652c9398e5bb6d944364 + ) + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xzf ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/ + ) + endif() message(STATUS "Done.") if(ENABLE_INSTALL_TESTS) install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat DESTINATION share/gnss-sdr/signal_samples) @@ -652,6 +664,7 @@ if(ENABLE_UNIT_TESTING) if(GNSSTK_OLDER_THAN_9) target_compile_definitions(run_tests PRIVATE -DGNSSTK_OLDER_THAN_9=1) endif() + target_compile_definitions(run_tests PRIVATE -DBASE_OSNMA_TEST_VECTORS="${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors/") endif() xcode_remove_warning_duplicates(run_tests) if(ENABLE_STRIP) @@ -1356,53 +1369,6 @@ else() endif() endif() - -######################################################### osnma_msg_receiver_test - -if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) - set(OSNMA_MSG_RECEIVER_TEST_SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/single_test_main.cc - ${CMAKE_CURRENT_SOURCE_DIR}/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc - ) - - if(USE_CMAKE_TARGET_SOURCES) - add_executable(osnma_msg_receiver_test) - target_sources(osnma_msg_receiver_test PRIVATE ${OSNMA_MSG_RECEIVER_TEST_SOURCES}) - else() - add_executable(osnma_msg_receiver_test ${OSNMA_MSG_RECEIVER_TEST_SOURCES}) - endif() - - target_link_libraries(osnma_msg_receiver_test - PRIVATE - gnss_sdr_flags - Boost::thread - GTest::GTest - GTest::Main - core_libs - Gnuradio::blocks - Gnuradio::runtime - Gnuradio::filter # workaround for old systems - ) - if(ENABLE_GLOG_AND_GFLAGS) - target_link_libraries(osnma_msg_receiver_test PRIVATE Gflags::gflags Glog::glog) - target_compile_definitions(osnma_msg_receiver_test PRIVATE -DUSE_GLOG_AND_GFLAGS=1) - else() - target_link_libraries(osnma_msg_receiver_test PRIVATE absl::flags absl::flags_parse absl::log absl::log_initialize) - target_link_libraries(osnma_msg_receiver_test INTERFACE "$") - endif() - - xcode_remove_warning_duplicates(osnma_msg_receiver_test) # TODO - unsure if needed - - add_test(osnma_msg_receiver_test osnma_msg_receiver_test) - - set_property(TEST osnma_msg_receiver_test PROPERTY TIMEOUT 30) - - target_include_directories(osnma_msg_receiver_test - PRIVATE - ${GNSSSDR_SOURCE_DIR}/src/core/system_parameters - ) -endif() - if(ENABLE_BENCHMARKS) add_subdirectory(benchmarks) endif() diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 7990ca258..bcd2b7018 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -113,7 +113,7 @@ private: #include "unit-tests/signal-processing-blocks/adapter/pass_through_test.cc" #include "unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc" #include "unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc" -// #include "unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc" +#include "unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc" #include "unit-tests/signal-processing-blocks/pvt/geohash_test.cc" #include "unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc" #include "unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc" @@ -184,6 +184,7 @@ private: #include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc" +#include "unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc" #endif // #include "unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc" #include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc" diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 1d2c628ae..05da06b9d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -1,5 +1,5 @@ /*! - * \file osmna_msg_receiver_testt.cc + * \file osmna_msg_receiver_test.cc * \brief Tests for the osnma_msg_receiver class. * \author Carles Fernandez, 2023-2024. cfernandez(at)cttc.es * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de @@ -28,30 +28,12 @@ #if USE_GLOG_AND_GFLAGS #include // for LOG -#include #else #include #endif -struct TestVector -{ - int svId; - int numNavBits; - std::vector navBits; -}; - - -// TODO - parametrize class for different configurations (config_1, config_2, etc.. potentially 5 or 6 more) an make sure wont affect current TEST_F -// note: until the test is parametrized for configuration 1 and 2, in order to change between them you have to comment/uncomment the respective calls in this test, identified with comments // conf. 1/2 -// log_name, input_time, crtFilePath, merkleFilePath, testVectors class OsnmaMsgReceiverTest : public ::testing::Test { -public: - static std::vector parseNavBits(const std::string& hex); - static std::vector readTestVectorsFromFile(const std::string& filename); - std::string bytes_to_str(const std::vector& bytes); - std::vector extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes); - protected: Osnma_Helper helper; osnma_msg_receiver_sptr osnma; @@ -63,22 +45,13 @@ protected: std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm const uint32_t LEAP_SECONDS = 0; // 13 + 5; void set_time(std::tm& input); - // std::string log_name {"CONFIG1-2023-08-16-PKID1-OSNMA"}; - std::string log_name{"CONFIG2-2023-07-27-PKID2-MT2-OSNMA"}; // TODO - google::InitGoogleLogging(log_name.c_str()); but cannot be called twice - void initializeGoogleLog(); void SetUp() override { - initializeGoogleLog(); // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); - // std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230803105952_newPKID_1.crt"; // conf. 1 - // std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; - std::string crtFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 - std::string merkleFilePath = "/home/cgm/CLionProjects/osnma/data/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - std::string rootKeyFilePath = ROOTKEYFILE_DEFAULT; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath, ROOTKEYFILE_DEFAULT); + osnma = osnma_msg_receiver_make("", ""); } }; @@ -220,15 +193,16 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; osnma->d_nav_data_manager->add_navigation_data( - "000011101001011001000100000101000111010110100100100101100000000000" - "011101101011001111101110101010000001010000011011111100000011101011" - "011100101101011010101011011011001001110111101011110110111111001111" - "001000011111101110011000111111110111111010000011101011111111110000" - "110111000000100000001110110000110110001110000100001110101100010100" - "110100010001000110001110011010110000111010000010000000000001101000" - "000000000011100101100100010000000000000110110100110001111100000000" - "000000100110100000000101010010100000001011000010001001100000011111" - "110111111111000000000", PRNa, TOW_NavData); + "000011101001011001000100000101000111010110100100100101100000000000" + "011101101011001111101110101010000001010000011011111100000011101011" + "011100101101011010101011011011001001110111101011110110111111001111" + "001000011111101110011000111111110111111010000011101011111111110000" + "110111000000100000001110110000110110001110000100001110101100010100" + "110100010001000110001110011010110000111010000010000000000001101000" + "000000000011100101100100010000000000000110110100110001111100000000" + "000000100110100000000101010010100000001011000010001001100000011111" + "110111111111000000000", + PRNa, TOW_NavData); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MACK_tag_and_info MTI; @@ -256,8 +230,8 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; osnma->d_nav_data_manager->add_navigation_data( "111111111111111111111111111111110000000000000000000000010001001001001000" - "111000001000100111100010010111111111011110111111111001001100000100000" - , PRNa, TOW_NavData); + "111000001000100111100010010111111111011110111111111001001100000100000", + PRNa, TOW_NavData); osnma->d_osnma_data.d_nma_header.nmas = 0b10; MTI.tag = static_cast(0x7BB238C883); @@ -297,325 +271,6 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) } -TEST_F(OsnmaMsgReceiverTest, OsnmaTestVectorsSimulation) -{ - // Arrange - std::vector testVectors = readTestVectorsFromFile("/home/cgm/CLionProjects/osnma/data/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 - if (testVectors.empty()) - { - ASSERT_TRUE(false); - } - - bool end_of_hex_stream{false}; - int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds - - const int DUMMY_PAGE{63}; - bool flag_dummy_page{false}; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; - - // Act - // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (end_of_hex_stream == false) - { - // loop over all SVs, extract a subframe - for (const TestVector& tv : testVectors) - { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; - auto osnmaMsg_sptr = std::make_shared(); - std::array hkroot{}; - std::array mack{}; - byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words_for_OSNMA; // structure containing and - - for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe - { - // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index - std::vector page_bytes = extract_page_bytes(tv, byte_index, SIZE_PAGE_BYTES); - if (page_bytes.empty()) - { - std::cout << "OsnmaTestVectorsSimulation: end of TestVectors \n" - << "byte_index=" << byte_index << " expected= " << 432000 / 8 << std::endl; - end_of_hex_stream = true; - break; - } - // convert them to bitset representation using bytes_to_string - std::string page_bits = bytes_to_str(page_bytes); - // Extract the 40 OSNMA bits starting from the 18th bit - std::string even_page = page_bits.substr(0, page_bits.size() / 2); - std::string odd_page = page_bits.substr(page_bits.size() / 2); - if (even_page.size() < 120 || odd_page.size() < 120) - { - std::cout << "OsnmaTestVectorsSimulation: error parsing pages" << std::endl; - } - bool even_odd_OK = even_page[0] == '0' && odd_page[0] == '1'; - bool page_type_OK = even_page[1] == '0' && odd_page[1] == '0'; - bool tail_bits_OK = even_page.substr(even_page.size() - 6) == "000000" && odd_page.substr(odd_page.size() - 6) == "000000"; - if (!even_odd_OK || !page_type_OK || !tail_bits_OK) - std::cerr << "OsnmaTestVectorsSimulation: error parsing pages." << std::endl; - - std::bitset<112> data_k(even_page.substr(2, 112)); - std::bitset<16> data_j(odd_page.substr(2, 16)); - std::bitset<112> shifted_data_k = data_k; - uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word - std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; - if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) - { - // store raw word - std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); - words_for_OSNMA[word_type] = data_combined; - } - if (word_type == DUMMY_PAGE) - flag_dummy_page = true; - - // place it into osnma object. - std::bitset<40> osnmaBits(odd_page.substr(18, 40)); - - // Extract bits for hkroot and mack - std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); - std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); - hkroot[idx] = static_cast(hkrootBits.to_ulong()); - mack[idx] = static_cast(mackBits.to_ulong()); - - byte_index += SIZE_PAGE_BYTES; - } - - std::cout << "----------" << std::endl; - if (end_of_hex_stream) - break; - if (flag_dummy_page) - { - flag_dummy_page = false; - continue; // skip this SV - } - - // Fill osnma object - osnmaMsg_sptr->hkroot = hkroot; - osnmaMsg_sptr->mack = mack; - - osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; - osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; - osnmaMsg_sptr->PRN = tv.svId; // PRNa - - // TODO - refactor this logic, currently it is split - - // check if words_for_OSNMA 1--> 5 words_for_OSNMA are received => fill EphClockStatus data vector - bool ephClockStatusWordsReceived = true; - for (int i = 1; i <= 5; ++i) - { - if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) - { - ephClockStatusWordsReceived = false; - std::cerr << "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " - "Word " - << i << " should be received for each subframe but was not." << std::endl; - } - } - // extract bits as needed by osnma block - if (ephClockStatusWordsReceived) - { - // Define the starting position and length of bits to extract for each word - std::map> extractionParams = { - {1, {6, 120}}, - {2, {6, 120}}, - {3, {6, 122}}, - {4, {6, 120}}, - {5, {6, 67}}, - }; - - // Fill NavData bits -- Iterate over the extraction parameters - std::string nav_data_ADKD_0_12 = ""; - for (const auto& param : extractionParams) - { - uint8_t wordKey = param.first; - uint8_t start = param.second.first; - uint8_t length = param.second.second; - - // Extract the required bits and fill osnma block - nav_data_ADKD_0_12 += words_for_OSNMA[wordKey].to_string().substr(start, length); - } - // send to osnma block - bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; - if (check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> - tv.svId, - nav_data_ADKD_0_12, - osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; - osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); - } - } - - // check w6 && w10 is received => fill TimingData data vector - bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && - words_for_OSNMA.find(10) != words_for_OSNMA.end(); - // extract bits as needed by osnma block - if (timingWordsReceived) - { - // Define the starting position and length of bits to extract for each word - std::map> extractionParams = { - {6, {6, 99}}, - {10, {86, 42}}}; - - std::string nav_data_ADKD_4 = ""; - // Fill NavData bits -- Iterate over the extraction parameters - for (const auto& param : extractionParams) - { - uint8_t wordKey = param.first; - uint8_t start = param.second.first; - uint8_t length = param.second.second; - - // Extract the required bits and fill osnma block - nav_data_ADKD_4 += words_for_OSNMA[wordKey].to_string().substr(start, length); - } - // send to osnma block - bool check_size_is_ok = nav_data_ADKD_4.size() == 141; - if (check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> - tv.svId, - nav_data_ADKD_4, - osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; - osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); - } - } - - // Call the handler, as if it came from telemetry decoder block - auto temp_obj = pmt::make_any(osnmaMsg_sptr); - - osnma->msg_handler_osnma(temp_obj); // osnma entry point - } - - if (!end_of_hex_stream) - { - offset_byte = byte_index; // update offset for the next subframe - d_GST_SIS += DURATION_SUBFRAME; - TOW = d_GST_SIS & 0x000FFFFF; - WN = (d_GST_SIS & 0xFFF00000) >> 20; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; - } - } - // Assert - - // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) -} - - -// Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. -// Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. -std::vector OsnmaMsgReceiverTest::readTestVectorsFromFile(const std::string& filename) -{ - std::ifstream file(filename); - std::vector testVectors; - if (!file.is_open()) - { - std::cerr << "Error reading the file \"" << filename << "\" \n"; - return testVectors; - } - - std::string line; - std::getline(file, line); - if (line != "SVID,NumNavBits,NavBitsHEX\r") - { - std::cerr << "Error parsing first line" - << "\n"; - } - - while (std::getline(file, line)) - { - std::stringstream ss(line); - TestVector tv; - - std::string val; - - std::getline(ss, val, ','); - tv.svId = std::stoi(val); - - std::getline(ss, val, ','); - tv.numNavBits = std::stoi(val); - - std::getline(ss, val, ','); - tv.navBits = OsnmaMsgReceiverTest::parseNavBits(val); - - testVectors.push_back(tv); - } - - return testVectors; -} - - -std::vector OsnmaMsgReceiverTest::parseNavBits(const std::string& hex) -{ - std::vector bytes; - - for (unsigned int i = 0; i < hex.length() - 1; i += 2) - { - std::string byteString = hex.substr(i, 2); - uint8_t byte = (uint8_t)strtol(byteString.c_str(), NULL, 16); - bytes.push_back(byte); - } - return bytes; -} - - -std::string OsnmaMsgReceiverTest::bytes_to_str(const std::vector& bytes) -{ - std::string bit_string; - bit_string.reserve(bytes.size() * 8); - for (const auto& byte : bytes) - { - std::bitset<8> bits(byte); - bit_string += bits.to_string(); - } - return bit_string; -} - - -/** - * @brief Extracts a range of bytes from a TestVector's navBits vector. - * - * This function extracts a extracts the bytes of complete page (odd+even) - * from the navBits vector of a TestVector object. - * - * - * @param tv The TestVector object from which to extract bytes. - * @param byte_index The index of the first byte to extract. - * @param num_bytes The number of bytes to extract. - * @return A vector containing the extracted bytes, or an empty vector if extraction is not possible. - */ -std::vector OsnmaMsgReceiverTest::extract_page_bytes(const TestVector& tv, const int byte_index, const int num_bytes) -{ - // Ensure we don't go beyond the end of tv.navBits - int num_bytes_to_extract = std::min(num_bytes, static_cast(tv.navBits.size() - byte_index)); - - // If byte_index is beyond the end of tv.navBits, return an empty vector - if (num_bytes_to_extract <= 0) - { - return std::vector(); - } - - // Use std::next to get an iterator to the range to extract - std::vector extracted_bytes(tv.navBits.begin() + byte_index, tv.navBits.begin() + byte_index + num_bytes_to_extract); - - return extracted_bytes; -} - - /** * @brief Sets the time based on the given input. * @@ -647,47 +302,3 @@ void OsnmaMsgReceiverTest::set_time(std::tm& input) // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); } - - -void OsnmaMsgReceiverTest::initializeGoogleLog() -{ - // google::InitGoogleLogging(log_name.c_str()); - FLAGS_minloglevel = 0; // INFO - FLAGS_logtostderr = 0; // add this line - // FLAGS_log_dir = "/home/cgm/CLionProjects/osnma/data/logs"; - if (FLAGS_log_dir.empty()) - { - std::cout << "Logging will be written at " - << std::filesystem::temp_directory_path() - << '\n' - << "Use gnss-sdr --log_dir=/path/to/log to change that.\n"; - } - else - { - try - { - const std::filesystem::path p(FLAGS_log_dir); - if (!std::filesystem::exists(p)) - { - std::cout << "The path " - << FLAGS_log_dir - << " does not exist, attempting to create it.\n"; - std::error_code ec; - if (!std::filesystem::create_directory(p, ec)) - { - std::cout << "Could not create the " << FLAGS_log_dir << " folder.\n"; - gflags::ShutDownCommandLineFlags(); - throw std::runtime_error("Could not create folder for logs"); - } - } - std::cout << "Logging will be written at " << FLAGS_log_dir << '\n'; - } - catch (const std::exception& e) - { - std::cerr << e.what() << '\n'; - std::cerr << "Could not create the " << FLAGS_log_dir << " folder.\n"; - gflags::ShutDownCommandLineFlags(); - throw; - } - } -} diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc new file mode 100644 index 000000000..edb8b401f --- /dev/null +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -0,0 +1,423 @@ +/*! + * \file osmna_test_vectors.cc + * \brief Tests for the osnma_msg_receiver class. + * \author Carles Fernandez, 2023-2024. cfernandez(at)cttc.es + * Cesare Ghionoiu Martinez, 2023-2024. c.ghionoiu-martinez@tu-braunschweig.de + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "gnss_crypto.h" +#include "osnma_helper.h" +#include "osnma_msg_receiver.h" +#include +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS +#include // for LOG +#else +#include +#endif + +struct TestVector +{ + int svId; + int numNavBits; + std::vector navBits; +}; + + +class OsnmaTestVectors : public ::testing::Test +{ +public: + static std::vector parseNavBits(const std::string& hex); + static std::vector readTestVectorsFromFile(const std::string& filename); + std::string bytes_to_str(const std::vector& bytes); + std::vector extract_page_bytes(const TestVector& tv, int byte_index, int num_bytes); + +protected: + Osnma_Helper helper; + osnma_msg_receiver_sptr osnma; + OSNMA_msg osnma_msg{}; + std::array nma_position_filled; + uint32_t d_GST_SIS{}; + uint32_t TOW{}; + uint32_t WN{}; + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + const uint32_t LEAP_SECONDS = 0; // 13 + 5; + void set_time(std::tm& input); + + void SetUp() override + { + // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 + set_time(input_time); + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + } +}; + + +TEST_F(OsnmaTestVectors, OsnmaTestVectorsSimulation) +{ + // Arrange + std::vector testVectors = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/configuration_2/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 + if (testVectors.empty()) + { + ASSERT_TRUE(false); + } + + bool end_of_hex_stream{false}; + int offset_byte{0}; + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds + + const int DUMMY_PAGE{63}; + bool flag_dummy_page{false}; + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; + + // Act + // loop over all bytes of data. Note: all TestVectors have same amount of data. + while (end_of_hex_stream == false) + { + // loop over all SVs, extract a subframe + for (const TestVector& tv : testVectors) + { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; + auto osnmaMsg_sptr = std::make_shared(); + std::array hkroot{}; + std::array mack{}; + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words_for_OSNMA; // structure containing and + + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + { + // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index + std::vector page_bytes = extract_page_bytes(tv, byte_index, SIZE_PAGE_BYTES); + if (page_bytes.empty()) + { + std::cout << "OsnmaTestVectorsSimulation: end of TestVectors \n" + << "byte_index=" << byte_index << " expected= " << 432000 / 8 << std::endl; + end_of_hex_stream = true; + break; + } + // convert them to bitset representation using bytes_to_string + std::string page_bits = bytes_to_str(page_bytes); + // Extract the 40 OSNMA bits starting from the 18th bit + std::string even_page = page_bits.substr(0, page_bits.size() / 2); + std::string odd_page = page_bits.substr(page_bits.size() / 2); + if (even_page.size() < 120 || odd_page.size() < 120) + { + std::cout << "OsnmaTestVectorsSimulation: error parsing pages" << std::endl; + } + bool even_odd_OK = even_page[0] == '0' && odd_page[0] == '1'; + bool page_type_OK = even_page[1] == '0' && odd_page[1] == '0'; + bool tail_bits_OK = even_page.substr(even_page.size() - 6) == "000000" && odd_page.substr(odd_page.size() - 6) == "000000"; + if (!even_odd_OK || !page_type_OK || !tail_bits_OK) + std::cerr << "OsnmaTestVectorsSimulation: error parsing pages." << std::endl; + + std::bitset<112> data_k(even_page.substr(2, 112)); + std::bitset<16> data_j(odd_page.substr(2, 16)); + std::bitset<112> shifted_data_k = data_k; + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; + if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) + { + // store raw word + std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); + words_for_OSNMA[word_type] = data_combined; + } + if (word_type == DUMMY_PAGE) + flag_dummy_page = true; + + // place it into osnma object. + std::bitset<40> osnmaBits(odd_page.substr(18, 40)); + + // Extract bits for hkroot and mack + std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); + std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); + hkroot[idx] = static_cast(hkrootBits.to_ulong()); + mack[idx] = static_cast(mackBits.to_ulong()); + + byte_index += SIZE_PAGE_BYTES; + } + + std::cout << "----------" << std::endl; + if (end_of_hex_stream) + break; + if (flag_dummy_page) + { + flag_dummy_page = false; + continue; // skip this SV + } + + // Fill osnma object + osnmaMsg_sptr->hkroot = hkroot; + osnmaMsg_sptr->mack = mack; + + osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; + osnmaMsg_sptr->PRN = tv.svId; // PRNa + + // TODO - refactor this logic, currently it is split + + // check if words_for_OSNMA 1--> 5 words_for_OSNMA are received => fill EphClockStatus data vector + bool ephClockStatusWordsReceived = true; + for (int i = 1; i <= 5; ++i) + { + if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) + { + ephClockStatusWordsReceived = false; + std::cerr << "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " + "Word " + << i << " should be received for each subframe but was not." << std::endl; + } + } + // extract bits as needed by osnma block + if (ephClockStatusWordsReceived) + { + // Define the starting position and length of bits to extract for each word + std::map> extractionParams = { + {1, {6, 120}}, + {2, {6, 120}}, + {3, {6, 122}}, + {4, {6, 120}}, + {5, {6, 67}}, + }; + + // Fill NavData bits -- Iterate over the extraction parameters + std::string nav_data_ADKD_0_12 = ""; + for (const auto& param : extractionParams) + { + uint8_t wordKey = param.first; + uint8_t start = param.second.first; + uint8_t length = param.second.second; + + // Extract the required bits and fill osnma block + nav_data_ADKD_0_12 += words_for_OSNMA[wordKey].to_string().substr(start, length); + } + // send to osnma block + bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; + if (check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " + << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + tv.svId, + nav_data_ADKD_0_12, + osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; + osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } + } + + // check w6 && w10 is received => fill TimingData data vector + bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && + words_for_OSNMA.find(10) != words_for_OSNMA.end(); + // extract bits as needed by osnma block + if (timingWordsReceived) + { + // Define the starting position and length of bits to extract for each word + std::map> extractionParams = { + {6, {6, 99}}, + {10, {86, 42}}}; + + std::string nav_data_ADKD_4 = ""; + // Fill NavData bits -- Iterate over the extraction parameters + for (const auto& param : extractionParams) + { + uint8_t wordKey = param.first; + uint8_t start = param.second.first; + uint8_t length = param.second.second; + + // Extract the required bits and fill osnma block + nav_data_ADKD_4 += words_for_OSNMA[wordKey].to_string().substr(start, length); + } + // send to osnma block + bool check_size_is_ok = nav_data_ADKD_4.size() == 141; + if (check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " + << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + tv.svId, + nav_data_ADKD_4, + osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; + osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } + } + + // Call the handler, as if it came from telemetry decoder block + auto temp_obj = pmt::make_any(osnmaMsg_sptr); + + osnma->msg_handler_osnma(temp_obj); // osnma entry point + } + + if (!end_of_hex_stream) + { + offset_byte = byte_index; // update offset for the next subframe + d_GST_SIS += DURATION_SUBFRAME; + TOW = d_GST_SIS & 0x000FFFFF; + WN = (d_GST_SIS & 0xFFF00000) >> 20; + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; + } + } + // Assert + + // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) +} + + +// Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. +// Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. +std::vector OsnmaTestVectors::readTestVectorsFromFile(const std::string& filename) +{ + std::ifstream file(filename); + std::vector testVectors; + if (!file.is_open()) + { + std::cerr << "Error reading the file \"" << filename << "\" \n"; + return testVectors; + } + + std::string line; + std::getline(file, line); + if (line != "SVID,NumNavBits,NavBitsHEX\r") + { + std::cerr << "Error parsing first line" + << "\n"; + } + + while (std::getline(file, line)) + { + std::stringstream ss(line); + TestVector tv; + + std::string val; + + std::getline(ss, val, ','); + tv.svId = std::stoi(val); + + std::getline(ss, val, ','); + tv.numNavBits = std::stoi(val); + + std::getline(ss, val, ','); + tv.navBits = OsnmaTestVectors::parseNavBits(val); + + testVectors.push_back(tv); + } + + return testVectors; +} + + +std::vector OsnmaTestVectors::parseNavBits(const std::string& hexadecimal) +{ + std::vector bytes; + + for (unsigned int i = 0; i < hexadecimal.length() - 1; i += 2) + { + std::string byteString = hexadecimal.substr(i, 2); + uint8_t byte = static_cast(strtol(byteString.c_str(), nullptr, 16)); + bytes.push_back(byte); + } + return bytes; +} + + +std::string OsnmaTestVectors::bytes_to_str(const std::vector& bytes) +{ + std::string bit_string; + bit_string.reserve(bytes.size() * 8); + for (const auto& byte : bytes) + { + std::bitset<8> bits(byte); + bit_string += bits.to_string(); + } + return bit_string; +} + + +/** + * @brief Extracts a range of bytes from a TestVector's navBits vector. + * + * This function extracts a extracts the bytes of complete page (odd+even) + * from the navBits vector of a TestVector object. + * + * + * @param tv The TestVector object from which to extract bytes. + * @param byte_index The index of the first byte to extract. + * @param num_bytes The number of bytes to extract. + * @return A vector containing the extracted bytes, or an empty vector if extraction is not possible. + */ +std::vector OsnmaTestVectors::extract_page_bytes(const TestVector& tv, int byte_index, int num_bytes) +{ + // Ensure we don't go beyond the end of tv.navBits + int num_bytes_to_extract = std::min(num_bytes, static_cast(tv.navBits.size() - byte_index)); + + // If byte_index is beyond the end of tv.navBits, return an empty vector + if (num_bytes_to_extract <= 0) + { + return std::vector(); + } + + // Use std::next to get an iterator to the range to extract + std::vector extracted_bytes(tv.navBits.begin() + byte_index, tv.navBits.begin() + byte_index + num_bytes_to_extract); + + return extracted_bytes; +} + + +/** + * @brief Sets the time based on the given input. + * + * This function calculates the week number (WN) and time of week (TOW) + * based on the input time and the GST_START_EPOCH. It then stores the + * calculated values in the WN and TOW member variables. Finally, it + * combines the WN and TOW into a single 32-bit value and stores it in + * the d_GST_SIS member variable. + * + * @param input The input time as a tm struct. + */ +void OsnmaTestVectors::set_time(std::tm& input) +{ + auto epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&GST_START_EPOCH)); + auto input_time_point = std::chrono::system_clock::from_time_t(mktime(&input)); + + // Get the duration from epoch in seconds + auto duration_sec = std::chrono::duration_cast(input_time_point - epoch_time_point); + + // Calculate the week number (WN) and time of week (TOW) + uint32_t sec_in_week = 7 * 24 * 60 * 60; + uint32_t week_number = duration_sec.count() / sec_in_week; + uint32_t time_of_week = duration_sec.count() % sec_in_week; + this->WN = week_number; + this->TOW = time_of_week + LEAP_SECONDS; + // Return the week number and time of week as a pair + + // TODO: d_GST_SIS or d_receiver_time? doubt + // I am assuming that local realisation of receiver is identical to SIS GST time coming from W5 or W0 + this->d_GST_SIS = (this->WN & 0x00000FFF) << 20 | (this->TOW & 0x000FFFFF); +} From 6cfc8a351fd5042d4c3198d6cffd8d600c12cf2c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Jul 2024 18:20:24 +0200 Subject: [PATCH 274/499] Adapt to new API --- .../signal-processing-blocks/osnma/gnss_crypto_test.cc | 2 +- .../signal-processing-blocks/osnma/osnma_msg_receiver_test.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 2d7355fd7..4f9a75690 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -84,7 +84,7 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) ASSERT_TRUE(result); - auto d_crypto2 = std::make_unique(f1, ""); + auto d_crypto2 = std::make_unique(f1, "", ""); bool result2 = d_crypto2->store_public_key(f2); ASSERT_TRUE(result2); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 05da06b9d..519f78a22 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -51,7 +51,7 @@ protected: // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); - osnma = osnma_msg_receiver_make("", ""); + osnma = osnma_msg_receiver_make("", "", ""); } }; From c54f941dce148ca78b09ab6f8d67bc241f19200c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Jul 2024 18:26:15 +0200 Subject: [PATCH 275/499] Adapt to new API --- .../signal-processing-blocks/osnma/osnma_test_vectors.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index edb8b401f..31da16907 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -66,7 +66,7 @@ protected: set_time(input_time); std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath, ""); } }; From 27f93e5626c17847aef45c13a83bd36bfff4b9cc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Jul 2024 20:02:15 +0200 Subject: [PATCH 276/499] Add OSNMA tests to the GitHub CI --- .github/workflows/main.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8323fdea8..91d1a3930 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,8 @@ jobs: - name: check run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - name: default position_test - run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test + run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ + ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* --log_dir=./ build-macos: runs-on: macos-latest @@ -66,7 +67,8 @@ jobs: - name: check run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - name: default position_test - run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. && ninja && ../install/position_test + run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ + ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* build-macos-xcode: runs-on: macos-latest @@ -104,9 +106,10 @@ jobs: - name: default position_test run: | cd build - cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON .. + cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. xcodebuild -configuration Release -target position_test ../install/position_test + ../install/run_tests --gtest_filter=Osnma* clang-format: runs-on: ubuntu-latest From 03a8366fa23bb6c5735337ff21478842d2a3c08e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 26 Jul 2024 20:21:45 +0200 Subject: [PATCH 277/499] Add OSNMA tests to the GitHub CI --- .github/workflows/main.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 91d1a3930..e4bd9f38d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,8 +34,9 @@ jobs: - name: check run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - name: default position_test - run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ - ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* --log_dir=./ + run: | + cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ + ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* build-macos: runs-on: macos-latest @@ -67,8 +68,9 @@ jobs: - name: check run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - name: default position_test - run: cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ - ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* + run: | + cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ + ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* build-macos-xcode: runs-on: macos-latest From 491a4ab40fd55b49f49da026c26ecabd5f491d01 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 27 Jul 2024 07:48:34 +0200 Subject: [PATCH 278/499] Add missing include --- src/tests/benchmarks/benchmark_crypto.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/benchmarks/benchmark_crypto.cc b/src/tests/benchmarks/benchmark_crypto.cc index 43d5f1035..2adc95348 100644 --- a/src/tests/benchmarks/benchmark_crypto.cc +++ b/src/tests/benchmarks/benchmark_crypto.cc @@ -17,6 +17,7 @@ #include "gnss_crypto.h" #include +#include void bm_SHA_256(benchmark::State& state) { From f17a24f7f9abd9d2950a250e5baa71877d6bf0a8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 27 Jul 2024 09:25:35 +0200 Subject: [PATCH 279/499] Fix building local Armadillo with old CMake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 638a5e08d..f0fbcae71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2113,7 +2113,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/armadillo-${armadillo_RELEASE} - -DSTATIC_LIB=ON + -DBUILD_SHARED_LIBS=OFF -DBUILD_SMOKE_TEST=OFF -DALLOW_BLAS_LAPACK_MACOS=ON ${ARMADILLO_CXX_VERSION} From a4cfe5151517442ea42f7cf1b1d1f549b014b7b4 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 27 Jul 2024 18:25:20 +0200 Subject: [PATCH 280/499] [TAS-248] [BUG][Kroot] Kroot and PK available, but until DSM-Kroot arrived no MACK processing * reverted commit [TAS-247][FEAT][Kroot] enable hotstart with last known Kroot * DSM-KROOT loaded during startup * if new DSM verified => stored * this improves TTFAF from 4 min to 1 minute. --- src/core/libs/osnma_msg_receiver.cc | 96 +++++++++++++++---- src/core/libs/osnma_msg_receiver.h | 12 ++- src/core/receiver/gnss_flowgraph.cc | 3 +- src/core/system_parameters/Galileo_OSNMA.h | 8 +- src/core/system_parameters/gnss_crypto.cc | 71 +------------- src/core/system_parameters/gnss_crypto.h | 13 +-- .../osnma/osnma_msg_receiver_test.cc | 2 +- 7 files changed, 92 insertions(+), 113 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 27130600f..80613ca3d 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -24,7 +24,7 @@ #include "gnss_satellite.h" #include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader #include "osnma_helper.h" -#include "osnma_nav_data_manager.h" // TODO - all these repeated includes, is it good practice to include them in the source file? +#include "osnma_nav_data_manager.h" #include // for gr::io_signature::make #include #include @@ -37,6 +37,7 @@ #include #include // for typeid #include +#include // for std::ifstream and std::ofstream #if USE_GLOG_AND_GFLAGS @@ -60,24 +61,36 @@ namespace wht = std; #endif -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath) +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath) { - return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath, rootKeyFilePath)); + return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath)); } -osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath) : gr::block("osnma_msg_receiver", +osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); - d_crypto = std::make_unique(crtFilePath, merkleFilePath, rootKeyFilePath); + d_crypto = std::make_unique(crtFilePath, merkleFilePath); d_helper = std::make_unique(); d_nav_data_manager = std::make_unique(); - if(d_crypto->have_root_key()){ - d_kroot = d_crypto->get_root_key(); - d_kroot_verified = true; + if(d_crypto->have_public_key()){ // Hot start is enabled + auto dsm_nmah = parse_dsm_kroot(); + if (!dsm_nmah.first.empty()){ + LOG(WARNING) << "OSNMA DSM-KROOT and NMA Header successfully read from file " << KROOTFILE_DEFAULT; + std::cout << "OSNMA DSM-KROOT and NMA Header successfully read from file " << KROOTFILE_DEFAULT << std::endl; + d_flag_hot_start = true; + process_dsm_message(dsm_nmah.first, dsm_nmah.second); + LOG(WARNING) << "OSNMA DSM-KROOT available :: HOT START"; + std::cout << "OSNMA DSM-KROOT available :: HOT START" << std::endl; + } + else + { + LOG(WARNING) << "OSNMA DSM-KROOT not available :: WARM START"; + std::cout << "OSNMA DSM-KROOT not available :: WARM START" << std::endl; + } } // register OSNMA input message port from telemetry blocks @@ -369,7 +382,7 @@ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osn } d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; - process_dsm_message(dsm_msg, osnma_msg); + process_dsm_message(dsm_msg, osnma_msg->hkroot[0]); } } @@ -381,10 +394,10 @@ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osn * case DSM-PKR: * - calls verify_dsm_pkr to verify the public key * */ -void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg) +void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, const uint8_t& nma_header) { // DSM-KROOT message - if (d_osnma_data.d_dsm_header.dsm_id < 12) + if (d_osnma_data.d_dsm_header.dsm_id < 12 || d_flag_hot_start) { // Parse Kroot message LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received."; @@ -438,13 +451,13 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // validation of padding const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; - MSG.reserve(size_m + l_ds_bytes + 1); // C: message will get too many zeroes? ((12+1)+16) + 64 + 1? => in theory not, allocating is not assigning - MSG.push_back(osnma_msg->hkroot[0]); // C: NMA header + MSG.reserve(size_m + l_ds_bytes + 1); + MSG.push_back(nma_header); // NMA header for (uint16_t i = 1; i < size_m; i++) { MSG.push_back(dsm_msg[i]); } - std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 + std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); @@ -478,7 +491,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; - local_time_verification(osnma_msg); + // local_time_verification(osnma_msg); // FIXME TODO: real time verification needed if (l_ds_bits == 512) { d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); @@ -494,10 +507,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); - // Save Kroot into a permanent storage - d_crypto->store_root_key(ROOTKEYFILE_DEFAULT); - d_kroot = d_osnma_data.d_dsm_kroot_message.kroot; - d_crypto->set_root_key(d_kroot); + // Save DSM-Kroot and NMA header into a permanent storage + if(d_flag_hot_start){ + d_flag_hot_start = false; + return; + } + store_dsm_kroot(dsm_msg, nma_header); } else { @@ -576,7 +591,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { d_public_key_verified = true; d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); - d_crypto->store_public_key(PEMFILE_STORED); + d_crypto->store_public_key(PEMFILE_DEFAULT); } } } @@ -1812,6 +1827,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ return verified_tags; } } + void osnma_msg_receiver::send_data_to_pvt(std::vector data) { if (!data.empty()) @@ -1823,3 +1839,43 @@ void osnma_msg_receiver::send_data_to_pvt(std::vector data) } } } + +bool osnma_msg_receiver::store_dsm_kroot(const std::vector& dsm, const uint8_t nma_header) const +{ + std::ofstream file(KROOTFILE_DEFAULT, std::ios::binary | std::ios::out); + + if (!file.is_open()) { + return false; + } + + // NMA header + file.write(reinterpret_cast(&nma_header), 1); + + // Then writing the entire dsm_msg vector to the file + file.write(reinterpret_cast(dsm.data()), dsm.size()); + + return file.good(); +} + +std::pair, uint8_t> osnma_msg_receiver::parse_dsm_kroot() const +{ + std::ifstream file(KROOTFILE_DEFAULT, std::ios::binary | std::ios::in); + if (!file) { + return {std::vector(), 0}; + } + + // Read the first byte into hkroot[0] + uint8_t nma_header; + file.read(reinterpret_cast(&nma_header), 1); + + // Read the remaining file content into dsm_msg + std::vector dsm_msg((std::istreambuf_iterator(file)), std::istreambuf_iterator()); + + file.close(); + + if (file.bad()) { + return {std::vector(), 0}; + } + + return {dsm_msg, nma_header}; +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index cda571321..15abc632d 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -50,7 +50,7 @@ class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath); +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); /*! * \brief GNU Radio block that receives asynchronous OSNMA messages @@ -63,8 +63,8 @@ class osnma_msg_receiver : public gr::block public: ~osnma_msg_receiver() = default; //!< Default destructor private: - friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath); - osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath, const std::string& rootKeyFilePath); + friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); + osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath); void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); @@ -73,7 +73,7 @@ private: void read_dsm_block(const std::shared_ptr& osnma_msg); void local_time_verification(const std::shared_ptr& osnma_msg); void process_dsm_block(const std::shared_ptr& osnma_msg); - void process_dsm_message(const std::vector& dsm_msg, const std::shared_ptr& osnma_msg); + void process_dsm_message(const std::vector& dsm_msg, const uint8_t& nma_header); void read_and_process_mack_block(const std::shared_ptr& osnma_msg); void read_mack_header(); void read_mack_body(); @@ -89,7 +89,9 @@ private: bool tag_has_key_available(const Tag& t) const; bool verify_macseq(const MACK_message& mack); bool verify_dsm_pkr(const DSM_PKR_message& message) const; + bool store_dsm_kroot(const std::vector& dsm, const uint8_t nma_header) const; + std::pair, uint8_t> parse_dsm_kroot() const; std::vector get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const; std::vector compute_merkle_root(const DSM_PKR_message& dsm_pkr_message, const std::vector& m_i) const; std::vector build_message(Tag& tag) const; @@ -100,7 +102,6 @@ private: std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW - std::vector d_kroot; // last available stored root key std::vector d_tags_to_verify{0, 4, 12}; std::vector d_macks_awaiting_MACSEQ_verification; @@ -143,6 +144,7 @@ private: bool d_kroot_verified{false}; bool d_tesla_key_verified{false}; bool d_flag_debug{false}; + bool d_flag_hot_start{false}; // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 035d690dc..af1795ee0 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -126,8 +126,7 @@ void GNSSFlowgraph::init() enable_osnma_rx_ = true; const auto certFilePath = configuration_->property("GNSS-SDR.osnma_public_key", CRTFILE_DEFAULT); const auto merKleTreePath = configuration_->property("GNSS-SDR.osnma_merkletree", MERKLEFILE_DEFAULT); - const auto rootKeyPath = configuration_->property("GNSS-SDR.osnma_root_key", ROOTKEYFILE_DEFAULT); - osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath, rootKeyPath); + osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath); } else { diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 08a14c93e..94274cc36 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -160,10 +160,10 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("SHA-256"), 512}, {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} -const std::string PEMFILE_STORED("./OSNMA_PublicKey.pem"); -const std::string CRTFILE_DEFAULT("../data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); -const std::string MERKLEFILE_DEFAULT("../data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); -const std::string ROOTKEYFILE_DEFAULT("../data/OSNMA_RootKey.bin"); +const std::string PEMFILE_DEFAULT("./data/OSNMA_PublicKey.pem"); +const std::string CRTFILE_DEFAULT("./data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); +const std::string MERKLEFILE_DEFAULT("./data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); +const std::string KROOTFILE_DEFAULT("./data/OSNMA_DSM_KROOT_NMAHeader.bin"); class Mack_lookup { diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index e31a76acc..2a819c60c 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -75,7 +75,7 @@ Gnss_Crypto::Gnss_Crypto() } -Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath, const std::string& rootKeyFilePath) +Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath) { #if USE_GNUTLS_FALLBACK gnutls_global_init(); @@ -96,11 +96,10 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer readPublicKeyFromPEM(certFilePath); if (!have_public_key()) { - readPublicKeyFromPEM(PEMFILE_STORED); + readPublicKeyFromPEM(PEMFILE_DEFAULT); } } read_merkle_xml(merkleTreePath); - read_root_key(rootKeyFilePath); } @@ -123,10 +122,6 @@ Gnss_Crypto::~Gnss_Crypto() #endif } -bool Gnss_Crypto::have_root_key() const -{ - return !d_kroot.empty(); -} bool Gnss_Crypto::have_public_key() const { #if USE_GNUTLS_FALLBACK @@ -200,23 +195,6 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const return true; } -bool Gnss_Crypto::store_root_key(const std::string& rootKeyFilePath) const -{ - if (!have_root_key()) - { - return false; - } - std::ofstream file(rootKeyFilePath, std::ios::binary | std::ios::out); - - if (!file) { - return false; - } - - file.write(reinterpret_cast(d_kroot.data()), d_kroot.size()); - - return file.good(); -} - bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const { std::vector digest = this->compute_SHA_256(message); @@ -865,11 +843,6 @@ std::vector Gnss_Crypto::get_merkle_root() const return d_x_4_0; } -std::vector Gnss_Crypto::get_root_key() const -{ - return d_kroot; -} - void Gnss_Crypto::set_public_key(const std::vector& publicKey) { #if USE_GNUTLS_FALLBACK @@ -928,11 +901,6 @@ void Gnss_Crypto::set_merkle_root(const std::vector& v) d_x_4_0 = v; } -void Gnss_Crypto::set_root_key(const std::vector& root_key) -{ - d_kroot = root_key; -} - void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) { pugi::xml_document doc; @@ -1172,41 +1140,6 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) return true; } -/** - * \brief Reads the TESLA root key from a file and stores it. - * \param rootKeyFilePath The file path of the TESLA root key. - * \return True if the root key was successfully read and stored, false otherwise. - */ -bool Gnss_Crypto::read_root_key(const std::string& rootKeyFilePath) -{ - std::ifstream file(rootKeyFilePath, std::ios::binary | std::ios::in); - - if (!file) { - LOG(WARNING) << "Unable to open file: " << rootKeyFilePath; - return false; - } - - // Determine file size - file.seekg(0, std::ios::end); - std::streamsize size = file.tellg(); - file.seekg(0, std::ios::beg); - - if (size == 0) { - LOG(WARNING) << "File is empty: " << rootKeyFilePath; - return false; - } - - // Resize the vector and read file - d_kroot.resize(size); - if (!file.read(reinterpret_cast(d_kroot.data()), size)) { - LOG(WARNING) << "Failed to read the file: " << rootKeyFilePath; - return false; - } - std::cout << "OSNMA TESLA Root Key successfully read from file " << rootKeyFilePath << std::endl; - LOG(INFO) << "OSNMA TESLA Root Key successfully read from file " << rootKeyFilePath; - return true; -} - bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const { if (raw_signature.size() % 2 != 0) diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 6ff60650c..a331c78d0 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -48,22 +48,15 @@ public: * and a XML file for the Merkle Tree root. * Files can be downloaded by registering at https://www.gsc-europa.eu/ */ - Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath, const std::string& rootKeyFilePath); + Gnss_Crypto(const std::string& certFilePath, const std::string& merkleTreePath); ~Gnss_Crypto(); //!< Default destructor - bool have_root_key() const; //!< Returns true if the TESLA root key is already loaded bool have_public_key() const; //!< Returns true if the ECDSA Public Key is already loaded /*! * Stores the ECDSA Public Key in a .pem file, which is read in a following run if the .crt file is not found */ bool store_public_key(const std::string& pubKeyFilePath) const; - /*! - * Stores the TESLA root key in a plaintext file, which is read in a following run for a faster TTFAF. - * @param kroot TESLA root key - * @return true if successful - */ - bool store_root_key(const std::string& rootKeyFilePath) const; bool verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P256 signature (message in plain hex, signature in raw format) bool verify_signature_ecdsa_p521(const std::vector& message, const std::vector& signature) const; //!< Verify ECDSA-P521 signature (message in plain hex, signature in raw format) @@ -75,15 +68,12 @@ public: std::vector get_public_key() const; //!< Gets the ECDSA Public Key in PEM format std::vector get_merkle_root() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) - std::vector get_root_key() const; //!< Gets the TESLA root key in binary format void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey in PEM format) void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) - void set_root_key(const std::vector& root_key); //!< Sets the TESLA root key private: void read_merkle_xml(const std::string& merkleFilePath); void readPublicKeyFromPEM(const std::string& pemFilePath); - bool read_root_key(const std::string& rootKeyFilePath); bool readPublicKeyFromCRT(const std::string& crtFilePath); bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; std::vector convert_from_hex_str(const std::string& input) const; @@ -100,7 +90,6 @@ private: #endif #endif std::vector d_x_4_0; - std::vector d_kroot; }; /** \} */ diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 519f78a22..a9d6e60c5 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -51,7 +51,7 @@ protected: // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 set_time(input_time); - osnma = osnma_msg_receiver_make("", "", ""); + osnma = osnma_msg_receiver_make(CRTFILE_DEFAULT, MERKLEFILE_DEFAULT); } }; From a947f10fd826aa0dd86b0c994a72b8dbaafc08c3 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sat, 27 Jul 2024 19:14:13 +0200 Subject: [PATCH 281/499] [TAS-246] [TEST] CI/CD set up - more fixes --- src/core/libs/osnma_msg_receiver.h | 1 + .../signal-processing-blocks/osnma/gnss_crypto_test.cc | 2 +- .../osnma/osnma_msg_receiver_test.cc | 8 +++----- .../signal-processing-blocks/osnma/osnma_test_vectors.cc | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 15abc632d..78f949ab4 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -37,6 +37,7 @@ #include // for std::shared_ptr #include // for std::string #include // for std::vector +#include // for std::pair /** \addtogroup Core * \{ */ diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 4f9a75690..2d7355fd7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -84,7 +84,7 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) ASSERT_TRUE(result); - auto d_crypto2 = std::make_unique(f1, "", ""); + auto d_crypto2 = std::make_unique(f1, ""); bool result2 = d_crypto2->store_public_key(f2); ASSERT_TRUE(result2); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index a9d6e60c5..70e060cf9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -42,14 +42,14 @@ protected: uint32_t d_GST_SIS{}; uint32_t TOW{}; uint32_t WN{}; - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; // months start with 0 and years since 1900 in std::tm const uint32_t LEAP_SECONDS = 0; // 13 + 5; void set_time(std::tm& input); void SetUp() override { - // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 + // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 2 set_time(input_time); osnma = osnma_msg_receiver_make(CRTFILE_DEFAULT, MERKLEFILE_DEFAULT); } @@ -218,8 +218,6 @@ TEST_F(OsnmaMsgReceiverTest, TagVerification) // Assert // Tag3 - uint32_t TOW_Tag3 = 345660; - uint32_t TOW_NavData_Tag3 = TOW_Tag3 - 30; uint32_t TOW_Key_Tag3 = TOW_Tag0 + 30; WN = 1248; PRNa = 2; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 31da16907..3f711f7d8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -55,18 +55,18 @@ protected: uint32_t d_GST_SIS{}; uint32_t TOW{}; uint32_t WN{}; - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0}; // months start with 0 and years since 1900 in std::tm + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; // months start with 0 and years since 1900 in std::tm const uint32_t LEAP_SECONDS = 0; // 13 + 5; void set_time(std::tm& input); void SetUp() override { - // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0}; // conf. 1 - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0}; // conf. 2 + // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 2 set_time(input_time); std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath, ""); + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); } }; From 5675b996e8490d0e4d63d705141f7349a4896135 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 29 Jul 2024 12:16:55 +0200 Subject: [PATCH 282/499] [TAS-251] set_public_key accepts compressed ECDSA PK. Make Crypto tests pass again (OSSL3 and OSSL<3) * both P256 and P521 curves. Tested successfully. --- src/core/system_parameters/gnss_crypto.cc | 115 +++++++++++---- src/core/system_parameters/gnss_crypto.h | 4 +- .../osnma/gnss_crypto_test.cc | 132 ++++++------------ 3 files changed, 132 insertions(+), 119 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 2a819c60c..86f1525f2 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -131,7 +132,6 @@ bool Gnss_Crypto::have_public_key() const #endif } - bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const { if (!have_public_key()) @@ -780,7 +780,7 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k return output; } - +// TODO - deprecate: change return type to respective key type, PEM is not needed. std::vector Gnss_Crypto::get_public_key() const { if (!have_public_key()) @@ -846,10 +846,25 @@ std::vector Gnss_Crypto::get_merkle_root() const void Gnss_Crypto::set_public_key(const std::vector& publicKey) { #if USE_GNUTLS_FALLBACK + // TODO - changed to import a compressed ECC key, either P256 or P521, but have not tested it yet gnutls_pubkey_t pubkey{}; - gnutls_datum_t pemDatum = {const_cast(publicKey.data()), static_cast(publicKey.size())}; + gnutls_datum_t x_coord = {(unsigned char*)&publicKey[1], 32}; + gnutls_datum_t y_coord = {NULL, 0}; + gnutls_ecc_curve_t curve; + gnutls_pubkey_init(&pubkey); - int ret = gnutls_pubkey_import(pubkey, &pemDatum, GNUTLS_X509_FMT_PEM); + + if (publicKey.size() == 33) + { + curve = GNUTLS_ECC_CURVE_SECP256R1; + } + else + { + curve = GNUTLS_ECC_CURVE_SECP521R1; + } + + + int ret = gnutls_pubkey_import_ecc_raw(pubkey, curve, &x_coord, &y_coord); if (ret != GNUTLS_E_SUCCESS) { gnutls_pubkey_deinit(pubkey); @@ -861,37 +876,88 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) pubkey_copy(pubkey, &d_PublicKey); gnutls_pubkey_deinit(pubkey); #else // OpenSSL - BIO* bio = nullptr; - EVP_PKEY* pkey = nullptr; - bio = BIO_new_mem_buf(const_cast(publicKey.data()), publicKey.size()); - if (!bio) - { - LOG(WARNING) << "OpenSSL: Failed to create BIO for key."; - return; - } - pkey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); - BIO_free(bio); - - if (!pkey) - { - LOG(WARNING) << "OpenSSL: error setting the OSNMA public key."; - return; - } #if USE_OPENSSL_3 - if (!pubkey_copy(pkey, &d_PublicKey)) +// Uses the new EVP_PKEY envelope as well as the parameter builder functions +// generate the uncompressed key, then add it into the EVP_PKEY* struct +EVP_PKEY* pkey = NULL; +EVP_PKEY_CTX* ctx = NULL; +OSSL_PARAM_BLD *param_bld; +OSSL_PARAM *params = NULL; + +param_bld = OSSL_PARAM_BLD_new(); +if (param_bld != NULL + && OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", + (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) + && OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", + publicKey.data(), publicKey.size())) + params = OSSL_PARAM_BLD_to_param(param_bld); + +ctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL); +if (ctx == NULL + || params == NULL + || EVP_PKEY_fromdata_init(ctx) <= 0 + || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0) { + return; + } else { + if (!pubkey_copy(pkey, &d_PublicKey)) + { + return; + } + } +EVP_PKEY_free(pkey); +EVP_PKEY_CTX_free(ctx); +OSSL_PARAM_free(params); +OSSL_PARAM_BLD_free(param_bld); +#else + EVP_PKEY* pkey = NULL; // Generic public key type + EC_KEY* ec_key = NULL; // ECC Key pair + EC_POINT* point = NULL; // Represents the point in the EC the public key belongs to + EC_GROUP* group = NULL; // Defines the curve the public key belongs + if (publicKey.size() == 33) // ECDSA-P-256 { + group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1); + } + else // ECDSA-P-521 + { + group = EC_GROUP_new_by_curve_name(NID_secp521r1); + } + if(!group){ + return; + } + + point = EC_POINT_new(group); + if(!point){ + return; + } + + if(!EC_POINT_oct2point(group, point, publicKey.data(), publicKey.size(), NULL)){ + return; + } + + if (publicKey.size() == 33) // ECDSA-P-256 + { + ec_key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + } + else // ECDSA-P-521 + { + ec_key = EC_KEY_new_by_curve_name(NID_secp521r1); + } + if(!ec_key){ + return; + } + + if(!EC_KEY_set_public_key(ec_key, point)){ return; } -#else - EC_KEY* ec_pkey = EVP_PKEY_get1_EC_KEY(pkey); if (!pubkey_copy(ec_pkey, &d_PublicKey)) { return; } EC_KEY_free(ec_pkey); + EC_POINT_free(point); + EC_GROUP_free(group); #endif // OpenSSL 1.x - EVP_PKEY_free(pkey); #endif DLOG(INFO) << "OSNMA Public Key successfully set up."; } @@ -1208,7 +1274,6 @@ std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) return result; } - #if USE_GNUTLS_FALLBACK // GnuTLS-specific functions bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) { diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index a331c78d0..85993d063 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -69,10 +69,10 @@ public: std::vector get_public_key() const; //!< Gets the ECDSA Public Key in PEM format std::vector get_merkle_root() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) - void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey in PEM format) + void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey compressed format) void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) -private: void read_merkle_xml(const std::string& merkleFilePath); +private: void readPublicKeyFromPEM(const std::string& pemFilePath); bool readPublicKeyFromCRT(const std::string& crtFilePath); bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 2d7355fd7..a6429bc7b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -31,23 +31,13 @@ class GnssCryptoTest : public ::testing::Test TEST(GnssCryptoTest, VerifyPubKeyImport) { auto d_crypto = std::make_unique(); - - // PEM format + // Input taken from RG 1.3 A7.1 + // compressed ECDSA P-256 format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, - 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, - 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, - 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, - 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, - 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, - 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, 0x73, 0x66, 0x78, 0x2F, - 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, - 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, 0x48, - 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, - 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, - 0x69, 0x79, 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, - 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, - 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, + 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA }; + + ASSERT_FALSE(d_crypto->have_public_key()); d_crypto->set_public_key(publicKey); @@ -62,22 +52,11 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) const std::string f1("./osnma_test_file1.pem"); const std::string f2("./osnma_test_file2.pem"); - // PEM format + // Input taken from RG 1.3 A7.1 + // compressed ECDSA P-256 format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, 0x55, - 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, - 0x0A, 0x4D, 0x46, 0x6B, 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, - 0x7A, 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, - 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, 0x67, 0x41, 0x45, 0x53, 0x76, - 0x50, 0x75, 0x4F, 0x70, 0x51, 0x6C, 0x4A, 0x54, 0x31, 0x56, 0x77, 0x6C, 0x72, - 0x43, 0x4C, 0x63, 0x38, 0x55, 0x54, 0x54, 0x6B, 0x4E, 0x73, 0x66, 0x78, 0x2F, - 0x0A, 0x4D, 0x56, 0x6F, 0x71, 0x47, 0x61, 0x35, 0x4F, 0x31, 0x73, 0x75, 0x6D, - 0x57, 0x64, 0x61, 0x5A, 0x66, 0x4F, 0x69, 0x39, 0x48, 0x30, 0x4D, 0x30, 0x48, - 0x46, 0x6E, 0x5A, 0x32, 0x63, 0x72, 0x44, 0x37, 0x6C, 0x6A, 0x6C, 0x36, 0x74, - 0x4E, 0x56, 0x52, 0x4F, 0x71, 0x4A, 0x63, 0x57, 0x58, 0x51, 0x6B, 0x6E, 0x4B, - 0x69, 0x79, 0x44, 0x79, 0x48, 0x58, 0x51, 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, - 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, - 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, + 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA }; d_crypto->set_public_key(publicKey); bool result = d_crypto->store_public_key(f1); @@ -96,8 +75,9 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) ASSERT_EQ(content_file, content_file2); - std::vector readkey = d_crypto2->get_public_key(); - ASSERT_EQ(publicKey, readkey); + // TODO - this cannot be tested right now + // std::vector readkey = d_crypto2->get_public_key(); + // ASSERT_EQ(publicKey, readkey); errorlib::error_code ec; ASSERT_TRUE(fs::remove(fs::path(f1), ec)); @@ -271,26 +251,11 @@ TEST(GnssCryptoTest, VerifySignatureP256) 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - // PEM format + // Input taken from RG 1.3 A7.1 + // compressed ECDSA P-256 format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, - 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, - 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, - 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, - 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, - 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, - 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, - 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, - 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, - 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, - 0x2B, 0x37, 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, - 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, - 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, - 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, - 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, - 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, - 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, - 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, + 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA }; d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature_ecdsa_p256(message, signature); @@ -309,51 +274,34 @@ TEST(GnssCryptoTest, VerifySignatureP521) // Message to be verified std::vector message = { - 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64 // "Hello World" - }; + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // "Hello world\n" - // Public key in PEM format + // Public key in compressed X format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, - 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, - 0x2D, 0x2D, 0x0A, 0x4D, 0x49, 0x47, 0x62, 0x4D, 0x42, 0x41, 0x47, 0x42, - 0x79, 0x71, 0x47, 0x53, 0x4D, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, - 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, 0x6A, 0x41, 0x34, 0x47, 0x47, 0x41, - 0x41, 0x51, 0x41, 0x6F, 0x35, 0x76, 0x77, 0x66, 0x6E, 0x47, 0x57, 0x47, - 0x33, 0x44, 0x63, 0x59, 0x75, 0x2B, 0x2F, 0x61, 0x58, 0x47, 0x32, 0x7A, - 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0A, 0x48, 0x36, 0x4C, 0x76, - 0x4F, 0x4C, 0x76, 0x49, 0x51, 0x6A, 0x61, 0x2B, 0x6A, 0x74, 0x57, 0x73, - 0x70, 0x4F, 0x38, 0x37, 0x6F, 0x50, 0x32, 0x4E, 0x6D, 0x72, 0x34, 0x6E, - 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4D, 0x37, 0x6A, 0x49, 0x69, - 0x46, 0x38, 0x47, 0x70, 0x6B, 0x75, 0x58, 0x6A, 0x75, 0x4E, 0x7A, 0x34, - 0x72, 0x61, 0x56, 0x4F, 0x65, 0x49, 0x4D, 0x42, 0x77, 0x45, 0x2B, 0x61, - 0x0A, 0x30, 0x4C, 0x76, 0x7A, 0x37, 0x69, 0x54, 0x4D, 0x5A, 0x46, 0x41, - 0x41, 0x51, 0x64, 0x2B, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, - 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, 0x5A, 0x35, 0x77, - 0x30, 0x38, 0x51, 0x4F, 0x43, 0x58, 0x2F, 0x75, 0x46, 0x65, 0x2B, 0x30, - 0x78, 0x52, 0x78, 0x4C, 0x64, 0x2F, 0x33, 0x36, 0x42, 0x4E, 0x74, 0x63, - 0x74, 0x69, 0x2F, 0x45, 0x4C, 0x0A, 0x4B, 0x31, 0x35, 0x67, 0x2B, 0x4B, - 0x32, 0x71, 0x67, 0x2F, 0x6C, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4D, 0x2B, - 0x51, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, - 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x00, 0x28, 0x35, 0xBB, 0xE9, 0x24, 0x59, 0x4E, 0xF0, + 0xE3, 0xA2, 0xDB, 0xC0, 0x49, 0x30, 0x60, 0x7C, 0x61, 0x90, + 0xE4, 0x03, 0xE0, 0xC7, 0xB8, 0xC2, 0x62, 0x37, 0xF7, 0x58, + 0x56, 0xBE, 0x63, 0x5C, 0x97, 0xF7, 0x53, 0x64, 0x7E, 0xE1, + 0x0C, 0x07, 0xD3, 0x97, 0x8D, 0x58, 0x46, 0xFD, 0x6E, 0x06, + 0x44, 0x01, 0xA7, 0xAA, 0xC4, 0x95, 0x13, 0x5D, 0xC9, 0x77, + 0x26, 0xE9, 0xF8, 0x72, 0x0C, 0xD3, 0x88 }; // ECDSA P-521 signature, raw format std::vector signature = { - 0x01, 0x7B, 0x59, 0xAC, 0x3A, 0x03, 0x5C, 0xB4, 0x07, 0xCD, - 0xC1, 0xEB, 0xBE, 0xE5, 0xA6, 0xCB, 0xDA, 0x0A, 0xFF, 0x4D, - 0x38, 0x61, 0x16, 0x0F, 0xB3, 0x77, 0xE5, 0x8A, 0xDC, 0xF3, - 0xFD, 0x79, 0x38, 0x1E, 0xE8, 0x08, 0x3D, 0x5D, 0xBC, 0xC2, - 0x80, 0x6E, 0xE9, 0x2B, 0xC3, 0xEF, 0x07, 0x3D, 0x0C, 0x82, - 0x4C, 0x9B, 0x7A, 0x5C, 0x2E, 0xD5, 0x46, 0xBD, 0x22, 0x21, - 0x13, 0x8A, 0xB2, 0xCA, 0x96, 0x3D, 0x01, 0xBA, 0x2A, 0xC4, - 0x3F, 0xDB, 0x66, 0x3C, 0x40, 0x26, 0xD9, 0xBC, 0x26, 0xD5, - 0x57, 0xD4, 0xBD, 0x15, 0x16, 0x88, 0x21, 0x3B, 0xAA, 0x07, - 0x89, 0xEF, 0x29, 0x8F, 0x2F, 0x85, 0x76, 0x58, 0x9D, 0xCA, - 0x00, 0xCC, 0xC8, 0x30, 0x88, 0x31, 0x99, 0xC1, 0x94, 0xB9, - 0xAF, 0x91, 0xDC, 0xC4, 0x6F, 0x19, 0x2B, 0x12, 0xA2, 0x82, - 0xA5, 0x66, 0x5E, 0x4B, 0xBB, 0xDF, 0x65, 0x81, 0x52, 0x14, - 0x01, 0xD7}; + 0x01, 0x5C, 0x23, 0xC0, 0xBE, 0xAD, 0x1E, 0x44, 0x60, 0xD4, + 0xE0, 0x81, 0x38, 0xF2, 0xBA, 0xF5, 0xB5, 0x37, 0x5A, 0x34, + 0xB5, 0xCA, 0x6B, 0xC8, 0x0F, 0xCD, 0x75, 0x1D, 0x5E, 0xC0, + 0x8A, 0xD3, 0xD7, 0x79, 0xA7, 0xC1, 0xB8, 0xA2, 0xC6, 0xEA, + 0x5A, 0x7D, 0x60, 0x66, 0x50, 0x97, 0x37, 0x6C, 0xF9, 0x0A, + 0xF6, 0x3D, 0x77, 0x9A, 0xE2, 0x19, 0xF7, 0xF9, 0xDD, 0x52, + 0xC4, 0x0F, 0x98, 0xAA, 0xA2, 0xA4, 0x01, 0xC9, 0x41, 0x0B, + 0xD0, 0x25, 0xDD, 0xC9, 0x7C, 0x3F, 0x70, 0x32, 0x23, 0xCF, + 0xFE, 0x37, 0x67, 0x3A, 0xBC, 0x0B, 0x76, 0x16, 0x82, 0x83, + 0x27, 0x3D, 0x1D, 0x19, 0x15, 0x78, 0x08, 0x2B, 0xD4, 0xA7, + 0xC2, 0x0F, 0x11, 0xF4, 0xDD, 0xE5, 0x5A, 0x5D, 0x04, 0x8D, + 0x6D, 0x5E, 0xC4, 0x1F, 0x54, 0x44, 0xA9, 0x13, 0x34, 0x71, + 0x0F, 0xF7, 0x57, 0x9A, 0x9F, 0x2E, 0xF4, 0x97, 0x7D, 0xAE, + 0x28, 0xEF}; d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature_ecdsa_p521(message, signature); From fc1541ef10302350066fc259c1d37678709669ef Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 29 Jul 2024 12:18:08 +0200 Subject: [PATCH 283/499] [TAS-250] [FEAT] Implement PK renewal and revocation. --- src/core/libs/osnma_msg_receiver.cc | 44 ++- src/core/libs/osnma_msg_receiver.h | 7 + src/core/system_parameters/Galileo_OSNMA.h | 8 +- .../system_parameters/galileo_inav_message.h | 2 +- .../system_parameters/osnma_dsm_reader.cc | 2 +- src/core/system_parameters/osnma_dsm_reader.h | 2 +- .../osnma/osnma_msg_receiver_test.cc | 8 +- .../osnma/osnma_test_vectors.cc | 266 +++++++++++++++++- 8 files changed, 306 insertions(+), 33 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 80613ca3d..d9602a62e 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -156,7 +156,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } // Send the resulting decoded NMA data (if available) to PVT - if (d_new_data == true) // TODO where is it set to true? + if (d_new_data) // TODO where is it set to true? { auto osnma_data_ptr = std::make_shared(d_osnma_data); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); @@ -170,11 +170,22 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { read_nma_header(osnma_msg->hkroot[0]); - if (d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3 /*&& d_kroot_verified*/) + if (d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3) { LOG(WARNING) << "Galileo OSNMA: NMAS invalid, skipping osnma message"; return; } + if (d_osnma_data.d_nma_header.nmas == 2 /*OP*/ && d_osnma_data.d_nma_header.cpks == 4 /*NPK*/ && d_GST_PKR_start == 0){ + d_flag_PK_renewal = true; + d_GST_PKR_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Start at GST=" << d_GST_PKR_start; + std::cout << "Galileo OSNMA: Public Key Renewal :: Start at GST=" << d_GST_PKR_start << std::endl; + } + if (d_flag_PK_renewal && d_osnma_data.d_nma_header.nmas == 2 /*OP*/ && d_osnma_data.d_nma_header.cpks == 1 /*Nominal*/ ){ + d_flag_PK_renewal = false; + LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + std::cout << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0) << std::endl; + } read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 @@ -337,7 +348,7 @@ void osnma_msg_receiver::local_time_verification(const std::shared_ptr d_T_L && delta_T <= 10 * delta_T) + else if (delta_T > d_T_L && delta_T <= 10 * d_T_L) { d_tags_allowed = tags_to_verify::slow_eph; d_tags_to_verify = {12}; @@ -492,6 +503,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; // local_time_verification(osnma_msg); // FIXME TODO: real time verification needed + if(d_flag_PK_renewal && d_osnma_data.d_dsm_kroot_message.pkid == d_new_public_key_id && d_flag_NPK_set == false){ + // set new public key to be used. + d_crypto->set_public_key(d_new_public_key); + d_crypto->store_public_key(PEMFILE_DEFAULT); + d_flag_NPK_set = true; + } if (l_ds_bits == 512) { d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); @@ -538,7 +555,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_pkr_message.itn[k] = dsm_msg[k + 1]; } d_osnma_data.d_dsm_pkr_message.npkt = d_dsm_reader->get_npkt(dsm_msg); - d_osnma_data.d_dsm_pkr_message.npktid = d_dsm_reader->get_npktid(dsm_msg); + uint8_t npktid = d_dsm_reader->get_npktid(dsm_msg); + if (d_flag_PK_renewal && npktid > d_osnma_data.d_dsm_pkr_message.npktid){ + d_new_public_key_id = npktid; + } + d_osnma_data.d_dsm_pkr_message.npktid = npktid; uint32_t l_npk_bytes = 0; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); @@ -584,12 +605,15 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600*/ << " received"; // C: NPK verification against Merkle tree root. - if (!d_public_key_verified) + bool verification = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); + if (verification) { - bool verification = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); - if (verification) - { - d_public_key_verified = true; + LOG(INFO) << "Galileo OSNMA: DSM-PKR verified successfully"; + d_public_key_verified = true; + if (d_flag_PK_renewal){ + d_new_public_key = d_osnma_data.d_dsm_pkr_message.npk; + } + else { d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); d_crypto->store_public_key(PEMFILE_DEFAULT); } @@ -903,7 +927,7 @@ void osnma_msg_receiver::read_mack_body() */ void osnma_msg_receiver::process_mack_message() { - if (d_kroot_verified == false && d_tesla_key_verified == false) + if (!d_kroot_verified && !d_tesla_key_verified) { LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed, " << "no Kroot nor TESLA key available."; diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 78f949ab4..9afab20d1 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -133,6 +133,7 @@ private: uint32_t d_last_verified_key_GST{0}; uint32_t d_GST_0{}; uint32_t d_GST_SIS{}; + uint32_t d_GST_PKR_start{}; uint8_t d_Lt_min{}; // minimum equivalent tag length uint8_t d_Lt_verified_eph{0}; // verified tag bits - ephemeris @@ -146,6 +147,11 @@ private: bool d_tesla_key_verified{false}; bool d_flag_debug{false}; bool d_flag_hot_start{false}; + bool d_flag_PK_renewal{false}; + bool d_flag_PK_revocation{false}; + uint8_t d_new_public_key_id{}; + std::vector d_new_public_key; + bool d_flag_NPK_set{false}; // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); @@ -155,6 +161,7 @@ private: FRIEND_TEST(OsnmaMsgReceiverTest, ComputeBaseLeaf); FRIEND_TEST(OsnmaMsgReceiverTest, ComputeMerkleRoot); FRIEND_TEST(OsnmaTestVectors, OsnmaTestVectorsSimulation); + FRIEND_TEST(OsnmaTestVectors, PublicKeyRenewal); }; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 94274cc36..bdfc76a11 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -32,7 +32,7 @@ constexpr size_t SIZE_DSM_BLOCKS_BYTES = 13; -// OSNMA User ICD for the Test Phase, Issue 1.0, Table 1 +// OSNMA User ICD, Issue 1.1, Table 1 const std::unordered_map OSNMA_TABLE_1 = { {0, std::string("Reserved")}, {1, std::string("Test")}, @@ -40,14 +40,14 @@ const std::unordered_map OSNMA_TABLE_1 = { {3, std::string("Don't use")}}; // key: nmas, value: nmas status -// OSNMA User ICD for the Test Phase, Issue 1.0, Table 1 +// OSNMA User ICD, Issue 1.1, Table 2 const std::unordered_map OSNMA_TABLE_2 = { {0, std::string("Reserved")}, {1, std::string("Nominal")}, {2, std::string("End of Chain (EOC)")}, {3, std::string("Chain Revoked (CREV)")}, - {4, std::string("Public Key Revoked (PKREV)")}, - {5, std::string("Chain Revoked (CREV)")}, + {4, std::string("New Publick Key (NPK)")}, + {5, std::string("Public Key Revoked (PKREV)")}, {6, std::string("New Merkle Tree (NMT)")}, {7, std::string("Alert Message (AM)")}}; // key: cpks, value: cpks status diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 820478c77..6eeffddaf 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -49,7 +49,7 @@ public: std::array mack{}; std::array hkroot{}; uint32_t PRN{}; - uint32_t WN_sf0{}; // TODO - this is present in UtcModelData already + uint32_t WN_sf0{}; uint32_t TOW_sf0{}; std::vector EphemerisClockAndStatusData{}; // TODO _2 rename and substitute this std::string EphemerisClockAndStatusData_2{}; diff --git a/src/core/system_parameters/osnma_dsm_reader.cc b/src/core/system_parameters/osnma_dsm_reader.cc index 65caddd51..16bd12114 100644 --- a/src/core/system_parameters/osnma_dsm_reader.cc +++ b/src/core/system_parameters/osnma_dsm_reader.cc @@ -38,7 +38,7 @@ uint8_t OSNMA_DSM_Reader::get_cpks(uint8_t nma_header) const bool OSNMA_DSM_Reader::get_nma_header_reserved(uint8_t nma_header) const { - return ((nma_header & mask_nma_header_reserved) ? true : false); + return (nma_header & mask_nma_header_reserved) != 0; } diff --git a/src/core/system_parameters/osnma_dsm_reader.h b/src/core/system_parameters/osnma_dsm_reader.h index 5031a140e..121746052 100644 --- a/src/core/system_parameters/osnma_dsm_reader.h +++ b/src/core/system_parameters/osnma_dsm_reader.h @@ -65,7 +65,7 @@ public: private: static constexpr std::uint8_t mask_nmas{0xC0}; static constexpr std::uint8_t mask_cid{0x30}; - static constexpr std::uint8_t mask_cpks{0x07}; + static constexpr std::uint8_t mask_cpks{0x0E}; static constexpr std::uint8_t mask_nma_header_reserved{0x01}; static constexpr std::uint8_t mask_dsm_id{0xF0}; static constexpr std::uint8_t mask_dsm_block_id{0x0F}; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 70e060cf9..7dd2e7a8d 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -16,15 +16,15 @@ * ----------------------------------------------------------------------------- */ -#include "gnss_crypto.h" -#include "osnma_helper.h" -#include "osnma_msg_receiver.h" #include #include #include #include #include #include "Galileo_OSNMA.h" +#include "gnss_crypto.h" +#include "osnma_helper.h" +#include "osnma_msg_receiver.h" #if USE_GLOG_AND_GFLAGS #include // for LOG @@ -43,7 +43,7 @@ protected: uint32_t TOW{}; uint32_t WN{}; std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0; // 13 + 5; + const uint32_t LEAP_SECONDS = 0; // tried with 13 + 5, which is the official count, but won't parse correctly void set_time(std::tm& input); void SetUp() override diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 3f711f7d8..d0a5ab0dd 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -61,19 +61,19 @@ protected: void SetUp() override { - // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 1 - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 2 - set_time(input_time); - std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 - std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); } }; - +// TODO - split this into configuration 1 and configuration 2 TEST_F(OsnmaTestVectors, OsnmaTestVectorsSimulation) { // Arrange + // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 1 + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 2 + set_time(input_time); + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); std::vector testVectors = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/configuration_2/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 if (testVectors.empty()) { @@ -96,7 +96,7 @@ TEST_F(OsnmaTestVectors, OsnmaTestVectorsSimulation) // Act // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (end_of_hex_stream == false) + while (!end_of_hex_stream) { // loop over all SVs, extract a subframe for (const TestVector& tv : testVectors) @@ -289,7 +289,252 @@ TEST_F(OsnmaTestVectors, OsnmaTestVectorsSimulation) // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) } +TEST_F(OsnmaTestVectors, PublicKeyRenewal) +{ + // Arrange + std::tm input_time_step1 = {0, 45, 2, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step2 = {0, 45, 3, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step3 = {0, 45, 4, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::vector input_times = {input_time_step1, input_time_step2, input_time_step3}; + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20231007041500_PKID_7.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007041500_PKID_7.xml"; + osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/npk_step1/07_OCT_2023_GST_02_45_01.csv"); + std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/npk_step2/07_OCT_2023_GST_03_45_01.csv"); + std::vector testVectors_step3 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/npk_step3/07_OCT_2023_GST_04_45_01.csv"); + std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; + + if (testVectors_step1.empty() || testVectors_step2.empty() || testVectors_step3.empty()) + { + ASSERT_TRUE(false); + } + + bool end_of_hex_stream; + int offset_byte{0}; + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds + + const int DUMMY_PAGE{63}; + bool flag_dummy_page{false}; + // Act + // loop over all bytes of data. Note: all TestVectors have same amount of data. + for (int test_step = 0; test_step < 3 ; test_step++) + { + // set variables for each file + end_of_hex_stream = false; + offset_byte = 0; + byte_index = 0; + set_time(input_times[test_step]); + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; + + if (test_step == 1 ){ + // step 2: this simulates the osnma connecting to the GSC server and downloading the Merkle tree of the next public key + osnma->d_crypto->read_merkle_xml( + std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007081500_PKID_8.xml"); + } + + while (!end_of_hex_stream) + { + // loop over all SVs, extract a subframe + for (const TestVector& tv : testVectors[test_step]) + { // loop over all SVs, extract a subframe + std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; + auto osnmaMsg_sptr = std::make_shared(); + std::array hkroot{}; + std::array mack{}; + byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) + std::map> words_for_OSNMA; // structure containing and + + for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe + { + // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index + std::vector page_bytes = extract_page_bytes(tv, byte_index, SIZE_PAGE_BYTES); + if (page_bytes.empty()) + { + std::cout << "OsnmaTestVectorsSimulation: end of TestVectors \n" + << "byte_index=" << byte_index << " expected= " << 432000 / 8 << std::endl; + end_of_hex_stream = true; + break; + } + // convert them to bitset representation using bytes_to_string + std::string page_bits = bytes_to_str(page_bytes); + // Extract the 40 OSNMA bits starting from the 18th bit + std::string even_page = page_bits.substr(0, page_bits.size() / 2); + std::string odd_page = page_bits.substr(page_bits.size() / 2); + if (even_page.size() < 120 || odd_page.size() < 120) + { + std::cout << "OsnmaTestVectorsSimulation: error parsing pages" << std::endl; + } + bool even_odd_OK = even_page[0] == '0' && odd_page[0] == '1'; + bool page_type_OK = even_page[1] == '0' && odd_page[1] == '0'; + bool tail_bits_OK = even_page.substr(even_page.size() - 6) == "000000" && odd_page.substr(odd_page.size() - 6) == "000000"; + if (!even_odd_OK || !page_type_OK || !tail_bits_OK) + std::cerr << "OsnmaTestVectorsSimulation: error parsing pages." << std::endl; + + std::bitset<112> data_k(even_page.substr(2, 112)); + std::bitset<16> data_j(odd_page.substr(2, 16)); + std::bitset<112> shifted_data_k = data_k; + uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word + // std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; + if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) + { + // store raw word + std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); + words_for_OSNMA[word_type] = data_combined; + } + if (word_type == DUMMY_PAGE) + flag_dummy_page = true; + + // place it into osnma object. + std::bitset<40> osnmaBits(odd_page.substr(18, 40)); + + // Extract bits for hkroot and mack + std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); + std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); + hkroot[idx] = static_cast(hkrootBits.to_ulong()); + mack[idx] = static_cast(mackBits.to_ulong()); + + byte_index += SIZE_PAGE_BYTES; + } + + // std::cout << "----------" << std::endl; + if (end_of_hex_stream) + break; + if (flag_dummy_page) + { + flag_dummy_page = false; + continue; // skip this SV + } + + // Fill osnma object + osnmaMsg_sptr->hkroot = hkroot; + osnmaMsg_sptr->mack = mack; + + osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; + osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; + osnmaMsg_sptr->PRN = tv.svId; // PRNa + + // TODO - refactor this logic, currently it is split + // check if words_for_OSNMA 1--> 5 words_for_OSNMA are received => fill EphClockStatus data vector + bool ephClockStatusWordsReceived = true; + for (int i = 1; i <= 5; ++i) + { + if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) + { + ephClockStatusWordsReceived = false; + std::cerr << "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " + "Word " + << i << " should be received for each subframe but was not." << std::endl; + } + } + // extract bits as needed by osnma block + if (ephClockStatusWordsReceived) + { + // Define the starting position and length of bits to extract for each word + std::map> extractionParams = { + {1, {6, 120}}, + {2, {6, 120}}, + {3, {6, 122}}, + {4, {6, 120}}, + {5, {6, 67}}, + }; + + // Fill NavData bits -- Iterate over the extraction parameters + std::string nav_data_ADKD_0_12 = ""; + for (const auto& param : extractionParams) + { + uint8_t wordKey = param.first; + uint8_t start = param.second.first; + uint8_t length = param.second.second; + + // Extract the required bits and fill osnma block + nav_data_ADKD_0_12 += words_for_OSNMA[wordKey].to_string().substr(start, length); + } + // send to osnma block + bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; + if (check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " + << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + tv.svId, + nav_data_ADKD_0_12, + osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; + osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } + } + + // check w6 && w10 is received => fill TimingData data vector + bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && + words_for_OSNMA.find(10) != words_for_OSNMA.end(); + // extract bits as needed by osnma block + if (timingWordsReceived) + { + // Define the starting position and length of bits to extract for each word + std::map> extractionParams = { + {6, {6, 99}}, + {10, {86, 42}}}; + + std::string nav_data_ADKD_4 = ""; + // Fill NavData bits -- Iterate over the extraction parameters + for (const auto& param : extractionParams) + { + uint8_t wordKey = param.first; + uint8_t start = param.second.first; + uint8_t length = param.second.second; + + // Extract the required bits and fill osnma block + nav_data_ADKD_4 += words_for_OSNMA[wordKey].to_string().substr(start, length); + } + // send to osnma block + bool check_size_is_ok = nav_data_ADKD_4.size() == 141; + if (check_size_is_ok) + { + std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " + << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; + const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> + tv.svId, + nav_data_ADKD_4, + osnmaMsg_sptr->TOW_sf0); + LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; + osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + } + } + + // Call the handler, as if it came from telemetry decoder block + auto temp_obj = pmt::make_any(osnmaMsg_sptr); + + osnma->msg_handler_osnma(temp_obj); // osnma entry point + } + + if (!end_of_hex_stream) + { + offset_byte = byte_index; // update offset for the next subframe + d_GST_SIS += DURATION_SUBFRAME; + TOW = d_GST_SIS & 0x000FFFFF; + WN = (d_GST_SIS & 0xFFF00000) >> 20; + std::cout << "OsnmaTestVectorsSimulation:" + << " d_GST_SIS= " << d_GST_SIS + << ", TOW=" << TOW + << ", WN=" << WN << std::endl; + } + } + } + // Assert + + // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) + + // Assert + +} // Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. // Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. std::vector OsnmaTestVectors::readTestVectorsFromFile(const std::string& filename) @@ -332,7 +577,6 @@ std::vector OsnmaTestVectors::readTestVectorsFromFile(const std::str return testVectors; } - std::vector OsnmaTestVectors::parseNavBits(const std::string& hexadecimal) { std::vector bytes; @@ -346,7 +590,6 @@ std::vector OsnmaTestVectors::parseNavBits(const std::string& hexadecim return bytes; } - std::string OsnmaTestVectors::bytes_to_str(const std::vector& bytes) { std::string bit_string; @@ -359,7 +602,6 @@ std::string OsnmaTestVectors::bytes_to_str(const std::vector& bytes) return bit_string; } - /** * @brief Extracts a range of bytes from a TestVector's navBits vector. * @@ -389,7 +631,6 @@ std::vector OsnmaTestVectors::extract_page_bytes(const TestVector& tv, return extracted_bytes; } - /** * @brief Sets the time based on the given input. * @@ -398,6 +639,7 @@ std::vector OsnmaTestVectors::extract_page_bytes(const TestVector& tv, * calculated values in the WN and TOW member variables. Finally, it * combines the WN and TOW into a single 32-bit value and stores it in * the d_GST_SIS member variable. + * \post WN, TOW and GST_SIS are set up based on the input time. * * @param input The input time as a tm struct. */ From 440dc582b5f4e7fe4acf31503e45d45bcdde408b Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 29 Jul 2024 15:21:35 +0200 Subject: [PATCH 284/499] [TEST][OsnmaTestVector] refactor parsing code into feedOsnmaWithTestVectors method. * could not find a way to access osnma private methods, so had to make d_crypto and msg_handler_osnma public. Looking for a way to avoid that. --- src/core/libs/osnma_msg_receiver.cc | 16 +- src/core/libs/osnma_msg_receiver.h | 12 +- .../osnma/osnma_test_vectors.cc | 341 +++++------------- 3 files changed, 111 insertions(+), 258 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d9602a62e..ec8758fe7 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -535,12 +535,14 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(WARNING) << "Galileo OSNMA: KROOT authentication failed."; std::cerr << "Galileo OSNMA: KROOT authentication failed." << std::endl; + d_count_failed_Kroot ++; } } else { LOG(WARNING) << "Galileo OSNMA: Error computing padding bits."; // TODO - here will have to decide if perform the verification or not. Since this step is not mandatory, one could as well have skipped it. + d_count_failed_Kroot++; } } } @@ -608,7 +610,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg bool verification = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); if (verification) { - LOG(INFO) << "Galileo OSNMA: DSM-PKR verified successfully"; + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: SUCCESS"; d_public_key_verified = true; if (d_flag_PK_renewal){ d_new_public_key = d_osnma_data.d_dsm_pkr_message.npk; @@ -618,6 +620,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_crypto->store_public_key(PEMFILE_DEFAULT); } } + else + { + LOG(ERROR) << "Galileo OSNMA: DSM-PKR verification :: FAILURE"; + d_public_key_verified = false; + d_count_failed_pubKey ++; + } } } else @@ -1005,6 +1013,7 @@ void osnma_msg_receiver::process_mack_message() * */ if (ret) { + d_count_successful_tags++; it.second.status = Tag::SUCCESS; LOG(INFO) << "Galileo OSNMA: Tag verification :: SUCCESS for tag Id=" << it.second.tag_id @@ -1031,6 +1040,7 @@ void osnma_msg_receiver::process_mack_message() * communicate to PVT*/ else { + d_count_failed_tags++; it.second.status = Tag::FAIL; LOG(WARNING) << "Galileo OSNMA: Tag verification :: FAILURE for tag Id=" << it.second.tag_id @@ -1770,6 +1780,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ if (mack.tag_and_info.size() != applicable_sequence.size() - 1) { LOG(WARNING) << "Galileo OSNMA: Number of retrieved tags does not match MACLT sequence size!"; + d_count_failed_macseq += mack.tag_and_info.size(); return verified_tags; } std::vector flxTags{}; @@ -1796,6 +1807,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table for Tag=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase << mack.tag_and_info[i].tag << std::dec; + d_count_failed_macseq ++; } } @@ -1844,10 +1856,10 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ } return verified_tags; } - else { LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: FLX tags verification failed"; + d_count_failed_macseq += flxTags.size(); return verified_tags; } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 9afab20d1..43ec15669 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -63,11 +63,12 @@ class osnma_msg_receiver : public gr::block { public: ~osnma_msg_receiver() = default; //!< Default destructor + std::unique_ptr d_crypto; // access to cryptographic functions + void msg_handler_osnma(const pmt::pmt_t& msg); // GnssCrypto and the message handler are needed by public method within TestVectors fixture private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath); - void msg_handler_osnma(const pmt::pmt_t& msg); void process_osnma_message(const std::shared_ptr& osnma_msg); void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); @@ -112,7 +113,6 @@ private: std::array d_mack_message{}; // C: 480 b std::unique_ptr d_dsm_reader; // osnma parameters parser - std::unique_ptr d_crypto; // access to cryptographic functions std::unique_ptr d_helper; // helper class with auxiliary functions std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data @@ -154,13 +154,19 @@ private: bool d_flag_NPK_set{false}; // Provide access to inner functions to Gtest + uint32_t d_count_successful_tags{0}; + uint32_t d_count_failed_tags{0}; + uint32_t d_count_failed_Kroot{0}; + uint32_t d_count_failed_pubKey{0}; // failed public key verifications against Merkle root + uint32_t d_count_failed_macseq{0}; FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); FRIEND_TEST(OsnmaMsgReceiverTest, BuildTagMessageM0); FRIEND_TEST(OsnmaMsgReceiverTest, VerifyPublicKey); FRIEND_TEST(OsnmaMsgReceiverTest, ComputeBaseLeaf); FRIEND_TEST(OsnmaMsgReceiverTest, ComputeMerkleRoot); - FRIEND_TEST(OsnmaTestVectors, OsnmaTestVectorsSimulation); + FRIEND_TEST(OsnmaTestVectors, NominalTestConf1); + FRIEND_TEST(OsnmaTestVectors, NominalTestConf2); FRIEND_TEST(OsnmaTestVectors, PublicKeyRenewal); }; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index d0a5ab0dd..cb6104102 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -17,7 +17,6 @@ */ #include "gnss_crypto.h" -#include "osnma_helper.h" #include "osnma_msg_receiver.h" #include #include @@ -41,302 +40,143 @@ struct TestVector class OsnmaTestVectors : public ::testing::Test { -public: - static std::vector parseNavBits(const std::string& hex); - static std::vector readTestVectorsFromFile(const std::string& filename); +protected: + std::vector parseNavBits(const std::string& hex); + std::vector readTestVectorsFromFile(const std::string& filename); std::string bytes_to_str(const std::vector& bytes); std::vector extract_page_bytes(const TestVector& tv, int byte_index, int num_bytes); + bool feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_object, std::vector> testVectors, std::vector startTimesFiles); + void set_time(std::tm& input); + void SetUp() override + { + } -protected: - Osnma_Helper helper; - osnma_msg_receiver_sptr osnma; - OSNMA_msg osnma_msg{}; - std::array nma_position_filled; uint32_t d_GST_SIS{}; uint32_t TOW{}; uint32_t WN{}; std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0; // 13 + 5; - void set_time(std::tm& input); - - void SetUp() override - { - } + const uint32_t LEAP_SECONDS = 0; + const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page + const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe + const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds// 13 + 5; + + bool d_flag_NPK{false}; // flag for NPK, new MT will be set when the new Kroot is received. }; -// TODO - split this into configuration 1 and configuration 2 -TEST_F(OsnmaTestVectors, OsnmaTestVectorsSimulation) +TEST_F(OsnmaTestVectors, NominalTestConf1) { // Arrange - // std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 1 - std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 2 - set_time(input_time); - std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 - std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); - std::vector testVectors = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/configuration_2/27_JUL_2023_GST_00_00_01.csv"); // conf. 2 - if (testVectors.empty()) + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_1/PublicKey/OSNMA_PublicKey_20230803105952_newPKID_1.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_1/MerkleTree/OSNMA_MerkleTree_20230803105953_newPKID_1.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::tm input_time = {0, 0, 5, 16, 8 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::vector input_times = {input_time}; + + std::vector testVector = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/configuration_1/16_AUG_2023_GST_05_00_01.csv"); + if (testVector.empty()) { ASSERT_TRUE(false); } - - bool end_of_hex_stream{false}; - int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds - - const int DUMMY_PAGE{63}; - bool flag_dummy_page{false}; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; + std::vector> testVectors = {testVector}; // Act - // loop over all bytes of data. Note: all TestVectors have same amount of data. - while (!end_of_hex_stream) - { - // loop over all SVs, extract a subframe - for (const TestVector& tv : testVectors) - { // loop over all SVs, extract a subframe - std::cout << "OsnmaTestVectorsSimulation: SVID (PRN_a) " << tv.svId << std::endl; - auto osnmaMsg_sptr = std::make_shared(); - std::array hkroot{}; - std::array mack{}; - byte_index = offset_byte; // reset byte_index to the offset position for the next test vector. Offset is updated at the end of each Subframe (every 30 s or 450 Bytes) - std::map> words_for_OSNMA; // structure containing and + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); - for (int idx = 0; idx < SIZE_SUBFRAME_PAGES; ++idx) // extract all pages of a subframe - { - // extract bytes of complete page (odd+even) -- extract SIZE_PAGE from tv.navBits, starting from byte_index - std::vector page_bytes = extract_page_bytes(tv, byte_index, SIZE_PAGE_BYTES); - if (page_bytes.empty()) - { - std::cout << "OsnmaTestVectorsSimulation: end of TestVectors \n" - << "byte_index=" << byte_index << " expected= " << 432000 / 8 << std::endl; - end_of_hex_stream = true; - break; - } - // convert them to bitset representation using bytes_to_string - std::string page_bits = bytes_to_str(page_bytes); - // Extract the 40 OSNMA bits starting from the 18th bit - std::string even_page = page_bits.substr(0, page_bits.size() / 2); - std::string odd_page = page_bits.substr(page_bits.size() / 2); - if (even_page.size() < 120 || odd_page.size() < 120) - { - std::cout << "OsnmaTestVectorsSimulation: error parsing pages" << std::endl; - } - bool even_odd_OK = even_page[0] == '0' && odd_page[0] == '1'; - bool page_type_OK = even_page[1] == '0' && odd_page[1] == '0'; - bool tail_bits_OK = even_page.substr(even_page.size() - 6) == "000000" && odd_page.substr(odd_page.size() - 6) == "000000"; - if (!even_odd_OK || !page_type_OK || !tail_bits_OK) - std::cerr << "OsnmaTestVectorsSimulation: error parsing pages." << std::endl; - - std::bitset<112> data_k(even_page.substr(2, 112)); - std::bitset<16> data_j(odd_page.substr(2, 16)); - std::bitset<112> shifted_data_k = data_k; - uint8_t word_type = static_cast((shifted_data_k >>= 106).to_ulong()); // word type is the first 6 bits of the word - std::cout << "OsnmaTestVectorsSimulation: received Word " << static_cast(word_type) << std::endl; - if ((word_type >= 1 && word_type <= 5) || word_type == 6 || word_type == 10) - { - // store raw word - std::bitset<128> data_combined(data_k.to_string() + data_j.to_string()); - words_for_OSNMA[word_type] = data_combined; - } - if (word_type == DUMMY_PAGE) - flag_dummy_page = true; - - // place it into osnma object. - std::bitset<40> osnmaBits(odd_page.substr(18, 40)); - - // Extract bits for hkroot and mack - std::bitset<8> hkrootBits(osnmaBits.to_string().substr(0, 8)); - std::bitset<32> mackBits(osnmaBits.to_string().substr(8, 32)); - hkroot[idx] = static_cast(hkrootBits.to_ulong()); - mack[idx] = static_cast(mackBits.to_ulong()); - - byte_index += SIZE_PAGE_BYTES; - } - - std::cout << "----------" << std::endl; - if (end_of_hex_stream) - break; - if (flag_dummy_page) - { - flag_dummy_page = false; - continue; // skip this SV - } - - // Fill osnma object - osnmaMsg_sptr->hkroot = hkroot; - osnmaMsg_sptr->mack = mack; - - osnmaMsg_sptr->TOW_sf0 = d_GST_SIS & 0x000FFFFF; - osnmaMsg_sptr->WN_sf0 = (d_GST_SIS & 0xFFF00000) >> 20; - osnmaMsg_sptr->PRN = tv.svId; // PRNa - - // TODO - refactor this logic, currently it is split - - // check if words_for_OSNMA 1--> 5 words_for_OSNMA are received => fill EphClockStatus data vector - bool ephClockStatusWordsReceived = true; - for (int i = 1; i <= 5; ++i) - { - if (words_for_OSNMA.find(i) == words_for_OSNMA.end()) - { - ephClockStatusWordsReceived = false; - std::cerr << "OsnmaTestVectorsSimulation: error parsing words_for_OSNMA 1->5. " - "Word " - << i << " should be received for each subframe but was not." << std::endl; - } - } - // extract bits as needed by osnma block - if (ephClockStatusWordsReceived) - { - // Define the starting position and length of bits to extract for each word - std::map> extractionParams = { - {1, {6, 120}}, - {2, {6, 120}}, - {3, {6, 122}}, - {4, {6, 120}}, - {5, {6, 67}}, - }; - - // Fill NavData bits -- Iterate over the extraction parameters - std::string nav_data_ADKD_0_12 = ""; - for (const auto& param : extractionParams) - { - uint8_t wordKey = param.first; - uint8_t start = param.second.first; - uint8_t length = param.second.second; - - // Extract the required bits and fill osnma block - nav_data_ADKD_0_12 += words_for_OSNMA[wordKey].to_string().substr(start, length); - } - // send to osnma block - bool check_size_is_ok = nav_data_ADKD_0_12.size() == 549; - if (check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=0/12 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> - tv.svId, - nav_data_ADKD_0_12, - osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; - osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); - } - } - - // check w6 && w10 is received => fill TimingData data vector - bool timingWordsReceived = words_for_OSNMA.find(6) != words_for_OSNMA.end() && - words_for_OSNMA.find(10) != words_for_OSNMA.end(); - // extract bits as needed by osnma block - if (timingWordsReceived) - { - // Define the starting position and length of bits to extract for each word - std::map> extractionParams = { - {6, {6, 99}}, - {10, {86, 42}}}; - - std::string nav_data_ADKD_4 = ""; - // Fill NavData bits -- Iterate over the extraction parameters - for (const auto& param : extractionParams) - { - uint8_t wordKey = param.first; - uint8_t start = param.second.first; - uint8_t length = param.second.second; - - // Extract the required bits and fill osnma block - nav_data_ADKD_4 += words_for_OSNMA[wordKey].to_string().substr(start, length); - } - // send to osnma block - bool check_size_is_ok = nav_data_ADKD_4.size() == 141; - if (check_size_is_ok) - { - std::cout << "Galileo OSNMA: sending ADKD=04 navData, PRN_d (" << tv.svId << ") " - << "TOW_sf=" << osnmaMsg_sptr->TOW_sf0 << std::endl; - const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> - tv.svId, - nav_data_ADKD_4, - osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; - osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); - } - } - - // Call the handler, as if it came from telemetry decoder block - auto temp_obj = pmt::make_any(osnmaMsg_sptr); - - osnma->msg_handler_osnma(temp_obj); // osnma entry point - } - - if (!end_of_hex_stream) - { - offset_byte = byte_index; // update offset for the next subframe - d_GST_SIS += DURATION_SUBFRAME; - TOW = d_GST_SIS & 0x000FFFFF; - WN = (d_GST_SIS & 0xFFF00000) >> 20; - std::cout << "OsnmaTestVectorsSimulation:" - << " d_GST_SIS= " << d_GST_SIS - << ", TOW=" << TOW - << ", WN=" << WN << std::endl; - } - } // Assert + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); +} - // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) +TEST_F(OsnmaTestVectors, NominalTestConf2) +{ + // Arrange + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20230720113300_newPKID_2.crt"; // conf. 2 + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20230720113300_newPKID_2.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::tm input_time = {0, 0, 0, 27, 7 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; // conf. 2 + std::vector input_times = {input_time}; + + std::vector testVector = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/configuration_2/27_JUL_2023_GST_00_00_01.csv"); + if (testVector.empty()) + { + ASSERT_TRUE(false); + } + std::vector> testVectors = {testVector}; + + // Act + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); + + // Assert + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); } TEST_F(OsnmaTestVectors, PublicKeyRenewal) { // Arrange + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20231007041500_PKID_7.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007041500_PKID_7.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + std::tm input_time_step1 = {0, 45, 2, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; std::tm input_time_step2 = {0, 45, 3, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; std::tm input_time_step3 = {0, 45, 4, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; std::vector input_times = {input_time_step1, input_time_step2, input_time_step3}; - std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20231007041500_PKID_7.crt"; - std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007041500_PKID_7.xml"; - osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); - std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/npk_step1/07_OCT_2023_GST_02_45_01.csv"); std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/npk_step2/07_OCT_2023_GST_03_45_01.csv"); std::vector testVectors_step3 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/npk_step3/07_OCT_2023_GST_04_45_01.csv"); - std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; - if (testVectors_step1.empty() || testVectors_step2.empty() || testVectors_step3.empty()) { ASSERT_TRUE(false); } + std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; + d_flag_NPK = true; + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); + + // Assert + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); +} +// Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. +// Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. +bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_object, std::vector> testVectors, std::vector startTimesFiles){ bool end_of_hex_stream; int offset_byte{0}; int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size - const int SIZE_PAGE_BYTES{240 / 8}; // total bytes of a page - const int SIZE_SUBFRAME_PAGES{15}; // number of pages of a subframe - const int DURATION_SUBFRAME{30}; // duration of a subframe, in seconds const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; // Act // loop over all bytes of data. Note: all TestVectors have same amount of data. - for (int test_step = 0; test_step < 3 ; test_step++) + // if needed, add global flags so that particular logic may be done at certain points in between files + for (size_t test_step = 0; test_step < testVectors.size() ; test_step++) { // set variables for each file end_of_hex_stream = false; offset_byte = 0; byte_index = 0; - set_time(input_times[test_step]); + set_time(startTimesFiles[test_step]); std::cout << "OsnmaTestVectorsSimulation:" << " d_GST_SIS= " << d_GST_SIS << ", TOW=" << TOW << ", WN=" << WN << std::endl; - if (test_step == 1 ){ + if (test_step == 1 && d_flag_NPK == true ){ // step 2: this simulates the osnma connecting to the GSC server and downloading the Merkle tree of the next public key - osnma->d_crypto->read_merkle_xml( + osnma_object->d_crypto->read_merkle_xml( std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007081500_PKID_8.xml"); } @@ -468,7 +308,7 @@ TEST_F(OsnmaTestVectors, PublicKeyRenewal) nav_data_ADKD_0_12, osnmaMsg_sptr->TOW_sf0); LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; - osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + osnma_object->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); } } @@ -505,16 +345,15 @@ TEST_F(OsnmaTestVectors, PublicKeyRenewal) nav_data_ADKD_4, osnmaMsg_sptr->TOW_sf0); LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; - osnma->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); + osnma_object->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); } } // Call the handler, as if it came from telemetry decoder block auto temp_obj = pmt::make_any(osnmaMsg_sptr); - osnma->msg_handler_osnma(temp_obj); // osnma entry point + osnma_object->msg_handler_osnma(temp_obj); // osnma entry point } - if (!end_of_hex_stream) { offset_byte = byte_index; // update offset for the next subframe @@ -527,16 +366,12 @@ TEST_F(OsnmaTestVectors, PublicKeyRenewal) << ", WN=" << WN << std::endl; } } + if (end_of_hex_stream) + break; } - // Assert - - // TODO - create global vars with failed tags and compare to total tags (Tag Id for example) - - // Assert - +return true; } -// Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. -// Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. + std::vector OsnmaTestVectors::readTestVectorsFromFile(const std::string& filename) { std::ifstream file(filename); From 26f77a3c4279700b3789638b88464d2576582ba1 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 30 Jul 2024 12:25:22 +0200 Subject: [PATCH 285/499] [TAS-250] (x2) [FEAT] Implement PK renewal and revocation. * Revocation implemented and tested. DSM-KROOT appears to be corrupted because length check fails after start of step 1, during steps 2 and 3. --- src/core/libs/osnma_msg_receiver.cc | 92 +++++++++++++------ src/core/libs/osnma_msg_receiver.h | 3 +- .../osnma/osnma_test_vectors.cc | 35 ++++++- 3 files changed, 101 insertions(+), 29 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index ec8758fe7..308dd5a6d 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -77,6 +77,10 @@ osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std d_nav_data_manager = std::make_unique(); if(d_crypto->have_public_key()){ // Hot start is enabled + LOG(WARNING) << "OSNMA Public Key available, trying to find DSM-KROOT saved"; + std::cout << "OSNMA Public Key available, trying to find DSM-KROOT saved" << std::endl; + d_public_key_verified = true; + auto dsm_nmah = parse_dsm_kroot(); if (!dsm_nmah.first.empty()){ LOG(WARNING) << "OSNMA DSM-KROOT and NMA Header successfully read from file " << KROOTFILE_DEFAULT; @@ -170,22 +174,47 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { read_nma_header(osnma_msg->hkroot[0]); - if (d_osnma_data.d_nma_header.nmas == 0 || d_osnma_data.d_nma_header.nmas == 3) - { - LOG(WARNING) << "Galileo OSNMA: NMAS invalid, skipping osnma message"; + + // Check for corner cases: renewal, revocation + if (d_osnma_data.d_nma_header.nmas == 0 /* RES */){ + LOG(WARNING) << "Galileo OSNMA: NMAS invalid (RES), skipping osnma message"; return; } - if (d_osnma_data.d_nma_header.nmas == 2 /*OP*/ && d_osnma_data.d_nma_header.cpks == 4 /*NPK*/ && d_GST_PKR_start == 0){ + + if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 4 /* NPK */ && d_GST_PKR_PKREV_start == 0){ d_flag_PK_renewal = true; - d_GST_PKR_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); - LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Start at GST=" << d_GST_PKR_start; - std::cout << "Galileo OSNMA: Public Key Renewal :: Start at GST=" << d_GST_PKR_start << std::endl; + d_GST_PKR_PKREV_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; + std::cout << "Galileo OSNMA: Public Key Renewal :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; } - if (d_flag_PK_renewal && d_osnma_data.d_nma_header.nmas == 2 /*OP*/ && d_osnma_data.d_nma_header.cpks == 1 /*Nominal*/ ){ + if (d_flag_PK_renewal && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */ ){ d_flag_PK_renewal = false; - LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); - std::cout << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0) << std::endl; + uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600; + LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << duration_hours << ", Duration=" << duration_hours << " h"; + std::cout << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << duration_hours << ", Duration=" << duration_hours << " h" << std::endl; } + + if(d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 5 /* PKREV */ && d_GST_PKR_PKREV_start == 0){ + d_flag_PK_revocation = true; + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; + d_public_key_verified = false; + d_kroot_verified = false; + d_tesla_key_verified = false; + d_GST_PKR_PKREV_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; + std::cout << "Galileo OSNMA: Public Key Revocation :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; + } + if (d_flag_PK_revocation && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */ ){ + // step 2 , start using new chain + d_flag_PK_revocation = false; + uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600; + LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << ", Duration=" << duration_hours << "h"; + std::cout << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << ", Duration=" << duration_hours << "h" << std::endl; + } + + read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 @@ -393,6 +422,7 @@ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osn } d_dsm_message[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; d_dsm_id_received[d_osnma_data.d_dsm_header.dsm_id] = std::array{}; + LOG(INFO) << "Galileo OSNMA: DSM message completed :: start processing, GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; process_dsm_message(dsm_msg, osnma_msg->hkroot[0]); } } @@ -408,7 +438,7 @@ void osnma_msg_receiver::process_dsm_block(const std::shared_ptr& osn void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg, const uint8_t& nma_header) { // DSM-KROOT message - if (d_osnma_data.d_dsm_header.dsm_id < 12 || d_flag_hot_start) + if ((d_osnma_data.d_dsm_header.dsm_id < 12 || d_flag_hot_start) && d_public_key_verified) { // Parse Kroot message LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received."; @@ -456,6 +486,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (l_dk_bits != check_l_dk) { LOG(WARNING) << "Galileo OSNMA: Failed length reading of DSM-KROOT message"; + d_count_failed_Kroot++; } else { @@ -498,7 +529,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) { LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received ok."; - LOG(INFO) << "Galileo OSNMA: KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) + LOG(INFO) << "Galileo OSNMA: DSM-KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; @@ -519,22 +550,22 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } if (d_kroot_verified) { - std::cout << "Galileo OSNMA: KROOT authentication successful!" << std::endl; - LOG(INFO) << "Galileo OSNMA: KROOT authentication successful!"; + std::cout << "Galileo OSNMA: DSM-KROOT authentication successful!" << std::endl; + LOG(INFO) << "Galileo OSNMA: DSM-KROOT authentication successful!"; LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); // Save DSM-Kroot and NMA header into a permanent storage - if(d_flag_hot_start){ + if (d_flag_hot_start){ d_flag_hot_start = false; return; } - store_dsm_kroot(dsm_msg, nma_header); + store_dsm_kroot(dsm_msg, nma_header); // TODO - store it only if DSM-KROOT is new } else { - LOG(WARNING) << "Galileo OSNMA: KROOT authentication failed."; - std::cerr << "Galileo OSNMA: KROOT authentication failed." << std::endl; + LOG(WARNING) << "Galileo OSNMA: DSM-KROOT authentication failed."; + std::cerr << "Galileo OSNMA: DSM-KROOT authentication failed." << std::endl; d_count_failed_Kroot ++; } } @@ -546,9 +577,10 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } } } + // DSM-PKR message else if (d_osnma_data.d_dsm_header.dsm_id >= 12 && d_osnma_data.d_dsm_header.dsm_id < 16) { - LOG(INFO) << "Galileo OSNMA: DSM-PKR message received."; + LOG(INFO) << "Galileo OSNMA: DSM-PKR message received"; // Save DSM-PKR message d_osnma_data.d_dsm_pkr_message.nb_dp = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); d_osnma_data.d_dsm_pkr_message.mid = d_dsm_reader->get_mid(dsm_msg); @@ -606,7 +638,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg /*<< ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600*/ << " received"; - // C: NPK verification against Merkle tree root. + // Public key verification against Merkle tree root. bool verification = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); if (verification) { @@ -634,13 +666,14 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(WARNING) << "Galileo OSNMA: Reserved message received"; std::cerr << "Galileo OSNMA: Reserved message received" << std::endl; } - d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; // TODO - reset during header parsing in PKREV? } /** - * @brief Reads the Mack message from the given OSNMA_msg object. + * @brief Reads the Mack message from the given OSNMA_msg object * + * @details Conditions for MACK processing: * @param osnma_msg The OSNMA_msg object containing the Mack message. */ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptr& osnma_msg) @@ -657,8 +690,10 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrTOW_sf0); - - if (d_kroot_verified || d_tesla_key_verified || d_osnma_data.d_dsm_kroot_message.ts != 0 /*mack parser needs to know the tag size, otherwise cannot parse mack messages*/) // C: 4 ts < ts < 10 + bool can_process_mack_block = d_osnma_data.d_nma_header.nmas != 3; // Don't Use + bool can_verify_tesla_key = d_kroot_verified || d_tesla_key_verified; // Either of those suffices for verifying the incoming TESLA key + bool can_parse_tag_fields = d_osnma_data.d_dsm_kroot_message.ts != 0; // calculating the number of tags is based on the TS of the DSM-KROOT. + if (can_verify_tesla_key && can_parse_tag_fields && can_process_mack_block) { // TODO - correct? with this, MACK would not be processed unless a Kroot is available -- no, if TK available MACK sould go on, this has to change in future read_mack_header(); d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly. @@ -669,6 +704,12 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrd_count_failed_pubKey, 0); ASSERT_EQ(osnma->d_count_failed_macseq, 0); } + +TEST_F(OsnmaTestVectors, PublicKeyRevocation) +{ + // Arrange + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20231007081500_PKID_8.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007081500_PKID_8.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::tm input_time_step1 = {0, 45, 7, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step2 = {0, 30, 9, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step3 = {0, 30, 10, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::vector input_times = { input_time_step1, input_time_step2, input_time_step3 }; + + std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/pkrev_step1/07_OCT_2023_GST_07_45_01.csv"); + std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/pkrev_step2/07_OCT_2023_GST_09_30_01.csv"); + std::vector testVectors_step3 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/pkrev_step3/07_OCT_2023_GST_10_30_01.csv"); + if (testVectors_step1.empty() || testVectors_step2.empty() || testVectors_step3.empty()) + { + ASSERT_TRUE(false); + } + std::vector> testVectors = { testVectors_step1, testVectors_step2, testVectors_step3}; + + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); + + // Assert + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); +} // Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. // Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_object, std::vector> testVectors, std::vector startTimesFiles){ @@ -367,7 +398,7 @@ bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_ob } } if (end_of_hex_stream) - break; + continue; } return true; } From 07cbf2c01f2eb194bef564cda3ac569616b29253 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 30 Jul 2024 18:00:41 +0200 Subject: [PATCH 286/499] Fixes for GnuTLS and OpenSSL < 3 (#14) * Fix set_public_key when using GnuTLS * Fix for OpenSSL 1.1.1 * Fix formatting * Fix formatting * Fix ECDSA-P521 signature verification when using GnuTLS * Improve finding of the GMP library in Debian-based systems * Improve finding of the GMP library in Debian-based systems * Keep GMP usage private --- cmake/Modules/FindGMP.cmake | 119 +++++++ cmake/Modules/GnssSdrCrypto.cmake | 14 + src/core/system_parameters/gnss_crypto.cc | 311 ++++++++++++++---- src/core/system_parameters/gnss_crypto.h | 3 + src/tests/test_main.cc | 2 +- .../osnma/gnss_crypto_test.cc | 50 +-- 6 files changed, 415 insertions(+), 84 deletions(-) create mode 100644 cmake/Modules/FindGMP.cmake diff --git a/cmake/Modules/FindGMP.cmake b/cmake/Modules/FindGMP.cmake new file mode 100644 index 000000000..f0648feb3 --- /dev/null +++ b/cmake/Modules/FindGMP.cmake @@ -0,0 +1,119 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT PKG_CONFIG_FOUND) + include(FindPkgConfig) +endif() +pkg_check_modules(PC_GMP "gmp") + +set(GMP_DEFINITIONS ${PC_GMP_CFLAGS_OTHER}) + +find_path( + GMP_INCLUDE_DIR + NAMES gmpxx.h + HINTS ${PC_GMP_INCLUDEDIR} + PATHS ${CMAKE_INSTALL_PREFIX}/include + /usr/local/include + /usr/include + /opt/local/include +) + +set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR}) +set(GMP_PC_ADD_CFLAGS "-I${GMP_INCLUDE_DIR}") + +find_library( + GMPXX_LIBRARY + NAMES gmpxx + HINTS ${PC_GMP_LIBDIR} + PATHS ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 + /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 + /usr/lib/x86_64-linux-gnu + /usr/lib/i386-linux-gnu + /usr/lib/arm-linux-gnueabihf + /usr/lib/arm-linux-gnueabi + /usr/lib/aarch64-linux-gnu + /usr/lib/mipsel-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/hppa-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/i386-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib/alpha-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu + /opt/local/lib +) + +find_library( + GMP_LIBRARY + NAMES gmp + HINTS ${PC_GMP_LIBDIR} + PATHS ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 + /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 + /usr/lib/x86_64-linux-gnu + /usr/lib/i386-linux-gnu + /usr/lib/arm-linux-gnueabihf + /usr/lib/arm-linux-gnueabi + /usr/lib/aarch64-linux-gnu + /usr/lib/mipsel-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/hppa-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/i386-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib/alpha-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/loongarch64-linux-gnu + /opt/local/lib +) + +set(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMP DEFAULT_MSG GMPXX_LIBRARY GMP_LIBRARY + GMP_INCLUDE_DIR) + +if(GMP_FOUND AND NOT TARGET Gmp::gmp) + add_library(Gmp::gmp SHARED IMPORTED) + set_target_properties(Gmp::gmp PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GMPXX_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${GMP_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${GMP_LIBRARIES}" + ) +endif() + +mark_as_advanced(GMPXX_LIBRARY GMP_LIBRARY GMP_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index 5286c6d01..ac84260d1 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -13,6 +13,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif() unset(OPENSSL_FOUND CACHE) unset(GnuTLS_FOUND CACHE) +unset(GMP_FOUND CACHE) if(NOT ENABLE_GNUTLS) find_package(OpenSSL) endif() @@ -133,6 +134,17 @@ else() if("${gnutls_abstract_file_contents}" MATCHES "gnutls_pubkey_export2") set(GNUTLS_PUBKEY_EXPORT2 TRUE) endif() + + find_package(GMP) + set_package_properties(GMP PROPERTIES + URL "https://gmplib.org/" + PURPOSE "Required to decompress cryptographic keys." + DESCRIPTION "The GNU Multiple Precision Arithmetic Library" + TYPE REQUIRED + ) + if(NOT GMP_FOUND) + message(FATAL_ERROR "GMP is required by gnss-sdr if linking against GnuTLS") + endif() endif() ################################################################################ @@ -175,6 +187,8 @@ function(link_to_crypto_dependencies target) PUBLIC ${GNUTLS_LIBRARIES} ${GNUTLS_OPENSSL_LIBRARY} + PRIVATE + Gmp::gmp ) target_include_directories(${target} PUBLIC diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 86f1525f2..a2543d18a 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -27,6 +27,7 @@ #if USE_GNUTLS_FALLBACK #include +#include #include #include #else // OpenSSL @@ -158,7 +159,7 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const return false; } - pubKeyFile.write((const char*)pem_data.data, pem_data.size); + pubKeyFile.write(reinterpret_cast(pem_data.data), pem_data.size); pubKeyFile.close(); gnutls_free(pem_data.data); #else // OpenSSL @@ -195,14 +196,15 @@ bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const return true; } + bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& message, const std::vector& signature) const { - std::vector digest = this->compute_SHA_256(message); if (!have_public_key()) { LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; return false; } + std::vector digest = this->compute_SHA_256(message); bool success = false; #if USE_GNUTLS_FALLBACK #if HAVE_GNUTLS_SIGN_ECDSA_SHA256 @@ -843,33 +845,40 @@ std::vector Gnss_Crypto::get_merkle_root() const return d_x_4_0; } + void Gnss_Crypto::set_public_key(const std::vector& publicKey) { #if USE_GNUTLS_FALLBACK - // TODO - changed to import a compressed ECC key, either P256 or P521, but have not tested it yet gnutls_pubkey_t pubkey{}; - gnutls_datum_t x_coord = {(unsigned char*)&publicKey[1], 32}; - gnutls_datum_t y_coord = {NULL, 0}; gnutls_ecc_curve_t curve; + std::vector x; + std::vector y; gnutls_pubkey_init(&pubkey); - - if (publicKey.size() == 33) + const size_t size_pk = publicKey.size(); + if (size_pk == 33) { curve = GNUTLS_ECC_CURVE_SECP256R1; + decompress_public_key_secp256r1(publicKey, x, y); + } + else if (size_pk == 67) + { + curve = GNUTLS_ECC_CURVE_SECP521R1; + decompress_public_key_secp521r1(publicKey, x, y); } else { - curve = GNUTLS_ECC_CURVE_SECP521R1; + LOG(WARNING) << "GnuTLS: Invalid public key size"; + return; } + gnutls_datum_t x_coord = {x.data(), static_cast(x.size())}; + gnutls_datum_t y_coord = {y.data(), static_cast(y.size())}; int ret = gnutls_pubkey_import_ecc_raw(pubkey, curve, &x_coord, &y_coord); if (ret != GNUTLS_E_SUCCESS) { gnutls_pubkey_deinit(pubkey); - std::cerr << "GnuTLS: error setting the public key" << std::endl; - std::cerr << "GnuTLS error: " << gnutls_strerror(ret) << std::endl; LOG(WARNING) << "GnuTLS: error setting the OSNMA public key: " << gnutls_strerror(ret); return; } @@ -878,60 +887,59 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) #else // OpenSSL #if USE_OPENSSL_3 -// Uses the new EVP_PKEY envelope as well as the parameter builder functions -// generate the uncompressed key, then add it into the EVP_PKEY* struct -EVP_PKEY* pkey = NULL; -EVP_PKEY_CTX* ctx = NULL; -OSSL_PARAM_BLD *param_bld; -OSSL_PARAM *params = NULL; + // Uses the new EVP_PKEY envelope as well as the parameter builder functions + // generate the uncompressed key, then add it into the EVP_PKEY* struct + EVP_PKEY* pkey = nullptr; + EVP_PKEY_CTX* ctx = nullptr; + OSSL_PARAM_BLD* param_bld; + OSSL_PARAM* params = nullptr; -param_bld = OSSL_PARAM_BLD_new(); -if (param_bld != NULL - && OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", - (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) - && OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", - publicKey.data(), publicKey.size())) - params = OSSL_PARAM_BLD_to_param(param_bld); + param_bld = OSSL_PARAM_BLD_new(); + if (param_bld != nullptr && + OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) && + OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) + params = OSSL_PARAM_BLD_to_param(param_bld); -ctx = EVP_PKEY_CTX_new_from_name(NULL, "EC", NULL); -if (ctx == NULL - || params == NULL - || EVP_PKEY_fromdata_init(ctx) <= 0 - || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0) { - return; - } else { - if (!pubkey_copy(pkey, &d_PublicKey)) - { - return; - } - } -EVP_PKEY_free(pkey); -EVP_PKEY_CTX_free(ctx); -OSSL_PARAM_free(params); -OSSL_PARAM_BLD_free(param_bld); -#else - EVP_PKEY* pkey = NULL; // Generic public key type - EC_KEY* ec_key = NULL; // ECC Key pair - EC_POINT* point = NULL; // Represents the point in the EC the public key belongs to - EC_GROUP* group = NULL; // Defines the curve the public key belongs + ctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr); + if (ctx == nullptr || params == nullptr || EVP_PKEY_fromdata_init(ctx) <= 0 || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0) + { + return; + } + + if (!pubkey_copy(pkey, &d_PublicKey)) + { + return; + } + + EVP_PKEY_free(pkey); + EVP_PKEY_CTX_free(ctx); + OSSL_PARAM_free(params); + OSSL_PARAM_BLD_free(param_bld); +#else // OpenSSL 1.x + EC_KEY* ec_key = nullptr; // ECC Key pair + EC_POINT* point = nullptr; // Represents the point in the EC the public key belongs to + EC_GROUP* group = nullptr; // Defines the curve the public key belongs if (publicKey.size() == 33) // ECDSA-P-256 { group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1); } - else // ECDSA-P-521 + else // ECDSA-P-521 { group = EC_GROUP_new_by_curve_name(NID_secp521r1); } - if(!group){ + if (!group) + { return; } point = EC_POINT_new(group); - if(!point){ + if (!point) + { return; } - if(!EC_POINT_oct2point(group, point, publicKey.data(), publicKey.size(), NULL)){ + if (!EC_POINT_oct2point(group, point, publicKey.data(), publicKey.size(), nullptr)) + { return; } @@ -939,22 +947,24 @@ OSSL_PARAM_BLD_free(param_bld); { ec_key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); } - else // ECDSA-P-521 + else // ECDSA-P-521 { ec_key = EC_KEY_new_by_curve_name(NID_secp521r1); } - if(!ec_key){ - return; - } - - if(!EC_KEY_set_public_key(ec_key, point)){ - return; - } - if (!pubkey_copy(ec_pkey, &d_PublicKey)) + if (!ec_key) { return; } - EC_KEY_free(ec_pkey); + + if (!EC_KEY_set_public_key(ec_key, point)) + { + return; + } + if (!pubkey_copy(ec_key, &d_PublicKey)) + { + return; + } + EC_KEY_free(ec_key); EC_POINT_free(point); EC_GROUP_free(group); #endif // OpenSSL 1.x @@ -962,11 +972,13 @@ OSSL_PARAM_BLD_free(param_bld); DLOG(INFO) << "OSNMA Public Key successfully set up."; } + void Gnss_Crypto::set_merkle_root(const std::vector& v) { d_x_4_0 = v; } + void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) { pugi::xml_document doc; @@ -1206,6 +1218,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) return true; } + bool Gnss_Crypto::convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const { if (raw_signature.size() % 2 != 0) @@ -1312,6 +1325,188 @@ bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) return true; } + + +bool tonelli_shanks(mpz_t& res, const mpz_t& n, const mpz_t& p) +{ + if (mpz_legendre(n, p) != 1) + { + return false; + } + mpz_t q; + mpz_t s; + mpz_t z; + mpz_t m; + mpz_t c; + mpz_t t; + mpz_t r; + mpz_t b; + mpz_t two; + mpz_t p_minus_one; + mpz_inits(q, s, z, m, c, t, r, b, two, p_minus_one, nullptr); + + mpz_set_ui(two, 2); + + mpz_sub_ui(q, p, 1); + mpz_set_ui(s, 0); + while (mpz_even_p(q)) + { + mpz_add_ui(s, s, 1); + mpz_divexact_ui(q, q, 2); + } + + mpz_set_ui(z, 2); + while (mpz_legendre(z, p) != -1) + { + mpz_add_ui(z, z, 1); + } + + mpz_powm(c, z, q, p); + + mpz_add_ui(p_minus_one, p, 1); + mpz_divexact_ui(p_minus_one, p_minus_one, 4); + mpz_powm(r, n, p_minus_one, p); + mpz_powm(t, n, q, p); + mpz_set(m, s); + + while (mpz_cmp_ui(t, 1) != 0) + { + mpz_set(b, t); + unsigned int i; + for (i = 0; mpz_cmp_ui(b, 1) != 0; i++) + { + mpz_powm_ui(b, b, 2, p); + } + if (i == mpz_get_ui(m)) + { + mpz_clears(q, s, z, m, c, t, r, b, two, p_minus_one, nullptr); + return false; + } + + mpz_powm_ui(b, two, mpz_get_ui(m) - i - 1, p); + mpz_powm(c, c, b, p); + mpz_mul(r, r, c); + mpz_mod(r, r, p); + mpz_powm_ui(c, c, 2, p); + mpz_mul(t, t, c); + mpz_mod(t, t, p); + mpz_set_ui(m, mpz_get_ui(m) - i - 1); + } + + mpz_set(res, r); + mpz_clears(q, s, z, m, c, t, r, b, two, p_minus_one, nullptr); + return true; +} + + +void Gnss_Crypto::decompress_public_key_secp256r1(const std::vector& compressed_key, std::vector& x, std::vector& y) const +{ + // Define curve parameters for secp256r1 + const char* p_str = "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF"; + const char* a_str = "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC"; + const char* b_str = "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B"; + + mpz_t p; + mpz_t a; + mpz_t b; + mpz_t x_coord; + mpz_t y_coord; + mpz_t y_squared; + mpz_t tmp; + mpz_inits(p, a, b, x_coord, y_coord, y_squared, tmp, nullptr); + + // Initialize curve parameters + mpz_set_str(p, p_str, 16); + mpz_set_str(a, a_str, 16); + mpz_set_str(b, b_str, 16); + + // Set x coordinate + mpz_import(x_coord, 32, 1, 1, 1, 0, &compressed_key[1]); + + // Calculate y^2 = x^3 + ax + b (mod p) + mpz_powm_ui(y_squared, x_coord, 3, p); // y_squared = x^3 + mpz_mul(tmp, a, x_coord); // tmp = ax + mpz_add(y_squared, y_squared, tmp); // y_squared = x^3 + ax + mpz_add(y_squared, y_squared, b); // y_squared = x^3 + ax + b + mpz_mod(y_squared, y_squared, p); // y_squared = (x^3 + ax + b) % p + + // Calculate the square root of y_squared to get y + if (!tonelli_shanks(y_coord, y_squared, p)) + { + mpz_clears(p, a, b, x_coord, y_coord, y_squared, tmp, nullptr); + LOG(WARNING) << "GnuTLS: Failed to decompress public key: No valid y coordinate"; + return; + } + + // Select the correct y coordinate based on the parity bit + if ((compressed_key[0] & 1) != (mpz_tstbit(y_coord, 0) & 1)) + { + mpz_sub(y_coord, p, y_coord); // y = p - y + } + + // Export the x and y coordinates to vectors + x.resize(32); + y.resize(32); + mpz_export(x.data(), nullptr, 1, 1, 1, 0, x_coord); + mpz_export(y.data(), nullptr, 1, 1, 1, 0, y_coord); + + mpz_clears(p, a, b, x_coord, y_coord, y_squared, tmp, nullptr); +} + + +void Gnss_Crypto::decompress_public_key_secp521r1(const std::vector& compressed_key, std::vector& x, std::vector& y) const +{ + // Define curve parameters for secp521r1 + const char* p_str = "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"; + const char* a_str = "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC"; + const char* b_str = "0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00"; + + mpz_t p; + mpz_t a; + mpz_t b; + mpz_t x_coord; + mpz_t y_coord; + mpz_t y_squared; + mpz_t tmp; + mpz_inits(p, a, b, x_coord, y_coord, y_squared, tmp, nullptr); + + // Initialize curve parameters + mpz_set_str(p, p_str, 16); + mpz_set_str(a, a_str, 16); + mpz_set_str(b, b_str, 16); + + // Set x coordinate + mpz_import(x_coord, 66, 1, 1, 1, 0, &compressed_key[1]); + + // Calculate y^2 = x^3 + ax + b (mod p) + mpz_powm_ui(y_squared, x_coord, 3, p); // y_squared = x^3 + mpz_mul(tmp, a, x_coord); // tmp = ax + mpz_add(y_squared, y_squared, tmp); // y_squared = x^3 + ax + mpz_add(y_squared, y_squared, b); // y_squared = x^3 + ax + b + mpz_mod(y_squared, y_squared, p); // y_squared = (x^3 + ax + b) % p + + // Calculate the square root of y_squared to get y + if (!tonelli_shanks(y_coord, y_squared, p)) + { + mpz_clears(p, a, b, x_coord, y_coord, y_squared, tmp, nullptr); + LOG(WARNING) << "GnuTLS: Failed to decompress public key: No valid y coordinate"; + return; + } + + // Select the correct y coordinate based on the parity bit + if ((compressed_key[0] & 1) != (mpz_tstbit(y_coord, 0) & 1)) + { + mpz_sub(y_coord, p, y_coord); // y = p - y + } + + // Export the x and y coordinates to vectors + x.resize(66, 0); // Ensure 66 bytes with leading zeros if necessary + y.resize(66, 0); + mpz_export(x.data() + 1, nullptr, 1, 1, 1, 0, x_coord); + mpz_export(y.data(), nullptr, 1, 1, 1, 0, y_coord); + + mpz_clears(p, a, b, x_coord, y_coord, y_squared, tmp, nullptr); +} #else // OpenSSL #if USE_OPENSSL_3 bool Gnss_Crypto::pubkey_copy(EVP_PKEY* src, EVP_PKEY** dest) diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 85993d063..c4e9f4e96 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -72,12 +72,15 @@ public: void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey compressed format) void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) void read_merkle_xml(const std::string& merkleFilePath); + private: void readPublicKeyFromPEM(const std::string& pemFilePath); bool readPublicKeyFromCRT(const std::string& crtFilePath); bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; std::vector convert_from_hex_str(const std::string& input) const; #if USE_GNUTLS_FALLBACK + void decompress_public_key_secp256r1(const std::vector& compressed_key, std::vector& x, std::vector& y) const; + void decompress_public_key_secp521r1(const std::vector& compressed_key, std::vector& x, std::vector& y) const; bool pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest); gnutls_pubkey_t d_PublicKey{}; #else // OpenSSL diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index bcd2b7018..cf6dfbccc 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -183,8 +183,8 @@ private: #ifndef EXCLUDE_TESTS_REQUIRING_BINARIES #include "unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc" #include "unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc" -#include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc" #include "unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc" +#include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc" #endif // #include "unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc" #include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc" diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index a6429bc7b..6d645edb1 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -35,7 +35,7 @@ TEST(GnssCryptoTest, VerifyPubKeyImport) // compressed ECDSA P-256 format std::vector publicKey = { 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, - 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA }; + 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; ASSERT_FALSE(d_crypto->have_public_key()); @@ -56,7 +56,7 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) // compressed ECDSA P-256 format std::vector publicKey = { 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, - 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA }; + 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); bool result = d_crypto->store_public_key(f1); @@ -255,7 +255,7 @@ TEST(GnssCryptoTest, VerifySignatureP256) // compressed ECDSA P-256 format std::vector publicKey = { 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, - 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA }; + 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature_ecdsa_p256(message, signature); @@ -274,34 +274,34 @@ TEST(GnssCryptoTest, VerifySignatureP521) // Message to be verified std::vector message = { - 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A }; // "Hello world\n" + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // "Hello world\n" // Public key in compressed X format std::vector publicKey = { - 0x03, 0x00, 0x28, 0x35, 0xBB, 0xE9, 0x24, 0x59, 0x4E, 0xF0, - 0xE3, 0xA2, 0xDB, 0xC0, 0x49, 0x30, 0x60, 0x7C, 0x61, 0x90, - 0xE4, 0x03, 0xE0, 0xC7, 0xB8, 0xC2, 0x62, 0x37, 0xF7, 0x58, - 0x56, 0xBE, 0x63, 0x5C, 0x97, 0xF7, 0x53, 0x64, 0x7E, 0xE1, - 0x0C, 0x07, 0xD3, 0x97, 0x8D, 0x58, 0x46, 0xFD, 0x6E, 0x06, - 0x44, 0x01, 0xA7, 0xAA, 0xC4, 0x95, 0x13, 0x5D, 0xC9, 0x77, - 0x26, 0xE9, 0xF8, 0x72, 0x0C, 0xD3, 0x88 }; + 0x03, 0x00, 0x28, 0x35, 0xBB, 0xE9, 0x24, 0x59, 0x4E, 0xF0, + 0xE3, 0xA2, 0xDB, 0xC0, 0x49, 0x30, 0x60, 0x7C, 0x61, 0x90, + 0xE4, 0x03, 0xE0, 0xC7, 0xB8, 0xC2, 0x62, 0x37, 0xF7, 0x58, + 0x56, 0xBE, 0x63, 0x5C, 0x97, 0xF7, 0x53, 0x64, 0x7E, 0xE1, + 0x0C, 0x07, 0xD3, 0x97, 0x8D, 0x58, 0x46, 0xFD, 0x6E, 0x06, + 0x44, 0x01, 0xA7, 0xAA, 0xC4, 0x95, 0x13, 0x5D, 0xC9, 0x77, + 0x26, 0xE9, 0xF8, 0x72, 0x0C, 0xD3, 0x88}; // ECDSA P-521 signature, raw format std::vector signature = { - 0x01, 0x5C, 0x23, 0xC0, 0xBE, 0xAD, 0x1E, 0x44, 0x60, 0xD4, - 0xE0, 0x81, 0x38, 0xF2, 0xBA, 0xF5, 0xB5, 0x37, 0x5A, 0x34, - 0xB5, 0xCA, 0x6B, 0xC8, 0x0F, 0xCD, 0x75, 0x1D, 0x5E, 0xC0, - 0x8A, 0xD3, 0xD7, 0x79, 0xA7, 0xC1, 0xB8, 0xA2, 0xC6, 0xEA, - 0x5A, 0x7D, 0x60, 0x66, 0x50, 0x97, 0x37, 0x6C, 0xF9, 0x0A, - 0xF6, 0x3D, 0x77, 0x9A, 0xE2, 0x19, 0xF7, 0xF9, 0xDD, 0x52, - 0xC4, 0x0F, 0x98, 0xAA, 0xA2, 0xA4, 0x01, 0xC9, 0x41, 0x0B, - 0xD0, 0x25, 0xDD, 0xC9, 0x7C, 0x3F, 0x70, 0x32, 0x23, 0xCF, - 0xFE, 0x37, 0x67, 0x3A, 0xBC, 0x0B, 0x76, 0x16, 0x82, 0x83, - 0x27, 0x3D, 0x1D, 0x19, 0x15, 0x78, 0x08, 0x2B, 0xD4, 0xA7, - 0xC2, 0x0F, 0x11, 0xF4, 0xDD, 0xE5, 0x5A, 0x5D, 0x04, 0x8D, - 0x6D, 0x5E, 0xC4, 0x1F, 0x54, 0x44, 0xA9, 0x13, 0x34, 0x71, - 0x0F, 0xF7, 0x57, 0x9A, 0x9F, 0x2E, 0xF4, 0x97, 0x7D, 0xAE, - 0x28, 0xEF}; + 0x01, 0x5C, 0x23, 0xC0, 0xBE, 0xAD, 0x1E, 0x44, 0x60, 0xD4, + 0xE0, 0x81, 0x38, 0xF2, 0xBA, 0xF5, 0xB5, 0x37, 0x5A, 0x34, + 0xB5, 0xCA, 0x6B, 0xC8, 0x0F, 0xCD, 0x75, 0x1D, 0x5E, 0xC0, + 0x8A, 0xD3, 0xD7, 0x79, 0xA7, 0xC1, 0xB8, 0xA2, 0xC6, 0xEA, + 0x5A, 0x7D, 0x60, 0x66, 0x50, 0x97, 0x37, 0x6C, 0xF9, 0x0A, + 0xF6, 0x3D, 0x77, 0x9A, 0xE2, 0x19, 0xF7, 0xF9, 0xDD, 0x52, + 0xC4, 0x0F, 0x98, 0xAA, 0xA2, 0xA4, 0x01, 0xC9, 0x41, 0x0B, + 0xD0, 0x25, 0xDD, 0xC9, 0x7C, 0x3F, 0x70, 0x32, 0x23, 0xCF, + 0xFE, 0x37, 0x67, 0x3A, 0xBC, 0x0B, 0x76, 0x16, 0x82, 0x83, + 0x27, 0x3D, 0x1D, 0x19, 0x15, 0x78, 0x08, 0x2B, 0xD4, 0xA7, + 0xC2, 0x0F, 0x11, 0xF4, 0xDD, 0xE5, 0x5A, 0x5D, 0x04, 0x8D, + 0x6D, 0x5E, 0xC4, 0x1F, 0x54, 0x44, 0xA9, 0x13, 0x34, 0x71, + 0x0F, 0xF7, 0x57, 0x9A, 0x9F, 0x2E, 0xF4, 0x97, 0x7D, 0xAE, + 0x28, 0xEF}; d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature_ecdsa_p521(message, signature); From 02c5d26dcc3c2e407180609149a586569a1ead40 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Tue, 30 Jul 2024 18:09:07 +0200 Subject: [PATCH 287/499] [TAS-250] (x3) [FEAT] Implement PK renewal and revocation. Bugfix for DS length computation. * it was based on the HF field, which is not correct. It was discovered when the PK was P521 instead of P256 then the Padding size check was failing due to this. * The solution is temporary: ** GNSS_Crypto: when reading the key, the type is inferred (only for OSSL for the moment) ** when PK comes through the satellites, the public key type is taken from the NPKT field. --- src/core/libs/osnma_msg_receiver.cc | 10 ++++++---- src/core/system_parameters/Galileo_OSNMA.h | 6 ++---- src/core/system_parameters/gnss_crypto.cc | 11 +++++++++++ src/core/system_parameters/gnss_crypto.h | 1 + 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 308dd5a6d..b7eb88af4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -459,9 +459,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t l_lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, l_lk_bytes); // DS field - std::string hash_function = d_dsm_reader->get_hash_function(d_osnma_data.d_dsm_kroot_message.hf); uint16_t l_ds_bits = 0; - const auto it = OSNMA_TABLE_15.find(hash_function); + const auto it = OSNMA_TABLE_15.find(d_crypto->d_PublicKeyType); if (it != OSNMA_TABLE_15.cend()) { l_ds_bits = it->second; @@ -596,9 +595,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_pkr_message.npktid = npktid; uint32_t l_npk_bytes = 0; + std::string PKT; const auto it = OSNMA_TABLE_5.find(d_osnma_data.d_dsm_pkr_message.npkt); if (it != OSNMA_TABLE_5.cend()) { + PKT = it->second; const auto it2 = OSNMA_TABLE_6.find(it->second); if (it2 != OSNMA_TABLE_6.cend()) { @@ -648,6 +649,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_new_public_key = d_osnma_data.d_dsm_pkr_message.npk; } else { + d_crypto->d_PublicKeyType = PKT; d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); d_crypto->store_public_key(PEMFILE_DEFAULT); } @@ -1159,8 +1161,8 @@ bool osnma_msg_receiver::verify_dsm_pkr(const DSM_PKR_message& message) const if (computed_merkle_root == d_crypto->get_merkle_root()) { - LOG(INFO) << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: SUCCESS."; - std::cout << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: SUCCESS." << std::endl; + LOG(INFO) << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: SUCCESS. PKID=" << static_cast(message.npktid); + std::cout << "Galileo OSNMA: DSM-PKR verification for Message ID " << msg_id << " :: SUCCESS. PKID=" << static_cast(message.npktid) << std::endl; return true; } else diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index bdfc76a11..68c374a8b 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -92,7 +92,7 @@ const std::unordered_map OSNMA_TABLE_6 = { {std::string("ECDSA P-256"), 264}, {std::string("ECDSA P-521"), 536}}; -// OSNMA User ICD for the Test Phase, Issue 1.0, Table 7 +// OSNMA User ICD, Issue 1.1, Table 7 const std::unordered_map> OSNMA_TABLE_7 = { {0, {0, 0}}, {1, {7, 728}}, @@ -156,9 +156,7 @@ const std::unordered_map OSNMA_TABLE_11 = { const std::unordered_map OSNMA_TABLE_15 = { {std::string("ECDSA P-256"), 512}, - {std::string("ECDSA P-521"), 1056}, - {std::string("SHA-256"), 512}, - {std::string("SHA-512"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} + {std::string("ECDSA P-521"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} const std::string PEMFILE_DEFAULT("./data/OSNMA_PublicKey.pem"); const std::string CRTFILE_DEFAULT("./data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index a2543d18a..4faa8a30a 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -1189,6 +1189,17 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) // Read the public key from the certificate EVP_PKEY* pubkey = X509_get_pubkey(cert); + + // store the key type - needed for the Kroot in case no DSM-PKR available + // TODO - only way I have found to find the curve type + auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey); + const EC_GROUP *group = EC_KEY_get0_group(ec_key); + int nid = EC_GROUP_get_curve_name(group); + if (nid == NID_X9_62_prime256v1) { + d_PublicKeyType = "ECDSA P-256"; + } else if (nid == NID_secp521r1) { + d_PublicKeyType = "ECDSA P-521"; + } #if USE_OPENSSL_3 if (!pubkey) { diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index c4e9f4e96..6aa347bb0 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -72,6 +72,7 @@ public: void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey compressed format) void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) void read_merkle_xml(const std::string& merkleFilePath); + std::string d_PublicKeyType; private: void readPublicKeyFromPEM(const std::string& pemFilePath); From 19a152c6ce42f66f9a052cc05655cbc334583ce4 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Tue, 30 Jul 2024 22:28:52 +0200 Subject: [PATCH 288/499] Replaced the AD9361 FPGA signal source with the ADRV9361_Z7035 FPGA and the FMCOMMS5 FPGA signal sources. --- .../signal_source/adapters/CMakeLists.txt | 6 +- ...c => adrv9361_z7035_signal_source_fpga.cc} | 28 +- ....h => adrv9361_z7035_signal_source_fpga.h} | 20 +- .../adapters/dma_signal_source_fpga.cc | 2 +- .../adapters/fmcomms5_signal_source_fpga.cc | 347 ++++++++++++++++++ .../adapters/fmcomms5_signal_source_fpga.h | 135 +++++++ .../max2771_evkit_signal_source_fpga.cc | 2 +- src/core/receiver/gnss_block_factory.cc | 19 +- 8 files changed, 525 insertions(+), 34 deletions(-) rename src/algorithms/signal_source/adapters/{ad9361_signal_source_fpga.cc => adrv9361_z7035_signal_source_fpga.cc} (94%) rename src/algorithms/signal_source/adapters/{ad9361_signal_source_fpga.h => adrv9361_z7035_signal_source_fpga.h} (87%) create mode 100644 src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc create mode 100644 src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 9b9100f76..0aa745101 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -37,8 +37,10 @@ if(ENABLE_AD9361) ############################################### # AD9361 DIRECT TO FPGA Hardware ############################################### - list(APPEND OPT_DRIVER_SOURCES ad9361_signal_source_fpga.cc) - list(APPEND OPT_DRIVER_HEADERS ad9361_signal_source_fpga.h) + list(APPEND OPT_DRIVER_SOURCES adrv9361_z7035_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS adrv9361_z7035_signal_source_fpga.h) + list(APPEND OPT_DRIVER_SOURCES fmcomms5_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS fmcomms5_signal_source_fpga.h) endif() if(ENABLE_MAX2771) diff --git a/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc similarity index 94% rename from src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.cc rename to src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc index d745cdd55..9d29e2de2 100644 --- a/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -1,7 +1,7 @@ /*! - * \file ad9361_signal_source_fpga.cc - * \brief signal source for Analog Devices front-end AD9361 connected directly - * to FPGA accelerators. + * \file adrv9361_z7035_signal_source_fpga.cc + * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. * Please use the fmcomms2 source if conventional SDR acquisition and tracking @@ -16,13 +16,13 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- */ -#include "ad9361_signal_source_fpga.h" +#include "adrv9361_z7035_signal_source_fpga.h" #include "GPS_L1_CA.h" #include "GPS_L5.h" #include "ad9361_manager.h" @@ -44,10 +44,10 @@ using namespace std::string_literals; -Ad9361SignalSourceFPGA::Ad9361SignalSourceFPGA(const ConfigurationInterface *configuration, +Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "Ad9361_Signal_Source_Fpga"s), + : SignalSourceBase(configuration, role, "ADRV9361_Z7035_Signal_Source_FPGA"s), gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), @@ -276,7 +276,7 @@ Ad9361SignalSourceFPGA::Ad9361SignalSourceFPGA(const ConfigurationInterface *con } -Ad9361SignalSourceFPGA::~Ad9361SignalSourceFPGA() +Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() { /* cleanup and exit */ @@ -328,7 +328,7 @@ Ad9361SignalSourceFPGA::~Ad9361SignalSourceFPGA() } -void Ad9361SignalSourceFPGA::run_dynamic_bit_selection_process() +void Adrv9361z7035SignalSourceFPGA::run_dynamic_bit_selection_process() { bool dynamic_bit_selection_active = true; @@ -347,7 +347,7 @@ void Ad9361SignalSourceFPGA::run_dynamic_bit_selection_process() } -void Ad9361SignalSourceFPGA::run_buffer_monitor_process() +void Adrv9361z7035SignalSourceFPGA::run_buffer_monitor_process() { bool enable_ovf_check_buffer_monitor_active = true; @@ -367,7 +367,7 @@ void Ad9361SignalSourceFPGA::run_buffer_monitor_process() } -void Ad9361SignalSourceFPGA::connect(gr::top_block_sptr top_block) +void Adrv9361z7035SignalSourceFPGA::connect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -376,7 +376,7 @@ void Ad9361SignalSourceFPGA::connect(gr::top_block_sptr top_block) } -void Ad9361SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) +void Adrv9361z7035SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) { if (top_block) { /* top_block is not null */ @@ -385,14 +385,14 @@ void Ad9361SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) } -gr::basic_block_sptr Ad9361SignalSourceFPGA::get_left_block() +gr::basic_block_sptr Adrv9361z7035SignalSourceFPGA::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; return {}; } -gr::basic_block_sptr Ad9361SignalSourceFPGA::get_right_block() +gr::basic_block_sptr Adrv9361z7035SignalSourceFPGA::get_right_block() { return {}; } diff --git a/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.h b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h similarity index 87% rename from src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.h rename to src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h index c8fce2110..5e7e8b7e4 100644 --- a/src/algorithms/signal_source/adapters/ad9361_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h @@ -1,7 +1,7 @@ /*! - * \file ad9361_signal_source_fpga.h - * \brief signal source for Analog Devices front-end AD9361 connected directly - * to FPGA accelerators. + * \file adrv9361_z7035_signal_source_fpga.h + * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. * Please use the fmcomms2 source if conventional SDR acquisition and tracking @@ -12,14 +12,14 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_AD9361_SIGNAL_SOURCE_FPGA_H -#define GNSS_SDR_AD9361_SIGNAL_SOURCE_FPGA_H +#ifndef GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" @@ -44,14 +44,14 @@ class ConfigurationInterface; -class Ad9361SignalSourceFPGA : public SignalSourceBase +class Adrv9361z7035SignalSourceFPGA : public SignalSourceBase { public: - Ad9361SignalSourceFPGA(const ConfigurationInterface *configuration, + Adrv9361z7035SignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~Ad9361SignalSourceFPGA(); + ~Adrv9361z7035SignalSourceFPGA(); inline size_t item_size() override { @@ -139,4 +139,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_AD9361_SIGNAL_SOURCE_FPGA_H +#endif // GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc index bba301459..6d4f91b03 100644 --- a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc @@ -41,7 +41,7 @@ using namespace std::string_literals; DMASignalSourceFPGA::DMASignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "DMA_Signal_Source_Fpga"s), + : SignalSourceBase(configuration, role, "DMA_Signal_Source_FPGA"s), queue_(queue), filename0_(configuration->property(role + ".filename", empty_string)), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc new file mode 100644 index 000000000..d8c5a65c0 --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc @@ -0,0 +1,347 @@ +/*! + * \file fmcomms5_signal_source_fpga.cc + * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * to the FPGA accelerators. + * This source implements only the AD9361 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * Please use the fmcomms2 source if conventional SDR acquisition and tracking + * is selected in the configuration file. + * \authors
      + *
    • Javier Arribas, jarribas(at)cttc.es + *
    • Marc Majoral, mmajoral(at)cttc.es + *
    + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "fmcomms5_signal_source_fpga.h" +#include "GPS_L1_CA.h" +#include "GPS_L5.h" +#include "ad9361_manager.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::max +#include // for std::chrono +#include // for std::floor +#include // for std::exception +#include // for std::cout + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "FMCOMMS5_Signal_Source_FPGA"s), + gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), + gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), + rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), + rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), + rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), + freq0_(configuration->property(role + ".freq0", static_cast(GPS_L1_FREQ_HZ))), + freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), + sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), + bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), + Fpass_(configuration->property(role + ".Fpass", static_cast(0.0))), + Fstop_(configuration->property(role + ".Fstop", static_cast(0.0))), + in_stream_(in_stream), + out_stream_(out_stream), + item_size_(sizeof(int8_t)), + filter_auto_(configuration->property(role + ".filter_auto", false)), + quadrature_(configuration->property(role + ".quadrature", true)), + rf_dc_(configuration->property(role + ".rf_dc", true)), + bb_dc_(configuration->property(role + ".bb_dc", true)), + rx1_enable_(configuration->property(role + ".rx1_enable", true)), + rx2_enable_(configuration->property(role + ".rx2_enable", true)), + enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), + enable_ovf_check_buffer_monitor_active_(true), + dump_(configuration->property(role + ".dump", false)), +#if USE_GLOG_AND_GFLAGS + rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)) +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))) +#endif +{ + const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || + (configuration->property("Channels_1B.count", 0) > 0)); + const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || + (configuration->property("Channels_L5.count", 0) > 0) || + (configuration->property("Channels_5X.count", 0) > 0)); + + const uint32_t num_freq_bands = ((enable_rx1_band == true) and (enable_rx2_band == true)) ? 2 : 1; + + if (filter_auto_) + { + filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); + } + else + { + filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); + } + + switch_fpga = std::make_shared(); + switch_fpga->set_switch_position(switch_to_real_time_mode); + + std::cout << "Sample rate: " << sample_rate_ << " Sps\n"; + + // some basic checks + if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2")) + { + std::cout << "Configuration parameter rf_port_select should take one of these values:\n"; + std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2\n"; + std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_port_select=" << default_rf_port_select << '\n'; + rf_port_select_ = default_rf_port_select; + LOG(WARNING) << "Invalid configuration value for rf_port_select parameter. Set to rf_port_select=" << default_rf_port_select; + } + + if ((gain_mode_rx1_ != "manual") && (gain_mode_rx1_ != "slow_attack") && (gain_mode_rx1_ != "fast_attack") && (gain_mode_rx1_ != "hybrid")) + { + std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx1=" << default_gain_mode << '\n'; + gain_mode_rx1_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx1=" << default_gain_mode; + } + + if ((gain_mode_rx2_ != "manual") && (gain_mode_rx2_ != "slow_attack") && (gain_mode_rx2_ != "fast_attack") && (gain_mode_rx2_ != "hybrid")) + { + std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx2=" << default_gain_mode << '\n'; + gain_mode_rx2_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx2 parameter. Set to gain_mode_rx2=" << default_gain_mode; + } + + if (gain_mode_rx1_ == "manual") + { + if (rf_gain_rx1_ > 73.0 || rf_gain_rx1_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx1 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx1=" << rf_gain_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx1=" << default_manual_gain_rx1 << '\n'; + rf_gain_rx1_ = default_manual_gain_rx1; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx1 parameter. Set to rf_gain_rx1=" << default_manual_gain_rx1; + } + } + + if (gain_mode_rx2_ == "manual") + { + if (rf_gain_rx2_ > 73.0 || rf_gain_rx2_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx2 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx2=" << rf_gain_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx2=" << default_manual_gain_rx2 << '\n'; + rf_gain_rx2_ = default_manual_gain_rx2; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx2 parameter. Set to rf_gain_rx2=" << default_manual_gain_rx2; + } + } + + if ((filter_source_ != "Off") && (filter_source_ != "Auto") && (filter_source_ != "File") && (filter_source_ != "Design")) + { + std::cout << "Configuration parameter filter_source should take one of these values:\n"; + std::cout << " Off: Disable filter\n"; + std::cout << " Auto: Use auto-generated filters\n"; + std::cout << " File: User-provided filter in filter_filename parameter\n"; + std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters\n"; + std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value filter_source=Off\n"; + filter_source_ = std::string("Off"); + LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off"; + } + + if (bandwidth_ < 200000 || bandwidth_ > 56000000) + { + std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz\n"; + std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << '\n'; + bandwidth_ = default_bandwidth; + LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth; + } + + if (enable_rx1_band) + { + std::cout << "LO 0 frequency : " << freq0_ << " Hz\n"; + } + if (enable_rx2_band) + { + std::cout << "LO 1 frequency : " << freq1_ << " Hz\n"; + } + try + { + config_ad9361_rx_local(bandwidth_, + sample_rate_, + freq0_, + freq1_, + rf_port_select_, + rx1_enable_, + rx2_enable_, + gain_mode_rx1_, + gain_mode_rx2_, + rf_gain_rx1_, + rf_gain_rx2_, + quadrature_, + rf_dc_, + bb_dc_, + filter_source_, + filter_filename_, + Fpass_, + Fstop_); + } + catch (const std::runtime_error &e) + { + std::cerr << "Exception cached when configuring the RX chain: " << e.what() << '\n'; + return; + } + + std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + + buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); + thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); + + + // dynamic bits selection + if (enable_dynamic_bit_selection_) + { + dynamic_bit_selection_fpga = std::make_shared(enable_rx1_band, enable_rx2_band); + thread_dynamic_bit_selection = std::thread([&] { run_dynamic_bit_selection_process(); }); + } + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +Fmcomms5SignalSourceFPGA::~Fmcomms5SignalSourceFPGA() +{ + /* cleanup and exit */ + + if (rf_shutdown_) + { + std::cout << "* Disabling RX streaming channels\n"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } + } + + // disable buffer overflow checking and buffer monitoring + std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + lock_buffer_monitor.unlock(); + + if (thread_buffer_monitor.joinable()) + { + thread_buffer_monitor.join(); + } + + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bool bit_selection_enabled = enable_dynamic_bit_selection_; + lock_dyn_bit_sel.unlock(); + + if (bit_selection_enabled == true) + { + std::unique_lock lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + lock.unlock(); + + if (thread_dynamic_bit_selection.joinable()) + { + thread_dynamic_bit_selection.join(); + } + } +} + + +void Fmcomms5SignalSourceFPGA::run_dynamic_bit_selection_process() +{ + bool dynamic_bit_selection_active = true; + + while (dynamic_bit_selection_active) + { + // setting the bit selection to the top bits + dynamic_bit_selection_fpga->bit_selection(); + std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); + std::unique_lock lock(dynamic_bit_selection_mutex); + if (enable_dynamic_bit_selection_ == false) + { + dynamic_bit_selection_active = false; + } + lock.unlock(); + } +} + + +void Fmcomms5SignalSourceFPGA::run_buffer_monitor_process() +{ + bool enable_ovf_check_buffer_monitor_active = true; + + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitoring_initial_delay_ms)); + + while (enable_ovf_check_buffer_monitor_active) + { + buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); + std::unique_lock lock(buffer_monitor_mutex); + if (enable_ovf_check_buffer_monitor_active_ == false) + { + enable_ovf_check_buffer_monitor_active = false; + } + lock.unlock(); + } +} + + +void Fmcomms5SignalSourceFPGA::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void Fmcomms5SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr Fmcomms5SignalSourceFPGA::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr Fmcomms5SignalSourceFPGA::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h new file mode 100644 index 000000000..1bdcf4e6f --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h @@ -0,0 +1,135 @@ +/*! + * \file fmcomms5_signal_source_fpga.h + * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * to the FPGA accelerators. + * This source implements only the AD9361 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * Please use the fmcomms2 source if conventional SDR acquisition and tracking + * is selected in the configuration file. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FMCOMMS5_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_FMCOMMS5_SIGNAL_SOURCE_FPGA_H + +#include "concurrent_queue.h" +#include "fpga_buffer_monitor.h" +#include "fpga_dma-proxy.h" +#include "fpga_dynamic_bit_selection.h" +#include "fpga_switch.h" +#include "gnss_block_interface.h" +#include "signal_source_base.h" +#include +#include +#include +#include +#include +#include + + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + + +class ConfigurationInterface; + +class Fmcomms5SignalSourceFPGA : public SignalSourceBase +{ +public: + Fmcomms5SignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); + + ~Fmcomms5SignalSourceFPGA(); + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); + const std::string default_rf_port_select = std::string("A_BALANCED"); + const std::string default_gain_mode = std::string("slow_attack"); + const double default_tx_attenuation_db = -10.0; + const double default_manual_gain_rx1 = 64.0; + const double default_manual_gain_rx2 = 64.0; + const uint64_t default_bandwidth = 12500000; + + // perform dynamic bit selection every 500 ms by default + const uint32_t Gain_control_period_ms = 500; + // check buffer overflow and perform buffer monitoring every 1s by default + const uint32_t buffer_monitor_period_ms = 1000; + // buffer overflow and buffer monitoring initial delay + const uint32_t buffer_monitoring_initial_delay_ms = 2000; + // sample block size when running in post-processing mode + const int sample_block_size = 16384; + const int32_t switch_to_real_time_mode = 2; + + void run_dynamic_bit_selection_process(); + void run_buffer_monitor_process(); + + std::thread thread_dynamic_bit_selection; + std::thread thread_buffer_monitor; + + std::shared_ptr switch_fpga; + std::shared_ptr dynamic_bit_selection_fpga; + std::shared_ptr buffer_monitor_fpga; + + std::mutex dynamic_bit_selection_mutex; + std::mutex buffer_monitor_mutex; + + std::string gain_mode_rx1_; + std::string gain_mode_rx2_; + std::string rf_port_select_; + std::string filter_file_; + std::string filter_source_; + std::string filter_filename_; + + double rf_gain_rx1_; + double rf_gain_rx2_; + + uint64_t freq0_; // frequency of local oscillator for ADRV9361-A + uint64_t freq1_; // frequency of local oscillator for ADRV9361-B + uint64_t sample_rate_; + uint64_t bandwidth_; + + float Fpass_; + float Fstop_; + uint32_t in_stream_; + uint32_t out_stream_; + + size_t item_size_; + + bool filter_auto_; + bool quadrature_; + bool rf_dc_; + bool bb_dc_; + bool rx1_enable_; + bool rx2_enable_; + bool enable_dynamic_bit_selection_; + bool enable_ovf_check_buffer_monitor_active_; + bool dump_; + bool rf_shutdown_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_FMCOMMS5_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc index 180680a1c..788b50e77 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -40,7 +40,7 @@ using namespace std::string_literals; MAX2771EVKITSignalSourceFPGA::MAX2771EVKITSignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "MAX2771_EVKIT_Signal_Source_Fpga"s), + : SignalSourceBase(configuration, role, "MAX2771_EVKIT_Signal_Source_FPGA"s), freq_(configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ))), sample_rate_(configuration->property(role + ".sampling_frequency", default_sampling_rate)), in_stream_(in_stream), diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 428aebaad..4012c4121 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -166,8 +166,9 @@ #include "fmcomms2_signal_source.h" #endif -#if AD9361_DRIVER -#include "ad9361_signal_source_fpga.h" +#if ENABLE_FPGA and AD9361_DRIVER +#include "adrv9361_z7035_signal_source_fpga.h" +#include "fmcomms5_signal_source_fpga.h" #endif #if MAX2771_DRIVER @@ -820,16 +821,22 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and AD9361_DRIVER - else if (implementation == "Ad9361_Signal_Source_Fpga") + else if (implementation == "Adrv9361_Z7035_Signal_Source_Fpga") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } + else if (implementation == "Fmcomms5_Signal_Source_Fpga") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } #endif #if ENABLE_FPGA and MAX2771_DRIVER - else if (implementation == "MAX2771_EVKIT_Signal_Source_Fpga") + else if (implementation == "Max2771_Evkit_Signal_Source_Fpga") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); @@ -838,7 +845,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and DMA_PROXY_DRIVER - else if (implementation == "DMA_Signal_Source_Fpga") + else if (implementation == "Dma_Signal_Source_Fpga") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); From 2db37f384e50325a311b9a231878c619c2946746 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 31 Jul 2024 17:08:06 +0200 Subject: [PATCH 289/499] [TAS-242][FEAT] Implement alert message handling * Test show that behavior is as expected. * interestingly, the first batch of Tags after OAM received fail, then succeeds, until OAM is verified and OSNMA is disabled. --- .../galileo_telemetry_decoder_gs.cc | 28 +------- src/core/libs/osnma_msg_receiver.cc | 64 ++++++++++++++----- src/core/libs/osnma_msg_receiver.h | 7 +- .../osnma/osnma_test_vectors.cc | 40 +++++++++++- 4 files changed, 92 insertions(+), 47 deletions(-) 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 e83bfb05c..6c72f1b8c 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 @@ -370,9 +370,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // 1. De-interleave std::vector page_part_symbols_soft_value(frame_length); deinterleaver(GALILEO_INAV_INTERLEAVER_ROWS, GALILEO_INAV_INTERLEAVER_COLS, page_part_symbols, page_part_symbols_soft_value.data()); - bool flag_osnma_adkd_4_gst = false; - bool flag_osnma_adkd_4_utc = false; - // 2. Viterbi decoder // 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder) for (int32_t i = 0; i < frame_length; i++) @@ -443,8 +440,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in // 4. Push the new navigation data to the queues // extract OSNMA bits, reset container. - bool check_size_is_ok = d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549; - if (check_size_is_ok) + if (d_inav_nav.get_osnma_adkd_0_12_nav_bits().size() == 549) { DLOG(INFO) << "Galileo OSNMA: new ADKD=0/12 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW5() - 25; const auto tmp_obj_osnma = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> @@ -452,14 +448,9 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.get_osnma_adkd_0_12_nav_bits(), d_inav_nav.get_TOW5() - 25); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj_osnma)); - DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" - << static_cast(d_satellite.get_PRN()) - << ", TOW=" << static_cast(d_inav_nav.get_TOW5() - 25) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_0_12_nav_bits(); d_inav_nav.reset_osnma_nav_bits_adkd0_12(); } - - check_size_is_ok = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; - if (check_size_is_ok) + if (d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141) { DLOG(INFO) << "Galileo OSNMA: new ADKD=4 navData from " << d_satellite << " at TOW_sf=" << d_inav_nav.get_TOW6() - 5; const auto tmp_obj = std::make_shared>( // < PRNd , navDataBits, TOW_Sosf> // TODO conversion from W6 to W_Start_of_subframe @@ -467,9 +458,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.get_osnma_adkd_4_nav_bits(), d_inav_nav.get_TOW6() - 5); this->message_port_pub(pmt::mp("OSNMA_from_TLM"), pmt::make_any(tmp_obj)); - DLOG(INFO) << "|---> Galileo OSNMA :: Sending Telemetry Decoder NavData (PRN_d=" - << static_cast(d_satellite.get_PRN()) - << ", TOW=" << static_cast(d_inav_nav.get_TOW6() - 5) << ")"; //: 0b" << d_inav_nav.get_osnma_adkd_4_nav_bits(); d_inav_nav.reset_osnma_nav_bits_adkd4(); } @@ -588,8 +576,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_delta_t = tmp_obj->A_0G + tmp_obj->A_1G * (static_cast(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G + 604800 * (std::fmod(static_cast(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G), 64.0))); DLOG(INFO) << "delta_t=" << d_delta_t << "[s]"; - - flag_osnma_adkd_4_utc = true; } if (d_inav_nav.have_new_almanac() == true) // flag_almanac_4 tells if W10 available. @@ -623,16 +609,6 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in DLOG(INFO) << "Current parameters:"; DLOG(INFO) << "d_TOW_at_current_symbol_ms=" << d_TOW_at_current_symbol_ms; DLOG(INFO) << "d_nav.WN_0=" << d_inav_nav.get_Galileo_week(); - - flag_osnma_adkd_4_gst = true; - } - - // get osnma message if the needed nav data is available - bool adkd_4_nav_data_available = flag_osnma_adkd_4_utc && flag_osnma_adkd_4_gst; // supposition: data did not change bt. flags reset and now. - - // bool adkd_4_nav_data_available = d_inav_nav.get_osnma_adkd_4_nav_bits().size() == 141; // newApproach: let decoder decide when block starts and let it fill the data, and just check for length - if (adkd_4_nav_data_available /*&& d_inav_nav.is_TOW5_set() not needed cause W6 has TOW also.*/) - { } auto newOSNMA = d_inav_nav.have_new_nma(); if (d_band == '1' && newOSNMA) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index b7eb88af4..1e85e3a89 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -142,12 +142,11 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } // OSNMA frame received else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received { - // TODO - PRNa is a typo here, I think for d_satellite_nav_data, is PRN_d the name to use const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); - uint32_t PRNa = std::get<0>(*inav_data); + uint32_t PRNd = std::get<0>(*inav_data); std::string nav_data = std::get<1>(*inav_data); uint32_t TOW = std::get<2>(*inav_data); - d_nav_data_manager->add_navigation_data(nav_data, PRNa, TOW); + d_nav_data_manager->add_navigation_data(nav_data, PRNd, TOW); } else { @@ -173,6 +172,9 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { + if (d_flag_alert_message && (d_public_key_verified || d_kroot_verified)){ + return; + } read_nma_header(osnma_msg->hkroot[0]); // Check for corner cases: renewal, revocation @@ -180,7 +182,8 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& LOG(WARNING) << "Galileo OSNMA: NMAS invalid (RES), skipping osnma message"; return; } - + // TODO - trusting the NMAS and CPKS shall be done upon PKR verification or Tag verification. + // It's ok to activate the flags, but the final decision should happen after verifying it. if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 4 /* NPK */ && d_GST_PKR_PKREV_start == 0){ d_flag_PK_renewal = true; d_GST_PKR_PKREV_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); @@ -195,7 +198,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& std::cout << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << duration_hours << ", Duration=" << duration_hours << " h" << std::endl; } - if(d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 5 /* PKREV */ && d_GST_PKR_PKREV_start == 0){ + if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 5 /* PKREV */ && d_GST_PKR_PKREV_start == 0){ d_flag_PK_revocation = true; d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; d_public_key_verified = false; @@ -214,6 +217,14 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& std::cout << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << ", Duration=" << duration_hours << "h" << std::endl; } + if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 7 /* AM */ && d_GST_PKR_AM_start == 0){ + d_flag_alert_message = true; + d_GST_PKR_AM_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + d_public_key_verified = false; + d_kroot_verified = false; + LOG(INFO) << "Galileo OSNMA: Alert message :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; + std::cout << "Galileo OSNMA: Alert message :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; + } read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); @@ -533,8 +544,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; // local_time_verification(osnma_msg); // FIXME TODO: real time verification needed + + // If new PK verified and the new KROOT arrived, set the new PK before attempting verification if(d_flag_PK_renewal && d_osnma_data.d_dsm_kroot_message.pkid == d_new_public_key_id && d_flag_NPK_set == false){ - // set new public key to be used. d_crypto->set_public_key(d_new_public_key); d_crypto->store_public_key(PEMFILE_DEFAULT); d_flag_NPK_set = true; @@ -551,9 +563,15 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { std::cout << "Galileo OSNMA: DSM-KROOT authentication successful!" << std::endl; LOG(INFO) << "Galileo OSNMA: DSM-KROOT authentication successful!"; - LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " - << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " - << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); + if (d_flag_alert_message){ + LOG(WARNING) << "Galileo OSNMA: DSM-KROOT :: Alert message verification :: SUCCESS. "; + } + else + { + LOG(INFO) << "Galileo OSNMA: NMA Status is " << d_dsm_reader->get_nmas_status(d_osnma_data.d_nma_header.nmas) << ", " + << "Chain in force is " << static_cast(d_osnma_data.d_nma_header.cid) << ", " + << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); + } // Save DSM-Kroot and NMA header into a permanent storage if (d_flag_hot_start){ d_flag_hot_start = false; @@ -565,6 +583,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(WARNING) << "Galileo OSNMA: DSM-KROOT authentication failed."; std::cerr << "Galileo OSNMA: DSM-KROOT authentication failed." << std::endl; + if (d_flag_alert_message){ + d_flag_alert_message = false; + } d_count_failed_Kroot ++; } } @@ -607,9 +628,10 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } } uint32_t l_dp_bytes = dsm_msg.size(); - if (d_osnma_data.d_dsm_pkr_message.npkt == 4) + if (d_osnma_data.d_dsm_pkr_message.npkt == 4 && d_osnma_data.d_dsm_pkr_message.npktid == 0) { - LOG(WARNING) << "Galileo OSNMA: OAM received"; + LOG(WARNING) << "Galileo OSNMA: DSM-PKR :: Alert message received. Verifying it."; + std::cout << "Galileo OSNMA: DSM-PKR :: Alert message received. Verifying it." << std::endl; l_npk_bytes = l_dp_bytes - 130; // bytes } @@ -624,6 +646,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (l_dp_bytes != check_l_dp_bytes) { LOG(WARNING) << "Galileo OSNMA: Failed length reading of DSM-PKR message"; + d_flag_alert_message = false; } else { @@ -635,10 +658,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // TODO: kroot fields are 0 in case no DSM-KROOT received yet, need to take this into account. // std::vector mi; // (NPKT + NPKID + NPK) LOG(INFO) << "Galileo OSNMA: DSM-PKR with CID=" << static_cast(d_osnma_data.d_nma_header.cid) - << ", PKID=" << static_cast(d_osnma_data.d_dsm_pkr_message.npktid) - /*<< ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600*/ - << " received"; + << ", PKID=" << static_cast(d_osnma_data.d_dsm_pkr_message.npktid) << " received"; // Public key verification against Merkle tree root. bool verification = verify_dsm_pkr(d_osnma_data.d_dsm_pkr_message); if (verification) @@ -648,7 +668,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg if (d_flag_PK_renewal){ d_new_public_key = d_osnma_data.d_dsm_pkr_message.npk; } - else { + else if (d_flag_alert_message){ + LOG(WARNING) << "Galileo OSNMA: DSM-PKR verification :: Alert message verification :: SUCCESS. OSNMA disabled. Contact Galileo Service Centre"; + std::cout << "Galileo OSNMA: DSM-PKR verification :: Alert message verification :: SUCCESS. OSNMA disabled. Contact Galileo Service Centre" << std::endl; + + } + else{ d_crypto->d_PublicKeyType = PKT; d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); d_crypto->store_public_key(PEMFILE_DEFAULT); @@ -659,6 +684,10 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(ERROR) << "Galileo OSNMA: DSM-PKR verification :: FAILURE"; d_public_key_verified = false; d_count_failed_pubKey ++; + if (d_flag_alert_message){ + d_flag_alert_message = false; // disregard message as its authenticity could not be verified. + + } } } } @@ -692,7 +721,8 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrTOW_sf0); - bool can_process_mack_block = d_osnma_data.d_nma_header.nmas != 3; // Don't Use + bool can_process_mack_block = (d_osnma_data.d_nma_header.nmas != 3 && d_kroot_verified) || // NMAS different than DU + (d_osnma_data.d_nma_header.nmas == 3 && !d_kroot_verified); // NMAS is DU, but must be disregarded bool can_verify_tesla_key = d_kroot_verified || d_tesla_key_verified; // Either of those suffices for verifying the incoming TESLA key bool can_parse_tag_fields = d_osnma_data.d_dsm_kroot_message.ts != 0; // calculating the number of tags is based on the TS of the DSM-KROOT. if (can_verify_tesla_key && can_parse_tag_fields && can_process_mack_block) diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 97713a79a..59158ab4c 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -62,8 +62,8 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, class osnma_msg_receiver : public gr::block { public: - ~osnma_msg_receiver() = default; //!< Default destructor - std::unique_ptr d_crypto; // access to cryptographic functions + ~osnma_msg_receiver() = default; //!< Default destructor + std::unique_ptr d_crypto; // access to cryptographic functions void msg_handler_osnma(const pmt::pmt_t& msg); // GnssCrypto and the message handler are needed by public method within TestVectors fixture private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); @@ -134,6 +134,7 @@ private: uint32_t d_GST_0{}; uint32_t d_GST_SIS{}; uint32_t d_GST_PKR_PKREV_start{}; + uint32_t d_GST_PKR_AM_start{}; uint8_t d_Lt_min{}; // minimum equivalent tag length uint8_t d_Lt_verified_eph{0}; // verified tag bits - ephemeris @@ -152,6 +153,7 @@ private: uint8_t d_new_public_key_id{}; std::vector d_new_public_key; bool d_flag_NPK_set{false}; + bool d_flag_alert_message{false}; // Provide access to inner functions to Gtest uint32_t d_count_successful_tags{0}; @@ -169,6 +171,7 @@ private: FRIEND_TEST(OsnmaTestVectors, NominalTestConf2); FRIEND_TEST(OsnmaTestVectors, PublicKeyRenewal); FRIEND_TEST(OsnmaTestVectors, PublicKeyRevocation); + FRIEND_TEST(OsnmaTestVectors, AlertMessage); }; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index e640e6b50..0b525805c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -181,6 +181,42 @@ TEST_F(OsnmaTestVectors, PublicKeyRevocation) ASSERT_EQ(osnma->d_count_failed_pubKey, 0); ASSERT_EQ(osnma->d_count_failed_macseq, 0); } + +TEST_F(OsnmaTestVectors, AlertMessage){ + // Arrange + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_3/PublicKey/OSNMA_PublicKey_20231007201500_PKID_1.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_3/MerkleTree/OSNMA_MerkleTree_20231007201500_PKID_1.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::tm input_time_step1 = {0, 45, 18, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step2 = {0, 45, 19, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::vector input_times = { input_time_step1, input_time_step2 }; + + std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/oam_step1/07_OCT_2023_GST_18_45_01.csv"); + std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/oam_step2/07_OCT_2023_GST_19_45_01.csv"); + if (testVectors_step1.empty() || testVectors_step2.empty()) + { + ASSERT_TRUE(false); + } + std::vector> testVectors = { testVectors_step1, testVectors_step2}; + + // Act + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); + + // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); +} + // Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. // Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_object, std::vector> testVectors, std::vector startTimesFiles){ @@ -338,7 +374,7 @@ bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_ob tv.svId, nav_data_ADKD_0_12, osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; + // LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_0_12; osnma_object->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); } } @@ -375,7 +411,7 @@ bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_ob tv.svId, nav_data_ADKD_4, osnmaMsg_sptr->TOW_sf0); - LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; + // LOG(INFO) << "|---> Galileo OSNMA :: Telemetry Decoder NavData (PRN_d=" << static_cast(tv.svId) << ", TOW=" << static_cast(osnmaMsg_sptr->TOW_sf0) << "): 0b" << nav_data_ADKD_4; osnma_object->msg_handler_osnma(pmt::make_any(tmp_obj_osnma)); } } From f0f6618071a8edc0787ba432cadecf463a70c902 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 31 Jul 2024 19:10:46 +0200 Subject: [PATCH 290/499] Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 --- CMakeLists.txt | 4 ++-- README.md | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f0fbcae71..06a60741b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,9 +351,9 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.2") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.3") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") -set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") +set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.5") diff --git a/README.md b/README.md index b9c64d1ff..cea038c48 100644 --- a/README.md +++ b/README.md @@ -490,8 +490,8 @@ $ sudo ldconfig #### Download [GoogleTest](https://github.com/google/googletest "Googletest Homepage") ``` -$ wget https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip -$ unzip v1.14.0.zip +$ wget https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip +$ unzip v1.15.2.zip ``` Please **DO NOT build or install** Google Test. Every user needs to compile @@ -515,10 +515,10 @@ downloaded resides. Just type in your terminal (or add it to your `$HOME/.bashrc` file for a permanent solution) the following line: ``` -export GTEST_DIR=/home/username/googletest-1.14.0 +export GTEST_DIR=/home/username/googletest-1.15.2 ``` -changing `/home/username/googletest-1.14.0` by the actual path where you +changing `/home/username/googletest-1.15.2` by the actual path where you unpacked Google Test. If the CMake script does not find that folder, or the environment variable is not defined, or the source code is not installed by a package, then it will download a fresh copy of the Google Test source code and From ef4fbc98d976655af70fc18f5786e620b1165376 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 31 Jul 2024 21:00:51 +0200 Subject: [PATCH 291/499] Avoid code duplication in CMake modules --- CMakeLists.txt | 1 + cmake/Modules/FindCPUFEATURES.cmake | 35 +++------------- cmake/Modules/FindGFLAGS.cmake | 35 +++------------- cmake/Modules/FindGFORTRAN.cmake | 33 ++++----------- cmake/Modules/FindGLOG.cmake | 35 +++------------- cmake/Modules/FindGNURADIO.cmake | 65 +++-------------------------- cmake/Modules/FindGRIIO.cmake | 35 +++------------- cmake/Modules/FindGRLIMESDR.cmake | 35 +++------------- cmake/Modules/FindGROSMOSDR.cmake | 35 +++------------- cmake/Modules/FindLIBAD9361.cmake | 35 +++------------- cmake/Modules/FindLIBIIO.cmake | 35 +++------------- cmake/Modules/FindLIBUNWIND.cmake | 5 +++ cmake/Modules/FindLOG4CPP.cmake | 34 +++------------ cmake/Modules/FindMATIO.cmake | 32 +++----------- cmake/Modules/FindORC.cmake | 46 +++----------------- cmake/Modules/FindPCAP.cmake | 32 +++----------- cmake/Modules/FindPUGIXML.cmake | 33 +++------------ cmake/Modules/FindUHD.cmake | 35 +++------------- cmake/Modules/FindVOLK.cmake | 34 +++------------ cmake/Modules/FindZEROMQ.cmake | 32 +++----------- cmake/Modules/GnsssdrLibPaths.cmake | 43 +++++++++++++++++++ 21 files changed, 143 insertions(+), 562 deletions(-) create mode 100644 cmake/Modules/GnsssdrLibPaths.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 06a60741b..620fd5957 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH ${GNSSSDR_SOURCE_DIR}/cmake/Modules) # Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..' ################################################################################ include(FeatureSummary) +include(GnsssdrLibPaths) # Support of optional RF front-ends option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON) diff --git a/cmake/Modules/FindCPUFEATURES.cmake b/cmake/Modules/FindCPUFEATURES.cmake index 7c25e69c2..6f4f0e58f 100644 --- a/cmake/Modules/FindCPUFEATURES.cmake +++ b/cmake/Modules/FindCPUFEATURES.cmake @@ -6,38 +6,13 @@ set(FPHSA_NAME_MISMATCHED ON) +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + find_library(CPUFEATURES_LIBRARIES NAMES cpu_features - PATHS /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) find_path(CPUFEATURES_INCLUDE_DIR cpu_features_macros.h diff --git a/cmake/Modules/FindGFLAGS.cmake b/cmake/Modules/FindGFLAGS.cmake index 08a5056b8..cbfa07cd3 100644 --- a/cmake/Modules/FindGFLAGS.cmake +++ b/cmake/Modules/FindGFLAGS.cmake @@ -25,6 +25,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT GFLAGS_ROOT) set(GFLAGS_ROOT_USER_PROVIDED /usr/local) else() @@ -52,36 +56,7 @@ else() PATHS ${GFLAGS_ROOT_USER_PROVIDED}/lib ${GFLAGS_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) endif() diff --git a/cmake/Modules/FindGFORTRAN.cmake b/cmake/Modules/FindGFORTRAN.cmake index 5a698ce89..26764a688 100644 --- a/cmake/Modules/FindGFORTRAN.cmake +++ b/cmake/Modules/FindGFORTRAN.cmake @@ -8,6 +8,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT GFORTRAN_ROOT) set(GFORTRAN_ROOT_USER_DEFINED /usr/lib) else() @@ -20,13 +24,12 @@ if(DEFINED ENV{GFORTRAN_ROOT}) ) endif() -set(GCC_MAJOR_SERIES 14 13 12 11 10 9 8 7 6 5) +set(GCC_MAJOR_SERIES 15 14 13 12 11 10 9 8 7 6 5) set(GCC4_SERIES 4.9.1 4.9 4.8.3 4.8.1 4.7.2 4.7 4.8.2 4.8 4.7 4.6 4.5 4.4.4 4.4) set(GCC_SERIES ${GCC_MAJOR_SERIES} ${GCC4_SERIES}) find_library(GFORTRAN NAMES gfortran PATHS ${GFORTRAN_ROOT_USER_DEFINED} - /usr/lib64 /usr/lib/gcc/x86_64-linux-gnu # Debian /usr/lib/gcc/i386-linux-gnu /usr/lib/gcc/i486-linux-gnu @@ -65,35 +68,13 @@ find_library(GFORTRAN NAMES gfortran /usr/lib/gcc/x86_64-suse-linux /usr/lib/gcc/armv6hl-suse-linux-gnueabi /usr/lib/gcc/armv7hl-suse-linux-gnueabi + /usr/lib/gcc/loongarch64-linux-gnu /usr/lib64/gcc/aarch64-suse-linux /usr/lib64/gcc/powerpc64-suse-linux /usr/lib64/gcc/powerpc64le-suse-linux /usr/lib64/gcc/riscv64-suse-linux /usr/lib64/gcc/s390x-suse-linux - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/aarch64-linux-gnu - /usr/lib/i386-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /usr/local/lib/i386 + ${GNSSSDR_LIB_PATHS} PATH_SUFFIXES ${GCC_SERIES} ) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index 6c506643e..8f6c880a0 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -24,6 +24,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -45,36 +49,7 @@ macro(_FIND_GLOG_LIBRARIES _var) NAMES ${ARGN} HINTS ${PC_GLOG_LIBDIR} PATHS ${LIB_PATHS} - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ${GLOG_ROOT}/lib $ENV{GLOG_ROOT}/lib ${GLOG_ROOT}/lib64 diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 9855ddc29..cfaf51764 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -12,6 +12,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -105,36 +109,7 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE) HINTS ${PC_LIBDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}}) endforeach() @@ -314,35 +289,7 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99) HINTS ${PC_GNURADIO_IIO_LIBDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(GNURADIO_IIO_LIBRARIES) diff --git a/cmake/Modules/FindGRIIO.cmake b/cmake/Modules/FindGRIIO.cmake index 1abd5caf4..6a4352fc0 100644 --- a/cmake/Modules/FindGRIIO.cmake +++ b/cmake/Modules/FindGRIIO.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(IIO_LIBRARIES HINTS ${PC_IIO_LIBDIR} PATHS ${GRIIO_ROOT_USER_DEFINED}/lib ${GRIIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGRLIMESDR.cmake b/cmake/Modules/FindGRLIMESDR.cmake index 2fb60cb3f..a0ca9a565 100644 --- a/cmake/Modules/FindGRLIMESDR.cmake +++ b/cmake/Modules/FindGRLIMESDR.cmake @@ -31,6 +31,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(GRLIMESDR_LIBRARIES PATHS ${GRLIMESDR_ROOT_USER_DEFINED}/lib ${GRLIMESDR_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGROSMOSDR.cmake b/cmake/Modules/FindGROSMOSDR.cmake index 22ee7d51e..15a36c32b 100644 --- a/cmake/Modules/FindGROSMOSDR.cmake +++ b/cmake/Modules/FindGROSMOSDR.cmake @@ -31,6 +31,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(GROSMOSDR_LIBRARIES PATHS ${GROSMOSDR_ROOT_USER_DEFINED}/lib ${GROSMOSDR_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindLIBAD9361.cmake b/cmake/Modules/FindLIBAD9361.cmake index e1ff8e4a3..175a81af2 100644 --- a/cmake/Modules/FindLIBAD9361.cmake +++ b/cmake/Modules/FindLIBAD9361.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -49,36 +53,7 @@ find_library(LIBAD9361_LIBRARIES HINTS ${PC_LIBAD9361_LIBDIR} PATHS ${LIBAD9361_ROOT_USER_DEFINED}/lib ${LIBAD9361_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} /Library/Frameworks/ad9361.framework ) diff --git a/cmake/Modules/FindLIBIIO.cmake b/cmake/Modules/FindLIBIIO.cmake index 44f4d367e..add9215de 100644 --- a/cmake/Modules/FindLIBIIO.cmake +++ b/cmake/Modules/FindLIBIIO.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -51,36 +55,7 @@ find_library( HINTS ${PC_LIBIIO_LIBDIR} PATHS ${LIBIIO_ROOT_USER_DEFINED}/lib ${LIBIIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} /Library/Frameworks/iio.framework/ ) diff --git a/cmake/Modules/FindLIBUNWIND.cmake b/cmake/Modules/FindLIBUNWIND.cmake index f2c88b569..b5c6a68a8 100644 --- a/cmake/Modules/FindLIBUNWIND.cmake +++ b/cmake/Modules/FindLIBUNWIND.cmake @@ -17,6 +17,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h @@ -41,6 +45,7 @@ find_library(LIBUNWIND_GENERIC_LIBRARY PATHS "${LIBUNWIND_ROOT}/lib" "${LIBUNWIND_ROOT}/lib64" + ${GNSSSDR_LIB_PATHS} ) if(LIBUNWIND_INCLUDE_DIR) diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 95a14cf62..f351ebf3a 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -19,6 +19,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -74,35 +78,7 @@ find_library(LOG4CPP_LIBRARY HINTS ${PC_LOG4CPP_LIBDIR} PATHS ${LOG4CPP_ROOT_USER_PROVIDED}/lib ${LOG4CPP_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY) diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake index d9a6cebd2..73f8d053d 100644 --- a/cmake/Modules/FindMATIO.cmake +++ b/cmake/Modules/FindMATIO.cmake @@ -55,6 +55,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT MATIO_ROOT) set(MATIO_ROOT_USER_DEFINED /usr) else() @@ -85,33 +89,7 @@ find_library(MATIO_LIBRARY PATHS ${MATIO_ROOT_USER_DEFINED}/lib ${MATIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib DOC "The MATIO library" ) diff --git a/cmake/Modules/FindORC.cmake b/cmake/Modules/FindORC.cmake index b6a4ba364..600d0ac35 100644 --- a/cmake/Modules/FindORC.cmake +++ b/cmake/Modules/FindORC.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -65,26 +69,7 @@ find_path(ORC_LIBRARY_DIR ${ORC_ROOT_USER_PROVIDED}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(ORC_LIB orc-0.4 @@ -93,26 +78,7 @@ find_library(ORC_LIB orc-0.4 ${ORC_ROOT_USER_PROVIDED}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index 39a7aff15..2a3db3aff 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -23,6 +23,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -88,33 +92,7 @@ else() ${PC_PCAP_LIBDIR} PATHS ${PCAP_ROOT_USER_PROVIDED}/lib - /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) endif() diff --git a/cmake/Modules/FindPUGIXML.cmake b/cmake/Modules/FindPUGIXML.cmake index 5f7f5dcb2..4ff6419cc 100644 --- a/cmake/Modules/FindPUGIXML.cmake +++ b/cmake/Modules/FindPUGIXML.cmake @@ -20,6 +20,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -66,36 +70,9 @@ find_library(PUGIXML_LIBRARY ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-${PC_PUGIXML_VERSION} ${PUGIXML_ROOT_USER_DEFINED}}/lib/pugixml-1.9 ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-1.9 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/i386-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 + ${GNSSSDR_LIB_PATHS} /usr/local/lib/pugixml-${PC_PUGIXML_VERSION} /usr/local/lib/pugixml-1.9 - /opt/local/lib ) # Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found. diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index a6ed654a3..d30313535 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -16,6 +16,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -60,36 +64,7 @@ find_library(UHD_LIBRARIES HINTS ${PC_UHD_LIBDIR} PATHS ${UHD_ROOT_USER_PROVIDED}/lib ${UHD_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindVOLK.cmake b/cmake/Modules/FindVOLK.cmake index bda662186..2247f8247 100644 --- a/cmake/Modules/FindVOLK.cmake +++ b/cmake/Modules/FindVOLK.cmake @@ -16,6 +16,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -58,35 +62,7 @@ find_library(VOLK_LIBRARIES HINTS ${PC_VOLK_LIBDIR} PATHS ${VOLK_ROOT_USER_PROVIDED}/lib ${VOLK_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindZEROMQ.cmake b/cmake/Modules/FindZEROMQ.cmake index 6579d9ed7..d42a68d2d 100644 --- a/cmake/Modules/FindZEROMQ.cmake +++ b/cmake/Modules/FindZEROMQ.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -29,33 +33,7 @@ find_path(ZEROMQ_INCLUDE_DIRS find_library(ZEROMQ_LIBRARIES NAMES zmq libzmq.so.5 ${ZEROMQ_LIBRARY_NAME} HINTS ${PC_ZEROMQ_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - PATHS /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/GnsssdrLibPaths.cmake b/cmake/Modules/GnsssdrLibPaths.cmake new file mode 100644 index 000000000..9f76e362f --- /dev/null +++ b/cmake/Modules/GnsssdrLibPaths.cmake @@ -0,0 +1,43 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(GNSSSDR_LIB_PATHS) + return() +endif() + +set(GNSSSDR_LIB_PATHS + /usr/lib + /usr/lib/aarch64-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/i386-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/i386-linux-gnu + /usr/lib/loongarch64-linux-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib64 + /usr/local/lib + /usr/local/lib/i386 + /usr/local/lib64 + /opt/local/lib +) From ef1cb81784e4641741ac6a7d686d71a89d92af80 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 31 Jul 2024 22:31:01 +0200 Subject: [PATCH 292/499] Update clang-tidy job --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8323fdea8..32dc29f9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -146,7 +146,7 @@ jobs: ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run - run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.14.0 core_monitor core_libs pvt_libs + run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.15.2 core_monitor core_libs pvt_libs - name: run clang-tidy run: cd build && /opt/homebrew/opt/llvm/bin/run-clang-tidy -fix - name: check From a47cf1187c1983729ca627b1de63c52fccb0a468 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Aug 2024 11:52:28 +0200 Subject: [PATCH 293/499] [TAS-255] [BUG] Assure time synch. is properly done if d_flag_debug=false, now system clock is used to for the receiver synchronisation. It uses the UTC time and the GST epoch start time (adjusted for local time zone difference) to create a local estimation of GST, then compares with GST_SIS (coming from NavData Words 5 and 6) --- src/core/libs/osnma_msg_receiver.cc | 185 ++++++++---------- src/core/libs/osnma_msg_receiver.h | 30 +-- src/core/system_parameters/osnma_helper.cc | 41 +++- src/core/system_parameters/osnma_helper.h | 8 + .../osnma/osnma_msg_receiver_test.cc | 5 +- 5 files changed, 141 insertions(+), 128 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1e85e3a89..7035a9e08 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -112,6 +112,21 @@ osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, _1)); #endif #endif + std::chrono::time_point now; + if (d_flag_debug){ + // d_GST_Rx = d_helper->compute_gst(d_initial_debug_time); + LOG(WARNING) << "Galileo OSNMA: Debug mode, time artificially set up."; + std::cout << "Galileo OSNMA: Debug mode, time artificially set up." << std::endl; + // TODO - need to synchronize time lapse with Gnss_Synchro? + } + else{ + d_GST_Rx = d_helper->compute_gst_now(); + } + + d_WN = d_helper->get_WN(d_GST_Rx); + d_TOW = d_helper->get_TOW(d_GST_Rx); + LOG(WARNING) << "Galileo OSNMA: initial receiver time GST=["<< d_WN << " " << d_TOW <<"]"; + std::cout << "Galileo OSNMA: initial receiver time GST=["<< d_WN << " " << d_TOW <<"]" << std::endl; } @@ -138,6 +153,50 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) LOG(INFO) << output_message.str(); std::cout << output_message.str() << std::endl; + // Receiver time update + d_GST_SIS = d_helper->compute_gst(nma_msg->WN_sf0, nma_msg->TOW_sf0); + if (d_last_verified_key_GST == 0){ + d_last_received_GST = d_GST_SIS; + } + else if (d_GST_SIS > d_last_received_GST){ + d_last_received_GST = d_GST_SIS; + } + if (d_flag_debug){ + d_GST_Rx = d_last_received_GST; + } + else{ + d_GST_Rx = d_helper->compute_gst_now(); + } + LOG(INFO) << "Galileo OSNMA: Receiver Time GST=[" << d_helper->get_WN(d_GST_Rx) << " " << d_helper->get_TOW(d_GST_Rx) << "]"; + std::cout << "Galileo OSNMA: Receiver Time GST=[" << d_helper->get_WN(d_GST_Rx) << " " << d_helper->get_TOW(d_GST_Rx) << "]" << std::endl; + + // time constraint verification + std::time_t delta_T = std::abs(static_cast(d_GST_Rx - d_GST_SIS)); + if (delta_T <= d_T_L) + { + d_tags_to_verify = {0, 4, 12}; + LOG(INFO) << "Galileo OSNMA: time constraint OK ( delta_T=" << delta_T << " s)"; + std::cout << "Galileo OSNMA: time constraint OK ( delta_T=" << delta_T << " s)" << std::endl; + } + else if (delta_T > d_T_L && delta_T <= 10 * d_T_L) + { + d_tags_to_verify = {12}; + LOG(WARNING) << "Galileo OSNMA: time constraint allows only slow MACs to be verified"; + std::cout << "Galileo OSNMA: |local_t - GST_SIS| < T_L [ |" << static_cast(d_GST_Rx - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; + LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_GST_Rx << " d_GST_SIS: " << d_GST_SIS; + LOG(WARNING) << "Galileo OSNMA: |local_t - GST_SIS| < T_L [ |" << static_cast(d_GST_Rx - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; + } + else + { + d_tags_to_verify = {}; + LOG(WARNING) << "Galileo OSNMA: time constraint violation"; + std::cerr << "Galileo OSNMA: time constraint violation" << std::endl; + std::cerr << "Galileo OSNMA: | local_t - GST_SIS | < T_L [ | " << static_cast(d_GST_Rx - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]" << std::endl; + LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_GST_Rx << " d_GST_SIS: " << d_GST_SIS; + LOG(WARNING) << "Galileo OSNMA: | local_t - GST_SIS | < T_L [ | " << static_cast(d_GST_Rx - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; + return; + } + process_osnma_message(nma_msg); } // OSNMA frame received else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received @@ -159,7 +218,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } // Send the resulting decoded NMA data (if available) to PVT - if (d_new_data) // TODO where is it set to true? + if (d_new_data) { auto osnma_data_ptr = std::make_shared(d_osnma_data); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(osnma_data_ptr)); @@ -177,13 +236,14 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& } read_nma_header(osnma_msg->hkroot[0]); - // Check for corner cases: renewal, revocation + // Check for corner cases: renewal, revocation, alert message if (d_osnma_data.d_nma_header.nmas == 0 /* RES */){ LOG(WARNING) << "Galileo OSNMA: NMAS invalid (RES), skipping osnma message"; return; } // TODO - trusting the NMAS and CPKS shall be done upon PKR verification or Tag verification. // It's ok to activate the flags, but the final decision should happen after verifying it. + // For OAM is solved, but NPK and PKREV I think not yet if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 4 /* NPK */ && d_GST_PKR_PKREV_start == 0){ d_flag_PK_renewal = true; d_GST_PKR_PKREV_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); @@ -229,9 +289,9 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 - if (d_osnma_data.d_dsm_kroot_message.towh_k != 0) - { - local_time_verification(osnma_msg); + if (d_osnma_data.d_dsm_kroot_message.towh_k != 0){ + d_GST_0 = d_helper->compute_gst(d_osnma_data.d_dsm_kroot_message.wn_k, d_osnma_data.d_dsm_kroot_message.towh_k * 3600); + d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. } read_and_process_mack_block(osnma_msg); // only process them if at least 3 available. } @@ -350,63 +410,6 @@ void osnma_msg_receiver::read_dsm_block(const std::shared_ptr& osnma_ std::cout << available_blocks.str() << std::endl; } - -/** - * @brief Function to verify the local time based on GST_SIS and GST_0 - * - * @param osnma_msg Shared pointer to OSNMA message structure - */ -void osnma_msg_receiver::local_time_verification(const std::shared_ptr& osnma_msg) -{ - // compute local time based on GST_SIS and GST_0 - d_GST_SIS = (osnma_msg->WN_sf0 & 0x00000FFF) << 20 | (osnma_msg->TOW_sf0 & 0x000FFFFF); - // std::cout << "Galileo OSNMA: d_GST_SIS: " << d_GST_SIS << std::endl; - // d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - d_GST_0 = ((d_osnma_data.d_dsm_kroot_message.wn_k & 0x00000FFF) << 20 | (d_osnma_data.d_dsm_kroot_message.towh_k * 3600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - // d_GST_0 = d_osnma_data.d_dsm_kroot_message.towh_k + 604800 * d_osnma_data.d_dsm_kroot_message.wn_k + 30; - // TODO store list of SVs sending OSNMA and if received ID matches one stored, then just increment time 30s for that ID. - if (d_receiver_time != 0) - { - d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. - // d_receiver_time += 30; - // std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; - } - else - { // local time not initialised -> compute it. - d_receiver_time = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. - // std::cout << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << std::endl; - } - // verify time constraint - std::time_t delta_T = std::abs(static_cast(d_receiver_time - d_GST_SIS)); - if (delta_T <= d_T_L) - { - d_tags_allowed = tags_to_verify::all; - d_tags_to_verify = {0, 4, 12}; - LOG(INFO) << "Galileo OSNMA: time constraint OK ( delta_T=" << delta_T << " s)"; - // LOG(INFO) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS; - // std::cout << "( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS)<< " | < " << static_cast(d_T_L) << " ]" << std::endl; - - // TODO set flag to false to avoid processing dsm and MACK messages - } - else if (delta_T > d_T_L && delta_T <= 10 * d_T_L) - { - d_tags_allowed = tags_to_verify::slow_eph; - d_tags_to_verify = {12}; - LOG(WARNING) << "Galileo OSNMA: time constraint allows only slow MACs to be verified"; - LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS; - LOG(WARNING) << "Galileo OSNMA: ( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; - } - else - { - d_tags_allowed = tags_to_verify::none; - d_tags_to_verify = {}; - LOG(WARNING) << "Galileo OSNMA: time constraint violation"; - LOG(WARNING) << "Galileo OSNMA: d_receiver_time: " << d_receiver_time << " d_GST_SIS: " << d_GST_SIS; - LOG(WARNING) << "Galileo OSNMA: ( |local_t - GST_SIS| < T_L ) [ |" << static_cast(d_receiver_time - d_GST_SIS) << " | < " << static_cast(d_T_L) << " ]"; - } -} - - /** * @brief Process DSM block of an OSNMA message. * @@ -671,7 +674,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg else if (d_flag_alert_message){ LOG(WARNING) << "Galileo OSNMA: DSM-PKR verification :: Alert message verification :: SUCCESS. OSNMA disabled. Contact Galileo Service Centre"; std::cout << "Galileo OSNMA: DSM-PKR verification :: Alert message verification :: SUCCESS. OSNMA disabled. Contact Galileo Service Centre" << std::endl; - } else{ d_crypto->d_PublicKeyType = PKT; @@ -686,7 +688,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_count_failed_pubKey ++; if (d_flag_alert_message){ d_flag_alert_message = false; // disregard message as its authenticity could not be verified. - } } } @@ -697,7 +698,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg LOG(WARNING) << "Galileo OSNMA: Reserved message received"; std::cerr << "Galileo OSNMA: Reserved message received" << std::endl; } - d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; // TODO - reset during header parsing in PKREV? + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; // TODO - reset during header parsing in PKREV? } @@ -725,8 +726,7 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrPRN; // FIXME this is ugly. d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; @@ -1012,14 +1012,8 @@ void osnma_msg_receiver::process_mack_message() { LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed, " << "no Kroot nor TESLA key available."; - if (!d_flag_debug) - { - return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. - } - else - { - LOG(WARNING) << "Galileo OSNMA: But it will be processed for debugging purposes."; - } + return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. + } // verify tesla key and add it to the container of verified keys if successful if (d_tesla_keys.find(d_osnma_data.d_nav_data.get_tow_sf0()) == d_tesla_keys.end()) // check if already available => no need to verify @@ -1425,14 +1419,14 @@ void osnma_msg_receiver::display_data() bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TOW) { uint32_t num_of_hashes_needed; - uint32_t GST_SFi = d_receiver_time - 30; // GST of target key is to be used. + uint32_t GST_SFi = d_GST_Sf - 30; // GST of target key is to be used. std::vector hash; const uint8_t lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; std::vector validated_key; if (d_tesla_key_verified) { // have to go up to last verified key validated_key = d_tesla_keys.rbegin()->second; - num_of_hashes_needed = (d_receiver_time - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified + num_of_hashes_needed = (d_GST_Sf - d_last_verified_key_GST) / 30; // Eq. 19 ICD modified LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) need to be performed up to closest verified TESLA key"; hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); @@ -1440,7 +1434,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO else { // have to go until Kroot validated_key = d_osnma_data.d_dsm_kroot_message.kroot; - num_of_hashes_needed = (d_receiver_time - d_GST_0) / 30 + 1; // Eq. 19 IC + num_of_hashes_needed = (d_GST_Sf - d_GST_0) / 30 + 1; // Eq. 19 IC LOG(INFO) << "Galileo OSNMA: TESLA verification (" << num_of_hashes_needed << " hashes) need to be performed up to Kroot"; hash = hash_chain(num_of_hashes_needed, key, GST_SFi, lk_bytes); @@ -1458,24 +1452,16 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO std::cout << "Galileo OSNMA: TESLA key verification :: SUCCESS!" << std::endl; d_tesla_keys.insert(std::pair>(TOW, key)); d_tesla_key_verified = true; - d_last_verified_key_GST = d_receiver_time; + d_last_verified_key_GST = d_GST_Sf; } else if (num_of_hashes_needed > 0) { LOG(WARNING) << "Galileo OSNMA: TESLA key verification :: FAILED"; std::cerr << "Galileo OSNMA: TESLA key verification :: FAILED" << std::endl; - if (d_flag_debug) - { - d_tesla_keys.insert(std::pair>(TOW, key)); - d_last_verified_key_GST = d_receiver_time; - d_tesla_key_verified = true; - // TODO - if intermediate verification fails, can one still use the former verified tesla key or should go to Kroot or even retrieve new Kroot? - } } return d_tesla_key_verified; } - /** * @brief Removes the tags that have been verified from the multimap d_tags_awaiting_verify. * @@ -1582,7 +1568,7 @@ void osnma_msg_receiver::control_tags_awaiting_verify_size() bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) { // MACSEQ verification - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received.. + uint32_t GST_SFi = d_GST_Sf - 30; // time of the start of SF containing MACSEQ std::vector applicable_key = d_tesla_keys[mack.TOW + 30]; // current tesla key ie transmitted in the next subframe std::vector sq1{}; std::vector sq2{}; @@ -1594,7 +1580,6 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) sq1 = it->second.sequence1; sq2 = it->second.sequence2; } - // Assign relevant sequence based on subframe time if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. { @@ -1633,12 +1618,12 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) return true; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag - m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); // TODO d_GST_Sf left useless - m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); - m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); - m[4] = static_cast(d_GST_Sf & 0x000000FF); + m[1] = static_cast((GST_SFi & 0xFF000000) >> 24); + m[2] = static_cast((GST_SFi & 0x00FF0000) >> 16); + m[3] = static_cast((GST_SFi & 0x0000FF00) >> 8); + m[4] = static_cast(GST_SFi & 0x000000FF); // Case tags flexible - Eq. 21 ICD for (size_t i = 0; i < flxTags.size(); i++) { @@ -1823,7 +1808,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ std::vector verified_tags{}; // MACSEQ verification - d_GST_Sf = d_receiver_time - 30; // time of the start of SF containing MACSEQ // TODO buffer with times? since out of debug not every 30 s a Sf is necessarily received. + uint32_t GST_Sfi = d_GST_Sf - 30; // time of the start of SF containing MACSEQ std::vector applicable_key; const auto key_it = d_tesla_keys.find(mack.TOW + 30); // current tesla key ie transmitted in the next subframe if (key_it != d_tesla_keys.cend()) @@ -1889,12 +1874,12 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ return verified_tags; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag - m[1] = static_cast((d_GST_Sf & 0xFF000000) >> 24); // TODO d_GST_Sf left useless - m[2] = static_cast((d_GST_Sf & 0x00FF0000) >> 16); - m[3] = static_cast((d_GST_Sf & 0x0000FF00) >> 8); - m[4] = static_cast(d_GST_Sf & 0x000000FF); + m[1] = static_cast((GST_Sfi & 0xFF000000) >> 24); + m[2] = static_cast((GST_Sfi & 0x00FF0000) >> 16); + m[3] = static_cast((GST_Sfi & 0x0000FF00) >> 8); + m[4] = static_cast(GST_Sfi & 0x000000FF); // Case tags flexible - Eq. 21 ICD for (size_t i = 0; i < flxTags.size(); i++) { diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 59158ab4c..fb83f2b8c 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -73,7 +73,6 @@ private: void read_nma_header(uint8_t nma_header); void read_dsm_header(uint8_t dsm_header); void read_dsm_block(const std::shared_ptr& osnma_msg); - void local_time_verification(const std::shared_ptr& osnma_msg); void process_dsm_block(const std::shared_ptr& osnma_msg); void process_dsm_message(const std::vector& dsm_msg, const uint8_t& nma_header); void read_and_process_mack_block(const std::shared_ptr& osnma_msg); @@ -118,35 +117,24 @@ private: OSNMA_data d_osnma_data{}; - enum tags_to_verify - { - all, - utc, - slow_eph, - eph, - none - }; - tags_to_verify d_tags_allowed{tags_to_verify::all}; - std::time_t d_receiver_time{0}; - - uint32_t d_GST_Sf{}; // C: used for MACSEQ and Tesla Key verification TODO need really to be global var? - uint32_t d_last_verified_key_GST{0}; - uint32_t d_GST_0{}; - uint32_t d_GST_SIS{}; + uint32_t d_last_received_GST{0}; // latest GST received + uint32_t d_GST_Sf{}; // Scaled GST time for cryptographic computations + uint32_t d_GST_Rx{0}; // local GST receiver time + uint32_t d_last_verified_key_GST{0}; // GST for the latest verified TESLA key + uint32_t d_GST_0{}; // Time of applicability GST (KROOT + 30 s) + uint32_t d_GST_SIS{}; // GST coming from W6 and W5 of SIS uint32_t d_GST_PKR_PKREV_start{}; uint32_t d_GST_PKR_AM_start{}; + uint32_t d_WN{}; + uint32_t d_TOW{}; - uint8_t d_Lt_min{}; // minimum equivalent tag length - uint8_t d_Lt_verified_eph{0}; // verified tag bits - ephemeris - uint8_t d_Lt_verified_utc{0}; // verified tag bits - timing uint8_t const d_T_L{30}; // s RG Section 2.1 - uint8_t const d_delta_COP{30}; // s SIS ICD Table 14 bool d_new_data{false}; bool d_public_key_verified{false}; bool d_kroot_verified{false}; bool d_tesla_key_verified{false}; - bool d_flag_debug{false}; + bool d_flag_debug{true}; bool d_flag_hot_start{false}; bool d_flag_PK_renewal{false}; bool d_flag_PK_revocation{false}; diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index f8650ed3f..3ce589302 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -19,13 +19,37 @@ #include #include #include +#include // timezone -uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const -{ - uint32_t GST = (WN & 0x00000FFF) << 20 | (TOW & 0x000FFFFF); - return GST; +uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const{ + return (WN & 0x00000FFF) << 20 | (TOW & 0x000FFFFF); } +uint32_t Osnma_Helper::compute_gst(tm& input) +{ + auto epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&GST_START_EPOCH)); + auto input_time_point = std::chrono::system_clock::from_time_t(mktime(&input)); + + // Get the duration from epoch in seconds + auto duration_sec = std::chrono::duration_cast(input_time_point - epoch_time_point); + + // Calculate the week number (WN) and time of week (TOW) + uint32_t sec_in_week = 7 * 24 * 60 * 60; + uint32_t week_number = duration_sec.count() / sec_in_week; + uint32_t time_of_week = duration_sec.count() % sec_in_week; + return compute_gst(week_number, time_of_week); +} + +uint32_t Osnma_Helper::compute_gst_now() +{ + std::chrono::time_point epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&GST_START_EPOCH) - timezone); +// auto time_utc = std::chrono::time_point_cast(time).time_since_epoch(); + auto duration_sec = std::chrono::duration_cast(std::chrono::system_clock::now() - epoch_time_point); + uint32_t sec_in_week = 7 * 24 * 60 * 60; + uint32_t week_number = duration_sec.count() / sec_in_week; + uint32_t time_of_week = duration_sec.count() % sec_in_week; + return compute_gst(week_number, time_of_week); +} std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const { @@ -121,3 +145,12 @@ std::vector Osnma_Helper::convert_from_hex_string(const std::string& he return result; } +uint32_t Osnma_Helper::get_WN(uint32_t GST) +{ + return (GST & 0xFFF00000) >> 20; +} +uint32_t Osnma_Helper::get_TOW(uint32_t GST) +{ + return GST & 0x000FFFFF; +} + diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 1e0eae235..ea4e81313 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -18,6 +18,7 @@ #define GNSS_SDR_OSNMA_HELPER_H +#include #include #include #include @@ -27,11 +28,18 @@ public: Osnma_Helper() = default; ~Osnma_Helper() = default; uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; + uint32_t compute_gst(std::tm& input); + uint32_t compute_gst_now(); + uint32_t get_WN(uint32_t GST); + uint32_t get_TOW(uint32_t GST); std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString) const; std::string verification_status_str(int status) const; std::string convert_to_hex_string(const std::vector& vector) const; std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto + + std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; + }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 7dd2e7a8d..5d5e3819f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -252,10 +252,9 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; - // local_time_verification would do this operation. TODO - eliminate duplication. osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); - osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) - osnma->d_receiver_time = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G.//345630; + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_GST_Sf = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G. osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 From fcea84d875beef460dcea3831c72a20d082db481 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Aug 2024 11:53:02 +0200 Subject: [PATCH 294/499] disable extra unit tests for the moment. --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4bd9f38d..ea0a516da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,7 +35,7 @@ jobs: run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - name: default position_test run: | - cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ + cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF .. && \ ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* build-macos: @@ -69,7 +69,7 @@ jobs: run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests - name: default position_test run: | - cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. && \ + cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF .. && \ ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* build-macos-xcode: @@ -108,7 +108,7 @@ jobs: - name: default position_test run: | cd build - cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=ON .. + cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF .. xcodebuild -configuration Release -target position_test ../install/position_test ../install/run_tests --gtest_filter=Osnma* From eefa3b3aa76f503c33da2be6302fdac74112bf86 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 1 Aug 2024 12:46:14 +0200 Subject: [PATCH 295/499] Update CMake scripts (#15) * Report GMP version if found * Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 * Avoid code duplication in CMake modules * Update CMake modules * Update clang-tidy job --- .github/workflows/main.yml | 2 +- CMakeLists.txt | 5 +- README.md | 8 +-- cmake/Modules/FindCPUFEATURES.cmake | 35 ++-------- cmake/Modules/FindGFLAGS.cmake | 35 ++-------- cmake/Modules/FindGFORTRAN.cmake | 33 ++------- cmake/Modules/FindGLOG.cmake | 35 ++-------- cmake/Modules/FindGMP.cmake | 104 +++++++++------------------- cmake/Modules/FindGNURADIO.cmake | 65 ++--------------- cmake/Modules/FindGRIIO.cmake | 35 ++-------- cmake/Modules/FindGRLIMESDR.cmake | 35 ++-------- cmake/Modules/FindGROSMOSDR.cmake | 35 ++-------- cmake/Modules/FindLIBAD9361.cmake | 35 ++-------- cmake/Modules/FindLIBIIO.cmake | 35 ++-------- cmake/Modules/FindLIBUNWIND.cmake | 5 ++ cmake/Modules/FindLOG4CPP.cmake | 34 ++------- cmake/Modules/FindMATIO.cmake | 32 ++------- cmake/Modules/FindORC.cmake | 46 ++---------- cmake/Modules/FindPCAP.cmake | 32 ++------- cmake/Modules/FindPUGIXML.cmake | 33 ++------- cmake/Modules/FindUHD.cmake | 35 ++-------- cmake/Modules/FindVOLK.cmake | 34 ++------- cmake/Modules/FindZEROMQ.cmake | 32 ++------- cmake/Modules/GnssSdrCrypto.cmake | 42 +++-------- cmake/Modules/GnsssdrLibPaths.cmake | 43 ++++++++++++ 25 files changed, 190 insertions(+), 675 deletions(-) create mode 100644 cmake/Modules/GnsssdrLibPaths.cmake diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea0a516da..54a478cba 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -151,7 +151,7 @@ jobs: ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run - run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.14.0 core_monitor core_libs pvt_libs + run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.15.2 core_monitor core_libs pvt_libs - name: run clang-tidy run: cd build && /opt/homebrew/opt/llvm/bin/run-clang-tidy -fix - name: check diff --git a/CMakeLists.txt b/CMakeLists.txt index b56c29253..eb113bad3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ list(APPEND CMAKE_MODULE_PATH ${GNSSSDR_SOURCE_DIR}/cmake/Modules) # Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..' ################################################################################ include(FeatureSummary) +include(GnsssdrLibPaths) # Support of optional RF front-ends option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON) @@ -353,9 +354,9 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.2") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.3") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") -set(GNSSSDR_GTEST_LOCAL_VERSION "1.14.0") +set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.5") diff --git a/README.md b/README.md index 557b3686c..d5cbacc94 100644 --- a/README.md +++ b/README.md @@ -488,8 +488,8 @@ $ sudo ldconfig #### Download [GoogleTest](https://github.com/google/googletest "Googletest Homepage") ``` -$ wget https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip -$ unzip v1.14.0.zip +$ wget https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip +$ unzip v1.15.2.zip ``` Please **DO NOT build or install** Google Test. Every user needs to compile @@ -513,10 +513,10 @@ downloaded resides. Just type in your terminal (or add it to your `$HOME/.bashrc` file for a permanent solution) the following line: ``` -export GTEST_DIR=/home/username/googletest-1.14.0 +export GTEST_DIR=/home/username/googletest-1.15.2 ``` -changing `/home/username/googletest-1.14.0` by the actual path where you +changing `/home/username/googletest-1.15.2` by the actual path where you unpacked Google Test. If the CMake script does not find that folder, or the environment variable is not defined, or the source code is not installed by a package, then it will download a fresh copy of the Google Test source code and diff --git a/cmake/Modules/FindCPUFEATURES.cmake b/cmake/Modules/FindCPUFEATURES.cmake index 7c25e69c2..6f4f0e58f 100644 --- a/cmake/Modules/FindCPUFEATURES.cmake +++ b/cmake/Modules/FindCPUFEATURES.cmake @@ -6,38 +6,13 @@ set(FPHSA_NAME_MISMATCHED ON) +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + find_library(CPUFEATURES_LIBRARIES NAMES cpu_features - PATHS /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) find_path(CPUFEATURES_INCLUDE_DIR cpu_features_macros.h diff --git a/cmake/Modules/FindGFLAGS.cmake b/cmake/Modules/FindGFLAGS.cmake index 08a5056b8..cbfa07cd3 100644 --- a/cmake/Modules/FindGFLAGS.cmake +++ b/cmake/Modules/FindGFLAGS.cmake @@ -25,6 +25,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT GFLAGS_ROOT) set(GFLAGS_ROOT_USER_PROVIDED /usr/local) else() @@ -52,36 +56,7 @@ else() PATHS ${GFLAGS_ROOT_USER_PROVIDED}/lib ${GFLAGS_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) endif() diff --git a/cmake/Modules/FindGFORTRAN.cmake b/cmake/Modules/FindGFORTRAN.cmake index 5a698ce89..26764a688 100644 --- a/cmake/Modules/FindGFORTRAN.cmake +++ b/cmake/Modules/FindGFORTRAN.cmake @@ -8,6 +8,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT GFORTRAN_ROOT) set(GFORTRAN_ROOT_USER_DEFINED /usr/lib) else() @@ -20,13 +24,12 @@ if(DEFINED ENV{GFORTRAN_ROOT}) ) endif() -set(GCC_MAJOR_SERIES 14 13 12 11 10 9 8 7 6 5) +set(GCC_MAJOR_SERIES 15 14 13 12 11 10 9 8 7 6 5) set(GCC4_SERIES 4.9.1 4.9 4.8.3 4.8.1 4.7.2 4.7 4.8.2 4.8 4.7 4.6 4.5 4.4.4 4.4) set(GCC_SERIES ${GCC_MAJOR_SERIES} ${GCC4_SERIES}) find_library(GFORTRAN NAMES gfortran PATHS ${GFORTRAN_ROOT_USER_DEFINED} - /usr/lib64 /usr/lib/gcc/x86_64-linux-gnu # Debian /usr/lib/gcc/i386-linux-gnu /usr/lib/gcc/i486-linux-gnu @@ -65,35 +68,13 @@ find_library(GFORTRAN NAMES gfortran /usr/lib/gcc/x86_64-suse-linux /usr/lib/gcc/armv6hl-suse-linux-gnueabi /usr/lib/gcc/armv7hl-suse-linux-gnueabi + /usr/lib/gcc/loongarch64-linux-gnu /usr/lib64/gcc/aarch64-suse-linux /usr/lib64/gcc/powerpc64-suse-linux /usr/lib64/gcc/powerpc64le-suse-linux /usr/lib64/gcc/riscv64-suse-linux /usr/lib64/gcc/s390x-suse-linux - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/aarch64-linux-gnu - /usr/lib/i386-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /usr/local/lib/i386 + ${GNSSSDR_LIB_PATHS} PATH_SUFFIXES ${GCC_SERIES} ) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index 6c506643e..8f6c880a0 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -24,6 +24,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -45,36 +49,7 @@ macro(_FIND_GLOG_LIBRARIES _var) NAMES ${ARGN} HINTS ${PC_GLOG_LIBDIR} PATHS ${LIB_PATHS} - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ${GLOG_ROOT}/lib $ENV{GLOG_ROOT}/lib ${GLOG_ROOT}/lib64 diff --git a/cmake/Modules/FindGMP.cmake b/cmake/Modules/FindGMP.cmake index f0648feb3..3f4db49c6 100644 --- a/cmake/Modules/FindGMP.cmake +++ b/cmake/Modules/FindGMP.cmake @@ -1,9 +1,17 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2024 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause +if(NOT COMMAND feature_summary) + include(FeatureSummary) +endif() + +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -11,8 +19,7 @@ pkg_check_modules(PC_GMP "gmp") set(GMP_DEFINITIONS ${PC_GMP_CFLAGS_OTHER}) -find_path( - GMP_INCLUDE_DIR +find_path(GMP_INCLUDE_DIR NAMES gmpxx.h HINTS ${PC_GMP_INCLUDEDIR} PATHS ${CMAKE_INSTALL_PREFIX}/include @@ -24,87 +31,26 @@ find_path( set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR}) set(GMP_PC_ADD_CFLAGS "-I${GMP_INCLUDE_DIR}") -find_library( - GMPXX_LIBRARY +find_library(GMPXX_LIBRARY NAMES gmpxx HINTS ${PC_GMP_LIBDIR} - PATHS ${CMAKE_INSTALL_PREFIX}/lib + PATHS ${GNSSSDR_LIB_PATHS} + ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /opt/local/lib ) -find_library( - GMP_LIBRARY +find_library(GMP_LIBRARY NAMES gmp HINTS ${PC_GMP_LIBDIR} - PATHS ${CMAKE_INSTALL_PREFIX}/lib + PATHS ${GNSSSDR_LIB_PATHS} + ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /opt/local/lib ) set(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY}) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GMP DEFAULT_MSG GMPXX_LIBRARY GMP_LIBRARY - GMP_INCLUDE_DIR) +find_package_handle_standard_args(GMP DEFAULT_MSG GMPXX_LIBRARY GMP_LIBRARY GMP_INCLUDE_DIR) if(GMP_FOUND AND NOT TARGET Gmp::gmp) add_library(Gmp::gmp SHARED IMPORTED) @@ -116,4 +62,18 @@ if(GMP_FOUND AND NOT TARGET Gmp::gmp) ) endif() -mark_as_advanced(GMPXX_LIBRARY GMP_LIBRARY GMP_INCLUDE_DIR) \ No newline at end of file +set_package_properties(GMP PROPERTIES + URL "https://gmplib.org/" +) + +if(PC_GMP_VERSION) + set_package_properties(GMP PROPERTIES + DESCRIPTION "The GNU Multiple Precision Arithmetic Library (found: v.${PC_GMP_VERSION})" + ) +else() + set_package_properties(GMP PROPERTIES + DESCRIPTION "The GNU Multiple Precision Arithmetic Library" + ) +endif() + +mark_as_advanced(GMPXX_LIBRARY GMP_LIBRARY GMP_INCLUDE_DIR) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 9855ddc29..cfaf51764 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -12,6 +12,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -105,36 +109,7 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE) HINTS ${PC_LIBDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}}) endforeach() @@ -314,35 +289,7 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99) HINTS ${PC_GNURADIO_IIO_LIBDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(GNURADIO_IIO_LIBRARIES) diff --git a/cmake/Modules/FindGRIIO.cmake b/cmake/Modules/FindGRIIO.cmake index 1abd5caf4..6a4352fc0 100644 --- a/cmake/Modules/FindGRIIO.cmake +++ b/cmake/Modules/FindGRIIO.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(IIO_LIBRARIES HINTS ${PC_IIO_LIBDIR} PATHS ${GRIIO_ROOT_USER_DEFINED}/lib ${GRIIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGRLIMESDR.cmake b/cmake/Modules/FindGRLIMESDR.cmake index 2fb60cb3f..a0ca9a565 100644 --- a/cmake/Modules/FindGRLIMESDR.cmake +++ b/cmake/Modules/FindGRLIMESDR.cmake @@ -31,6 +31,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(GRLIMESDR_LIBRARIES PATHS ${GRLIMESDR_ROOT_USER_DEFINED}/lib ${GRLIMESDR_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGROSMOSDR.cmake b/cmake/Modules/FindGROSMOSDR.cmake index 22ee7d51e..15a36c32b 100644 --- a/cmake/Modules/FindGROSMOSDR.cmake +++ b/cmake/Modules/FindGROSMOSDR.cmake @@ -31,6 +31,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -70,36 +74,7 @@ find_library(GROSMOSDR_LIBRARIES PATHS ${GROSMOSDR_ROOT_USER_DEFINED}/lib ${GROSMOSDR_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindLIBAD9361.cmake b/cmake/Modules/FindLIBAD9361.cmake index e1ff8e4a3..175a81af2 100644 --- a/cmake/Modules/FindLIBAD9361.cmake +++ b/cmake/Modules/FindLIBAD9361.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -49,36 +53,7 @@ find_library(LIBAD9361_LIBRARIES HINTS ${PC_LIBAD9361_LIBDIR} PATHS ${LIBAD9361_ROOT_USER_DEFINED}/lib ${LIBAD9361_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} /Library/Frameworks/ad9361.framework ) diff --git a/cmake/Modules/FindLIBIIO.cmake b/cmake/Modules/FindLIBIIO.cmake index 44f4d367e..add9215de 100644 --- a/cmake/Modules/FindLIBIIO.cmake +++ b/cmake/Modules/FindLIBIIO.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -51,36 +55,7 @@ find_library( HINTS ${PC_LIBIIO_LIBDIR} PATHS ${LIBIIO_ROOT_USER_DEFINED}/lib ${LIBIIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} /Library/Frameworks/iio.framework/ ) diff --git a/cmake/Modules/FindLIBUNWIND.cmake b/cmake/Modules/FindLIBUNWIND.cmake index f2c88b569..b5c6a68a8 100644 --- a/cmake/Modules/FindLIBUNWIND.cmake +++ b/cmake/Modules/FindLIBUNWIND.cmake @@ -17,6 +17,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h @@ -41,6 +45,7 @@ find_library(LIBUNWIND_GENERIC_LIBRARY PATHS "${LIBUNWIND_ROOT}/lib" "${LIBUNWIND_ROOT}/lib64" + ${GNSSSDR_LIB_PATHS} ) if(LIBUNWIND_INCLUDE_DIR) diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 95a14cf62..f351ebf3a 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -19,6 +19,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -74,35 +78,7 @@ find_library(LOG4CPP_LIBRARY HINTS ${PC_LOG4CPP_LIBDIR} PATHS ${LOG4CPP_ROOT_USER_PROVIDED}/lib ${LOG4CPP_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY) diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake index d9a6cebd2..73f8d053d 100644 --- a/cmake/Modules/FindMATIO.cmake +++ b/cmake/Modules/FindMATIO.cmake @@ -55,6 +55,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT MATIO_ROOT) set(MATIO_ROOT_USER_DEFINED /usr) else() @@ -85,33 +89,7 @@ find_library(MATIO_LIBRARY PATHS ${MATIO_ROOT_USER_DEFINED}/lib ${MATIO_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib DOC "The MATIO library" ) diff --git a/cmake/Modules/FindORC.cmake b/cmake/Modules/FindORC.cmake index b6a4ba364..600d0ac35 100644 --- a/cmake/Modules/FindORC.cmake +++ b/cmake/Modules/FindORC.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -65,26 +69,7 @@ find_path(ORC_LIBRARY_DIR ${ORC_ROOT_USER_PROVIDED}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(ORC_LIB orc-0.4 @@ -93,26 +78,7 @@ find_library(ORC_LIB orc-0.4 ${ORC_ROOT_USER_PROVIDED}/lib64 ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STATIC_LIBRARY_SUFFIX} diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index 39a7aff15..2a3db3aff 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -23,6 +23,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -88,33 +92,7 @@ else() ${PC_PCAP_LIBDIR} PATHS ${PCAP_ROOT_USER_PROVIDED}/lib - /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) endif() diff --git a/cmake/Modules/FindPUGIXML.cmake b/cmake/Modules/FindPUGIXML.cmake index 5f7f5dcb2..4ff6419cc 100644 --- a/cmake/Modules/FindPUGIXML.cmake +++ b/cmake/Modules/FindPUGIXML.cmake @@ -20,6 +20,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -66,36 +70,9 @@ find_library(PUGIXML_LIBRARY ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-${PC_PUGIXML_VERSION} ${PUGIXML_ROOT_USER_DEFINED}}/lib/pugixml-1.9 ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-1.9 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/i386-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 + ${GNSSSDR_LIB_PATHS} /usr/local/lib/pugixml-${PC_PUGIXML_VERSION} /usr/local/lib/pugixml-1.9 - /opt/local/lib ) # Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found. diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index a6ed654a3..d30313535 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -16,6 +16,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -60,36 +64,7 @@ find_library(UHD_LIBRARIES HINTS ${PC_UHD_LIBDIR} PATHS ${UHD_ROOT_USER_PROVIDED}/lib ${UHD_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindVOLK.cmake b/cmake/Modules/FindVOLK.cmake index bda662186..2247f8247 100644 --- a/cmake/Modules/FindVOLK.cmake +++ b/cmake/Modules/FindVOLK.cmake @@ -16,6 +16,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -58,35 +62,7 @@ find_library(VOLK_LIBRARIES HINTS ${PC_VOLK_LIBDIR} PATHS ${VOLK_ROOT_USER_PROVIDED}/lib ${VOLK_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindZEROMQ.cmake b/cmake/Modules/FindZEROMQ.cmake index 6579d9ed7..d42a68d2d 100644 --- a/cmake/Modules/FindZEROMQ.cmake +++ b/cmake/Modules/FindZEROMQ.cmake @@ -13,6 +13,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() + if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() @@ -29,33 +33,7 @@ find_path(ZEROMQ_INCLUDE_DIRS find_library(ZEROMQ_LIBRARIES NAMES zmq libzmq.so.5 ${ZEROMQ_LIBRARY_NAME} HINTS ${PC_ZEROMQ_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 - PATHS /usr/lib - /usr/lib64 - /usr/lib/alpha-linux-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnssSdrCrypto.cmake index ac84260d1..a9d89e6be 100644 --- a/cmake/Modules/GnssSdrCrypto.cmake +++ b/cmake/Modules/GnssSdrCrypto.cmake @@ -4,6 +4,13 @@ # SPDX-FileCopyrightText: 2024 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause +if(NOT COMMAND feature_summary) + include(FeatureSummary) +endif() + +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrLibPaths) +endif() ################################################################################ # OpenSSL https://www.openssl.org/ @@ -53,38 +60,7 @@ else() endif() find_library(GNUTLS_OPENSSL_LIBRARY NAMES gnutls-openssl libgnutls-openssl.so.27 - PATHS - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/aarch64-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/i386-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/i386-gnu - /usr/lib/i686-gnu - /usr/lib/i686-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i686-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/sh4-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS ${GNSSSDR_LIB_PATHS} ) find_path(GNUTLS_INCLUDE_DIR NAMES gnutls/gnutls.h @@ -137,9 +113,7 @@ else() find_package(GMP) set_package_properties(GMP PROPERTIES - URL "https://gmplib.org/" PURPOSE "Required to decompress cryptographic keys." - DESCRIPTION "The GNU Multiple Precision Arithmetic Library" TYPE REQUIRED ) if(NOT GMP_FOUND) diff --git a/cmake/Modules/GnsssdrLibPaths.cmake b/cmake/Modules/GnsssdrLibPaths.cmake new file mode 100644 index 000000000..9f76e362f --- /dev/null +++ b/cmake/Modules/GnsssdrLibPaths.cmake @@ -0,0 +1,43 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(GNSSSDR_LIB_PATHS) + return() +endif() + +set(GNSSSDR_LIB_PATHS + /usr/lib + /usr/lib/aarch64-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/i386-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/i386-linux-gnu + /usr/lib/loongarch64-linux-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/lib64 + /usr/local/lib + /usr/local/lib/i386 + /usr/local/lib64 + /opt/local/lib +) From 1dec33dbf591455e021dd4efd4fa1a5c11a1922d Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Aug 2024 18:45:03 +0200 Subject: [PATCH 296/499] Clang Tidy fixes --- src/core/libs/osnma_msg_receiver.cc | 5 +- src/core/system_parameters/gnss_crypto.cc | 5 +- src/core/system_parameters/osnma_data.cc | 2 +- src/core/system_parameters/osnma_data.h | 2 +- src/core/system_parameters/osnma_helper.h | 1 - .../osnma_nav_data_manager.cc | 53 ++++++++++--------- .../osnma_nav_data_manager.h | 4 +- 7 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 7035a9e08..4f984143f 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1013,7 +1013,6 @@ void osnma_msg_receiver::process_mack_message() LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed, " << "no Kroot nor TESLA key available."; return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. - } // verify tesla key and add it to the container of verified keys if successful if (d_tesla_keys.find(d_osnma_data.d_nav_data.get_tow_sf0()) == d_tesla_keys.end()) // check if already available => no need to verify @@ -1925,9 +1924,9 @@ void osnma_msg_receiver::send_data_to_pvt(std::vector data) { if (!data.empty()) { - for (size_t i = 0; i < data.size(); i++) + for (auto & i : data) { - const auto tmp_obj = std::make_shared(data[i]); + const auto tmp_obj = std::make_shared(i); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj)); } } diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 4faa8a30a..a4f40a3e4 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -897,8 +897,9 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) param_bld = OSSL_PARAM_BLD_new(); if (param_bld != nullptr && OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) && - OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) + OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) { params = OSSL_PARAM_BLD_to_param(param_bld); + } ctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr); if (ctx == nullptr || params == nullptr || EVP_PKEY_fromdata_init(ctx) <= 0 || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0) @@ -1192,7 +1193,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) // store the key type - needed for the Kroot in case no DSM-PKR available // TODO - only way I have found to find the curve type - auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey); + const auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey); const EC_GROUP *group = EC_KEY_get0_group(ec_key); int nid = EC_GROUP_get_curve_name(group); if (nid == NID_X9_62_prime256v1) { diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index d19a30cab..6d969a7f0 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -19,7 +19,7 @@ uint32_t Tag::id_counter = 0; uint32_t OSNMA_NavData::id_counter = 0; -bool OSNMA_NavData::add_nav_data(std::string nav_data) +bool OSNMA_NavData::add_nav_data(const std::string& nav_data) { if (nav_data.size() == 549) { diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 46b54dcfe..052a23921 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -129,7 +129,7 @@ class OSNMA_NavData public: OSNMA_NavData(): nav_data_id(id_counter++){} bool have_this_bits(std::string nav_data); - bool add_nav_data(std::string nav_data); + bool add_nav_data(const std::string& nav_data); void update_last_received_timestamp(uint32_t TOW); const uint32_t nav_data_id; uint32_t verified_bits{0}; diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index ea4e81313..703a4fd0d 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -39,7 +39,6 @@ public: std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; - }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/system_parameters/osnma_nav_data_manager.cc index 5b42e799d..13aa96084 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.cc +++ b/src/core/system_parameters/osnma_nav_data_manager.cc @@ -29,7 +29,7 @@ * @param PRNd The satellite ID. * @param TOW The TOW of the received data. */ -void OSNMA_nav_data_Manager::add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) +void OSNMA_nav_data_Manager::add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { if (not have_nav_data(nav_bits, PRNd, TOW)) { @@ -52,18 +52,18 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& if (have_PRNd_nav_data(tag.second.PRN_d)) { std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { std::string nav_data; if (tag.second.ADKD == 0 || tag.second.ADKD == 12){ - nav_data = tow_it->second.get_ephemeris_data(); + nav_data = tow_it.second.get_ephemeris_data(); } else if (tag.second.ADKD == 4){ - nav_data = tow_it->second.get_utc_data(); + nav_data = tow_it.second.get_utc_data(); } // find associated OSNMA_NavData if (tag.second.nav_data == nav_data){ - _satellite_nav_data[tag.second.PRN_d][tow_it->first].verified_bits += tag_size; + _satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; } } } @@ -99,7 +99,7 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t if (it != _satellite_nav_data.cend()) { const auto it2 = it->second.find(TOW); - if (it2 != it->second.cend() && it->second[TOW].get_ephemeris_data() != "") + if (it2 != it->second.cend() && !it->second[TOW].get_ephemeris_data().empty()) { return true; } @@ -111,7 +111,7 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t if (it != _satellite_nav_data.cend()) { const auto it2 = it->second.find(TOW); - if (it2 != it->second.cend() && it->second[TOW].get_utc_data() != "") + if (it2 != it->second.cend() && !it->second[TOW].get_utc_data().empty()) { return true; } @@ -140,13 +140,13 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) { if (tag.ADKD == 0 || tag.ADKD == 12) { - if (tow_it->second.get_ephemeris_data() != ""){ + if (!tow_it->second.get_ephemeris_data().empty()){ return tow_it->second.get_ephemeris_data(); } } else if(tag.ADKD == 4) { - if (tow_it->second.get_utc_data() != ""){ + if (!tow_it->second.get_utc_data().empty()){ return tow_it->second.get_utc_data(); } } @@ -161,7 +161,7 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) * @param PRNd * @return */ -bool OSNMA_nav_data_Manager::have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) +bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ for (auto& data_timestamp : _satellite_nav_data[PRNd]) @@ -202,13 +202,13 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const { if (t.ADKD == 0 || t.ADKD == 12) { - if (tow_it->second.get_ephemeris_data() != ""){ + if (!tow_it->second.get_ephemeris_data().empty()){ return true; } } else if (t.ADKD == 4) { - if (tow_it->second.get_utc_data() != ""){ + if (!tow_it->second.get_utc_data().empty()){ return true; } } @@ -220,19 +220,20 @@ void OSNMA_nav_data_Manager::print_status() { for (const auto& satellite : _satellite_nav_data){ LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first; - auto& tow_data = satellite.second; - for (const auto& nav_data : tow_data) - LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase - << std::bitset<10>(nav_data.second.IOD_nav) - << ", TOW_start=" - << nav_data.second.get_tow_sf0() - << ", TOW_last=" - << nav_data.second.last_received_TOW - << ", l_t=" - << nav_data.second.verified_bits - << ", PRNd=" - << nav_data.second.PRNd - << ", verified=" - << nav_data.second.verified; + const auto& tow_data = satellite.second; + for (const auto& nav_data : tow_data) { + LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase + << std::bitset<10>(nav_data.second.IOD_nav) + << ", TOW_start=" + << nav_data.second.get_tow_sf0() + << ", TOW_last=" + << nav_data.second.last_received_TOW + << ", l_t=" + << nav_data.second.verified_bits + << ", PRNd=" + << nav_data.second.PRNd + << ", verified=" + << nav_data.second.verified; + } } } diff --git a/src/core/system_parameters/osnma_nav_data_manager.h b/src/core/system_parameters/osnma_nav_data_manager.h index 2101bef3a..98b3d523f 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.h +++ b/src/core/system_parameters/osnma_nav_data_manager.h @@ -32,10 +32,10 @@ class OSNMA_nav_data_Manager{ public: OSNMA_nav_data_Manager() = default; - bool have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); + bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); bool have_nav_data(const Tag& t) const; - void add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list + void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list std::string get_navigation_data(const Tag& t); void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); From 960e76e3a01551e6002aa74ef6b281f5403514f3 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 1 Aug 2024 18:45:03 +0200 Subject: [PATCH 297/499] Clang Tidy fixes --- src/core/libs/osnma_msg_receiver.cc | 7 +- src/core/libs/osnma_msg_receiver.h | 2 +- src/core/system_parameters/gnss_crypto.cc | 5 +- src/core/system_parameters/osnma_data.cc | 2 +- src/core/system_parameters/osnma_data.h | 2 +- src/core/system_parameters/osnma_helper.h | 1 - .../osnma_nav_data_manager.cc | 65 ++++++++++--------- .../osnma_nav_data_manager.h | 4 +- 8 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 7035a9e08..380d917f4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1013,7 +1013,6 @@ void osnma_msg_receiver::process_mack_message() LOG(WARNING) << "Galileo OSNMA: MACK cannot be processed, " << "no Kroot nor TESLA key available."; return; // early return, cannot proceed further without one of the two verified. this equals to having Kroot but no TESLa key yet. - } // verify tesla key and add it to the container of verified keys if successful if (d_tesla_keys.find(d_osnma_data.d_nav_data.get_tow_sf0()) == d_tesla_keys.end()) // check if already available => no need to verify @@ -1921,13 +1920,13 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ } } -void osnma_msg_receiver::send_data_to_pvt(std::vector data) +void osnma_msg_receiver::send_data_to_pvt(const std::vector& data) { if (!data.empty()) { - for (size_t i = 0; i < data.size(); i++) + for (auto & i : data) { - const auto tmp_obj = std::make_shared(data[i]); + const auto tmp_obj = std::make_shared(i); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj)); } } diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index fb83f2b8c..59d98e04a 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -82,7 +82,7 @@ private: void remove_verified_tags(); void control_tags_awaiting_verify_size(); void display_data(); - void send_data_to_pvt(std::vector); + void send_data_to_pvt(const std::vector& data); bool verify_tesla_key(std::vector& key, uint32_t TOW); bool verify_tag(Tag& tag) const; diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 4faa8a30a..e2c88faa4 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -897,8 +897,9 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) param_bld = OSSL_PARAM_BLD_new(); if (param_bld != nullptr && OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) && - OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) + OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) { params = OSSL_PARAM_BLD_to_param(param_bld); + } ctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr); if (ctx == nullptr || params == nullptr || EVP_PKEY_fromdata_init(ctx) <= 0 || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0) @@ -1192,7 +1193,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) // store the key type - needed for the Kroot in case no DSM-PKR available // TODO - only way I have found to find the curve type - auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey); + const auto *const ec_key = EVP_PKEY_get0_EC_KEY(pubkey); const EC_GROUP *group = EC_KEY_get0_group(ec_key); int nid = EC_GROUP_get_curve_name(group); if (nid == NID_X9_62_prime256v1) { diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index d19a30cab..6d969a7f0 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -19,7 +19,7 @@ uint32_t Tag::id_counter = 0; uint32_t OSNMA_NavData::id_counter = 0; -bool OSNMA_NavData::add_nav_data(std::string nav_data) +bool OSNMA_NavData::add_nav_data(const std::string& nav_data) { if (nav_data.size() == 549) { diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 46b54dcfe..052a23921 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -129,7 +129,7 @@ class OSNMA_NavData public: OSNMA_NavData(): nav_data_id(id_counter++){} bool have_this_bits(std::string nav_data); - bool add_nav_data(std::string nav_data); + bool add_nav_data(const std::string& nav_data); void update_last_received_timestamp(uint32_t TOW); const uint32_t nav_data_id; uint32_t verified_bits{0}; diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index ea4e81313..703a4fd0d 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -39,7 +39,6 @@ public: std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; - }; #endif // GNSS_SDR_OSNMA_HELPER_H diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/system_parameters/osnma_nav_data_manager.cc index 5b42e799d..8fdd9ee6e 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.cc +++ b/src/core/system_parameters/osnma_nav_data_manager.cc @@ -29,7 +29,7 @@ * @param PRNd The satellite ID. * @param TOW The TOW of the received data. */ -void OSNMA_nav_data_Manager::add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) +void OSNMA_nav_data_Manager::add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { if (not have_nav_data(nav_bits, PRNd, TOW)) { @@ -52,18 +52,18 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& if (have_PRNd_nav_data(tag.second.PRN_d)) { std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { std::string nav_data; if (tag.second.ADKD == 0 || tag.second.ADKD == 12){ - nav_data = tow_it->second.get_ephemeris_data(); + nav_data = tow_it.second.get_ephemeris_data(); } else if (tag.second.ADKD == 4){ - nav_data = tow_it->second.get_utc_data(); + nav_data = tow_it.second.get_utc_data(); } // find associated OSNMA_NavData if (tag.second.nav_data == nav_data){ - _satellite_nav_data[tag.second.PRN_d][tow_it->first].verified_bits += tag_size; + _satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; } } } @@ -99,7 +99,7 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t if (it != _satellite_nav_data.cend()) { const auto it2 = it->second.find(TOW); - if (it2 != it->second.cend() && it->second[TOW].get_ephemeris_data() != "") + if (it2 != it->second.cend() && !it->second[TOW].get_ephemeris_data().empty()) { return true; } @@ -111,7 +111,7 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t if (it != _satellite_nav_data.cend()) { const auto it2 = it->second.find(TOW); - if (it2 != it->second.cend() && it->second[TOW].get_utc_data() != "") + if (it2 != it->second.cend() && !it->second[TOW].get_utc_data().empty()) { return true; } @@ -133,21 +133,21 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition - if ((tag.TOW - 30 * tag.cop) <= tow_it->first && tow_it->first <= tag.TOW - 30) + if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30) { if (tag.ADKD == 0 || tag.ADKD == 12) { - if (tow_it->second.get_ephemeris_data() != ""){ - return tow_it->second.get_ephemeris_data(); + if (!tow_it.second.get_ephemeris_data().empty()){ + return tow_it.second.get_ephemeris_data(); } } else if(tag.ADKD == 4) { - if (tow_it->second.get_utc_data() != ""){ - return tow_it->second.get_utc_data(); + if (!tow_it.second.get_utc_data().empty()){ + return tow_it.second.get_utc_data(); } } } @@ -161,7 +161,7 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) * @param PRNd * @return */ -bool OSNMA_nav_data_Manager::have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW) +bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ for (auto& data_timestamp : _satellite_nav_data[PRNd]) @@ -195,20 +195,20 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const } // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto tow_it = tow_map.begin(); tow_it != tow_map.end(); ++tow_it) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition - if (t.TOW - 30 * t.cop <= tow_it->first && tow_it->first <= t.TOW - 30) + if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30) { if (t.ADKD == 0 || t.ADKD == 12) { - if (tow_it->second.get_ephemeris_data() != ""){ + if (!tow_it.second.get_ephemeris_data().empty()){ return true; } } else if (t.ADKD == 4) { - if (tow_it->second.get_utc_data() != ""){ + if (!tow_it.second.get_utc_data().empty()){ return true; } } @@ -220,19 +220,20 @@ void OSNMA_nav_data_Manager::print_status() { for (const auto& satellite : _satellite_nav_data){ LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first; - auto& tow_data = satellite.second; - for (const auto& nav_data : tow_data) - LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase - << std::bitset<10>(nav_data.second.IOD_nav) - << ", TOW_start=" - << nav_data.second.get_tow_sf0() - << ", TOW_last=" - << nav_data.second.last_received_TOW - << ", l_t=" - << nav_data.second.verified_bits - << ", PRNd=" - << nav_data.second.PRNd - << ", verified=" - << nav_data.second.verified; + const auto& tow_data = satellite.second; + for (const auto& nav_data : tow_data) { + LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase + << std::bitset<10>(nav_data.second.IOD_nav) + << ", TOW_start=" + << nav_data.second.get_tow_sf0() + << ", TOW_last=" + << nav_data.second.last_received_TOW + << ", l_t=" + << nav_data.second.verified_bits + << ", PRNd=" + << nav_data.second.PRNd + << ", verified=" + << nav_data.second.verified; + } } } diff --git a/src/core/system_parameters/osnma_nav_data_manager.h b/src/core/system_parameters/osnma_nav_data_manager.h index 2101bef3a..98b3d523f 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.h +++ b/src/core/system_parameters/osnma_nav_data_manager.h @@ -32,10 +32,10 @@ class OSNMA_nav_data_Manager{ public: OSNMA_nav_data_Manager() = default; - bool have_nav_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); + bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); bool have_nav_data(const Tag& t) const; - void add_navigation_data(std::string nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list + void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list std::string get_navigation_data(const Tag& t); void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); From 6beb92278f562466e270c65981a5c14fdf7c7722 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 2 Aug 2024 09:38:37 +0200 Subject: [PATCH 298/499] Read type of public key (#16) * Clang Tidy fixes * Improve reading public key type * Update osnma_nav_data_manager.cc hotfix --------- Co-authored-by: cesaaargm --- src/core/libs/osnma_msg_receiver.cc | 133 ++++++---- src/core/system_parameters/gnss_crypto.cc | 247 +++++++++++++----- src/core/system_parameters/gnss_crypto.h | 11 +- .../osnma_nav_data_manager.cc | 32 ++- .../osnma/gnss_crypto_test.cc | 30 ++- 5 files changed, 307 insertions(+), 146 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 380d917f4..d5cb1fcaa 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -29,6 +29,7 @@ #include #include #include +#include // for std::ifstream and std::ofstream #include // for std::setfill #include // for std::hex, std::uppercase #include @@ -37,7 +38,6 @@ #include #include // for typeid #include -#include // for std::ifstream and std::ofstream #if USE_GLOG_AND_GFLAGS @@ -68,21 +68,23 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(0, 0, 0)) { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(crtFilePath, merkleFilePath); d_helper = std::make_unique(); d_nav_data_manager = std::make_unique(); - if(d_crypto->have_public_key()){ // Hot start is enabled + if (d_crypto->have_public_key()) + { // Hot start is enabled LOG(WARNING) << "OSNMA Public Key available, trying to find DSM-KROOT saved"; std::cout << "OSNMA Public Key available, trying to find DSM-KROOT saved" << std::endl; d_public_key_verified = true; auto dsm_nmah = parse_dsm_kroot(); - if (!dsm_nmah.first.empty()){ + if (!dsm_nmah.first.empty()) + { LOG(WARNING) << "OSNMA DSM-KROOT and NMA Header successfully read from file " << KROOTFILE_DEFAULT; std::cout << "OSNMA DSM-KROOT and NMA Header successfully read from file " << KROOTFILE_DEFAULT << std::endl; d_flag_hot_start = true; @@ -113,20 +115,22 @@ osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std #endif #endif std::chrono::time_point now; - if (d_flag_debug){ + if (d_flag_debug) + { // d_GST_Rx = d_helper->compute_gst(d_initial_debug_time); LOG(WARNING) << "Galileo OSNMA: Debug mode, time artificially set up."; std::cout << "Galileo OSNMA: Debug mode, time artificially set up." << std::endl; // TODO - need to synchronize time lapse with Gnss_Synchro? } - else{ + else + { d_GST_Rx = d_helper->compute_gst_now(); } d_WN = d_helper->get_WN(d_GST_Rx); d_TOW = d_helper->get_TOW(d_GST_Rx); - LOG(WARNING) << "Galileo OSNMA: initial receiver time GST=["<< d_WN << " " << d_TOW <<"]"; - std::cout << "Galileo OSNMA: initial receiver time GST=["<< d_WN << " " << d_TOW <<"]" << std::endl; + LOG(WARNING) << "Galileo OSNMA: initial receiver time GST=[" << d_WN << " " << d_TOW << "]"; + std::cout << "Galileo OSNMA: initial receiver time GST=[" << d_WN << " " << d_TOW << "]" << std::endl; } @@ -155,16 +159,20 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) // Receiver time update d_GST_SIS = d_helper->compute_gst(nma_msg->WN_sf0, nma_msg->TOW_sf0); - if (d_last_verified_key_GST == 0){ + if (d_last_verified_key_GST == 0) + { d_last_received_GST = d_GST_SIS; } - else if (d_GST_SIS > d_last_received_GST){ + else if (d_GST_SIS > d_last_received_GST) + { d_last_received_GST = d_GST_SIS; } - if (d_flag_debug){ + if (d_flag_debug) + { d_GST_Rx = d_last_received_GST; } - else{ + else + { d_GST_Rx = d_helper->compute_gst_now(); } LOG(INFO) << "Galileo OSNMA: Receiver Time GST=[" << d_helper->get_WN(d_GST_Rx) << " " << d_helper->get_TOW(d_GST_Rx) << "]"; @@ -198,7 +206,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } process_osnma_message(nma_msg); - } // OSNMA frame received + } // OSNMA frame received else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received { const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); @@ -231,26 +239,30 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { - if (d_flag_alert_message && (d_public_key_verified || d_kroot_verified)){ + if (d_flag_alert_message && (d_public_key_verified || d_kroot_verified)) + { return; } read_nma_header(osnma_msg->hkroot[0]); // Check for corner cases: renewal, revocation, alert message - if (d_osnma_data.d_nma_header.nmas == 0 /* RES */){ + if (d_osnma_data.d_nma_header.nmas == 0 /* RES */) + { LOG(WARNING) << "Galileo OSNMA: NMAS invalid (RES), skipping osnma message"; return; } // TODO - trusting the NMAS and CPKS shall be done upon PKR verification or Tag verification. // It's ok to activate the flags, but the final decision should happen after verifying it. // For OAM is solved, but NPK and PKREV I think not yet - if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 4 /* NPK */ && d_GST_PKR_PKREV_start == 0){ + if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 4 /* NPK */ && d_GST_PKR_PKREV_start == 0) + { d_flag_PK_renewal = true; d_GST_PKR_PKREV_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; std::cout << "Galileo OSNMA: Public Key Renewal :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; } - if (d_flag_PK_renewal && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */ ){ + if (d_flag_PK_renewal && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */) + { d_flag_PK_renewal = false; uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600; @@ -258,7 +270,8 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& std::cout << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << duration_hours << ", Duration=" << duration_hours << " h" << std::endl; } - if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 5 /* PKREV */ && d_GST_PKR_PKREV_start == 0){ + if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 5 /* PKREV */ && d_GST_PKR_PKREV_start == 0) + { d_flag_PK_revocation = true; d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; d_public_key_verified = false; @@ -268,16 +281,20 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; std::cout << "Galileo OSNMA: Public Key Revocation :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; } - if (d_flag_PK_revocation && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */ ){ + if (d_flag_PK_revocation && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */) + { // step 2 , start using new chain d_flag_PK_revocation = false; uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600; - LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << ", Duration=" << duration_hours << "h"; - std::cout << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << ", Duration=" << duration_hours << "h" << std::endl; + LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" + << ", Duration=" << duration_hours << "h"; + std::cout << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" + << ", Duration=" << duration_hours << "h" << std::endl; } - if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 7 /* AM */ && d_GST_PKR_AM_start == 0){ + if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 7 /* AM */ && d_GST_PKR_AM_start == 0) + { d_flag_alert_message = true; d_GST_PKR_AM_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); d_public_key_verified = false; @@ -289,7 +306,8 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 - if (d_osnma_data.d_dsm_kroot_message.towh_k != 0){ + if (d_osnma_data.d_dsm_kroot_message.towh_k != 0) + { d_GST_0 = d_helper->compute_gst(d_osnma_data.d_dsm_kroot_message.wn_k, d_osnma_data.d_dsm_kroot_message.towh_k * 3600); d_GST_Sf = d_GST_0 + 30 * std::floor((d_GST_SIS - d_GST_0) / 30); // Eq. 3 R.G. } @@ -474,7 +492,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, l_lk_bytes); // DS field uint16_t l_ds_bits = 0; - const auto it = OSNMA_TABLE_15.find(d_crypto->d_PublicKeyType); + const auto it = OSNMA_TABLE_15.find(d_crypto->get_public_key_type()); if (it != OSNMA_TABLE_15.cend()) { l_ds_bits = it->second; @@ -507,12 +525,12 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg const uint16_t size_m = 13 + l_lk_bytes; std::vector MSG; MSG.reserve(size_m + l_ds_bytes + 1); - MSG.push_back(nma_header); // NMA header + MSG.push_back(nma_header); // NMA header for (uint16_t i = 1; i < size_m; i++) { MSG.push_back(dsm_msg[i]); } - std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 + std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 for (uint16_t k = 0; k < l_ds_bytes; k++) { MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); @@ -549,7 +567,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // local_time_verification(osnma_msg); // FIXME TODO: real time verification needed // If new PK verified and the new KROOT arrived, set the new PK before attempting verification - if(d_flag_PK_renewal && d_osnma_data.d_dsm_kroot_message.pkid == d_new_public_key_id && d_flag_NPK_set == false){ + if (d_flag_PK_renewal && d_osnma_data.d_dsm_kroot_message.pkid == d_new_public_key_id && d_flag_NPK_set == false) + { d_crypto->set_public_key(d_new_public_key); d_crypto->store_public_key(PEMFILE_DEFAULT); d_flag_NPK_set = true; @@ -566,7 +585,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { std::cout << "Galileo OSNMA: DSM-KROOT authentication successful!" << std::endl; LOG(INFO) << "Galileo OSNMA: DSM-KROOT authentication successful!"; - if (d_flag_alert_message){ + if (d_flag_alert_message) + { LOG(WARNING) << "Galileo OSNMA: DSM-KROOT :: Alert message verification :: SUCCESS. "; } else @@ -576,7 +596,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg << "Chain and Public Key Status is " << d_dsm_reader->get_cpks_status(d_osnma_data.d_nma_header.cpks); } // Save DSM-Kroot and NMA header into a permanent storage - if (d_flag_hot_start){ + if (d_flag_hot_start) + { d_flag_hot_start = false; return; } @@ -586,10 +607,11 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(WARNING) << "Galileo OSNMA: DSM-KROOT authentication failed."; std::cerr << "Galileo OSNMA: DSM-KROOT authentication failed." << std::endl; - if (d_flag_alert_message){ + if (d_flag_alert_message) + { d_flag_alert_message = false; } - d_count_failed_Kroot ++; + d_count_failed_Kroot++; } } else @@ -613,7 +635,8 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } d_osnma_data.d_dsm_pkr_message.npkt = d_dsm_reader->get_npkt(dsm_msg); uint8_t npktid = d_dsm_reader->get_npktid(dsm_msg); - if (d_flag_PK_renewal && npktid > d_osnma_data.d_dsm_pkr_message.npktid){ + if (d_flag_PK_renewal && npktid > d_osnma_data.d_dsm_pkr_message.npktid) + { d_new_public_key_id = npktid; } d_osnma_data.d_dsm_pkr_message.npktid = npktid; @@ -668,15 +691,18 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(INFO) << "Galileo OSNMA: DSM-PKR verification :: SUCCESS"; d_public_key_verified = true; - if (d_flag_PK_renewal){ + if (d_flag_PK_renewal) + { d_new_public_key = d_osnma_data.d_dsm_pkr_message.npk; } - else if (d_flag_alert_message){ + else if (d_flag_alert_message) + { LOG(WARNING) << "Galileo OSNMA: DSM-PKR verification :: Alert message verification :: SUCCESS. OSNMA disabled. Contact Galileo Service Centre"; std::cout << "Galileo OSNMA: DSM-PKR verification :: Alert message verification :: SUCCESS. OSNMA disabled. Contact Galileo Service Centre" << std::endl; } - else{ - d_crypto->d_PublicKeyType = PKT; + else + { + d_crypto->set_public_key_type(PKT); d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk); d_crypto->store_public_key(PEMFILE_DEFAULT); } @@ -685,8 +711,9 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg { LOG(ERROR) << "Galileo OSNMA: DSM-PKR verification :: FAILURE"; d_public_key_verified = false; - d_count_failed_pubKey ++; - if (d_flag_alert_message){ + d_count_failed_pubKey++; + if (d_flag_alert_message) + { d_flag_alert_message = false; // disregard message as its authenticity could not be verified. } } @@ -724,9 +751,10 @@ void osnma_msg_receiver::read_and_process_mack_block(const std::shared_ptrTOW_sf0); bool can_process_mack_block = (d_osnma_data.d_nma_header.nmas != 3 && d_kroot_verified) || // NMAS different than DU (d_osnma_data.d_nma_header.nmas == 3 && !d_kroot_verified); // NMAS is DU, but must be disregarded - bool can_verify_tesla_key = d_kroot_verified || d_tesla_key_verified; // Either of those suffices for verifying the incoming TESLA key - bool can_parse_tag_fields = d_osnma_data.d_dsm_kroot_message.ts != 0; // calculating the number of tags is based on the TS of the DSM-KROOT. - if (can_verify_tesla_key && can_parse_tag_fields && can_process_mack_block){ + bool can_verify_tesla_key = d_kroot_verified || d_tesla_key_verified; // Either of those suffices for verifying the incoming TESLA key + bool can_parse_tag_fields = d_osnma_data.d_dsm_kroot_message.ts != 0; // calculating the number of tags is based on the TS of the DSM-KROOT. + if (can_verify_tesla_key && can_parse_tag_fields && can_process_mack_block) + { read_mack_header(); d_osnma_data.d_mack_message.PRNa = osnma_msg->PRN; // FIXME this is ugly. d_osnma_data.d_mack_message.TOW = osnma_msg->TOW_sf0; @@ -1617,8 +1645,8 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) return true; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag m[1] = static_cast((GST_SFi & 0xFF000000) >> 24); m[2] = static_cast((GST_SFi & 0x00FF0000) >> 16); m[3] = static_cast((GST_SFi & 0x0000FF00) >> 8); @@ -1863,7 +1891,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ LOG(WARNING) << "Galileo OSNMA: MACSEQ verification :: FAILURE :: ADKD mismatch against MAC Look-up table for Tag=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase << mack.tag_and_info[i].tag << std::dec; - d_count_failed_macseq ++; + d_count_failed_macseq++; } } @@ -1873,8 +1901,8 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ return verified_tags; } // Fixed as well as FLX Tags share first part - Eq. 22 ICD - std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag + std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag m[1] = static_cast((GST_Sfi & 0xFF000000) >> 24); m[2] = static_cast((GST_Sfi & 0x00FF0000) >> 16); m[3] = static_cast((GST_Sfi & 0x0000FF00) >> 8); @@ -1924,7 +1952,7 @@ void osnma_msg_receiver::send_data_to_pvt(const std::vector& data { if (!data.empty()) { - for (auto & i : data) + for (auto& i : data) { const auto tmp_obj = std::make_shared(i); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj)); @@ -1936,7 +1964,8 @@ bool osnma_msg_receiver::store_dsm_kroot(const std::vector& dsm, const { std::ofstream file(KROOTFILE_DEFAULT, std::ios::binary | std::ios::out); - if (!file.is_open()) { + if (!file.is_open()) + { return false; } @@ -1952,7 +1981,8 @@ bool osnma_msg_receiver::store_dsm_kroot(const std::vector& dsm, const std::pair, uint8_t> osnma_msg_receiver::parse_dsm_kroot() const { std::ifstream file(KROOTFILE_DEFAULT, std::ios::binary | std::ios::in); - if (!file) { + if (!file) + { return {std::vector(), 0}; } @@ -1965,7 +1995,8 @@ std::pair, uint8_t> osnma_msg_receiver::parse_dsm_kroot() c file.close(); - if (file.bad()) { + if (file.bad()) + { return {std::vector(), 0}; } diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index e2c88faa4..ac8723ab5 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -124,6 +124,7 @@ Gnss_Crypto::~Gnss_Crypto() #endif } + bool Gnss_Crypto::have_public_key() const { #if USE_GNUTLS_FALLBACK @@ -133,6 +134,7 @@ bool Gnss_Crypto::have_public_key() const #endif } + bool Gnss_Crypto::store_public_key(const std::string& pubKeyFilePath) const { if (!have_public_key()) @@ -782,63 +784,6 @@ std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k return output; } -// TODO - deprecate: change return type to respective key type, PEM is not needed. -std::vector Gnss_Crypto::get_public_key() const -{ - if (!have_public_key()) - { - return {}; - } -#if USE_GNUTLS_FALLBACK - gnutls_datum_t pem_data = {nullptr, 0}; -#if HAVE_GNUTLS_PUBKEY_EXPORT2 - int ret = gnutls_pubkey_export2(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data); -#else - size_t output_stata_size; - int ret = gnutls_pubkey_export(d_PublicKey, GNUTLS_X509_FMT_PEM, &pem_data, &output_stata_size); -#endif - if (ret != GNUTLS_E_SUCCESS) - { - LOG(WARNING) << "GnuTLS: Failed to export public key to PEM format."; - return {}; - } - std::vector output(pem_data.data, pem_data.data + pem_data.size); - - // Free the allocated memory by gnutls_pubkey_export2 - gnutls_free(pem_data.data); -#else // OpenSSL - // Create a BIO for the memory buffer - BIO* mem = BIO_new(BIO_s_mem()); - if (!mem) - { - LOG(WARNING) << "OpenSSL: Failed to create BIO."; - return {}; - } -#if USE_OPENSSL_3 - if (!PEM_write_bio_PUBKEY(mem, d_PublicKey)) -#else // OpenSSL 1.x - if (!PEM_write_bio_EC_PUBKEY(mem, d_PublicKey)) -#endif - { - BIO_free(mem); - LOG(WARNING) << "OpenSSL: Failed to write public key to PEM format."; - return {}; - } - - // Get the length of the data in the BIO - BUF_MEM* mem_ptr; - BIO_get_mem_ptr(mem, &mem_ptr); - - // Copy the data from the BIO to a std::vector - std::vector output(mem_ptr->length); - memcpy(output.data(), mem_ptr->data, mem_ptr->length); - - // Clean up the BIO - BIO_free(mem); -#endif - return output; -} - std::vector Gnss_Crypto::get_merkle_root() const { @@ -846,8 +791,15 @@ std::vector Gnss_Crypto::get_merkle_root() const } +std::string Gnss_Crypto::get_public_key_type() const +{ + return d_PublicKeyType; +} + + void Gnss_Crypto::set_public_key(const std::vector& publicKey) { + d_PublicKeyType = "Unknown"; #if USE_GNUTLS_FALLBACK gnutls_pubkey_t pubkey{}; gnutls_ecc_curve_t curve; @@ -859,16 +811,19 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (size_pk == 33) { curve = GNUTLS_ECC_CURVE_SECP256R1; + d_PublicKeyType = "ECDSA P-256"; decompress_public_key_secp256r1(publicKey, x, y); } else if (size_pk == 67) { curve = GNUTLS_ECC_CURVE_SECP521R1; + d_PublicKeyType = "ECDSA P-521"; decompress_public_key_secp521r1(publicKey, x, y); } else { LOG(WARNING) << "GnuTLS: Invalid public key size"; + gnutls_pubkey_deinit(pubkey); return; } @@ -893,22 +848,41 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) EVP_PKEY_CTX* ctx = nullptr; OSSL_PARAM_BLD* param_bld; OSSL_PARAM* params = nullptr; + const size_t public_key_size = publicKey.size(); param_bld = OSSL_PARAM_BLD_new(); if (param_bld != nullptr && - OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", (publicKey.size() == 33) ? "prime256v1" : "secp521r1", 0) && - OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), publicKey.size())) { - params = OSSL_PARAM_BLD_to_param(param_bld); + OSSL_PARAM_BLD_push_utf8_string(param_bld, "group", (public_key_size == 33) ? "prime256v1" : "secp521r1", 0) && + OSSL_PARAM_BLD_push_octet_string(param_bld, "pub", publicKey.data(), public_key_size)) + { + params = OSSL_PARAM_BLD_to_param(param_bld); + } + + if (public_key_size == 33) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (public_key_size == 67) + { + d_PublicKeyType = "ECDSA P-521"; } ctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr); if (ctx == nullptr || params == nullptr || EVP_PKEY_fromdata_init(ctx) <= 0 || EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_PUBLIC_KEY, params) <= 0) { + EVP_PKEY_free(pkey); + EVP_PKEY_CTX_free(ctx); + OSSL_PARAM_free(params); + OSSL_PARAM_BLD_free(param_bld); return; } if (!pubkey_copy(pkey, &d_PublicKey)) { + EVP_PKEY_free(pkey); + EVP_PKEY_CTX_free(ctx); + OSSL_PARAM_free(params); + OSSL_PARAM_BLD_free(param_bld); return; } @@ -923,10 +897,12 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (publicKey.size() == 33) // ECDSA-P-256 { group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1); + d_PublicKeyType = "ECDSA P-256"; } else // ECDSA-P-521 { group = EC_GROUP_new_by_curve_name(NID_secp521r1); + d_PublicKeyType = "ECDSA P-256"; } if (!group) { @@ -974,6 +950,15 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) } +void Gnss_Crypto::set_public_key_type(const std::string& public_key_type) +{ + if (public_key_type == "ECDSA P-256" || public_key_type == "ECDSA P-521") + { + d_PublicKeyType = public_key_type; + } +} + + void Gnss_Crypto::set_merkle_root(const std::vector& v) { d_x_4_0 = v; @@ -1038,6 +1023,14 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) LOG(INFO) << "OSNMA Merkletree - Length in Bits: " << lengthInBits; LOG(INFO) << "OSNMA Merkletree - Point: " << point; LOG(INFO) << "OSNMA Merkletree - PK Type: " << pkType; + if (pkType == "ECDSA P-256/SHA-256") + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (pkType == "ECDSA P-521/SHA-512") + { + d_PublicKeyType = "ECDSA P-521"; + } } for (pugi::xml_node treeNode : merkleTree.children("TreeNode")) { @@ -1122,6 +1115,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { + d_PublicKeyType = "Unknown"; #if USE_GNUTLS_FALLBACK // Open the .crt file std::ifstream crtFile(crtFilePath, std::ios::binary); @@ -1160,6 +1154,72 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) gnutls_x509_crt_deinit(cert); return false; } + + // store the key type - needed for the Kroot in case no DSM-PKR available + gnutls_pk_algorithm_t pk_algorithm; + unsigned int bits; + + ret = gnutls_pubkey_get_pk_algorithm(pubkey, &bits); + if (ret < 0) + { + LOG(WARNING) << "GnuTLS: Failed to get public key algorithm: " << gnutls_strerror(ret); + gnutls_pubkey_deinit(pubkey); + gnutls_x509_crt_deinit(cert); + return false; + } + + pk_algorithm = static_cast(ret); + + if (pk_algorithm == GNUTLS_PK_ECDSA) + { + gnutls_datum_t params; + ret = gnutls_pubkey_export_ecc_raw(pubkey, nullptr, ¶ms, nullptr); + if (ret < 0) + { + LOG(WARNING) << "GnuTLS: Failed to export EC parameters: " << gnutls_strerror(ret); + gnutls_pubkey_deinit(pubkey); + gnutls_x509_crt_deinit(cert); + return false; + } + + gnutls_ecc_curve_t curve; + ret = gnutls_ecc_curve_get_id(reinterpret_cast(params.data)); + gnutls_free(params.data); + + if (ret < 0) + { + LOG(WARNING) << "GnuTLS: Failed to get EC curve: " << gnutls_strerror(ret); + gnutls_pubkey_deinit(pubkey); + gnutls_x509_crt_deinit(cert); + return false; + } + + curve = static_cast(ret); + + if (curve == GNUTLS_ECC_CURVE_SECP256R1) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (curve == GNUTLS_ECC_CURVE_SECP521R1) + { + d_PublicKeyType = "ECDSA P-521"; + } + else + { + LOG(WARNING) << "GnuTLS: Trying to read unknown EC curve"; + gnutls_x509_crt_deinit(cert); + gnutls_pubkey_deinit(pubkey); + return false; + } + } + else + { + LOG(WARNING) << "GnuTLS: Trying to read unknown key type"; + gnutls_x509_crt_deinit(cert); + gnutls_pubkey_deinit(pubkey); + return false; + } + pubkey_copy(pubkey, &d_PublicKey); gnutls_x509_crt_deinit(cert); gnutls_pubkey_deinit(pubkey); @@ -1190,27 +1250,69 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) // Read the public key from the certificate EVP_PKEY* pubkey = X509_get_pubkey(cert); - - // store the key type - needed for the Kroot in case no DSM-PKR available - // TODO - only way I have found to find the curve type - const auto *const ec_key = EVP_PKEY_get0_EC_KEY(pubkey); - const EC_GROUP *group = EC_KEY_get0_group(ec_key); - int nid = EC_GROUP_get_curve_name(group); - if (nid == NID_X9_62_prime256v1) { - d_PublicKeyType = "ECDSA P-256"; - } else if (nid == NID_secp521r1) { - d_PublicKeyType = "ECDSA P-521"; - } -#if USE_OPENSSL_3 if (!pubkey) { LOG(WARNING) << "OpenSSL: Failed to extract the public key"; X509_free(cert); return false; } +#if USE_OPENSSL_3 + // store the key type - needed for the Kroot in case no DSM-PKR available + // Get the key type + int key_type = EVP_PKEY_base_id(pubkey); + if (key_type == EVP_PKEY_EC) + { + // It's an EC key, now we need to determine the curve + char curve_name[256]; + size_t curve_name_len = sizeof(curve_name); + + if (EVP_PKEY_get_utf8_string_param(pubkey, OSSL_PKEY_PARAM_GROUP_NAME, curve_name, curve_name_len, &curve_name_len) == 1) + { + if (strcmp(curve_name, "prime256v1") == 0 || strcmp(curve_name, "P-256") == 0) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (strcmp(curve_name, "secp521r1") == 0 || strcmp(curve_name, "P-521") == 0) + { + d_PublicKeyType = "ECDSA P-521"; + } + else + { + LOG(WARNING) << "OpenSSL: Trying to read an unknown EC curve"; + X509_free(cert); + return false; + } + } + else + { + d_PublicKeyType = "Unknown EC curve"; + LOG(WARNING) << "OpenSSL: Trying to read an unknown EC curve"; + X509_free(cert); + return false; + } + } + else + { + LOG(WARNING) << "OpenSSL: Trying to read an unknown key type"; + X509_free(cert); + return false; + } pubkey_copy(pubkey, &d_PublicKey); EVP_PKEY_free(pubkey); #else // OpenSSL 1.x + // store the key type - needed for the Kroot in case no DSM-PKR available + const auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey); + const EC_GROUP* group = EC_KEY_get0_group(ec_key); + const int nid = EC_GROUP_get_curve_name(group); + if (nid == NID_X9_62_prime256v1) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (nid == NID_secp521r1) + { + d_PublicKeyType = "ECDSA P-521"; + } + EC_KEY* ec_pubkey = EVP_PKEY_get1_EC_KEY(pubkey); EVP_PKEY_free(pubkey); if (!ec_pubkey) @@ -1299,6 +1401,7 @@ std::vector Gnss_Crypto::convert_from_hex_str(const std::string& input) return result; } + #if USE_GNUTLS_FALLBACK // GnuTLS-specific functions bool Gnss_Crypto::pubkey_copy(gnutls_pubkey_t src, gnutls_pubkey_t* dest) { diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/system_parameters/gnss_crypto.h index 6aa347bb0..e197d61d0 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/system_parameters/gnss_crypto.h @@ -66,13 +66,13 @@ public: std::vector compute_HMAC_SHA_256(const std::vector& key, const std::vector& input) const; //!< Computes HMAC-SHA-256 message authentication code std::vector compute_CMAC_AES(const std::vector& key, const std::vector& input) const; //!< Computes CMAC-AES message authentication code - std::vector get_public_key() const; //!< Gets the ECDSA Public Key in PEM format std::vector get_merkle_root() const; //!< Gets the Merkle Tree root node (\f$ x_{4,0} \f$) + std::string get_public_key_type() const; //!< Gets the ECDSA Public Key type (ECDSA P-256 / ECDSA P-521 / Unknown) - void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey compressed format) - void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) - void read_merkle_xml(const std::string& merkleFilePath); - std::string d_PublicKeyType; + void set_public_key(const std::vector& publickey); //!< Sets the ECDSA Public Key (publickey compressed format) + void set_public_key_type(const std::string& public_key_type); //!< Sets the ECDSA Public Key type (ECDSA P-256 / ECDSA P-521) + void set_merkle_root(const std::vector& v); //!< Sets the Merkle Tree root node x(\f$ x_{4,0} \f$) + void read_merkle_xml(const std::string& merkleFilePath); //!> Reads the XML file provided from the GSC OSNMA server private: void readPublicKeyFromPEM(const std::string& pemFilePath); @@ -94,6 +94,7 @@ private: #endif #endif std::vector d_x_4_0; + std::string d_PublicKeyType; }; /** \} */ diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/system_parameters/osnma_nav_data_manager.cc index 8fdd9ee6e..9d5017aec 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.cc +++ b/src/core/system_parameters/osnma_nav_data_manager.cc @@ -38,6 +38,8 @@ void OSNMA_nav_data_Manager::add_navigation_data(const std::string& nav_bits, ui _satellite_nav_data[PRNd][TOW].set_tow_sf0(TOW); } } + + /** * @brief loops over the verified tags and updates the navigation data tag length */ @@ -55,7 +57,8 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { std::string nav_data; - if (tag.second.ADKD == 0 || tag.second.ADKD == 12){ + if (tag.second.ADKD == 0 || tag.second.ADKD == 12) + { nav_data = tow_it.second.get_ephemeris_data(); } else if (tag.second.ADKD == 4){ @@ -70,11 +73,15 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& } } } + + bool OSNMA_nav_data_Manager::have_PRNd_nav_data(uint32_t PRNd) { // check if have data from PRNd in _satellite_nav_data return _satellite_nav_data.find(PRNd) != _satellite_nav_data.end(); } + + std::vector OSNMA_nav_data_Manager::get_verified_data() { std::vector result; @@ -91,6 +98,8 @@ std::vector OSNMA_nav_data_Manager::get_verified_data() } return result; } + + bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD) { if (ADKD == 0 || ADKD == 12) @@ -119,6 +128,8 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t } return false; } + + /** * @brief returns OSNMA_NavData object. * @remarks assumes it exists (called have_nav_data before), otherwise undefined behavior @@ -140,13 +151,16 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) { if (tag.ADKD == 0 || tag.ADKD == 12) { - if (!tow_it.second.get_ephemeris_data().empty()){ + if (!tow_it.second.get_ephemeris_data().empty()) + { return tow_it.second.get_ephemeris_data(); } } else if(tag.ADKD == 4) { - if (!tow_it.second.get_utc_data().empty()){ + + if (!tow_it.second.get_utc_data().empty()) + { return tow_it.second.get_utc_data(); } } @@ -154,6 +168,8 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) } return ""; } + + /** * @brief Checks if the OSNMA_NavData bits are already present. In case affirmative, it updates the OSNMA_NavData 'last received' timestamp * @remarks e.g.: a SV may repeat the bits over several subframes. In that case, need to save them only once. @@ -182,6 +198,8 @@ bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t } return false; } + + /** * @brief Checks if there is a OSNMA_NavData element within the COP time interval for a Tag t * @param t Tag object @@ -202,13 +220,15 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const { if (t.ADKD == 0 || t.ADKD == 12) { - if (!tow_it.second.get_ephemeris_data().empty()){ + if (!tow_it.second.get_ephemeris_data().empty()) + { return true; } } else if (t.ADKD == 4) { - if (!tow_it.second.get_utc_data().empty()){ + if (!tow_it.second.get_utc_data().empty()) + { return true; } } @@ -216,6 +236,8 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const } return false; } + + void OSNMA_nav_data_Manager::print_status() { for (const auto& satellite : _satellite_nav_data){ diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 6d645edb1..6b4813975 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -34,8 +34,10 @@ TEST(GnssCryptoTest, VerifyPubKeyImport) // Input taken from RG 1.3 A7.1 // compressed ECDSA P-256 format std::vector publicKey = { - 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, - 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, + 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, + 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, + 0x79, 0x80, 0xEA}; ASSERT_FALSE(d_crypto->have_public_key()); @@ -55,8 +57,10 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) // Input taken from RG 1.3 A7.1 // compressed ECDSA P-256 format std::vector publicKey = { - 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, - 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, + 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, + 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, + 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); bool result = d_crypto->store_public_key(f1); @@ -75,10 +79,6 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) ASSERT_EQ(content_file, content_file2); - // TODO - this cannot be tested right now - // std::vector readkey = d_crypto2->get_public_key(); - // ASSERT_EQ(publicKey, readkey); - errorlib::error_code ec; ASSERT_TRUE(fs::remove(fs::path(f1), ec)); ASSERT_TRUE(fs::remove(fs::path(f2), ec)); @@ -93,8 +93,9 @@ TEST(GnssCryptoTest, TestComputeSHA_256) std::vector expected_output = { 0x18, 0x94, 0xA1, 0x9C, 0x85, 0xBA, 0x15, 0x3A, 0xCB, 0xF7, - 0x43, 0xAC, 0x4E, 0x43, 0xFC, 0x00, 0x4C, 0x89, 0x16, 0x04, 0xB2, - 0x6F, 0x8C, 0x69, 0xE1, 0xE8, 0x3E, 0xA2, 0xAF, 0xC7, 0xC4, 0x8F}; + 0x43, 0xAC, 0x4E, 0x43, 0xFC, 0x00, 0x4C, 0x89, 0x16, 0x04, + 0xB2, 0x6F, 0x8C, 0x69, 0xE1, 0xE8, 0x3E, 0xA2, 0xAF, 0xC7, + 0xC4, 0x8F}; std::vector output = d_crypto->compute_SHA_256(message); @@ -111,7 +112,8 @@ TEST(GnssCryptoTest, TestComputeSHA3_256) std::vector expected_output = { 0xCC, 0xB8, 0xF9, 0x23, 0x5F, 0x4A, 0x93, 0x2C, 0xA0, 0xAB, 0xBB, 0x2C, 0x24, 0x36, 0x72, 0x5E, 0x2E, 0x8D, 0xC7, 0x5B, - 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, 0x3B, 0x3F}; + 0x99, 0xE7, 0xF6, 0xC4, 0x50, 0x5B, 0x2A, 0x93, 0x6E, 0xB6, + 0x3B, 0x3F}; std::vector output = d_crypto->compute_SHA3_256(message); @@ -254,8 +256,10 @@ TEST(GnssCryptoTest, VerifySignatureP256) // Input taken from RG 1.3 A7.1 // compressed ECDSA P-256 format std::vector publicKey = { - 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, - 0x32, 0x0D, 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, + 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, + 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, + 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); bool result = d_crypto->verify_signature_ecdsa_p256(message, signature); From 3457b8ed3b7445dbfcff0c3d8c9d6a2656975493 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 3 Aug 2024 19:58:34 +0200 Subject: [PATCH 299/499] Get time zone offset in a more standard way (#17) * Clang Tidy fixes * Get time zone offset in a more standard way Account for leap seconds Use GNSS-SDR.osnma_mode=strict to check for local time * Fix for C++20 * Initialize tm in a more portable way * Remove unnecessary data members in osnma_msg_receiver --------- Co-authored-by: cesaaargm --- src/core/libs/osnma_msg_receiver.cc | 46 ++++++++------- src/core/libs/osnma_msg_receiver.h | 65 +++++++++++----------- src/core/receiver/gnss_flowgraph.cc | 8 ++- src/core/system_parameters/osnma_helper.cc | 45 ++++++++++----- src/core/system_parameters/osnma_helper.h | 19 +++++-- 5 files changed, 110 insertions(+), 73 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index d5cb1fcaa..16ade4101 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -61,15 +61,18 @@ namespace wht = std; #endif -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath) +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, bool strict_mode) { - return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath)); + return osnma_msg_receiver_sptr(new osnma_msg_receiver(pemFilePath, merkleFilePath, strict_mode)); } -osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath) : gr::block("osnma_msg_receiver", - gr::io_signature::make(0, 0, 0), - gr::io_signature::make(0, 0, 0)) +osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, + const std::string& merkleFilePath, + bool strict_mode) : gr::block("osnma_msg_receiver", + gr::io_signature::make(0, 0, 0), + gr::io_signature::make(0, 0, 0)), + d_strict_mode(strict_mode) { d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(crtFilePath, merkleFilePath); @@ -114,23 +117,20 @@ osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, const std boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, _1)); #endif #endif - std::chrono::time_point now; - if (d_flag_debug) + + if (d_strict_mode) { - // d_GST_Rx = d_helper->compute_gst(d_initial_debug_time); - LOG(WARNING) << "Galileo OSNMA: Debug mode, time artificially set up."; - std::cout << "Galileo OSNMA: Debug mode, time artificially set up." << std::endl; - // TODO - need to synchronize time lapse with Gnss_Synchro? + d_GST_Rx = d_helper->compute_gst_now(); + const auto WN = d_helper->get_WN(d_GST_Rx); + const auto TOW = d_helper->get_TOW(d_GST_Rx); + LOG(INFO) << "Galileo OSNMA: initial receiver time GST=[" << WN << " " << TOW << "]"; + std::cout << "Galileo OSNMA: initial receiver time GST=[" << WN << " " << TOW << "]" << std::endl; } else { - d_GST_Rx = d_helper->compute_gst_now(); + LOG(WARNING) << "Galileo OSNMA: in non-strict mode, local system time is not checked."; + std::cout << "Galileo OSNMA: in non-strict mode, local system time is not checked." << std::endl; } - - d_WN = d_helper->get_WN(d_GST_Rx); - d_TOW = d_helper->get_TOW(d_GST_Rx); - LOG(WARNING) << "Galileo OSNMA: initial receiver time GST=[" << d_WN << " " << d_TOW << "]"; - std::cout << "Galileo OSNMA: initial receiver time GST=[" << d_WN << " " << d_TOW << "]" << std::endl; } @@ -167,13 +167,13 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) { d_last_received_GST = d_GST_SIS; } - if (d_flag_debug) + if (d_strict_mode) { - d_GST_Rx = d_last_received_GST; + d_GST_Rx = d_helper->compute_gst_now(); } else { - d_GST_Rx = d_helper->compute_gst_now(); + d_GST_Rx = d_last_received_GST; } LOG(INFO) << "Galileo OSNMA: Receiver Time GST=[" << d_helper->get_WN(d_GST_Rx) << " " << d_helper->get_TOW(d_GST_Rx) << "]"; std::cout << "Galileo OSNMA: Receiver Time GST=[" << d_helper->get_WN(d_GST_Rx) << " " << d_helper->get_TOW(d_GST_Rx) << "]" << std::endl; @@ -1425,6 +1425,7 @@ std::vector osnma_msg_receiver::build_message(Tag& tag) const return m; } + void osnma_msg_receiver::display_data() { // if(d_satellite_nav_data.empty()) @@ -1489,6 +1490,7 @@ bool osnma_msg_receiver::verify_tesla_key(std::vector& key, uint32_t TO return d_tesla_key_verified; } + /** * @brief Removes the tags that have been verified from the multimap d_tags_awaiting_verify. * @@ -1560,6 +1562,7 @@ void osnma_msg_receiver::remove_verified_tags() } } + /** * @brief Control the size of the tags awaiting verification multimap. * @@ -1948,6 +1951,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ } } + void osnma_msg_receiver::send_data_to_pvt(const std::vector& data) { if (!data.empty()) @@ -1960,6 +1964,7 @@ void osnma_msg_receiver::send_data_to_pvt(const std::vector& data } } + bool osnma_msg_receiver::store_dsm_kroot(const std::vector& dsm, const uint8_t nma_header) const { std::ofstream file(KROOTFILE_DEFAULT, std::ios::binary | std::ios::out); @@ -1978,6 +1983,7 @@ bool osnma_msg_receiver::store_dsm_kroot(const std::vector& dsm, const return file.good(); } + std::pair, uint8_t> osnma_msg_receiver::parse_dsm_kroot() const { std::ifstream file(KROOTFILE_DEFAULT, std::ios::binary | std::ios::in); diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 59d98e04a..e48b6e5c3 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -28,16 +28,16 @@ #include "gnss_sdr_make_unique.h" // for std::make:unique in C++11 #include "osnma_data.h" // for OSNMA_data structures #include "osnma_nav_data_manager.h" -#include // for gr::block -#include // for pmt::pmt_t -#include // for std::array -#include // for uint8_t -#include // for std::time_t -#include // for std::map, std::multimap -#include // for std::shared_ptr -#include // for std::string -#include // for std::vector -#include // for std::pair +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::array +#include // for uint8_t +#include // for std::time_t +#include // for std::map, std::multimap +#include // for std::shared_ptr +#include // for std::string +#include // for std::pair +#include // for std::vector /** \addtogroup Core * \{ */ @@ -51,7 +51,7 @@ class osnma_msg_receiver; using osnma_msg_receiver_sptr = gnss_shared_ptr; -osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); +osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, bool strict_mode = false); /*! * \brief GNU Radio block that receives asynchronous OSNMA messages @@ -66,8 +66,8 @@ public: std::unique_ptr d_crypto; // access to cryptographic functions void msg_handler_osnma(const pmt::pmt_t& msg); // GnssCrypto and the message handler are needed by public method within TestVectors fixture private: - friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath); - osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath); + friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, bool strict_mode); + osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath, bool strict_mode); void process_osnma_message(const std::shared_ptr& osnma_msg); void read_nma_header(uint8_t nma_header); @@ -103,6 +103,7 @@ private: std::map> d_tesla_keys; // tesla keys over time, sorted by TOW std::multimap d_tags_awaiting_verify; // container with tags to verify from arbitrary SVIDs, sorted by TOW + std::vector d_new_public_key; std::vector d_tags_to_verify{0, 4, 12}; std::vector d_macks_awaiting_MACSEQ_verification; @@ -111,8 +112,8 @@ private: std::array d_number_of_blocks{}; std::array d_mack_message{}; // C: 480 b - std::unique_ptr d_dsm_reader; // osnma parameters parser - std::unique_ptr d_helper; // helper class with auxiliary functions + std::unique_ptr d_dsm_reader; // osnma parameters parser + std::unique_ptr d_helper; // helper class with auxiliary functions std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data OSNMA_data d_osnma_data{}; @@ -125,30 +126,28 @@ private: uint32_t d_GST_SIS{}; // GST coming from W6 and W5 of SIS uint32_t d_GST_PKR_PKREV_start{}; uint32_t d_GST_PKR_AM_start{}; - uint32_t d_WN{}; - uint32_t d_TOW{}; - uint8_t const d_T_L{30}; // s RG Section 2.1 - - bool d_new_data{false}; - bool d_public_key_verified{false}; - bool d_kroot_verified{false}; - bool d_tesla_key_verified{false}; - bool d_flag_debug{true}; - bool d_flag_hot_start{false}; - bool d_flag_PK_renewal{false}; - bool d_flag_PK_revocation{false}; - uint8_t d_new_public_key_id{}; - std::vector d_new_public_key; - bool d_flag_NPK_set{false}; - bool d_flag_alert_message{false}; - - // Provide access to inner functions to Gtest uint32_t d_count_successful_tags{0}; uint32_t d_count_failed_tags{0}; uint32_t d_count_failed_Kroot{0}; uint32_t d_count_failed_pubKey{0}; // failed public key verifications against Merkle root uint32_t d_count_failed_macseq{0}; + + uint8_t const d_T_L{30}; // s RG Section 2.1 + uint8_t d_new_public_key_id{}; + + bool d_new_data{false}; + bool d_public_key_verified{false}; + bool d_kroot_verified{false}; + bool d_tesla_key_verified{false}; + bool d_strict_mode{false}; + bool d_flag_hot_start{false}; + bool d_flag_PK_renewal{false}; + bool d_flag_PK_revocation{false}; + bool d_flag_NPK_set{false}; + bool d_flag_alert_message{false}; + + // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); FRIEND_TEST(OsnmaMsgReceiverTest, TagVerification); FRIEND_TEST(OsnmaMsgReceiverTest, BuildTagMessageM0); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index af1795ee0..b0e3dc418 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -126,7 +126,13 @@ void GNSSFlowgraph::init() enable_osnma_rx_ = true; const auto certFilePath = configuration_->property("GNSS-SDR.osnma_public_key", CRTFILE_DEFAULT); const auto merKleTreePath = configuration_->property("GNSS-SDR.osnma_merkletree", MERKLEFILE_DEFAULT); - osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath); + std::string osnma_mode = configuration_->property("GNSS-SDR.osnma_mode", std::string("")); + bool strict_mode = false; + if (osnma_mode == "strict") + { + strict_mode = true; + } + osnma_rx_ = osnma_msg_receiver_make(certFilePath, merKleTreePath, strict_mode); } else { diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/system_parameters/osnma_helper.cc index 3ce589302..23b67707a 100644 --- a/src/core/system_parameters/osnma_helper.cc +++ b/src/core/system_parameters/osnma_helper.cc @@ -16,15 +16,26 @@ #include "osnma_helper.h" #include +#include #include #include #include -#include // timezone -uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const{ + +Osnma_Helper::Osnma_Helper() +{ + GST_START_EPOCH.tm_mday = 22; + GST_START_EPOCH.tm_mon = 7; // August (0-based) + GST_START_EPOCH.tm_year = 1999 - 1900; +} + + +uint32_t Osnma_Helper::compute_gst(uint32_t WN, uint32_t TOW) const +{ return (WN & 0x00000FFF) << 20 | (TOW & 0x000FFFFF); } + uint32_t Osnma_Helper::compute_gst(tm& input) { auto epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&GST_START_EPOCH)); @@ -34,23 +45,28 @@ uint32_t Osnma_Helper::compute_gst(tm& input) auto duration_sec = std::chrono::duration_cast(input_time_point - epoch_time_point); // Calculate the week number (WN) and time of week (TOW) - uint32_t sec_in_week = 7 * 24 * 60 * 60; - uint32_t week_number = duration_sec.count() / sec_in_week; - uint32_t time_of_week = duration_sec.count() % sec_in_week; + const uint32_t sec_in_week = 604800; + const uint32_t week_number = duration_sec.count() / sec_in_week; + const uint32_t time_of_week = duration_sec.count() % sec_in_week; return compute_gst(week_number, time_of_week); } + uint32_t Osnma_Helper::compute_gst_now() { - std::chrono::time_point epoch_time_point = std::chrono::system_clock::from_time_t(mktime(&GST_START_EPOCH) - timezone); -// auto time_utc = std::chrono::time_point_cast(time).time_since_epoch(); + time_t now = time(nullptr); + struct tm local_tm = *std::localtime(&now); + struct tm utc_tm = *std::gmtime(&now); + auto timezone_offset = std::mktime(&utc_tm) - std::mktime(&local_tm); + auto epoch_time_point = std::chrono::system_clock::from_time_t(std::mktime(&GST_START_EPOCH) - timezone_offset) + std::chrono::seconds(13); auto duration_sec = std::chrono::duration_cast(std::chrono::system_clock::now() - epoch_time_point); - uint32_t sec_in_week = 7 * 24 * 60 * 60; - uint32_t week_number = duration_sec.count() / sec_in_week; - uint32_t time_of_week = duration_sec.count() % sec_in_week; + const uint32_t sec_in_week = 604800; + const uint32_t week_number = duration_sec.count() / sec_in_week; + const uint32_t time_of_week = duration_sec.count() % sec_in_week; return compute_gst(week_number, time_of_week); } + std::vector Osnma_Helper::gst_to_uint8(uint32_t GST) const { std::vector res; @@ -145,12 +161,15 @@ std::vector Osnma_Helper::convert_from_hex_string(const std::string& he return result; } -uint32_t Osnma_Helper::get_WN(uint32_t GST) + + +uint32_t Osnma_Helper::get_WN(uint32_t GST) const { return (GST & 0xFFF00000) >> 20; } -uint32_t Osnma_Helper::get_TOW(uint32_t GST) + + +uint32_t Osnma_Helper::get_TOW(uint32_t GST) const { return GST & 0x000FFFFF; } - diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/system_parameters/osnma_helper.h index 703a4fd0d..c6b367664 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/system_parameters/osnma_helper.h @@ -18,27 +18,34 @@ #define GNSS_SDR_OSNMA_HELPER_H -#include #include +#include #include #include + +/** \addtogroup Core + * \{ */ +/** \addtogroup System_Parameters + * \{ */ + class Osnma_Helper { public: - Osnma_Helper() = default; + Osnma_Helper(); ~Osnma_Helper() = default; uint32_t compute_gst(uint32_t WN, uint32_t TOW) const; uint32_t compute_gst(std::tm& input); uint32_t compute_gst_now(); - uint32_t get_WN(uint32_t GST); - uint32_t get_TOW(uint32_t GST); + uint32_t get_WN(uint32_t GST) const; + uint32_t get_TOW(uint32_t GST) const; std::vector gst_to_uint8(uint32_t GST) const; std::vector bytes(const std::string& binaryString) const; std::string verification_status_str(int status) const; std::string convert_to_hex_string(const std::vector& vector) const; std::vector convert_from_hex_string(const std::string& hex_string) const; // TODO remove similar function in gnss_crypto - - std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; + std::tm GST_START_EPOCH{}; }; +/** \} */ +/** \} */ #endif // GNSS_SDR_OSNMA_HELPER_H From 8a45df29a88936cd24bed211717d5b4a82177a13 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Aug 2024 10:29:01 +0200 Subject: [PATCH 300/499] Some API improvements and a bug fix (#18) * Clang Tidy fixes * Fix reading of .crt files with GnuTLS * Hide d_crypto pointer from public API * Read public key type also from .pem files --------- Co-authored-by: cesaaargm --- src/core/libs/CMakeLists.txt | 1 - src/core/libs/osnma_msg_receiver.cc | 12 +- src/core/libs/osnma_msg_receiver.h | 37 ++--- src/core/system_parameters/gnss_crypto.cc | 144 +++++++++++++++--- .../osnma/gnss_crypto_test.cc | 1 + .../osnma/osnma_test_vectors.cc | 2 +- 6 files changed, 157 insertions(+), 40 deletions(-) diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index fdcba15bc..0396b1e25 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -93,7 +93,6 @@ target_link_libraries(core_libs core_libs_supl core_system_parameters pvt_libs - algorithms_libs PRIVATE algorithms_libs Boost::serialization diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 16ade4101..e77260be5 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -22,9 +22,9 @@ #include "Galileo_OSNMA.h" #include "gnss_crypto.h" #include "gnss_satellite.h" -#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader -#include "osnma_helper.h" -#include "osnma_nav_data_manager.h" +#include "gnss_sdr_make_unique.h" // for std::make_unique in C++11 +#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader +#include "osnma_helper.h" // for Osnma_Helper #include // for gr::io_signature::make #include #include @@ -237,6 +237,12 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } +void osnma_msg_receiver::read_merkle_xml(const std::string& merklepath) +{ + d_crypto->read_merkle_xml(merklepath); +} + + void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& osnma_msg) { if (d_flag_alert_message && (d_public_key_verified || d_kroot_verified)) diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index e48b6e5c3..7039889ef 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -23,21 +23,20 @@ #define FRIEND_TEST(test_case_name, test_name) \ friend class test_case_name##_##test_name##_Test -#include "galileo_inav_message.h" // for OSNMA_msg -#include "gnss_block_interface.h" // for gnss_shared_ptr -#include "gnss_sdr_make_unique.h" // for std::make:unique in C++11 -#include "osnma_data.h" // for OSNMA_data structures -#include "osnma_nav_data_manager.h" -#include // for gr::block -#include // for pmt::pmt_t -#include // for std::array -#include // for uint8_t -#include // for std::time_t -#include // for std::map, std::multimap -#include // for std::shared_ptr -#include // for std::string -#include // for std::pair -#include // for std::vector +#include "galileo_inav_message.h" // for OSNMA_msg +#include "gnss_block_interface.h" // for gnss_shared_ptr +#include "osnma_data.h" // for OSNMA_data structures +#include "osnma_nav_data_manager.h" // for OSNMA_nav_data_Manager +#include // for gr::block +#include // for pmt::pmt_t +#include // for std::array +#include // for uint8_t +#include // for std::time_t +#include // for std::map, std::multimap +#include // for std::shared_ptr +#include // for std::string +#include // for std::pair +#include // for std::vector /** \addtogroup Core * \{ */ @@ -62,9 +61,10 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, class osnma_msg_receiver : public gr::block { public: - ~osnma_msg_receiver() = default; //!< Default destructor - std::unique_ptr d_crypto; // access to cryptographic functions - void msg_handler_osnma(const pmt::pmt_t& msg); // GnssCrypto and the message handler are needed by public method within TestVectors fixture + ~osnma_msg_receiver() = default; //!< Default destructor + void msg_handler_osnma(const pmt::pmt_t& msg); //!< For testing purposes + void read_merkle_xml(const std::string& merklepath); //!< Public for testing purposes + private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, bool strict_mode); osnma_msg_receiver(const std::string& crtFilePath, const std::string& merkleFilePath, bool strict_mode); @@ -112,6 +112,7 @@ private: std::array d_number_of_blocks{}; std::array d_mack_message{}; // C: 480 b + std::unique_ptr d_crypto; // class for cryptographic functions std::unique_ptr d_dsm_reader; // osnma parameters parser std::unique_ptr d_helper; // helper class with auxiliary functions std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index ac8723ab5..9d7662d09 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -20,6 +20,7 @@ #include "Galileo_OSNMA.h" #include #include +#include #include #include #include @@ -912,11 +913,14 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) point = EC_POINT_new(group); if (!point) { + EC_GROUP_free(group); return; } if (!EC_POINT_oct2point(group, point, publicKey.data(), publicKey.size(), nullptr)) { + EC_GROUP_free(group); + EC_POINT_free(point); return; } @@ -930,11 +934,16 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) } if (!ec_key) { + EC_GROUP_free(group); + EC_POINT_free(point); return; } if (!EC_KEY_set_public_key(ec_key, point)) { + EC_KEY_free(ec_key); + EC_POINT_free(point); + EC_GROUP_free(group); return; } if (!pubkey_copy(ec_key, &d_PublicKey)) @@ -1066,6 +1075,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) { return; } + d_PublicKeyType = "Unknown"; std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); #if USE_GNUTLS_FALLBACK // Import the PEM data @@ -1085,6 +1095,52 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) return; } + // store the key type - needed for the Kroot in case no DSM-PKR available + gnutls_pk_algorithm_t pk_algorithm; + unsigned int bits; + + ret = gnutls_pubkey_get_pk_algorithm(pubkey, &bits); + if (ret < 0) + { + LOG(WARNING) << "GnuTLS: Failed to get public key algorithm from .pem file: " << gnutls_strerror(ret); + gnutls_pubkey_deinit(pubkey); + return; + } + + pk_algorithm = static_cast(ret); + + if (pk_algorithm == GNUTLS_PK_ECDSA) + { + gnutls_ecc_curve_t curve; + ret = gnutls_pubkey_export_ecc_raw(pubkey, &curve, nullptr, nullptr); + if (ret < 0) + { + LOG(WARNING) << "GnuTLS: Failed to get EC curve from .pem file: " << gnutls_strerror(ret); + gnutls_pubkey_deinit(pubkey); + return; + } + + if (curve == GNUTLS_ECC_CURVE_SECP256R1) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (curve == GNUTLS_ECC_CURVE_SECP521R1) + { + d_PublicKeyType = "ECDSA P-521"; + } + else + { + LOG(WARNING) << "GnuTLS: Trying to read unknown EC curve from .pem file"; + gnutls_pubkey_deinit(pubkey); + return; + } + } + else + { + LOG(WARNING) << "GnuTLS: Trying to read unknown key type from .pem file"; + gnutls_pubkey_deinit(pubkey); + return; + } pubkey_copy(pubkey, &d_PublicKey); gnutls_pubkey_deinit(pubkey); #else // OpenSSL @@ -1096,9 +1152,77 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) return; } #if USE_OPENSSL_3 - d_PublicKey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); + EVP_PKEY* pubkey = nullptr; + pubkey = PEM_read_bio_PUBKEY(bio, nullptr, nullptr, nullptr); + + // store the key type - needed for the Kroot in case no DSM-PKR available + // Get the key type + int key_type = EVP_PKEY_base_id(pubkey); + if (key_type == EVP_PKEY_EC) + { + // It's an EC key, now we need to determine the curve + char curve_name[256]; + size_t curve_name_len = sizeof(curve_name); + + if (EVP_PKEY_get_utf8_string_param(pubkey, OSSL_PKEY_PARAM_GROUP_NAME, curve_name, curve_name_len, &curve_name_len) == 1) + { + if (strcmp(curve_name, "prime256v1") == 0 || strcmp(curve_name, "P-256") == 0) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (strcmp(curve_name, "secp521r1") == 0 || strcmp(curve_name, "P-521") == 0) + { + d_PublicKeyType = "ECDSA P-521"; + } + else + { + LOG(WARNING) << "OpenSSL: Trying to read an unknown EC curve from .pem file"; + BIO_free(bio); + EVP_PKEY_free(pubkey); + return; + } + } + else + { + LOG(WARNING) << "OpenSSL: Trying to read an unknown EC curve from .pem file"; + BIO_free(bio); + EVP_PKEY_free(pubkey); + return; + } + } + else + { + LOG(WARNING) << "OpenSSL: Trying to read an unknown key type from .pem file"; + BIO_free(bio); + EVP_PKEY_free(pubkey); + return; + } + pubkey_copy(pubkey, &d_PublicKey); + EVP_PKEY_free(pubkey); #else // OpenSSL 1.x - d_PublicKey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); + EC_KEY* pubkey = nullptr; + pubkey = PEM_read_bio_EC_PUBKEY(bio, nullptr, nullptr, nullptr); + if (!pubkey) + { + LOG(WARNING) << "OpenSSL: Failed to extract the public key from .pem file"; + BIO_free(bio); + return; + } + const EC_GROUP* group = EC_KEY_get0_group(pubkey); + int nid = EC_GROUP_get_curve_name(group); + const char* curve_name = OBJ_nid2sn(nid); + const std::string curve_str(curve_name); + if (curve_str == "prime256v1") + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (curve_str == "secp521r1") + { + d_PublicKeyType = "ECDSA P-521"; + } + + pubkey_copy(pubkey, &d_PublicKey); + EC_KEY_free(pubkey); #endif BIO_free(bio); if (d_PublicKey == nullptr) @@ -1172,20 +1296,8 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) if (pk_algorithm == GNUTLS_PK_ECDSA) { - gnutls_datum_t params; - ret = gnutls_pubkey_export_ecc_raw(pubkey, nullptr, ¶ms, nullptr); - if (ret < 0) - { - LOG(WARNING) << "GnuTLS: Failed to export EC parameters: " << gnutls_strerror(ret); - gnutls_pubkey_deinit(pubkey); - gnutls_x509_crt_deinit(cert); - return false; - } - gnutls_ecc_curve_t curve; - ret = gnutls_ecc_curve_get_id(reinterpret_cast(params.data)); - gnutls_free(params.data); - + ret = gnutls_pubkey_export_ecc_raw(pubkey, &curve, nullptr, nullptr); if (ret < 0) { LOG(WARNING) << "GnuTLS: Failed to get EC curve: " << gnutls_strerror(ret); @@ -1194,8 +1306,6 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) return false; } - curve = static_cast(ret); - if (curve == GNUTLS_ECC_CURVE_SECP256R1) { d_PublicKeyType = "ECDSA P-256"; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 6b4813975..1904a16e9 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -70,6 +70,7 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) auto d_crypto2 = std::make_unique(f1, ""); bool result2 = d_crypto2->store_public_key(f2); ASSERT_TRUE(result2); + ASSERT_TRUE(d_crypto2->get_public_key_type() == "ECDSA P-256"); std::ifstream t(f1); std::string content_file((std::istreambuf_iterator(t)), std::istreambuf_iterator()); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 0b525805c..73e5eb25c 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -243,7 +243,7 @@ bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_ob if (test_step == 1 && d_flag_NPK == true ){ // step 2: this simulates the osnma connecting to the GSC server and downloading the Merkle tree of the next public key - osnma_object->d_crypto->read_merkle_xml( + osnma_object->read_merkle_xml( std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007081500_PKID_8.xml"); } From a1ef5639884c8a3e6f2929b11db4c884dce774b2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 5 Aug 2024 13:06:28 +0200 Subject: [PATCH 301/499] Fix for OpenSSL 1.0 (#20) * Clang Tidy fixes * Fix for OpenSSL 1.0 --------- Co-authored-by: cesaaargm --- src/core/system_parameters/gnss_crypto.cc | 91 +++++++++++++++++++++-- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 9d7662d09..fd1403539 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -1210,15 +1210,38 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) } const EC_GROUP* group = EC_KEY_get0_group(pubkey); int nid = EC_GROUP_get_curve_name(group); - const char* curve_name = OBJ_nid2sn(nid); - const std::string curve_str(curve_name); - if (curve_str == "prime256v1") + + if (nid == 0) { - d_PublicKeyType = "ECDSA P-256"; + BIGNUM* p = BN_new(); + if (EC_GROUP_get_curve_GFp(group, p, nullptr, nullptr, nullptr) == 1) + { + char* p_str = BN_bn2hex(p); + const std::string pcstr(p_str); + if (pcstr.size() == 64) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (pcstr.size() == 132) + { + d_PublicKeyType = "ECDSA P-521"; + } + OPENSSL_free(p_str); + } + BN_free(p); } - else if (curve_str == "secp521r1") + else { - d_PublicKeyType = "ECDSA P-521"; + const char* curve_name = OBJ_nid2sn(nid); + const std::string curve_str(curve_name); + if (curve_str == "prime256v1") + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (curve_str == "secp521r1") + { + d_PublicKeyType = "ECDSA P-521"; + } } pubkey_copy(pubkey, &d_PublicKey); @@ -1410,9 +1433,16 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) pubkey_copy(pubkey, &d_PublicKey); EVP_PKEY_free(pubkey); #else // OpenSSL 1.x +#if USE_OPENSSL_111 // store the key type - needed for the Kroot in case no DSM-PKR available const auto ec_key = EVP_PKEY_get0_EC_KEY(pubkey); const EC_GROUP* group = EC_KEY_get0_group(ec_key); + if (!group) + { + X509_free(cert); + EC_KEY_free(ec_key); + return false; + } const int nid = EC_GROUP_get_curve_name(group); if (nid == NID_X9_62_prime256v1) { @@ -1422,7 +1452,56 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { d_PublicKeyType = "ECDSA P-521"; } +#else + EC_KEY* ec_key = EVP_PKEY_get1_EC_KEY(pubkey); + if (!ec_key) + { + X509_free(cert); + return false; + } + // Get the EC_GROUP from the EC_KEY + const EC_GROUP* group = EC_KEY_get0_group(ec_key); + if (!group) + { + X509_free(cert); + EC_KEY_free(ec_key); + return false; + } + const int nid = EC_GROUP_get_curve_name(group); + if (nid == 0) + { + BIGNUM* p = BN_new(); + if (EC_GROUP_get_curve_GFp(group, p, nullptr, nullptr, nullptr) == 1) + { + char* p_str = BN_bn2hex(p); + const std::string pcstr(p_str); + if (pcstr.size() == 64) + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (pcstr.size() == 132) + { + d_PublicKeyType = "ECDSA P-521"; + } + OPENSSL_free(p_str); + } + BN_free(p); + } + else + { + const char* curve_name = OBJ_nid2sn(nid); + const std::string curve_str(curve_name); + if (curve_str == "prime256v1") + { + d_PublicKeyType = "ECDSA P-256"; + } + else if (curve_str == "secp521r1") + { + d_PublicKeyType = "ECDSA P-521"; + } + } +#endif EC_KEY* ec_pubkey = EVP_PKEY_get1_EC_KEY(pubkey); EVP_PKEY_free(pubkey); if (!ec_pubkey) From 7367b56725c2a9c00aa795c001b960ef2e529e09 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 6 Aug 2024 12:28:01 +0200 Subject: [PATCH 302/499] Improve test (#21) * Clang Tidy fixes * Improve GnssCryptoTest.VerifyPublicKeyStorage test --------- Co-authored-by: cesaaargm --- src/core/system_parameters/gnss_crypto.cc | 104 ++++++++++-------- .../osnma/gnss_crypto_test.cc | 57 +++++++--- 2 files changed, 99 insertions(+), 62 deletions(-) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index fd1403539..e664e4f50 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -794,13 +794,17 @@ std::vector Gnss_Crypto::get_merkle_root() const std::string Gnss_Crypto::get_public_key_type() const { + if (d_PublicKeyType.empty()) + { + return std::string("Unknown"); + } return d_PublicKeyType; } void Gnss_Crypto::set_public_key(const std::vector& publicKey) { - d_PublicKeyType = "Unknown"; + d_PublicKeyType = std::string("Unknown"); #if USE_GNUTLS_FALLBACK gnutls_pubkey_t pubkey{}; gnutls_ecc_curve_t curve; @@ -812,13 +816,13 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (size_pk == 33) { curve = GNUTLS_ECC_CURVE_SECP256R1; - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); decompress_public_key_secp256r1(publicKey, x, y); } else if (size_pk == 67) { curve = GNUTLS_ECC_CURVE_SECP521R1; - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); decompress_public_key_secp521r1(publicKey, x, y); } else @@ -836,6 +840,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) { gnutls_pubkey_deinit(pubkey); LOG(WARNING) << "GnuTLS: error setting the OSNMA public key: " << gnutls_strerror(ret); + d_PublicKeyType = std::string("Unknown"); return; } pubkey_copy(pubkey, &d_PublicKey); @@ -861,11 +866,11 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (public_key_size == 33) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (public_key_size == 67) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } ctx = EVP_PKEY_CTX_new_from_name(nullptr, "EC", nullptr); @@ -875,6 +880,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) EVP_PKEY_CTX_free(ctx); OSSL_PARAM_free(params); OSSL_PARAM_BLD_free(param_bld); + d_PublicKeyType = std::string("Unknown"); return; } @@ -884,6 +890,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) EVP_PKEY_CTX_free(ctx); OSSL_PARAM_free(params); OSSL_PARAM_BLD_free(param_bld); + d_PublicKeyType = std::string("Unknown"); return; } @@ -898,15 +905,16 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (publicKey.size() == 33) // ECDSA-P-256 { group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1); - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else // ECDSA-P-521 { group = EC_GROUP_new_by_curve_name(NID_secp521r1); - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-521"); } if (!group) { + d_PublicKeyType = std::string("Unknown"); return; } @@ -914,6 +922,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) if (!point) { EC_GROUP_free(group); + d_PublicKeyType = std::string("Unknown"); return; } @@ -921,6 +930,7 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) { EC_GROUP_free(group); EC_POINT_free(point); + d_PublicKeyType = std::string("Unknown"); return; } @@ -936,18 +946,23 @@ void Gnss_Crypto::set_public_key(const std::vector& publicKey) { EC_GROUP_free(group); EC_POINT_free(point); + d_PublicKeyType = std::string("Unknown"); return; } - if (!EC_KEY_set_public_key(ec_key, point)) { EC_KEY_free(ec_key); EC_POINT_free(point); EC_GROUP_free(group); + d_PublicKeyType = std::string("Unknown"); return; } if (!pubkey_copy(ec_key, &d_PublicKey)) { + EC_KEY_free(ec_key); + EC_POINT_free(point); + EC_GROUP_free(group); + d_PublicKeyType = std::string("Unknown"); return; } EC_KEY_free(ec_key); @@ -1034,11 +1049,11 @@ void Gnss_Crypto::read_merkle_xml(const std::string& merkleFilePath) LOG(INFO) << "OSNMA Merkletree - PK Type: " << pkType; if (pkType == "ECDSA P-256/SHA-256") { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (pkType == "ECDSA P-521/SHA-512") { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } } for (pugi::xml_node treeNode : merkleTree.children("TreeNode")) @@ -1075,7 +1090,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) { return; } - d_PublicKeyType = "Unknown"; + d_PublicKeyType = std::string("Unknown"); std::string pemContent((std::istreambuf_iterator(pemFile)), std::istreambuf_iterator()); #if USE_GNUTLS_FALLBACK // Import the PEM data @@ -1108,8 +1123,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) } pk_algorithm = static_cast(ret); - - if (pk_algorithm == GNUTLS_PK_ECDSA) + if (pk_algorithm == GNUTLS_PK_ECC) { gnutls_ecc_curve_t curve; ret = gnutls_pubkey_export_ecc_raw(pubkey, &curve, nullptr, nullptr); @@ -1122,11 +1136,11 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) if (curve == GNUTLS_ECC_CURVE_SECP256R1) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (curve == GNUTLS_ECC_CURVE_SECP521R1) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } else { @@ -1168,11 +1182,11 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) { if (strcmp(curve_name, "prime256v1") == 0 || strcmp(curve_name, "P-256") == 0) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (strcmp(curve_name, "secp521r1") == 0 || strcmp(curve_name, "P-521") == 0) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } else { @@ -1210,7 +1224,6 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) } const EC_GROUP* group = EC_KEY_get0_group(pubkey); int nid = EC_GROUP_get_curve_name(group); - if (nid == 0) { BIGNUM* p = BN_new(); @@ -1220,11 +1233,11 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) const std::string pcstr(p_str); if (pcstr.size() == 64) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (pcstr.size() == 132) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } OPENSSL_free(p_str); } @@ -1236,11 +1249,11 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) const std::string curve_str(curve_name); if (curve_str == "prime256v1") { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (curve_str == "secp521r1") { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } } @@ -1262,8 +1275,7 @@ void Gnss_Crypto::readPublicKeyFromPEM(const std::string& pemFilePath) bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { - d_PublicKeyType = "Unknown"; -#if USE_GNUTLS_FALLBACK + d_PublicKeyType = std::string("Unknown"); // Open the .crt file std::ifstream crtFile(crtFilePath, std::ios::binary); if (!crtFile.is_open()) @@ -1278,8 +1290,8 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) } const std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); +#if USE_GNUTLS_FALLBACK const gnutls_datum_t buffer_datum = {const_cast(buffer.data()), static_cast(buffer.size())}; - gnutls_x509_crt_t cert; gnutls_x509_crt_init(&cert); int ret = gnutls_x509_crt_import(cert, &buffer_datum, GNUTLS_X509_FMT_PEM); @@ -1316,8 +1328,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) } pk_algorithm = static_cast(ret); - - if (pk_algorithm == GNUTLS_PK_ECDSA) + if (pk_algorithm == GNUTLS_PK_ECC) { gnutls_ecc_curve_t curve; ret = gnutls_pubkey_export_ecc_raw(pubkey, &curve, nullptr, nullptr); @@ -1331,11 +1342,11 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) if (curve == GNUTLS_ECC_CURVE_SECP256R1) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (curve == GNUTLS_ECC_CURVE_SECP521R1) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } else { @@ -1357,16 +1368,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) gnutls_x509_crt_deinit(cert); gnutls_pubkey_deinit(pubkey); #else // OpenSSL - // Open the .crt file - std::ifstream crtFile(crtFilePath, std::ios::binary); - if (!crtFile.is_open()) - { - LOG(WARNING) << "OpenSSL: Unable to open file: " << crtFilePath; - return false; - } - // Read certificate - std::vector buffer((std::istreambuf_iterator(crtFile)), std::istreambuf_iterator()); BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); if (!bio) { @@ -1387,6 +1389,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { LOG(WARNING) << "OpenSSL: Failed to extract the public key"; X509_free(cert); + BIO_free(bio); return false; } #if USE_OPENSSL_3 @@ -1403,24 +1406,25 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { if (strcmp(curve_name, "prime256v1") == 0 || strcmp(curve_name, "P-256") == 0) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (strcmp(curve_name, "secp521r1") == 0 || strcmp(curve_name, "P-521") == 0) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } else { LOG(WARNING) << "OpenSSL: Trying to read an unknown EC curve"; X509_free(cert); + BIO_free(bio); return false; } } else { - d_PublicKeyType = "Unknown EC curve"; LOG(WARNING) << "OpenSSL: Trying to read an unknown EC curve"; X509_free(cert); + BIO_free(bio); return false; } } @@ -1428,6 +1432,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { LOG(WARNING) << "OpenSSL: Trying to read an unknown key type"; X509_free(cert); + BIO_free(bio); return false; } pubkey_copy(pubkey, &d_PublicKey); @@ -1441,22 +1446,25 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { X509_free(cert); EC_KEY_free(ec_key); + BIO_free(bio); return false; } const int nid = EC_GROUP_get_curve_name(group); if (nid == NID_X9_62_prime256v1) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (nid == NID_secp521r1) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } + EC_KEY_free(ec_key); #else EC_KEY* ec_key = EVP_PKEY_get1_EC_KEY(pubkey); if (!ec_key) { X509_free(cert); + BIO_free(bio); return false; } @@ -1466,6 +1474,7 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) { X509_free(cert); EC_KEY_free(ec_key); + BIO_free(bio); return false; } const int nid = EC_GROUP_get_curve_name(group); @@ -1478,11 +1487,11 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) const std::string pcstr(p_str); if (pcstr.size() == 64) { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (pcstr.size() == 132) { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } OPENSSL_free(p_str); } @@ -1494,13 +1503,14 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) const std::string curve_str(curve_name); if (curve_str == "prime256v1") { - d_PublicKeyType = "ECDSA P-256"; + d_PublicKeyType = std::string("ECDSA P-256"); } else if (curve_str == "secp521r1") { - d_PublicKeyType = "ECDSA P-521"; + d_PublicKeyType = std::string("ECDSA P-521"); } } + EC_KEY_free(ec_key); #endif EC_KEY* ec_pubkey = EVP_PKEY_get1_EC_KEY(pubkey); EVP_PKEY_free(pubkey); diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 1904a16e9..2e536fb73 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -49,10 +49,9 @@ TEST(GnssCryptoTest, VerifyPubKeyImport) TEST(GnssCryptoTest, VerifyPublicKeyStorage) { - auto d_crypto = std::make_unique(); - const std::string f1("./osnma_test_file1.pem"); const std::string f2("./osnma_test_file2.pem"); + const std::string f3("./osnma_test_file3.pem"); // Input taken from RG 1.3 A7.1 // compressed ECDSA P-256 format @@ -62,15 +61,17 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, 0x79, 0x80, 0xEA}; + auto d_crypto = std::make_unique(); + ASSERT_FALSE(d_crypto->have_public_key()); + ASSERT_TRUE(d_crypto->get_public_key_type() == "Unknown"); d_crypto->set_public_key(publicKey); - bool result = d_crypto->store_public_key(f1); - - ASSERT_TRUE(result); + ASSERT_TRUE(d_crypto->have_public_key()); + ASSERT_TRUE(d_crypto->store_public_key(f1)); auto d_crypto2 = std::make_unique(f1, ""); - bool result2 = d_crypto2->store_public_key(f2); - ASSERT_TRUE(result2); + ASSERT_TRUE(d_crypto2->have_public_key()); ASSERT_TRUE(d_crypto2->get_public_key_type() == "ECDSA P-256"); + ASSERT_TRUE(d_crypto2->store_public_key(f2)); std::ifstream t(f1); std::string content_file((std::istreambuf_iterator(t)), std::istreambuf_iterator()); @@ -80,9 +81,39 @@ TEST(GnssCryptoTest, VerifyPublicKeyStorage) ASSERT_EQ(content_file, content_file2); + // P-521 Public key in compressed X format + std::vector publicKey_P521 = { + 0x03, 0x00, 0x28, 0x35, 0xBB, 0xE9, 0x24, 0x59, 0x4E, 0xF0, + 0xE3, 0xA2, 0xDB, 0xC0, 0x49, 0x30, 0x60, 0x7C, 0x61, 0x90, + 0xE4, 0x03, 0xE0, 0xC7, 0xB8, 0xC2, 0x62, 0x37, 0xF7, 0x58, + 0x56, 0xBE, 0x63, 0x5C, 0x97, 0xF7, 0x53, 0x64, 0x7E, 0xE1, + 0x0C, 0x07, 0xD3, 0x97, 0x8D, 0x58, 0x46, 0xFD, 0x6E, 0x06, + 0x44, 0x01, 0xA7, 0xAA, 0xC4, 0x95, 0x13, 0x5D, 0xC9, 0x77, + 0x26, 0xE9, 0xF8, 0x72, 0x0C, 0xD3, 0x88}; + + d_crypto->set_public_key(publicKey_P521); + ASSERT_TRUE(d_crypto->have_public_key()); + ASSERT_TRUE(d_crypto->get_public_key_type() == "ECDSA P-521"); + ASSERT_TRUE(d_crypto->store_public_key(f3)); + + auto d_crypto3 = std::make_unique(f3, ""); + ASSERT_TRUE(d_crypto3->have_public_key()); + ASSERT_TRUE(d_crypto3->get_public_key_type() == "ECDSA P-521"); + + std::vector wrong_publicKey = { + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, + 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, + 0x63, 0xFF, 0xA0}; + + auto d_crypto4 = std::make_unique(); + d_crypto4->set_public_key(wrong_publicKey); + ASSERT_FALSE(d_crypto4->have_public_key()); + ASSERT_TRUE(d_crypto4->get_public_key_type() == "Unknown"); + errorlib::error_code ec; ASSERT_TRUE(fs::remove(fs::path(f1), ec)); ASSERT_TRUE(fs::remove(fs::path(f2), ec)); + ASSERT_TRUE(fs::remove(fs::path(f3), ec)); } @@ -263,13 +294,11 @@ TEST(GnssCryptoTest, VerifySignatureP256) 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); - bool result = d_crypto->verify_signature_ecdsa_p256(message, signature); - ASSERT_TRUE(result); + ASSERT_TRUE(d_crypto->verify_signature_ecdsa_p256(message, signature)); std::vector wrong_signature = signature; wrong_signature[1] = 1; - bool result2 = d_crypto->verify_signature_ecdsa_p256(message, wrong_signature); - ASSERT_TRUE(!result2); + ASSERT_FALSE(d_crypto->verify_signature_ecdsa_p256(message, wrong_signature)); } @@ -309,11 +338,9 @@ TEST(GnssCryptoTest, VerifySignatureP521) 0x28, 0xEF}; d_crypto->set_public_key(publicKey); - bool result = d_crypto->verify_signature_ecdsa_p521(message, signature); - ASSERT_TRUE(result); + ASSERT_TRUE(d_crypto->verify_signature_ecdsa_p521(message, signature)); std::vector wrong_signature = signature; wrong_signature[1] = 1; - bool result2 = d_crypto->verify_signature_ecdsa_p521(message, wrong_signature); - ASSERT_TRUE(!result2); + ASSERT_FALSE(d_crypto->verify_signature_ecdsa_p521(message, wrong_signature)); } From 5a6d19be702b99a299ab5c5a8f61214dc48ce0f8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Aug 2024 09:13:13 +0200 Subject: [PATCH 303/499] Fix some defects detected by Coverity Scan (#22) * Clang Tidy fixes * Fix defects detected by Coverity Scan --------- Co-authored-by: cesaaargm --- src/core/libs/osnma_msg_receiver.cc | 12 ++++++------ src/core/system_parameters/gnss_crypto.cc | 5 +++-- .../osnma/gnss_crypto_test.cc | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index e77260be5..ec58a3eef 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -271,7 +271,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& { d_flag_PK_renewal = false; uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); - double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600; + double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600.0; LOG(INFO) << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << duration_hours << ", Duration=" << duration_hours << " h"; std::cout << "Galileo OSNMA: Public Key Renewal :: Finished at GST=" << duration_hours << ", Duration=" << duration_hours << " h" << std::endl; } @@ -1400,7 +1400,7 @@ std::vector osnma_msg_receiver::build_message(Tag& tag) const // Add applicable NavData bits to message std::string applicable_nav_data = d_nav_data_manager->get_navigation_data(tag); std::vector applicable_nav_data_bytes = d_helper->bytes(applicable_nav_data); - tag.nav_data = applicable_nav_data; // update tag with applicable data + tag.nav_data = std::move(applicable_nav_data); // update tag with applicable data // Convert and add OSNMA_NavData bytes into the message, taking care of that NMAS has only 2 bits for (uint8_t byte : applicable_nav_data_bytes) @@ -1619,11 +1619,11 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) // Assign relevant sequence based on subframe time if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. { - applicable_sequence = sq1; + applicable_sequence = std::move(sq1); } else if (mack.TOW % 60 >= 30) { - applicable_sequence = sq2; + applicable_sequence = std::move(sq2); } if (mack.tag_and_info.size() != applicable_sequence.size() - 1) { @@ -1864,11 +1864,11 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ // Assign relevant sequence based on subframe time if (mack.TOW % 60 < 30) // tried GST_Sf and it does not support the data present. { - applicable_sequence = sq1; + applicable_sequence = std::move(sq1); } else if (mack.TOW % 60 >= 30) { - applicable_sequence = sq2; + applicable_sequence = std::move(sq2); } if (mack.tag_and_info.size() != applicable_sequence.size() - 1) { diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index e664e4f50..27251a5a7 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -25,6 +25,7 @@ #include #include #include +#include #if USE_GNUTLS_FALLBACK #include @@ -625,7 +626,7 @@ std::vector Gnss_Crypto::compute_HMAC_SHA_256(const std::vector Gnss_Crypto::compute_CMAC_AES(const std::vector& k EVP_MAC_free(mac); aux.resize(output_length); - output = aux; + output = std::move(aux); #else // OpenSSL 1.x size_t mac_length = 0; // to hold the length of the MAC output diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc index 2e536fb73..58dcc3f2f 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc @@ -22,6 +22,7 @@ #include #include #include +#include class GnssCryptoTest : public ::testing::Test { @@ -296,7 +297,7 @@ TEST(GnssCryptoTest, VerifySignatureP256) d_crypto->set_public_key(publicKey); ASSERT_TRUE(d_crypto->verify_signature_ecdsa_p256(message, signature)); - std::vector wrong_signature = signature; + std::vector wrong_signature = std::move(signature); wrong_signature[1] = 1; ASSERT_FALSE(d_crypto->verify_signature_ecdsa_p256(message, wrong_signature)); } @@ -340,7 +341,7 @@ TEST(GnssCryptoTest, VerifySignatureP521) d_crypto->set_public_key(publicKey); ASSERT_TRUE(d_crypto->verify_signature_ecdsa_p521(message, signature)); - std::vector wrong_signature = signature; + std::vector wrong_signature = std::move(signature); wrong_signature[1] = 1; ASSERT_FALSE(d_crypto->verify_signature_ecdsa_p521(message, wrong_signature)); } From 158b7caeb426bc5f0f0b6764824dd96f9ed3f442 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 7 Aug 2024 09:34:09 +0200 Subject: [PATCH 304/499] Improve efficiency of Concurrent_Map and Concurrent_Queue classes --- src/core/receiver/concurrent_map.h | 40 ++++++++---------- src/core/receiver/concurrent_queue.h | 61 ++++++++++++++-------------- 2 files changed, 49 insertions(+), 52 deletions(-) diff --git a/src/core/receiver/concurrent_map.h b/src/core/receiver/concurrent_map.h index 330ab02ef..d16a963d7 100644 --- a/src/core/receiver/concurrent_map.h +++ b/src/core/receiver/concurrent_map.h @@ -36,52 +36,48 @@ template */ class Concurrent_Map { - typedef typename std::map::iterator Data_iterator; // iterator is scope dependent public: void write(int key, Data const& data) { - std::unique_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); + std::lock_guard lock(the_mutex); + auto data_iter = the_map.find(key); if (data_iter != the_map.end()) { data_iter->second = data; // update } else { - the_map.insert(std::pair(key, data)); // insert SILENTLY fails if the item already exists in the map! + the_map.insert(std::pair(key, data)); // insert does not overwrite if the item already exists in the map! } - lock.unlock(); } - std::map get_map_copy() + std::map get_map_copy() const& { - std::unique_lock lock(the_mutex); - std::map map_aux = the_map; - lock.unlock(); - return map_aux; + std::lock_guard lock(the_mutex); + return the_map; // This implicitly creates a copy } - size_t size() + std::map get_map_copy() && { - std::unique_lock lock(the_mutex); - size_t size_ = the_map.size(); - lock.unlock(); - return size_; + std::lock_guard lock(the_mutex); + return std::move(the_map); } - bool read(int key, Data& p_data) + size_t size() const { - std::unique_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); + std::lock_guard lock(the_mutex); + return the_map.size(); + } + + bool read(int key, Data& p_data) const + { + std::lock_guard lock(the_mutex); + auto data_iter = the_map.find(key); if (data_iter != the_map.end()) { p_data = data_iter->second; - lock.unlock(); return true; } - lock.unlock(); return false; } diff --git a/src/core/receiver/concurrent_queue.h b/src/core/receiver/concurrent_queue.h index ac7be0f17..ed4e68b0a 100644 --- a/src/core/receiver/concurrent_queue.h +++ b/src/core/receiver/concurrent_queue.h @@ -19,9 +19,10 @@ #include #include +#include #include #include -#include +#include /** \addtogroup Core * \{ */ @@ -33,48 +34,53 @@ template /*! * \brief This class implements a thread-safe std::queue - * - * Thread-safe object queue which uses the library - * boost_thread to perform MUTEX based on the code available at - * https://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html */ class Concurrent_Queue { public: - void push(Data const& data) + void push(const Data& data) { - std::unique_lock lock(the_mutex); - the_queue.push(data); - lock.unlock(); + { + std::lock_guard lock(the_mutex); + the_queue.push(data); + } the_condition_variable.notify_one(); } - bool empty() const + void push(Data&& data) { - std::unique_lock lock(the_mutex); - return the_queue.empty(); + { + std::lock_guard lock(the_mutex); + the_queue.push(std::move(data)); + } + the_condition_variable.notify_one(); } - size_t size() const + bool empty() const noexcept { - std::unique_lock lock(the_mutex); + return size() == 0; + } + + size_t size() const noexcept + { + std::lock_guard lock(the_mutex); return the_queue.size(); } void clear() { - std::unique_lock lock(the_mutex); - the_queue = std::queue(); + std::lock_guard lock(the_mutex); + std::queue().swap(the_queue); } bool try_pop(Data& popped_value) { - std::unique_lock lock(the_mutex); + std::lock_guard lock(the_mutex); if (the_queue.empty()) { return false; } - popped_value = the_queue.front(); + popped_value = std::move(the_queue.front()); the_queue.pop(); return true; } @@ -82,26 +88,21 @@ public: void wait_and_pop(Data& popped_value) { std::unique_lock lock(the_mutex); - while (the_queue.empty()) - { - the_condition_variable.wait(lock); - } - popped_value = the_queue.front(); + the_condition_variable.wait(lock, [this] { return !the_queue.empty(); }); + popped_value = std::move(the_queue.front()); the_queue.pop(); } bool timed_wait_and_pop(Data& popped_value, int wait_ms) { std::unique_lock lock(the_mutex); - if (the_queue.empty()) + if (!the_condition_variable.wait_for(lock, + std::chrono::milliseconds(wait_ms), + [this] { return !the_queue.empty(); })) { - the_condition_variable.wait_for(lock, std::chrono::milliseconds(wait_ms)); - if (the_queue.empty()) - { - return false; - } + return false; } - popped_value = the_queue.front(); + popped_value = std::move(the_queue.front()); the_queue.pop(); return true; } From 98f1cdfb6bf31bcc0243e5fabe2b48684f111482 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Aug 2024 09:33:48 +0200 Subject: [PATCH 305/499] More minor fixes (#23) * Clang Tidy fixes * Fix defects detected by Coverity Scan * Fix for OpenSSL 1.0 --------- Co-authored-by: cesaaargm --- src/core/libs/osnma_msg_receiver.cc | 8 ++++---- src/core/system_parameters/gnss_crypto.cc | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index ec58a3eef..46aca3fd0 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -292,7 +292,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& // step 2 , start using new chain d_flag_PK_revocation = false; uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); - double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600; + double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600.0; LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << ", Duration=" << duration_hours << "h"; std::cout << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" @@ -797,9 +797,9 @@ void osnma_msg_receiver::read_mack_header() { lt_bits = it->second; } - if (lt_bits == 0) + if (lt_bits < 16) { - return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure. + return; // The 16 is to avoid negative shifts if shorter tags were defined } uint16_t macseq = 0; uint8_t cop = 0; @@ -1330,7 +1330,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) const { lt_bits = it2->second; } - if (lt_bits == 0) + if (lt_bits < 16) { return false; } diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/system_parameters/gnss_crypto.cc index 27251a5a7..d92a62224 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/system_parameters/gnss_crypto.cc @@ -1370,7 +1370,11 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath) gnutls_pubkey_deinit(pubkey); #else // OpenSSL // Read certificate +#if !(USE_OPENSSL_3 || USE_OPENSSL_111) + BIO* bio = BIO_new_mem_buf(const_cast(buffer.data()), buffer.size()); +#else BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size()); +#endif if (!bio) { LOG(WARNING) << "OpenSSL: Unable to create BIO for file: " << crtFilePath; From 7ff1d9006ebf0177d63e2977629720dc81554b59 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Aug 2024 10:38:52 +0200 Subject: [PATCH 306/499] Fix segmentation fault if the SignalSource implementation is not available --- src/core/receiver/gnss_block_factory.cc | 1 + src/core/receiver/gnss_flowgraph.cc | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1a48e0a7f..dda8452a8 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -113,6 +113,7 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" +#include // for exit #include // for exception #include // for cerr #include // for move diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 957077eca..5b2b9d7f4 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -48,6 +48,7 @@ #include // for transform, sort, unique #include // for floor #include // for size_t +#include // for exit #include // for exception #include // for operator<< #include // for insert_iterator, inserter @@ -124,9 +125,15 @@ void GNSSFlowgraph::init() sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated); // Avoid segmentation fault caused by wrong configuration - if (sources_count_ == 2 && block_factory->GetSignalSource(configuration_.get(), queue_.get(), 0)->implementation() == "Multichannel_File_Signal_Source") + auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), 0); + if (!check_not_nullptr) { - std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuraiion file\n"; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + if (sources_count_ == 2 && check_not_nullptr->implementation() == "Multichannel_File_Signal_Source") + { + std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuration file\n"; std::cout << " if you are using the Multichannel_File_Signal_Source implementation.\n"; sources_count_ = 1; } From c8c46bc3c589a1457d84a515cee2b33e1e49c5e2 Mon Sep 17 00:00:00 2001 From: Xavier Guerrero-Pau Date: Thu, 8 Aug 2024 12:03:46 +0200 Subject: [PATCH 307/499] Moved decimation factor count variable to the class --- .gitignore | 7 +++++++ src/algorithms/signal_source/libs/ad936x_iio_custom.cc | 8 +++++--- src/core/monitor/gnss_synchro_monitor.cc | 2 +- src/core/monitor/gnss_synchro_monitor.h | 3 ++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 007b9ab0c..a876bf1c1 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,10 @@ cmake-build-debug/ .vscode/ .vs/ Testing/ + +GSDR* +PVT_* +HAS_* +gnss_sdr_pvt.nmea +build-debug/ +build-release/ \ No newline at end of file diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 2869081f2..2ad41edfc 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -22,6 +22,7 @@ #include #include #include +#include "display.h" #if USE_GLOG_AND_GFLAGS #include @@ -849,11 +850,12 @@ void ad936x_iio_custom::monitor_thread_fn() // } else { if (val & 4) { - std::cout << "WARNING: IIO status register reported overflow!\n"; - LOG(INFO) << "WARNING: IIO status register reported overflow!"; + std::cout + << TEXT_BOLD_RED + << "WARNING: IIO status register reported overflow!\n"; + LOG(WARNING) << "WARNING: IIO status register reported overflow!"; } - /* Clear bits */ if (val) { diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 502a5ed48..d5e95d623 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -50,6 +50,7 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, d_decimation_factor(decimation_factor) { udp_sink_ptr = std::make_unique(udp_addresses, udp_port, enable_protobuf); + count = 0; } @@ -73,7 +74,6 @@ int gnss_synchro_monitor::general_work(int noutput_items __attribute__((unused)) for (int channel_index = 0; channel_index < d_nchannels; channel_index++) { // Loop through each item in each input stream channel - int count = 0; for (int item_index = 0; item_index < ninput_items[channel_index]; item_index++) { // Use the count variable to limit how many items are sent per channel diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index b45b7cc5b..64749a001 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -71,9 +71,10 @@ private: const std::vector& udp_addresses, bool enable_protobuf); + std::unique_ptr udp_sink_ptr; + int count; int d_nchannels; int d_decimation_factor; - std::unique_ptr udp_sink_ptr; }; From 41dd9286890a98394e05821502ae6dddeb1878b6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Aug 2024 12:41:11 +0200 Subject: [PATCH 308/499] Avoid possible runtime error when PVT.enable_rx_clock_correction=true --- src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index b2dfbfaa5..5f33ecaed 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -2173,7 +2173,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item d_gnss_observables_map_t1 = d_gnss_observables_map; // ### select the rx_time and interpolate observables at that time - if (!d_gnss_observables_map_t0.empty()) + if (!d_gnss_observables_map_t0.empty() && !d_gnss_observables_map_t1.empty()) { const auto t0_int_ms = static_cast(d_gnss_observables_map_t0.cbegin()->second.RX_time * 1000.0); const uint32_t adjust_next_obs_interval_ms = d_observable_interval_ms - t0_int_ms % d_observable_interval_ms; From a19d2602819145f88798319890c6475b5a1f73eb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Aug 2024 14:05:03 +0200 Subject: [PATCH 309/499] Fix formatting --- .../signal_source/libs/ad936x_iio_custom.cc | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 2ad41edfc..72461bafd 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -13,6 +13,7 @@ * ----------------------------------------------------------------------------- */ #include "ad936x_iio_custom.h" +#include "display.h" #include #include #include @@ -22,7 +23,6 @@ #include #include #include -#include "display.h" #if USE_GLOG_AND_GFLAGS #include @@ -45,6 +45,7 @@ ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) n_channels = 0; } + ad936x_iio_custom::~ad936x_iio_custom() { // disable TX @@ -60,11 +61,13 @@ void ad936x_iio_custom::set_gnsstime_queue(std::shared_ptr> queue) { Pps_queue = std::move(queue); } + bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::string board_type) { // Find devices @@ -126,7 +129,6 @@ bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::str return false; } - phy = iio_context_find_device(ctx, "ad9361-phy"); if (phy == NULL) @@ -329,7 +331,6 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, configure_params(dds_dev, params_dds); } - return true; } @@ -346,6 +347,7 @@ bool ad936x_iio_custom::check_device() } } + bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, std::string &value) { struct iio_channel *chn = 0; @@ -387,6 +389,7 @@ bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, } } + bool ad936x_iio_custom::read_die_temp(double &temp_c) { std::string temp_mC_str; @@ -411,6 +414,8 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) return false; } } + + bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, @@ -426,7 +431,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, double lo_attenuation_db_, bool high_side_lo_, int tx_lo_channel_) - { if (check_device() == false) return false; @@ -611,14 +615,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Warning: rf_port_select write returned: " << ret << "\n"; no_errors = false; } - // ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_); // if (ret < 0) // { // std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n"; // no_errors = false; // } - long long set_rf_bw; ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw); if (ret < 0) @@ -631,7 +633,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Info: rf_bandwidth read returned: " << set_rf_bw << " Hz \n"; } - if (setRXGain(0, gain_mode_rx0_, rf_gain_rx0_) == false) { std::cerr << "Info: setRXGain read returned false \n"; @@ -663,14 +664,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Warning: rf_port_select write returned: " << ret << "\n"; no_errors = false; } - // ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_); // if (ret < 0) // { // std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n"; // no_errors = false; // } - long long set_rf_bw; ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw); if (ret < 0) @@ -703,6 +702,7 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, return no_errors; } + bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) { if (check_device() == false) return false; @@ -748,6 +748,7 @@ bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) return true; } + bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain_dB) { if (check_device() == false) return false; @@ -780,6 +781,7 @@ bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain } } + double ad936x_iio_custom::get_rx_gain(int ch_num) { if (check_device() == false) return -1; @@ -818,6 +820,7 @@ bool ad936x_iio_custom::calibrate([[maybe_unused]] int ch, [[maybe_unused]] doub return true; } + void ad936x_iio_custom::monitor_thread_fn() { uint32_t val; @@ -850,7 +853,7 @@ void ad936x_iio_custom::monitor_thread_fn() // } else { if (val & 4) { - std::cout + std::cout << TEXT_BOLD_RED << "WARNING: IIO status register reported overflow!\n"; LOG(WARNING) << "WARNING: IIO status register reported overflow!"; @@ -869,6 +872,7 @@ void ad936x_iio_custom::monitor_thread_fn() return; } + void ad936x_iio_custom::stop_record() { receive_samples = false; @@ -917,6 +921,7 @@ void ad936x_iio_custom::PlutoTxEnable(bool txon) } } + void ad936x_iio_custom::setPlutoGpo(int p) { char pins[11]; @@ -955,7 +960,6 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) // 1 Enable // X Enable Mask if Identifier=0xF - if (check_device() == false) return false; // int plutoGpo = 0; int ret; @@ -1008,6 +1012,8 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return true; } + + void ad936x_iio_custom::get_PPS_timestamp() { GnssTime tow; @@ -1044,7 +1050,6 @@ void ad936x_iio_custom::get_PPS_timestamp() // record pps rise samplestamp associated to the absolute sample counter // PPS rising edge must be associated with the corresponding uBlox time message (tx once a second) - if (GnssTime_queue->timed_wait_and_pop(tow, 2000) == false) { if (receive_samples == true) @@ -1075,6 +1080,8 @@ void ad936x_iio_custom::get_PPS_timestamp() } } } + + bool ad936x_iio_custom::start_sample_rx(bool ppsmode) { // using queues of smart pointers to preallocated buffers @@ -1120,9 +1127,7 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) // start sample overflow detector overflow_monitor_thread = std::thread(&ad936x_iio_custom::monitor_thread_fn, this); - // start PPS and GNSS Time capture thread - if (ppsmode == true) { capture_time_thread = std::thread(&ad936x_iio_custom::get_PPS_timestamp, this); @@ -1130,16 +1135,19 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) return true; } + void ad936x_iio_custom::pop_sample_buffer(std::shared_ptr ¤t_buffer) { used_buffers.wait_and_pop(current_buffer); } + void ad936x_iio_custom::push_sample_buffer(std::shared_ptr ¤t_buffer) { free_buffers.push(current_buffer); } + void ad936x_iio_custom::capture(const std::vector &channels) { if (check_device() == false) return; From 621ee34048b475b8fc1ed3495dbeb0a24acc6f64 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 8 Aug 2024 17:53:59 +0200 Subject: [PATCH 310/499] Fix clang-tidy job --- src/core/monitor/gnss_synchro_monitor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index d5e95d623..98526fe60 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -46,11 +46,11 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, : gr::block("gnss_synchro_monitor", gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), gr::io_signature::make(0, 0, 0)), + count(0), d_nchannels(n_channels), d_decimation_factor(decimation_factor) { udp_sink_ptr = std::make_unique(udp_addresses, udp_port, enable_protobuf); - count = 0; } From 1502808f5827060f4e48dfb45aebeb505d90e76d Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 8 Aug 2024 22:30:45 +0200 Subject: [PATCH 311/499] Capitalize FPGA in class implementation names --- ...lileo_e1_pcps_ambiguous_acquisition_fpga.h | 4 +- .../galileo_e5a_pcps_acquisition_fpga.h | 4 +- .../galileo_e5b_pcps_acquisition_fpga.h | 2 +- .../gps_l1_ca_pcps_acquisition_fpga.h | 4 +- .../adapters/gps_l2_m_pcps_acquisition_fpga.h | 4 +- .../adapters/gps_l5i_pcps_acquisition_fpga.h | 4 +- .../galileo_e1_dll_pll_veml_tracking_fpga.h | 4 +- .../galileo_e5a_dll_pll_tracking_fpga.h | 4 +- .../gps_l1_ca_dll_pll_tracking_fpga.h | 4 +- .../adapters/gps_l2_m_dll_pll_tracking_fpga.h | 4 +- .../adapters/gps_l5_dll_pll_tracking_fpga.h | 4 +- src/core/receiver/gnss_block_factory.cc | 48 +++++++++---------- ...e1_pcps_ambiguous_acquisition_test_fpga.cc | 4 +- .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 4 +- .../hybrid_observables_test_fpga.cc | 34 ++++++------- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 2 +- .../tracking/tracking_pull-in_test_fpga.cc | 36 +++++++------- 17 files changed, 85 insertions(+), 85 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index 09829267c..b28d63422 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -66,11 +66,11 @@ public: } /*! - * \brief Returns "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga" + * \brief Returns "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA" */ inline std::string implementation() override { - return "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga"; + return "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 12d38bf34..14dae0230 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -66,11 +66,11 @@ public: } /*! - * \brief Returns "Galileo_E5a_Pcps_Acquisition_Fpga" + * \brief Returns "Galileo_E5a_Pcps_Acquisition_FPGA" */ inline std::string implementation() override { - return "Galileo_E5a_Pcps_Acquisition_Fpga"; + return "Galileo_E5a_Pcps_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h index 8ae54e46a..d67bfd4a6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h @@ -65,7 +65,7 @@ public: } /*! - * \brief Returns "Galileo_E5b_Pcps_Acquisition_Fpga" + * \brief Returns "Galileo_E5b_Pcps_Acquisition_FPGA" */ inline std::string implementation() override { diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index cfc483cda..2b7bfd3f9 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -67,11 +67,11 @@ public: } /*! - * \brief Returns "GPS_L1_CA_PCPS_Acquisition_Fpga" + * \brief Returns "GPS_L1_CA_PCPS_Acquisition_FPGA" */ inline std::string implementation() override { - return "GPS_L1_CA_PCPS_Acquisition_Fpga"; + return "GPS_L1_CA_PCPS_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 19acec8cb..81f4d342c 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -60,11 +60,11 @@ public: } /*! - * \brief Returns "GPS_L2_M_PCPS_Acquisition_Fpga" + * \brief Returns "GPS_L2_M_PCPS_Acquisition_FPGA" */ inline std::string implementation() override { - return "GPS_L2_M_PCPS_Acquisition_Fpga"; + return "GPS_L2_M_PCPS_Acquisition_FPGA"; } inline size_t item_size() override diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index 497ab9b90..bf2bfafcf 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -69,11 +69,11 @@ public: } /*! - * \brief Returns "GPS_L5i_PCPS_Acquisition_Fpga" + * \brief Returns "GPS_L5i_PCPS_Acquisition_FPGA" */ inline std::string implementation() override { - return "GPS_L5i_PCPS_Acquisition_Fpga"; + return "GPS_L5i_PCPS_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h index 722440f32..8de75e087 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h @@ -65,11 +65,11 @@ public: } /*! - * \brief Returns "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga" + * \brief Returns "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA" */ inline std::string implementation() override { - return "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga"; + return "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h index 510df45ea..1b3c8f52b 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h @@ -59,11 +59,11 @@ public: } /*! - * \brief Returns "Galileo_E5a_DLL_PLL_Tracking_Fpga" + * \brief Returns "Galileo_E5a_DLL_PLL_Tracking_FPGA" */ inline std::string implementation() override { - return "Galileo_E5a_DLL_PLL_Tracking_Fpga"; + return "Galileo_E5a_DLL_PLL_Tracking_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h index dedefd7c5..ed3b23f4a 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h @@ -64,11 +64,11 @@ public: } /*! - * \brief Returns "GPS_L1_CA_DLL_PLL_Tracking_Fpga" + * \brief Returns "GPS_L1_CA_DLL_PLL_Tracking_FPGA" */ inline std::string implementation() override { - return "GPS_L1_CA_DLL_PLL_Tracking_Fpga"; + return "GPS_L1_CA_DLL_PLL_Tracking_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h index 506e8fec6..a89dd5d55 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h @@ -57,10 +57,10 @@ public: return role_; } - //! Returns "GPS_L2_M_DLL_PLL_Tracking_Fpga" + //! Returns "GPS_L2_M_DLL_PLL_Tracking_FPGA" inline std::string implementation() override { - return "GPS_L2_M_DLL_PLL_Tracking_Fpga"; + return "GPS_L2_M_DLL_PLL_Tracking_FPGA"; } inline size_t item_size() override diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h index 24fc37a14..ed85735b2 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h @@ -65,11 +65,11 @@ public: } /*! - * \brief Returns "GPS_L5_DLL_PLL_Tracking_Fpga" + * \brief Returns "GPS_L5_DLL_PLL_Tracking_FPGA" */ inline std::string implementation() override { - return "GPS_L5_DLL_PLL_Tracking_Fpga"; + return "GPS_L5_DLL_PLL_Tracking_FPGA"; } /*! diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 4012c4121..a9c0186e2 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -821,13 +821,13 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and AD9361_DRIVER - else if (implementation == "Adrv9361_Z7035_Signal_Source_Fpga") + else if (implementation == "Adrv9361_Z7035_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } - else if (implementation == "Fmcomms5_Signal_Source_Fpga") + else if (implementation == "Fmcomms5_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); @@ -836,7 +836,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and MAX2771_DRIVER - else if (implementation == "Max2771_Evkit_Signal_Source_Fpga") + else if (implementation == "Max2771_Evkit_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); @@ -845,7 +845,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and DMA_PROXY_DRIVER - else if (implementation == "Dma_Signal_Source_Fpga") + else if (implementation == "Dma_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); @@ -1084,31 +1084,31 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L1_CA_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga") + else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L2_M_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L5i_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L5i_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_Pcps_Acquisition_Fpga") + else if (implementation == "Galileo_E5a_Pcps_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); @@ -1234,31 +1234,31 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_Fpga") or (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga")) + else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_FPGA") or (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA")) { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); @@ -1522,31 +1522,31 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L1_CA_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga") + else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L2_M_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L5i_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L5i_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_Pcps_Acquisition_Fpga") + else if (implementation == "Galileo_E5a_Pcps_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); @@ -1690,31 +1690,31 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_Fpga") or (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga")) + else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_FPGA") or (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA")) { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc index 73aab356c..4d68363f8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc @@ -67,7 +67,7 @@ class GalileoE1PcpsAmbiguousAcquisitionTestFpga : public ::testing::Test { public: bool acquire_signal(); - std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_Fpga"; + std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_FPGA"; std::vector gnss_synchro_vec; const int32_t TEST_ACQ_SKIP_SAMPLES = 1024; @@ -397,7 +397,7 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal() void GalileoE1PcpsAmbiguousAcquisitionTestFpga::init() { config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga"); + config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA"); config->set_property("Acquisition.threshold", "0.00001"); config->set_property("Acquisition.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition.doppler_step", std::to_string(doppler_step)); 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 13058472e..47ddc54aa 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 @@ -66,7 +66,7 @@ class GpsL1CaPcpsAcquisitionTestFpga : public ::testing::Test { public: bool acquire_signal(); - std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_Fpga"; + std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_FPGA"; std::vector gnss_synchro_vec; const int32_t TEST_ACQ_SKIP_SAMPLES = 1024; @@ -396,7 +396,7 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal() void GpsL1CaPcpsAcquisitionTestFpga::init() { config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition_Fpga"); + config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition_FPGA"); config->set_property("Acquisition.threshold", "0.00001"); config->set_property("Acquisition.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition.doppler_step", std::to_string(doppler_step)); 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 a55d054b1..c466a277b 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 @@ -642,7 +642,7 @@ bool HybridObservablesTestFpga::acquire_signal() switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "1C"; @@ -654,7 +654,7 @@ bool HybridObservablesTestFpga::acquire_signal() args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "1B"; @@ -666,7 +666,7 @@ bool HybridObservablesTestFpga::acquire_signal() args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "5X"; @@ -678,7 +678,7 @@ bool HybridObservablesTestFpga::acquire_signal() args.freq_band = 1; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "L5"; @@ -732,19 +732,19 @@ bool HybridObservablesTestFpga::acquire_signal() // number of samples that the DMA has to transfer unsigned int nsamples_to_transfer; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); } - else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)) + else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_FPGA") == 0)) { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS))); } @@ -762,7 +762,7 @@ bool HybridObservablesTestFpga::acquire_signal() acquisition->init(); acquisition->set_local_code(); - if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga")) + if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA")) { // Skip the first TEST_OBS_SKIP_SAMPLES samples args.skip_used_samples = 0; @@ -910,7 +910,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); std::string System_and_Signal; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { gnss_synchro_master.System = 'G'; std::string signal = "1C"; @@ -923,7 +923,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { gnss_synchro_master.System = 'E'; std::string signal = "1B"; @@ -939,7 +939,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("TelemetryDecoder.implementation", "Galileo_E1B_Telemetry_Decoder"); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") // or implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") // or implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) { gnss_synchro_master.System = 'E'; std::string signal = "5X"; @@ -953,7 +953,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("TelemetryDecoder.implementation", "Galileo_E5a_Telemetry_Decoder"); } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { gnss_synchro_master.System = 'G'; std::string signal = "L5"; @@ -2031,22 +2031,22 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR; // reset the HW to clear the sample counters: the acquisition constructor generates a reset - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 4bd43fc30..d5f2348af 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -355,7 +355,7 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver() std::to_string(baseband_sampling_freq)); // Set Tracking config->set_property("Tracking_1C.implementation", - "GPS_L1_CA_DLL_PLL_Tracking_Fpga"); + "GPS_L1_CA_DLL_PLL_Tracking_FPGA"); config->set_property("Tracking_1C.item_type", "cshort"); config->set_property("Tracking_1C.dump", "true"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index 33baeac6f..a2f27204e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -536,7 +536,7 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); std::string System_and_Signal; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { gnss_synchro.System = 'G'; std::string signal = "1C"; @@ -545,7 +545,7 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("Tracking.early_late_space_chips", "0.5"); config->set_property("Tracking.early_late_space_narrow_chips", "0.5"); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { gnss_synchro.System = 'E'; std::string signal = "1B"; @@ -557,7 +557,7 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("Tracking.very_early_late_space_narrow_chips", "0.6"); config->set_property("Tracking.track_pilot", "true"); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga" or implementation == "Galileo_E5a_DLL_PLL_Tracking_b_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA" or implementation == "Galileo_E5a_DLL_PLL_Tracking_b_Fpga") { gnss_synchro.System = 'E'; std::string signal = "5X"; @@ -565,13 +565,13 @@ void TrackingPullInTestFpga::configure_receiver( signal.copy(gnss_synchro.Signal, 2, 0); if (implementation == "Galileo_E5a_DLL_PLL_Tracking_b") { - config->supersede_property("Tracking.implementation", std::string("Galileo_E5a_DLL_PLL_Tracking_Fpga")); + config->supersede_property("Tracking.implementation", std::string("Galileo_E5a_DLL_PLL_Tracking_FPGA")); } config->set_property("Tracking.early_late_space_chips", "0.5"); config->set_property("Tracking.track_pilot", "true"); config->set_property("Tracking.order", "2"); } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { gnss_synchro.System = 'G'; std::string signal = "L5"; @@ -638,7 +638,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "1C"; @@ -650,7 +650,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "1B"; @@ -662,7 +662,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "5X"; @@ -674,7 +674,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) args.freq_band = 1; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "L5"; @@ -732,19 +732,19 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) // number of samples that the DMA has to transfer unsigned int nsamples_to_transfer; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); } - else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)) + else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_FPGA") == 0)) { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS))); } @@ -762,7 +762,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) acquisition->init(); acquisition->set_local_code(); - if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga")) + if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA")) { // Configure the DMA to send TEST_TRK_PULL_IN_TEST_SKIP_SAMPLES in order to initialize the internal // states of the downsampling filter in the FPGA @@ -1079,22 +1079,22 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::shared_ptr acquisition; // reset the HW to clear the sample counters: the acquisition constructor generates a reset - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; From 9b9f0fc438da90d71747c357a1dc4d84d4886c42 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Fri, 9 Aug 2024 15:17:19 +0200 Subject: [PATCH 312/499] Capitalize acronyms in FPGA-related class names --- src/core/receiver/gnss_block_factory.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index a9c0186e2..9113af7f5 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -821,13 +821,13 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and AD9361_DRIVER - else if (implementation == "Adrv9361_Z7035_Signal_Source_FPGA") + else if (implementation == "ADRV9361_Z7035_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } - else if (implementation == "Fmcomms5_Signal_Source_FPGA") + else if (implementation == "FMCOMMS5_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); @@ -836,7 +836,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and MAX2771_DRIVER - else if (implementation == "Max2771_Evkit_Signal_Source_FPGA") + else if (implementation == "MAX2771_EVKIT_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); @@ -845,7 +845,7 @@ std::unique_ptr GNSSBlockFactory::GetBlock( #endif #if ENABLE_FPGA and DMA_PROXY_DRIVER - else if (implementation == "Dma_Signal_Source_FPGA") + else if (implementation == "DMA_Signal_Source_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); From 7ce4f623448069f3374197f1f32971d1221483fd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 10 Aug 2024 07:37:46 +0200 Subject: [PATCH 313/499] Instantiate sources only once --- src/core/receiver/gnss_flowgraph.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 5b2b9d7f4..d27da6070 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -125,13 +125,7 @@ void GNSSFlowgraph::init() sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated); // Avoid segmentation fault caused by wrong configuration - auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), 0); - if (!check_not_nullptr) - { - std::cout << "GNSS-SDR program ended.\n"; - exit(1); - } - if (sources_count_ == 2 && check_not_nullptr->implementation() == "Multichannel_File_Signal_Source") + if (sources_count_ == 2 && configuration_->property("SignalSource.implementation", std::string("")) == "Multichannel_File_Signal_Source") { std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuration file\n"; std::cout << " if you are using the Multichannel_File_Signal_Source implementation.\n"; @@ -143,7 +137,13 @@ void GNSSFlowgraph::init() for (int i = 0; i < sources_count_; i++) { DLOG(INFO) << "Creating source " << i; - sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i)); + auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), i); + if (!check_not_nullptr) + { + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + sig_source_.push_back(std::move(check_not_nullptr)); if (enable_fpga_offloading_ == false) { auto& src = sig_source_.back(); From 79da7787ffa3ac852f81fc1b672c04a641b36492 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 10 Aug 2024 11:31:15 +0200 Subject: [PATCH 314/499] Move files (#24) * Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 * Avoid code duplication in CMake modules * Update clang-tidy job * Clang Tidy fixes * Improve efficiency of Concurrent_Map and Concurrent_Queue classes * Fix segmentation fault if the SignalSource implementation is not available * Moved decimation factor count variable to the class * Avoid possible runtime error when PVT.enable_rx_clock_correction=true * Fix formatting * Fix clang-tidy job * Move receiver-related classes to src/core/libs * Uniformize cmake module names * Fix formatting * Make clang-tidy happy * Fix crypto benchmarks * Fixes for old systems * Instantiate sources only once --------- Co-authored-by: cesaaargm Co-authored-by: Xavier Guerrero-Pau --- .gitignore | 10 ++- CMakeLists.txt | 2 +- cmake/Modules/FindGNURADIO.cmake | 2 + ...nssSdrCrypto.cmake => GnsssdrCrypto.cmake} | 0 .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 2 +- .../signal_source/libs/ad936x_iio_custom.cc | 40 +++++---- src/core/libs/CMakeLists.txt | 43 ++++++---- .../gnss_crypto.cc | 6 +- .../{system_parameters => libs}/gnss_crypto.h | 2 +- .../osnma_helper.cc | 0 .../osnma_helper.h | 2 +- .../osnma_nav_data_manager.cc | 75 +++++++++------- .../osnma_nav_data_manager.h | 46 ++++++---- src/core/monitor/gnss_synchro_monitor.cc | 2 +- src/core/monitor/gnss_synchro_monitor.h | 3 +- src/core/receiver/concurrent_map.h | 40 ++++----- src/core/receiver/concurrent_queue.h | 61 ++++++------- src/core/receiver/gnss_block_factory.cc | 1 + src/core/receiver/gnss_flowgraph.cc | 13 ++- src/core/system_parameters/CMakeLists.txt | 10 --- src/core/system_parameters/osnma_data.h | 44 ++++++---- src/tests/benchmarks/CMakeLists.txt | 2 +- src/tests/benchmarks/benchmark_crypto.cc | 86 ++++++------------- 23 files changed, 260 insertions(+), 232 deletions(-) rename cmake/Modules/{GnssSdrCrypto.cmake => GnsssdrCrypto.cmake} (100%) rename src/core/{system_parameters => libs}/gnss_crypto.cc (99%) rename src/core/{system_parameters => libs}/gnss_crypto.h (99%) rename src/core/{system_parameters => libs}/osnma_helper.cc (100%) rename src/core/{system_parameters => libs}/osnma_helper.h (97%) rename src/core/{system_parameters => libs}/osnma_nav_data_manager.cc (83%) rename src/core/{system_parameters => libs}/osnma_nav_data_manager.h (61%) diff --git a/.gitignore b/.gitignore index dd9645f6d..4a50387fa 100644 --- a/.gitignore +++ b/.gitignore @@ -15,11 +15,17 @@ src/utils/nav-listener/build .cproject .idea cmake-build-debug/ +cmake-build-release/ /install .DS_Store .pydevproject .vscode/ .vs/ Testing/ -/build/* -/cmake-build-release/* \ No newline at end of file +GSDR* +PVT_* +HAS_* +gnss_sdr_pvt.nmea +build-debug/ +build-release/ + diff --git a/CMakeLists.txt b/CMakeLists.txt index eb113bad3..e8dfc5825 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2215,7 +2215,7 @@ endif() ################################################################################ # OpenSSL https://www.openssl.org/ or GnuTLS - https://www.gnutls.org/ ################################################################################ -include(GnssSdrCrypto) +include(GnsssdrCrypto) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index cfaf51764..d976d0e28 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -366,8 +366,10 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) ) if(CMAKE_VERSION VERSION_GREATER 3.13) target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) + target_link_libraries(Gnuradio::runtime INTERFACE Log4cpp::log4cpp) else() set_target_properties(Gnuradio::filter PROPERTIES INTERFACE_LINK_LIBRARIES Log4cpp::log4cpp) + set_target_properties(Gnuradio::runtime PROPERTIES INTERFACE_LINK_LIBRARIES Log4cpp::log4cpp) endif() endif() if(${_uses_spdlog}) diff --git a/cmake/Modules/GnssSdrCrypto.cmake b/cmake/Modules/GnsssdrCrypto.cmake similarity index 100% rename from cmake/Modules/GnssSdrCrypto.cmake rename to cmake/Modules/GnsssdrCrypto.cmake diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 109b935c7..2ffe95d24 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -2228,7 +2228,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item d_gnss_observables_map_t1 = d_gnss_observables_map; // ### select the rx_time and interpolate observables at that time - if (!d_gnss_observables_map_t0.empty()) + if (!d_gnss_observables_map_t0.empty() && !d_gnss_observables_map_t1.empty()) { const auto t0_int_ms = static_cast(d_gnss_observables_map_t0.cbegin()->second.RX_time * 1000.0); const uint32_t adjust_next_obs_interval_ms = d_observable_interval_ms - t0_int_ms % d_observable_interval_ms; diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 2869081f2..72461bafd 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -13,6 +13,7 @@ * ----------------------------------------------------------------------------- */ #include "ad936x_iio_custom.h" +#include "display.h" #include #include #include @@ -44,6 +45,7 @@ ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) n_channels = 0; } + ad936x_iio_custom::~ad936x_iio_custom() { // disable TX @@ -59,11 +61,13 @@ void ad936x_iio_custom::set_gnsstime_queue(std::shared_ptr> queue) { Pps_queue = std::move(queue); } + bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::string board_type) { // Find devices @@ -125,7 +129,6 @@ bool ad936x_iio_custom::initialize_device(std::string pluto_device_uri, std::str return false; } - phy = iio_context_find_device(ctx, "ad9361-phy"); if (phy == NULL) @@ -328,7 +331,6 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, configure_params(dds_dev, params_dds); } - return true; } @@ -345,6 +347,7 @@ bool ad936x_iio_custom::check_device() } } + bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, std::string &value) { struct iio_channel *chn = 0; @@ -386,6 +389,7 @@ bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, } } + bool ad936x_iio_custom::read_die_temp(double &temp_c) { std::string temp_mC_str; @@ -410,6 +414,8 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) return false; } } + + bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, @@ -425,7 +431,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, double lo_attenuation_db_, bool high_side_lo_, int tx_lo_channel_) - { if (check_device() == false) return false; @@ -610,14 +615,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Warning: rf_port_select write returned: " << ret << "\n"; no_errors = false; } - // ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_); // if (ret < 0) // { // std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n"; // no_errors = false; // } - long long set_rf_bw; ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw); if (ret < 0) @@ -630,7 +633,6 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Info: rf_bandwidth read returned: " << set_rf_bw << " Hz \n"; } - if (setRXGain(0, gain_mode_rx0_, rf_gain_rx0_) == false) { std::cerr << "Info: setRXGain read returned false \n"; @@ -662,14 +664,12 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, std::cerr << "Warning: rf_port_select write returned: " << ret << "\n"; no_errors = false; } - // ret = iio_channel_attr_write_longlong(phy_ch, "rf_bandwidth", bandwidth_); // if (ret < 0) // { // std::cerr << "Warning: rf_bandwidth write returned: " << ret << "\n"; // no_errors = false; // } - long long set_rf_bw; ret = iio_channel_attr_read_longlong(phy_ch, "rf_bandwidth", &set_rf_bw); if (ret < 0) @@ -702,6 +702,7 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, return no_errors; } + bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) { if (check_device() == false) return false; @@ -747,6 +748,7 @@ bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) return true; } + bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain_dB) { if (check_device() == false) return false; @@ -779,6 +781,7 @@ bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain } } + double ad936x_iio_custom::get_rx_gain(int ch_num) { if (check_device() == false) return -1; @@ -817,6 +820,7 @@ bool ad936x_iio_custom::calibrate([[maybe_unused]] int ch, [[maybe_unused]] doub return true; } + void ad936x_iio_custom::monitor_thread_fn() { uint32_t val; @@ -849,11 +853,12 @@ void ad936x_iio_custom::monitor_thread_fn() // } else { if (val & 4) { - std::cout << "WARNING: IIO status register reported overflow!\n"; - LOG(INFO) << "WARNING: IIO status register reported overflow!"; + std::cout + << TEXT_BOLD_RED + << "WARNING: IIO status register reported overflow!\n"; + LOG(WARNING) << "WARNING: IIO status register reported overflow!"; } - /* Clear bits */ if (val) { @@ -867,6 +872,7 @@ void ad936x_iio_custom::monitor_thread_fn() return; } + void ad936x_iio_custom::stop_record() { receive_samples = false; @@ -915,6 +921,7 @@ void ad936x_iio_custom::PlutoTxEnable(bool txon) } } + void ad936x_iio_custom::setPlutoGpo(int p) { char pins[11]; @@ -953,7 +960,6 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) // 1 Enable // X Enable Mask if Identifier=0xF - if (check_device() == false) return false; // int plutoGpo = 0; int ret; @@ -1006,6 +1012,8 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return true; } + + void ad936x_iio_custom::get_PPS_timestamp() { GnssTime tow; @@ -1042,7 +1050,6 @@ void ad936x_iio_custom::get_PPS_timestamp() // record pps rise samplestamp associated to the absolute sample counter // PPS rising edge must be associated with the corresponding uBlox time message (tx once a second) - if (GnssTime_queue->timed_wait_and_pop(tow, 2000) == false) { if (receive_samples == true) @@ -1073,6 +1080,8 @@ void ad936x_iio_custom::get_PPS_timestamp() } } } + + bool ad936x_iio_custom::start_sample_rx(bool ppsmode) { // using queues of smart pointers to preallocated buffers @@ -1118,9 +1127,7 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) // start sample overflow detector overflow_monitor_thread = std::thread(&ad936x_iio_custom::monitor_thread_fn, this); - // start PPS and GNSS Time capture thread - if (ppsmode == true) { capture_time_thread = std::thread(&ad936x_iio_custom::get_PPS_timestamp, this); @@ -1128,16 +1135,19 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) return true; } + void ad936x_iio_custom::pop_sample_buffer(std::shared_ptr ¤t_buffer) { used_buffers.wait_and_pop(current_buffer); } + void ad936x_iio_custom::push_sample_buffer(std::shared_ptr ¤t_buffer) { free_buffers.push(current_buffer); } + void ad936x_iio_custom::capture(const std::vector &channels) { if (check_device() == false) return; diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index 0396b1e25..cb77ec515 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -9,36 +9,42 @@ protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${GNSSSDR_SOURCE_DIR}/docs/protobuf/ add_subdirectory(supl) set(CORE_LIBS_SOURCES - ini.cc - INIReader.cc - string_converter.cc - gnss_sdr_supl_client.cc - gnss_sdr_sample_counter.cc - channel_status_msg_receiver.cc channel_event.cc + channel_status_msg_receiver.cc command_event.cc galileo_e6_has_msg_receiver.cc + galileo_tow_map.cc + gnss_crypto.cc + gnss_sdr_sample_counter.cc + gnss_sdr_supl_client.cc + ini.cc + INIReader.cc nav_message_monitor.cc nav_message_udp_sink.cc - galileo_tow_map.cc + osnma_helper.cc osnma_msg_receiver.cc + osnma_nav_data_manager.cc + string_converter.cc ) set(CORE_LIBS_HEADERS + channel_event.h + channel_status_msg_receiver.h + command_event.h + galileo_tow_map.h + gnss_crypto.h + gnss_sdr_sample_counter.h + gnss_sdr_supl_client.h ini.h INIReader.h - string_converter.h - gnss_sdr_supl_client.h - gnss_sdr_sample_counter.h - channel_status_msg_receiver.h - channel_event.h - command_event.h + nav_message_monitor.h nav_message_packet.h nav_message_udp_sink.h - serdes_nav_message.h - nav_message_monitor.h - galileo_tow_map.h + osnma_helper.h osnma_msg_receiver.h + osnma_nav_data_manager.h + serdes_nav_message.h + string_converter.h ) if(ENABLE_FPGA) @@ -96,6 +102,7 @@ target_link_libraries(core_libs PRIVATE algorithms_libs Boost::serialization + Boost::system Pugixml::pugixml ) @@ -123,6 +130,10 @@ target_include_directories(core_libs ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) +# links to the appropriate library and defines +# USE_GNUTLS_FALLBACK, USE_OPENSSL_3, or USE_OPENSSL_111 accordingly. +link_to_crypto_dependencies(core_libs) + if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) diff --git a/src/core/system_parameters/gnss_crypto.cc b/src/core/libs/gnss_crypto.cc similarity index 99% rename from src/core/system_parameters/gnss_crypto.cc rename to src/core/libs/gnss_crypto.cc index d92a62224..cbe4785ff 100644 --- a/src/core/system_parameters/gnss_crypto.cc +++ b/src/core/libs/gnss_crypto.cc @@ -205,7 +205,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p256(const std::vector& messag { if (!have_public_key()) { - LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; + LOG(WARNING) << "Signature verification error: Public key is not available"; return false; } std::vector digest = this->compute_SHA_256(message); @@ -344,7 +344,7 @@ bool Gnss_Crypto::verify_signature_ecdsa_p521(const std::vector& messag { if (!have_public_key()) { - LOG(WARNING) << "Galileo OSNMA KROOT verification error: Public key is not available"; + LOG(WARNING) << "Signature verification error: Public key is not available"; return false; } @@ -797,7 +797,7 @@ std::string Gnss_Crypto::get_public_key_type() const { if (d_PublicKeyType.empty()) { - return std::string("Unknown"); + return {"Unknown"}; } return d_PublicKeyType; } diff --git a/src/core/system_parameters/gnss_crypto.h b/src/core/libs/gnss_crypto.h similarity index 99% rename from src/core/system_parameters/gnss_crypto.h rename to src/core/libs/gnss_crypto.h index e197d61d0..b308f820b 100644 --- a/src/core/system_parameters/gnss_crypto.h +++ b/src/core/libs/gnss_crypto.h @@ -31,7 +31,7 @@ /** \addtogroup Core * \{ */ -/** \addtogroup System_Parameters +/** \addtogroup Core_Receiver_Library * \{ */ /*! diff --git a/src/core/system_parameters/osnma_helper.cc b/src/core/libs/osnma_helper.cc similarity index 100% rename from src/core/system_parameters/osnma_helper.cc rename to src/core/libs/osnma_helper.cc diff --git a/src/core/system_parameters/osnma_helper.h b/src/core/libs/osnma_helper.h similarity index 97% rename from src/core/system_parameters/osnma_helper.h rename to src/core/libs/osnma_helper.h index c6b367664..a7b2cc332 100644 --- a/src/core/system_parameters/osnma_helper.h +++ b/src/core/libs/osnma_helper.h @@ -25,7 +25,7 @@ /** \addtogroup Core * \{ */ -/** \addtogroup System_Parameters +/** \addtogroup Core_Receiver_Library * \{ */ class Osnma_Helper diff --git a/src/core/system_parameters/osnma_nav_data_manager.cc b/src/core/libs/osnma_nav_data_manager.cc similarity index 83% rename from src/core/system_parameters/osnma_nav_data_manager.cc rename to src/core/libs/osnma_nav_data_manager.cc index 9d5017aec..6d8a16113 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.cc +++ b/src/core/libs/osnma_nav_data_manager.cc @@ -1,23 +1,22 @@ /*! -* \file osnma_nav_data_manager.cc -* \brief Class for Galileo OSNMA navigation data management -* \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ + * \file osnma_nav_data_manager.cc + * \brief Class for Galileo OSNMA navigation data management + * \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ #include "osnma_nav_data_manager.h" #if USE_GLOG_AND_GFLAGS #include // for DLOG -#include #else #include #endif @@ -54,18 +53,20 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& if (have_PRNd_nav_data(tag.second.PRN_d)) { std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; - for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { std::string nav_data; if (tag.second.ADKD == 0 || tag.second.ADKD == 12) { nav_data = tow_it.second.get_ephemeris_data(); } - else if (tag.second.ADKD == 4){ + else if (tag.second.ADKD == 4) + { nav_data = tow_it.second.get_utc_data(); } // find associated OSNMA_NavData - if (tag.second.nav_data == nav_data){ + if (tag.second.nav_data == nav_data) + { _satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; } } @@ -138,16 +139,17 @@ bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) { auto prn_it = _satellite_nav_data.find(tag.PRN_d); - if (prn_it == _satellite_nav_data.end()){ + if (prn_it == _satellite_nav_data.end()) + { return ""; } // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition - if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30) + if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30) { if (tag.ADKD == 0 || tag.ADKD == 12) { @@ -156,9 +158,8 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) return tow_it.second.get_ephemeris_data(); } } - else if(tag.ADKD == 4) + else if (tag.ADKD == 4) { - if (!tow_it.second.get_utc_data().empty()) { return tow_it.second.get_utc_data(); @@ -179,17 +180,22 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) */ bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { - if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()){ + if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()) + { for (auto& data_timestamp : _satellite_nav_data[PRNd]) { - if (nav_bits.size() == EPH_SIZE){ - if (data_timestamp.second.get_ephemeris_data() == nav_bits){ + if (nav_bits.size() == EPH_SIZE) + { + if (data_timestamp.second.get_ephemeris_data() == nav_bits) + { data_timestamp.second.update_last_received_timestamp(TOW); return true; } } - else if (nav_bits.size() == UTC_SIZE){ - if (data_timestamp.second.get_utc_data() == nav_bits){ + else if (nav_bits.size() == UTC_SIZE) + { + if (data_timestamp.second.get_utc_data() == nav_bits) + { data_timestamp.second.update_last_received_timestamp(TOW); return true; } @@ -208,15 +214,16 @@ bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const { auto prn_it = _satellite_nav_data.find(t.PRN_d); - if (prn_it == _satellite_nav_data.end()){ + if (prn_it == _satellite_nav_data.end()) + { return false; } // satellite was found, check if TOW exists in inner map std::map tow_map = prn_it->second; - for (auto & tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset { // Check if current key (TOW) fulfills condition - if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30) + if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30) { if (t.ADKD == 0 || t.ADKD == 12) { @@ -240,10 +247,12 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const void OSNMA_nav_data_Manager::print_status() { - for (const auto& satellite : _satellite_nav_data){ + for (const auto& satellite : _satellite_nav_data) + { LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first; const auto& tow_data = satellite.second; - for (const auto& nav_data : tow_data) { + for (const auto& nav_data : tow_data) + { LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase << std::bitset<10>(nav_data.second.IOD_nav) << ", TOW_start=" diff --git a/src/core/system_parameters/osnma_nav_data_manager.h b/src/core/libs/osnma_nav_data_manager.h similarity index 61% rename from src/core/system_parameters/osnma_nav_data_manager.h rename to src/core/libs/osnma_nav_data_manager.h index 98b3d523f..6a64416d1 100644 --- a/src/core/system_parameters/osnma_nav_data_manager.h +++ b/src/core/libs/osnma_nav_data_manager.h @@ -1,27 +1,32 @@ /*! -* \file osnma_nav_data_manager.h -* \brief Class for Galileo OSNMA navigation data management -* \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ + * \file osnma_nav_data_manager.h + * \brief Class for Galileo OSNMA navigation data management + * \author Cesare Ghionoiu-Martinez, 2020-2023 cesare.martinez(at)proton.me + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ #ifndef GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H #define GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H #include "osnma_data.h" // NavData -#include // uint32_t +#include // uint32_t #include -#include #include +#include + +/** \addtogroup Core + * \{ */ +/** \addtogroup Core_Receiver_Library + * \{ */ /** * @class OSNMA_nav_data_Manager @@ -29,11 +34,12 @@ * @details It does good stuff * @remarks throw it whatever, it will improve it. Does good stuff */ -class OSNMA_nav_data_Manager{ +class OSNMA_nav_data_Manager +{ public: OSNMA_nav_data_Manager() = default; bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); - bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); + bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); bool have_nav_data(const Tag& t) const; void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list std::string get_navigation_data(const Tag& t); @@ -41,6 +47,7 @@ public: void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); std::vector get_verified_data(); void print_status(); + private: bool have_PRNd_nav_data(uint32_t PRNd); @@ -50,4 +57,7 @@ private: const uint16_t UTC_SIZE{141}; const uint16_t MAX_ALLOWED_SIZE{150}; // arbitrary maximum for the navigation data container }; + +/** \} */ +/** \} */ #endif // GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 502a5ed48..98526fe60 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -46,6 +46,7 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, : gr::block("gnss_synchro_monitor", gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), gr::io_signature::make(0, 0, 0)), + count(0), d_nchannels(n_channels), d_decimation_factor(decimation_factor) { @@ -73,7 +74,6 @@ int gnss_synchro_monitor::general_work(int noutput_items __attribute__((unused)) for (int channel_index = 0; channel_index < d_nchannels; channel_index++) { // Loop through each item in each input stream channel - int count = 0; for (int item_index = 0; item_index < ninput_items[channel_index]; item_index++) { // Use the count variable to limit how many items are sent per channel diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index b45b7cc5b..64749a001 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -71,9 +71,10 @@ private: const std::vector& udp_addresses, bool enable_protobuf); + std::unique_ptr udp_sink_ptr; + int count; int d_nchannels; int d_decimation_factor; - std::unique_ptr udp_sink_ptr; }; diff --git a/src/core/receiver/concurrent_map.h b/src/core/receiver/concurrent_map.h index 330ab02ef..d16a963d7 100644 --- a/src/core/receiver/concurrent_map.h +++ b/src/core/receiver/concurrent_map.h @@ -36,52 +36,48 @@ template */ class Concurrent_Map { - typedef typename std::map::iterator Data_iterator; // iterator is scope dependent public: void write(int key, Data const& data) { - std::unique_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); + std::lock_guard lock(the_mutex); + auto data_iter = the_map.find(key); if (data_iter != the_map.end()) { data_iter->second = data; // update } else { - the_map.insert(std::pair(key, data)); // insert SILENTLY fails if the item already exists in the map! + the_map.insert(std::pair(key, data)); // insert does not overwrite if the item already exists in the map! } - lock.unlock(); } - std::map get_map_copy() + std::map get_map_copy() const& { - std::unique_lock lock(the_mutex); - std::map map_aux = the_map; - lock.unlock(); - return map_aux; + std::lock_guard lock(the_mutex); + return the_map; // This implicitly creates a copy } - size_t size() + std::map get_map_copy() && { - std::unique_lock lock(the_mutex); - size_t size_ = the_map.size(); - lock.unlock(); - return size_; + std::lock_guard lock(the_mutex); + return std::move(the_map); } - bool read(int key, Data& p_data) + size_t size() const { - std::unique_lock lock(the_mutex); - Data_iterator data_iter; - data_iter = the_map.find(key); + std::lock_guard lock(the_mutex); + return the_map.size(); + } + + bool read(int key, Data& p_data) const + { + std::lock_guard lock(the_mutex); + auto data_iter = the_map.find(key); if (data_iter != the_map.end()) { p_data = data_iter->second; - lock.unlock(); return true; } - lock.unlock(); return false; } diff --git a/src/core/receiver/concurrent_queue.h b/src/core/receiver/concurrent_queue.h index ac7be0f17..ed4e68b0a 100644 --- a/src/core/receiver/concurrent_queue.h +++ b/src/core/receiver/concurrent_queue.h @@ -19,9 +19,10 @@ #include #include +#include #include #include -#include +#include /** \addtogroup Core * \{ */ @@ -33,48 +34,53 @@ template /*! * \brief This class implements a thread-safe std::queue - * - * Thread-safe object queue which uses the library - * boost_thread to perform MUTEX based on the code available at - * https://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html */ class Concurrent_Queue { public: - void push(Data const& data) + void push(const Data& data) { - std::unique_lock lock(the_mutex); - the_queue.push(data); - lock.unlock(); + { + std::lock_guard lock(the_mutex); + the_queue.push(data); + } the_condition_variable.notify_one(); } - bool empty() const + void push(Data&& data) { - std::unique_lock lock(the_mutex); - return the_queue.empty(); + { + std::lock_guard lock(the_mutex); + the_queue.push(std::move(data)); + } + the_condition_variable.notify_one(); } - size_t size() const + bool empty() const noexcept { - std::unique_lock lock(the_mutex); + return size() == 0; + } + + size_t size() const noexcept + { + std::lock_guard lock(the_mutex); return the_queue.size(); } void clear() { - std::unique_lock lock(the_mutex); - the_queue = std::queue(); + std::lock_guard lock(the_mutex); + std::queue().swap(the_queue); } bool try_pop(Data& popped_value) { - std::unique_lock lock(the_mutex); + std::lock_guard lock(the_mutex); if (the_queue.empty()) { return false; } - popped_value = the_queue.front(); + popped_value = std::move(the_queue.front()); the_queue.pop(); return true; } @@ -82,26 +88,21 @@ public: void wait_and_pop(Data& popped_value) { std::unique_lock lock(the_mutex); - while (the_queue.empty()) - { - the_condition_variable.wait(lock); - } - popped_value = the_queue.front(); + the_condition_variable.wait(lock, [this] { return !the_queue.empty(); }); + popped_value = std::move(the_queue.front()); the_queue.pop(); } bool timed_wait_and_pop(Data& popped_value, int wait_ms) { std::unique_lock lock(the_mutex); - if (the_queue.empty()) + if (!the_condition_variable.wait_for(lock, + std::chrono::milliseconds(wait_ms), + [this] { return !the_queue.empty(); })) { - the_condition_variable.wait_for(lock, std::chrono::milliseconds(wait_ms)); - if (the_queue.empty()) - { - return false; - } + return false; } - popped_value = the_queue.front(); + popped_value = std::move(the_queue.front()); the_queue.pop(); return true; } diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1a48e0a7f..dda8452a8 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -113,6 +113,7 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" +#include // for exit #include // for exception #include // for cerr #include // for move diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index b0e3dc418..0d1606924 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -49,6 +49,7 @@ #include // for transform, sort, unique #include // for floor #include // for size_t +#include // for exit #include // for exception #include // for operator<< #include // for insert_iterator, inserter @@ -144,9 +145,9 @@ void GNSSFlowgraph::init() sources_count_ = configuration_->property("GNSS-SDR.num_sources", sources_count_deprecated); // Avoid segmentation fault caused by wrong configuration - if (sources_count_ == 2 && block_factory->GetSignalSource(configuration_.get(), queue_.get(), 0)->implementation() == "Multichannel_File_Signal_Source") + if (sources_count_ == 2 && configuration_->property("SignalSource.implementation", std::string("")) == "Multichannel_File_Signal_Source") { - std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuraiion file\n"; + std::cout << " * Please set GNSS-SDR.num_sources=1 in your configuration file\n"; std::cout << " if you are using the Multichannel_File_Signal_Source implementation.\n"; sources_count_ = 1; } @@ -156,7 +157,13 @@ void GNSSFlowgraph::init() for (int i = 0; i < sources_count_; i++) { DLOG(INFO) << "Creating source " << i; - sig_source_.push_back(block_factory->GetSignalSource(configuration_.get(), queue_.get(), i)); + auto check_not_nullptr = block_factory->GetSignalSource(configuration_.get(), queue_.get(), i); + if (!check_not_nullptr) + { + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + sig_source_.push_back(std::move(check_not_nullptr)); if (enable_fpga_offloading_ == false) { auto& src = sig_source_.back(); diff --git a/src/core/system_parameters/CMakeLists.txt b/src/core/system_parameters/CMakeLists.txt index 5e42732c7..f2c5efce1 100644 --- a/src/core/system_parameters/CMakeLists.txt +++ b/src/core/system_parameters/CMakeLists.txt @@ -7,7 +7,6 @@ set(SYSTEM_PARAMETERS_SOURCES gnss_almanac.cc - gnss_crypto.cc gnss_ephemeris.cc gnss_satellite.cc gnss_signal.cc @@ -31,13 +30,10 @@ set(SYSTEM_PARAMETERS_SOURCES reed_solomon.cc osnma_data.cc osnma_dsm_reader.cc - osnma_helper.cc - osnma_nav_data_manager.cc ) set(SYSTEM_PARAMETERS_HEADERS gnss_almanac.h - gnss_crypto.h gnss_ephemeris.h gnss_satellite.h gnss_signal.h @@ -98,8 +94,6 @@ set(SYSTEM_PARAMETERS_HEADERS Galileo_OSNMA.h osnma_data.h osnma_dsm_reader.h - osnma_helper.h - osnma_nav_data_manager.h ) list(SORT SYSTEM_PARAMETERS_HEADERS) @@ -142,10 +136,6 @@ target_include_directories(core_system_parameters ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs ) -# links to the appropriate library and defines -# USE_GNUTLS_FALLBACK, USE_OPENSSL_3, or USE_OPENSSL_111 accordingly. -link_to_crypto_dependencies(core_system_parameters) - if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(core_system_parameters diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 052a23921..7bf85862c 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -40,6 +40,7 @@ public: bool reserved{}; }; + class DSM_dsm_header { public: @@ -48,6 +49,7 @@ public: uint8_t dsm_block_id{}; }; + class MACK_header { public: @@ -57,6 +59,7 @@ public: uint8_t cop{}; }; + class MACK_tag_info { public: @@ -66,6 +69,7 @@ public: uint8_t cop{}; }; + class MACK_tag_and_info { public: @@ -75,6 +79,7 @@ public: uint32_t counter; // CTR }; + class DSM_PKR_message { public: @@ -89,6 +94,7 @@ public: uint8_t npktid{}; }; + class DSM_KROOT_message { public: @@ -112,6 +118,7 @@ public: uint8_t towh_k{}; }; + class MACK_message { public: @@ -124,33 +131,38 @@ public: uint32_t PRNa; }; + class OSNMA_NavData { public: - OSNMA_NavData(): nav_data_id(id_counter++){} - bool have_this_bits(std::string nav_data); - bool add_nav_data(const std::string& nav_data); - void update_last_received_timestamp(uint32_t TOW); - const uint32_t nav_data_id; - uint32_t verified_bits{0}; - uint32_t get_tow_sf0() const {return TOW_sf0;} - void set_tow_sf0(int value) {TOW_sf0 = value;} - uint32_t last_received_TOW{0}; - uint32_t IOD_nav{0}; + OSNMA_NavData() : nav_data_id(id_counter++) {} + std::string get_utc_data() const; std::string get_ephemeris_data() const; - void set_ephemeris_data(std::string value) {d_ephemeris_iono = value;} - void set_utc_data(std::string value) {d_utc = value;} + uint32_t get_tow_sf0() const { return TOW_sf0; } + + const uint32_t nav_data_id; + + bool have_this_bits(std::string nav_data); + bool add_nav_data(const std::string& nav_data); bool verified{false}; + + void update_last_received_timestamp(uint32_t TOW); + void set_tow_sf0(int value) { TOW_sf0 = value; } + void set_ephemeris_data(std::string value) { d_ephemeris_iono = value; } + void set_utc_data(std::string value) { d_utc = value; } + + uint32_t verified_bits{0}; + uint32_t last_received_TOW{0}; + uint32_t IOD_nav{0}; uint32_t PRNd{0}; uint32_t ADKD{}; + private: std::string d_ephemeris_iono{""}; std::string d_utc{""}; uint32_t TOW_sf0{0}; - - - uint32_t static id_counter; + static uint32_t id_counter; }; /*! @@ -224,6 +236,8 @@ public: uint32_t skipped; std::string nav_data; }; + /** \} */ /** \} */ + #endif // GNSS_SDR_OSNMA_DATA_H diff --git a/src/tests/benchmarks/CMakeLists.txt b/src/tests/benchmarks/CMakeLists.txt index 74607d1a1..2d79f4d06 100644 --- a/src/tests/benchmarks/CMakeLists.txt +++ b/src/tests/benchmarks/CMakeLists.txt @@ -111,7 +111,7 @@ endif() add_benchmark(benchmark_atan2 Gnuradio::runtime) add_benchmark(benchmark_copy) -add_benchmark(benchmark_crypto core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_crypto core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) diff --git a/src/tests/benchmarks/benchmark_crypto.cc b/src/tests/benchmarks/benchmark_crypto.cc index 2adc95348..ec1945ab9 100644 --- a/src/tests/benchmarks/benchmark_crypto.cc +++ b/src/tests/benchmarks/benchmark_crypto.cc @@ -106,26 +106,12 @@ void bm_verify_ecdsa_p256(benchmark::State& state) 0x6B, 0xFF, 0x70, 0x06, 0xE0, 0xC4, 0x51, 0xEE, 0x3F, 0x87, 0x28, 0xC1, 0x77, 0xFB}; - // PEM format + // compressed ECDSA P-256 format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, - 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, - 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A, 0x4D, 0x46, 0x6B, - 0x77, 0x45, 0x77, 0x59, 0x48, 0x4B, 0x6F, 0x5A, 0x49, 0x7A, - 0x6A, 0x30, 0x43, 0x41, 0x51, 0x59, 0x49, 0x4B, 0x6F, 0x5A, - 0x49, 0x7A, 0x6A, 0x30, 0x44, 0x41, 0x51, 0x63, 0x44, 0x51, - 0x67, 0x41, 0x45, 0x41, 0x37, 0x4C, 0x4F, 0x5A, 0x4C, 0x77, - 0x67, 0x65, 0x39, 0x32, 0x4C, 0x78, 0x4E, 0x2B, 0x46, 0x6B, - 0x59, 0x66, 0x38, 0x74, 0x6F, 0x59, 0x79, 0x44, 0x57, 0x50, - 0x2F, 0x0A, 0x6F, 0x4A, 0x46, 0x42, 0x44, 0x38, 0x46, 0x59, - 0x2B, 0x37, 0x64, 0x35, 0x67, 0x4F, 0x71, 0x49, 0x61, 0x45, - 0x32, 0x52, 0x6A, 0x50, 0x41, 0x6E, 0x4B, 0x49, 0x36, 0x38, - 0x73, 0x2F, 0x4F, 0x4B, 0x2F, 0x48, 0x50, 0x67, 0x6F, 0x4C, - 0x6B, 0x4F, 0x32, 0x69, 0x6A, 0x51, 0x38, 0x78, 0x41, 0x5A, - 0x79, 0x44, 0x64, 0x50, 0x42, 0x31, 0x64, 0x48, 0x53, 0x51, - 0x3D, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, - 0x44, 0x20, 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, - 0x45, 0x59, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x03, 0xB2, 0xCE, 0x64, 0xBC, 0x20, 0x7B, 0xDD, 0x8B, + 0xC4, 0xDF, 0x85, 0x91, 0x87, 0xFC, 0xB6, 0x86, 0x32, 0x0D, + 0x63, 0xFF, 0xA0, 0x91, 0x41, 0x0F, 0xC1, 0x58, 0xFB, 0xB7, + 0x79, 0x80, 0xEA}; d_crypto->set_public_key(publicKey); @@ -146,50 +132,34 @@ void bm_verify_ecdsa_p521(benchmark::State& state) // Message to be verified std::vector message = { - 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x57, 0x6F, 0x72, 0x6C, 0x64}; + 0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x20, 0x77, 0x6F, 0x72, 0x6C, 0x64, 0x0A}; // "Hello world\n" - // Public key in PEM format + // Public key in compressed X format std::vector publicKey = { - 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x50, - 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, 0x2D, - 0x2D, 0x2D, 0x0A, 0x4D, 0x49, 0x47, 0x62, 0x4D, 0x42, 0x41, 0x47, 0x42, - 0x79, 0x71, 0x47, 0x53, 0x4D, 0x34, 0x39, 0x41, 0x67, 0x45, 0x47, 0x42, - 0x53, 0x75, 0x42, 0x42, 0x41, 0x41, 0x6A, 0x41, 0x34, 0x47, 0x47, 0x41, - 0x41, 0x51, 0x41, 0x6F, 0x35, 0x76, 0x77, 0x66, 0x6E, 0x47, 0x57, 0x47, - 0x33, 0x44, 0x63, 0x59, 0x75, 0x2B, 0x2F, 0x61, 0x58, 0x47, 0x32, 0x7A, - 0x74, 0x65, 0x41, 0x46, 0x50, 0x54, 0x33, 0x0A, 0x48, 0x36, 0x4C, 0x76, - 0x4F, 0x4C, 0x76, 0x49, 0x51, 0x6A, 0x61, 0x2B, 0x6A, 0x74, 0x57, 0x73, - 0x70, 0x4F, 0x38, 0x37, 0x6F, 0x50, 0x32, 0x4E, 0x6D, 0x72, 0x34, 0x6E, - 0x50, 0x68, 0x76, 0x62, 0x53, 0x58, 0x52, 0x4D, 0x37, 0x6A, 0x49, 0x69, - 0x46, 0x38, 0x47, 0x70, 0x6B, 0x75, 0x58, 0x6A, 0x75, 0x4E, 0x7A, 0x34, - 0x72, 0x61, 0x56, 0x4F, 0x65, 0x49, 0x4D, 0x42, 0x77, 0x45, 0x2B, 0x61, - 0x0A, 0x30, 0x4C, 0x76, 0x7A, 0x37, 0x69, 0x54, 0x4D, 0x5A, 0x46, 0x41, - 0x41, 0x51, 0x64, 0x2B, 0x70, 0x47, 0x72, 0x56, 0x54, 0x47, 0x77, 0x66, - 0x53, 0x48, 0x49, 0x72, 0x49, 0x49, 0x45, 0x78, 0x74, 0x5A, 0x35, 0x77, - 0x30, 0x38, 0x51, 0x4F, 0x43, 0x58, 0x2F, 0x75, 0x46, 0x65, 0x2B, 0x30, - 0x78, 0x52, 0x78, 0x4C, 0x64, 0x2F, 0x33, 0x36, 0x42, 0x4E, 0x74, 0x63, - 0x74, 0x69, 0x2F, 0x45, 0x4C, 0x0A, 0x4B, 0x31, 0x35, 0x67, 0x2B, 0x4B, - 0x32, 0x71, 0x67, 0x2F, 0x6C, 0x39, 0x46, 0x42, 0x47, 0x67, 0x4D, 0x2B, - 0x51, 0x3D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20, - 0x50, 0x55, 0x42, 0x4C, 0x49, 0x43, 0x20, 0x4B, 0x45, 0x59, 0x2D, 0x2D, - 0x2D, 0x2D, 0x2D, 0x0A}; + 0x03, 0x00, 0x28, 0x35, 0xBB, 0xE9, 0x24, 0x59, 0x4E, 0xF0, + 0xE3, 0xA2, 0xDB, 0xC0, 0x49, 0x30, 0x60, 0x7C, 0x61, 0x90, + 0xE4, 0x03, 0xE0, 0xC7, 0xB8, 0xC2, 0x62, 0x37, 0xF7, 0x58, + 0x56, 0xBE, 0x63, 0x5C, 0x97, 0xF7, 0x53, 0x64, 0x7E, 0xE1, + 0x0C, 0x07, 0xD3, 0x97, 0x8D, 0x58, 0x46, 0xFD, 0x6E, 0x06, + 0x44, 0x01, 0xA7, 0xAA, 0xC4, 0x95, 0x13, 0x5D, 0xC9, 0x77, + 0x26, 0xE9, 0xF8, 0x72, 0x0C, 0xD3, 0x88}; // ECDSA P-521 signature, raw format std::vector signature = { - 0x01, 0x7B, 0x59, 0xAC, 0x3A, 0x03, 0x5C, 0xB4, 0x07, 0xCD, - 0xC1, 0xEB, 0xBE, 0xE5, 0xA6, 0xCB, 0xDA, 0x0A, 0xFF, 0x4D, - 0x38, 0x61, 0x16, 0x0F, 0xB3, 0x77, 0xE5, 0x8A, 0xDC, 0xF3, - 0xFD, 0x79, 0x38, 0x1E, 0xE8, 0x08, 0x3D, 0x5D, 0xBC, 0xC2, - 0x80, 0x6E, 0xE9, 0x2B, 0xC3, 0xEF, 0x07, 0x3D, 0x0C, 0x82, - 0x4C, 0x9B, 0x7A, 0x5C, 0x2E, 0xD5, 0x46, 0xBD, 0x22, 0x21, - 0x13, 0x8A, 0xB2, 0xCA, 0x96, 0x3D, 0x01, 0xBA, 0x2A, 0xC4, - 0x3F, 0xDB, 0x66, 0x3C, 0x40, 0x26, 0xD9, 0xBC, 0x26, 0xD5, - 0x57, 0xD4, 0xBD, 0x15, 0x16, 0x88, 0x21, 0x3B, 0xAA, 0x07, - 0x89, 0xEF, 0x29, 0x8F, 0x2F, 0x85, 0x76, 0x58, 0x9D, 0xCA, - 0x00, 0xCC, 0xC8, 0x30, 0x88, 0x31, 0x99, 0xC1, 0x94, 0xB9, - 0xAF, 0x91, 0xDC, 0xC4, 0x6F, 0x19, 0x2B, 0x12, 0xA2, 0x82, - 0xA5, 0x66, 0x5E, 0x4B, 0xBB, 0xDF, 0x65, 0x81, 0x52, 0x14, - 0x01, 0xD7}; + 0x01, 0x5C, 0x23, 0xC0, 0xBE, 0xAD, 0x1E, 0x44, 0x60, 0xD4, + 0xE0, 0x81, 0x38, 0xF2, 0xBA, 0xF5, 0xB5, 0x37, 0x5A, 0x34, + 0xB5, 0xCA, 0x6B, 0xC8, 0x0F, 0xCD, 0x75, 0x1D, 0x5E, 0xC0, + 0x8A, 0xD3, 0xD7, 0x79, 0xA7, 0xC1, 0xB8, 0xA2, 0xC6, 0xEA, + 0x5A, 0x7D, 0x60, 0x66, 0x50, 0x97, 0x37, 0x6C, 0xF9, 0x0A, + 0xF6, 0x3D, 0x77, 0x9A, 0xE2, 0x19, 0xF7, 0xF9, 0xDD, 0x52, + 0xC4, 0x0F, 0x98, 0xAA, 0xA2, 0xA4, 0x01, 0xC9, 0x41, 0x0B, + 0xD0, 0x25, 0xDD, 0xC9, 0x7C, 0x3F, 0x70, 0x32, 0x23, 0xCF, + 0xFE, 0x37, 0x67, 0x3A, 0xBC, 0x0B, 0x76, 0x16, 0x82, 0x83, + 0x27, 0x3D, 0x1D, 0x19, 0x15, 0x78, 0x08, 0x2B, 0xD4, 0xA7, + 0xC2, 0x0F, 0x11, 0xF4, 0xDD, 0xE5, 0x5A, 0x5D, 0x04, 0x8D, + 0x6D, 0x5E, 0xC4, 0x1F, 0x54, 0x44, 0xA9, 0x13, 0x34, 0x71, + 0x0F, 0xF7, 0x57, 0x9A, 0x9F, 0x2E, 0xF4, 0x97, 0x7D, 0xAE, + 0x28, 0xEF}; d_crypto->set_public_key(publicKey); From 5a634f7332f915a0a1d7b3ee2d455a02872573b4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Aug 2024 12:44:18 +0200 Subject: [PATCH 315/499] More fixes (#25) * Clang Tidy fixes * Fix some potential defects and be more consistent in class name. Improve const correctness * Fix formatting --------- Co-authored-by: cesaaargm --- src/core/libs/osnma_msg_receiver.cc | 4 +- src/core/libs/osnma_msg_receiver.h | 10 +- src/core/libs/osnma_nav_data_manager.cc | 133 ++++++++---------- src/core/libs/osnma_nav_data_manager.h | 32 ++--- src/core/system_parameters/osnma_data.cc | 8 +- src/core/system_parameters/osnma_data.h | 19 ++- .../osnma/osnma_msg_receiver_test.cc | 12 +- .../osnma/osnma_test_vectors.cc | 23 +-- 8 files changed, 118 insertions(+), 123 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 46aca3fd0..72e6d7ef0 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -77,7 +77,7 @@ osnma_msg_receiver::osnma_msg_receiver(const std::string& crtFilePath, d_dsm_reader = std::make_unique(); d_crypto = std::make_unique(crtFilePath, merkleFilePath); d_helper = std::make_unique(); - d_nav_data_manager = std::make_unique(); + d_nav_data_manager = std::make_unique(); if (d_crypto->have_public_key()) { // Hot start is enabled @@ -1192,7 +1192,7 @@ void osnma_msg_receiver::process_mack_message() } d_nav_data_manager->update_nav_data(d_tags_awaiting_verify, tag_size); auto data_to_send = d_nav_data_manager->get_verified_data(); - d_nav_data_manager->print_status(); + d_nav_data_manager->log_status(); send_data_to_pvt(data_to_send); remove_verified_tags(); diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 7039889ef..4f3b0107b 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -26,7 +26,7 @@ #include "galileo_inav_message.h" // for OSNMA_msg #include "gnss_block_interface.h" // for gnss_shared_ptr #include "osnma_data.h" // for OSNMA_data structures -#include "osnma_nav_data_manager.h" // for OSNMA_nav_data_Manager +#include "osnma_nav_data_manager.h" // for OSNMA_NavDataManager #include // for gr::block #include // for pmt::pmt_t #include // for std::array @@ -112,10 +112,10 @@ private: std::array d_number_of_blocks{}; std::array d_mack_message{}; // C: 480 b - std::unique_ptr d_crypto; // class for cryptographic functions - std::unique_ptr d_dsm_reader; // osnma parameters parser - std::unique_ptr d_helper; // helper class with auxiliary functions - std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data + std::unique_ptr d_crypto; // class for cryptographic functions + std::unique_ptr d_dsm_reader; // osnma parameters parser + std::unique_ptr d_helper; // helper class with auxiliary functions + std::unique_ptr d_nav_data_manager; // refactor for holding and processing navigation data OSNMA_data d_osnma_data{}; diff --git a/src/core/libs/osnma_nav_data_manager.cc b/src/core/libs/osnma_nav_data_manager.cc index 6d8a16113..5a9331dae 100644 --- a/src/core/libs/osnma_nav_data_manager.cc +++ b/src/core/libs/osnma_nav_data_manager.cc @@ -28,13 +28,13 @@ * @param PRNd The satellite ID. * @param TOW The TOW of the received data. */ -void OSNMA_nav_data_Manager::add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) +void OSNMA_NavDataManager::add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { if (not have_nav_data(nav_bits, PRNd, TOW)) { - _satellite_nav_data[PRNd][TOW].add_nav_data(nav_bits); - _satellite_nav_data[PRNd][TOW].PRNd = PRNd; - _satellite_nav_data[PRNd][TOW].set_tow_sf0(TOW); + d_satellite_nav_data[PRNd][TOW].add_nav_data(nav_bits); + d_satellite_nav_data[PRNd][TOW].PRNd = PRNd; + d_satellite_nav_data[PRNd][TOW].set_tow_sf0(TOW); } } @@ -42,33 +42,39 @@ void OSNMA_nav_data_Manager::add_navigation_data(const std::string& nav_bits, ui /** * @brief loops over the verified tags and updates the navigation data tag length */ -void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size) +void OSNMA_NavDataManager::update_nav_data(const std::multimap& tags_verified, uint8_t tag_size) { + if (d_satellite_nav_data.empty()) + { + return; + } // loop through all tags for (const auto& tag : tags_verified) { // if tag status is verified, look for corresponding OSNMA_NavData and add increase verified tag bits. if (tag.second.status == Tag::e_verification_status::SUCCESS) { - if (have_PRNd_nav_data(tag.second.PRN_d)) + auto sat_it = d_satellite_nav_data.find(tag.second.PRN_d); + if (sat_it == d_satellite_nav_data.end()) { - std::map tow_map = _satellite_nav_data.find(tag.second.PRN_d)->second; - for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + continue; + } + auto& tow_map = sat_it->second; + for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + { + std::string nav_data; + if (tag.second.ADKD == 0 || tag.second.ADKD == 12) { - std::string nav_data; - if (tag.second.ADKD == 0 || tag.second.ADKD == 12) - { - nav_data = tow_it.second.get_ephemeris_data(); - } - else if (tag.second.ADKD == 4) - { - nav_data = tow_it.second.get_utc_data(); - } - // find associated OSNMA_NavData - if (tag.second.nav_data == nav_data) - { - _satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; - } + nav_data = tow_it.second.get_ephemeris_data(); + } + else if (tag.second.ADKD == 4) + { + nav_data = tow_it.second.get_utc_data(); + } + // find associated OSNMA_NavData + if (tag.second.nav_data == nav_data) + { + d_satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; } } } @@ -76,24 +82,17 @@ void OSNMA_nav_data_Manager::update_nav_data(const std::multimap& } -bool OSNMA_nav_data_Manager::have_PRNd_nav_data(uint32_t PRNd) -{ - // check if have data from PRNd in _satellite_nav_data - return _satellite_nav_data.find(PRNd) != _satellite_nav_data.end(); -} - - -std::vector OSNMA_nav_data_Manager::get_verified_data() +std::vector OSNMA_NavDataManager::get_verified_data() { std::vector result; - for (const auto& prna : _satellite_nav_data) + for (const auto& prna : d_satellite_nav_data) { for (const auto& tow_navdata : prna.second) { if (tow_navdata.second.verified_bits >= L_t_min) { result.push_back(tow_navdata.second); - _satellite_nav_data[prna.first][tow_navdata.first].verified = true; + d_satellite_nav_data[prna.first][tow_navdata.first].verified = true; } } } @@ -101,45 +100,37 @@ std::vector OSNMA_nav_data_Manager::get_verified_data() } -bool OSNMA_nav_data_Manager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD) +bool OSNMA_NavDataManager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD) const { - if (ADKD == 0 || ADKD == 12) + const auto sat_it = d_satellite_nav_data.find(PRNd); + if (sat_it == d_satellite_nav_data.cend()) { - const auto it = _satellite_nav_data.find(PRNd); - if (it != _satellite_nav_data.cend()) - { - const auto it2 = it->second.find(TOW); - if (it2 != it->second.cend() && !it->second[TOW].get_ephemeris_data().empty()) - { - return true; - } - } + return false; } - else if (ADKD == 4) + + const auto tow_it = sat_it->second.find(TOW); + if (tow_it == sat_it->second.cend()) { - const auto it = _satellite_nav_data.find(PRNd); - if (it != _satellite_nav_data.cend()) - { - const auto it2 = it->second.find(TOW); - if (it2 != it->second.cend() && !it->second[TOW].get_utc_data().empty()) - { - return true; - } - } + return false; + } + + switch (ADKD) + { + case 0: + case 12: + return !tow_it->second.get_ephemeris_data().empty(); + case 4: + return !tow_it->second.get_utc_data().empty(); + default: + return false; } - return false; } -/** - * @brief returns OSNMA_NavData object. - * @remarks assumes it exists (called have_nav_data before), otherwise undefined behavior - * TODO - maybe add const promise and use find() instead? this is kinda sensitive topic. - */ -std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) +std::string OSNMA_NavDataManager::get_navigation_data(const Tag& tag) const { - auto prn_it = _satellite_nav_data.find(tag.PRN_d); - if (prn_it == _satellite_nav_data.end()) + auto prn_it = d_satellite_nav_data.find(tag.PRN_d); + if (prn_it == d_satellite_nav_data.end()) { return ""; } @@ -178,11 +169,11 @@ std::string OSNMA_nav_data_Manager::get_navigation_data(const Tag& tag) * @param PRNd * @return */ -bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) +bool OSNMA_NavDataManager::have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW) { - if (_satellite_nav_data.find(PRNd) != _satellite_nav_data.end()) + if (d_satellite_nav_data.find(PRNd) != d_satellite_nav_data.end()) { - for (auto& data_timestamp : _satellite_nav_data[PRNd]) + for (auto& data_timestamp : d_satellite_nav_data[PRNd]) { if (nav_bits.size() == EPH_SIZE) { @@ -211,10 +202,10 @@ bool OSNMA_nav_data_Manager::have_nav_data(const std::string& nav_bits, uint32_t * @param t Tag object * @return True if the needed navigation data for the tag is available (oldest possible OSNMA_NavData available) */ -bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const +bool OSNMA_NavDataManager::have_nav_data(const Tag& t) const { - auto prn_it = _satellite_nav_data.find(t.PRN_d); - if (prn_it == _satellite_nav_data.end()) + auto prn_it = d_satellite_nav_data.find(t.PRN_d); + if (prn_it == d_satellite_nav_data.end()) { return false; } @@ -245,9 +236,9 @@ bool OSNMA_nav_data_Manager::have_nav_data(const Tag& t) const } -void OSNMA_nav_data_Manager::print_status() +void OSNMA_NavDataManager::log_status() const { - for (const auto& satellite : _satellite_nav_data) + for (const auto& satellite : d_satellite_nav_data) { LOG(INFO) << "Galileo OSNMA: NavData status :: SVID=" << satellite.first; const auto& tow_data = satellite.second; @@ -258,7 +249,7 @@ void OSNMA_nav_data_Manager::print_status() << ", TOW_start=" << nav_data.second.get_tow_sf0() << ", TOW_last=" - << nav_data.second.last_received_TOW + << nav_data.second.get_last_received_TOW() << ", l_t=" << nav_data.second.verified_bits << ", PRNd=" diff --git a/src/core/libs/osnma_nav_data_manager.h b/src/core/libs/osnma_nav_data_manager.h index 6a64416d1..6beaa907d 100644 --- a/src/core/libs/osnma_nav_data_manager.h +++ b/src/core/libs/osnma_nav_data_manager.h @@ -17,8 +17,8 @@ #ifndef GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H #define GNSS_SDR_OSNMA_NAV_DATA_MANAGER_H -#include "osnma_data.h" // NavData -#include // uint32_t +#include "osnma_data.h" // for OSNMA_NavData, Tag +#include // for uint32_t #include #include #include @@ -29,33 +29,29 @@ * \{ */ /** - * @class OSNMA_nav_data_Manager + * @class OSNMA_NavDataManager * @brief Class for managing OSNMA navigation data - * @details It does good stuff - * @remarks throw it whatever, it will improve it. Does good stuff */ -class OSNMA_nav_data_Manager +class OSNMA_NavDataManager { public: - OSNMA_nav_data_Manager() = default; - bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); - bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD); - bool have_nav_data(const Tag& t) const; - void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); // gets the bits and adds them to the list - std::string get_navigation_data(const Tag& t); + OSNMA_NavDataManager() = default; - void update_nav_data(const std::multimap& tags_verified, const uint8_t tag_size); + void log_status() const; + bool have_nav_data(const Tag& t) const; + bool have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t ADKD) const; + std::string get_navigation_data(const Tag& t) const; + + void add_navigation_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); + void update_nav_data(const std::multimap& tags_verified, uint8_t tag_size); + bool have_nav_data(const std::string& nav_bits, uint32_t PRNd, uint32_t TOW); std::vector get_verified_data(); - void print_status(); private: - bool have_PRNd_nav_data(uint32_t PRNd); - - std::map> _satellite_nav_data{}; // NavData sorted by [PRNd][TOW_start] + std::map> d_satellite_nav_data{}; // NavData sorted by [PRNd][TOW_start] const uint32_t L_t_min{40}; const uint16_t EPH_SIZE{549}; const uint16_t UTC_SIZE{141}; - const uint16_t MAX_ALLOWED_SIZE{150}; // arbitrary maximum for the navigation data container }; /** \} */ diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index 6d969a7f0..b5355113f 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -35,19 +35,25 @@ bool OSNMA_NavData::add_nav_data(const std::string& nav_data) } return false; } + + std::string OSNMA_NavData::get_utc_data() const { return d_utc; } + + std::string OSNMA_NavData::get_ephemeris_data() const { return d_ephemeris_iono; } + + /** * Updates the last TOW the NavData bits were received. * @param TOW */ void OSNMA_NavData::update_last_received_timestamp(uint32_t TOW) { - last_received_TOW = TOW; + d_last_received_TOW = TOW; } diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 7bf85862c..e3c78cdc4 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -136,35 +136,34 @@ class OSNMA_NavData { public: OSNMA_NavData() : nav_data_id(id_counter++) {} + const uint32_t nav_data_id; std::string get_utc_data() const; std::string get_ephemeris_data() const; - uint32_t get_tow_sf0() const { return TOW_sf0; } + uint32_t get_last_received_TOW() const { return d_last_received_TOW; } + uint32_t get_tow_sf0() const { return d_TOW_sf0; } - const uint32_t nav_data_id; - - bool have_this_bits(std::string nav_data); bool add_nav_data(const std::string& nav_data); - bool verified{false}; - - void update_last_received_timestamp(uint32_t TOW); - void set_tow_sf0(int value) { TOW_sf0 = value; } + void set_tow_sf0(int value) { d_TOW_sf0 = value; } void set_ephemeris_data(std::string value) { d_ephemeris_iono = value; } void set_utc_data(std::string value) { d_utc = value; } + void update_last_received_timestamp(uint32_t TOW); uint32_t verified_bits{0}; - uint32_t last_received_TOW{0}; uint32_t IOD_nav{0}; uint32_t PRNd{0}; uint32_t ADKD{}; + bool verified{false}; private: std::string d_ephemeris_iono{""}; std::string d_utc{""}; - uint32_t TOW_sf0{0}; + uint32_t d_TOW_sf0{0}; + uint32_t d_last_received_TOW{0}; static uint32_t id_counter; }; + /*! * \brief This class handles ONSMA data * See https://www.gsc-europa.eu/sites/default/files/sites/all/files/Galileo_OSNMA_User_ICD_for_Test_Phase_v1.0.pdf diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 5d5e3819f..7bbdd4e16 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -16,15 +16,15 @@ * ----------------------------------------------------------------------------- */ +#include "Galileo_OSNMA.h" +#include "gnss_crypto.h" +#include "osnma_helper.h" +#include "osnma_msg_receiver.h" #include #include #include #include #include -#include "Galileo_OSNMA.h" -#include "gnss_crypto.h" -#include "osnma_helper.h" -#include "osnma_msg_receiver.h" #if USE_GLOG_AND_GFLAGS #include // for LOG @@ -43,7 +43,7 @@ protected: uint32_t TOW{}; uint32_t WN{}; std::tm GST_START_EPOCH = {0, 0, 0, 22, 8 - 1, 1999 - 1900, 0, 0, 0, 0, 0}; // months start with 0 and years since 1900 in std::tm - const uint32_t LEAP_SECONDS = 0; // tried with 13 + 5, which is the official count, but won't parse correctly + const uint32_t LEAP_SECONDS = 0; // tried with 13 + 5, which is the official count, but won't parse correctly void set_time(std::tm& input); void SetUp() override @@ -253,7 +253,7 @@ TEST_F(OsnmaMsgReceiverTest, TeslaKeyVerification) osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); - osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) osnma->d_GST_Sf = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G. osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 73e5eb25c..5c097e10b 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -161,7 +161,7 @@ TEST_F(OsnmaTestVectors, PublicKeyRevocation) std::tm input_time_step1 = {0, 45, 7, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; std::tm input_time_step2 = {0, 30, 9, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; std::tm input_time_step3 = {0, 30, 10, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; - std::vector input_times = { input_time_step1, input_time_step2, input_time_step3 }; + std::vector input_times = {input_time_step1, input_time_step2, input_time_step3}; std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/pkrev_step1/07_OCT_2023_GST_07_45_01.csv"); std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/pkrev_step2/07_OCT_2023_GST_09_30_01.csv"); @@ -170,7 +170,7 @@ TEST_F(OsnmaTestVectors, PublicKeyRevocation) { ASSERT_TRUE(false); } - std::vector> testVectors = { testVectors_step1, testVectors_step2, testVectors_step3}; + std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); ASSERT_TRUE(result); @@ -182,7 +182,8 @@ TEST_F(OsnmaTestVectors, PublicKeyRevocation) ASSERT_EQ(osnma->d_count_failed_macseq, 0); } -TEST_F(OsnmaTestVectors, AlertMessage){ +TEST_F(OsnmaTestVectors, AlertMessage) +{ // Arrange std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_3/PublicKey/OSNMA_PublicKey_20231007201500_PKID_1.crt"; std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_3/MerkleTree/OSNMA_MerkleTree_20231007201500_PKID_1.xml"; @@ -190,7 +191,7 @@ TEST_F(OsnmaTestVectors, AlertMessage){ std::tm input_time_step1 = {0, 45, 18, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; std::tm input_time_step2 = {0, 45, 19, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; - std::vector input_times = { input_time_step1, input_time_step2 }; + std::vector input_times = {input_time_step1, input_time_step2}; std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/oam_step1/07_OCT_2023_GST_18_45_01.csv"); std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/oam_step2/07_OCT_2023_GST_19_45_01.csv"); @@ -198,7 +199,7 @@ TEST_F(OsnmaTestVectors, AlertMessage){ { ASSERT_TRUE(false); } - std::vector> testVectors = { testVectors_step1, testVectors_step2}; + std::vector> testVectors = {testVectors_step1, testVectors_step2}; // Act bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); @@ -219,17 +220,18 @@ TEST_F(OsnmaTestVectors, AlertMessage){ // Auxiliary functions for the OsnmaTestVectorsSimulation test fixture. // Essentially, they perform same work as the telemetry decoder block, but adapted to the osnma-test-vector files. -bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_object, std::vector> testVectors, std::vector startTimesFiles){ +bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_object, std::vector> testVectors, std::vector startTimesFiles) +{ bool end_of_hex_stream; int offset_byte{0}; - int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size + int byte_index{0}; // index containing the last byte position of the hex stream that was retrieved. Takes advantage that all TVs have same size const int DUMMY_PAGE{63}; bool flag_dummy_page{false}; // Act // loop over all bytes of data. Note: all TestVectors have same amount of data. // if needed, add global flags so that particular logic may be done at certain points in between files - for (size_t test_step = 0; test_step < testVectors.size() ; test_step++) + for (size_t test_step = 0; test_step < testVectors.size(); test_step++) { // set variables for each file end_of_hex_stream = false; @@ -241,7 +243,8 @@ bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_ob << ", TOW=" << TOW << ", WN=" << WN << std::endl; - if (test_step == 1 && d_flag_NPK == true ){ + if (test_step == 1 && d_flag_NPK == true) + { // step 2: this simulates the osnma connecting to the GSC server and downloading the Merkle tree of the next public key osnma_object->read_merkle_xml( std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007081500_PKID_8.xml"); @@ -436,7 +439,7 @@ bool OsnmaTestVectors::feedOsnmaWithTestVectors(osnma_msg_receiver_sptr osnma_ob if (end_of_hex_stream) continue; } -return true; + return true; } std::vector OsnmaTestVectors::readTestVectorsFromFile(const std::string& filename) From f370e33c260e718908b7481d604a5ae311b0c49d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 11 Aug 2024 13:00:06 +0200 Subject: [PATCH 316/499] Update changelog --- docs/CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e7e594fb9..931e8988f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -21,6 +21,25 @@ All notable changes to GNSS-SDR will be documented in this file. wideband device (HackRF/LimeSDR/USRP). Demonstration: https://www.youtube.com/watch?v=ZQs2sFchJ6w https://www.youtube.com/watch?v=HnZkKj9a-QM +- Add the following signal sources for use when GNSS-SDR is operating on SoC + FPGA boards (`-DENABLE_FPGA=ON`): + + - `ADRV9361_Z7035_Signal_Source_FPGA`: Analog Devices ADRV9361-Z7035 board. + - `FMCOMMS5_Signal_Source_FPGA`: FMCOMMS5 analog front-end. + - `MAX2771_EVKIT_Signal_Source_FPGA`: MAX2771 evaluation kit analog front-end. + - `DMA_Signal_Source_FPGA`: FPGA DMA working in post-processing mode. + + When building GNSS-SDR for the SoC FPGA, the following options can be passed + to CMake with possible values of `ON` or `OFF`, and their default value is + `OFF`: + + - `-DENABLE_AD9361`: Checks if the IIO driver is installed and builds the + `ADRV9361_Z7035_Signal_Source_FPGA` and the `FMCOMMS5_Signal_Source_FPGA` + sources. + - `-DENABLE_MAX2771`: Checks if the SPIdev driver is installed and builds the + `MAX2771_EVKIT_Signal_Source_FPGA` source. + - `-DENABLE_DMA_PROXY`: Checks if the DMA proxy driver is installed for + controlling the DMA in the FPGA and enables its usage. ### Improvements in Portability: From 794bd614195485175df32ba7af1187c2edad1c6b Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Sun, 11 Aug 2024 13:44:20 +0200 Subject: [PATCH 317/499] [TAS-249][Bug][Tag] new NavDataManager causes less tags to be verified [TAS-234][Feature] Dummy tags verification * Fixed the navData retrieval which caused many tags to be skipped * Dummy tags verification added. * Replaced direct field access with getters/setters for OSNMA navigation data. --- src/core/libs/gnss_crypto.h | 2 +- src/core/libs/osnma_msg_receiver.cc | 28 ++-- src/core/libs/osnma_nav_data_manager.cc | 129 +++++++++++++----- .../system_parameters/galileo_inav_message.cc | 7 +- .../system_parameters/galileo_inav_message.h | 13 +- src/core/system_parameters/osnma_data.cc | 14 -- src/core/system_parameters/osnma_data.h | 24 ++-- .../osnma/osnma_test_vectors.cc | 24 ++++ 8 files changed, 158 insertions(+), 83 deletions(-) diff --git a/src/core/libs/gnss_crypto.h b/src/core/libs/gnss_crypto.h index b308f820b..9fb16f96e 100644 --- a/src/core/libs/gnss_crypto.h +++ b/src/core/libs/gnss_crypto.h @@ -78,7 +78,7 @@ private: void readPublicKeyFromPEM(const std::string& pemFilePath); bool readPublicKeyFromCRT(const std::string& crtFilePath); bool convert_raw_to_der_ecdsa(const std::vector& raw_signature, std::vector& der_signature) const; - std::vector convert_from_hex_str(const std::string& input) const; + std::vector convert_from_hex_str(const std::string& input) const; // TODO - deprecate if OSNMA helper is to do this operation #if USE_GNUTLS_FALLBACK void decompress_public_key_secp256r1(const std::vector& compressed_key, std::vector& x, std::vector& y) const; void decompress_public_key_secp521r1(const std::vector& compressed_key, std::vector& x, std::vector& y) const; diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 72e6d7ef0..ace7dc40e 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -183,8 +183,8 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) if (delta_T <= d_T_L) { d_tags_to_verify = {0, 4, 12}; - LOG(INFO) << "Galileo OSNMA: time constraint OK ( delta_T=" << delta_T << " s)"; - std::cout << "Galileo OSNMA: time constraint OK ( delta_T=" << delta_T << " s)" << std::endl; + LOG(INFO) << "Galileo OSNMA: time constraint OK (delta_T=" << delta_T << " s)"; + std::cout << "Galileo OSNMA: time constraint OK (delta_T=" << delta_T << " s)" << std::endl; } else if (delta_T > d_T_L && delta_T <= 10 * d_T_L) { @@ -1067,7 +1067,18 @@ void osnma_msg_receiver::process_mack_message() // add tag0 first Tag tag0(*mack); d_tags_awaiting_verify.insert(std::pair(mack->TOW, tag0)); - // bool ret = verify_macseq(*mack); + LOG(INFO) << "Galileo OSNMA: Add Tag0 Id= " + << tag0.tag_id + << ", value=0x" << std::setfill('0') << std::setw(10) << std::hex << std::uppercase + << tag0.received_tag << std::dec + << ", TOW=" + << tag0.TOW + << ", ADKD=" + << static_cast(tag0.ADKD) + << ", PRNa=" + << static_cast(tag0.PRNa) + << ", PRNd=" + << static_cast(tag0.PRN_d); std::vector macseq_verified_tags = verify_macseq_new(*mack); for (auto& tag_and_info : macseq_verified_tags) { @@ -1521,11 +1532,11 @@ void osnma_msg_receiver::remove_verified_tags() << static_cast(it->second.PRNa) << ", PRNd=" << static_cast(it->second.PRN_d) - << ", status= " + << ", status=" << d_helper->verification_status_str(it->second.status); it = d_tags_awaiting_verify.erase(it); } - else if (it->second.skipped >= 20) + else if ((it->second.ADKD != 12 && !d_nav_data_manager->have_nav_data(it->second)) || (it->second.ADKD == 12 && (it->second.TOW + 30 * 11 < d_helper->get_TOW(d_last_verified_key_GST)))) { LOG(INFO) << "Galileo OSNMA: Tag verification :: DELETE tag Id=" << it->second.tag_id @@ -1539,8 +1550,9 @@ void osnma_msg_receiver::remove_verified_tags() << static_cast(it->second.PRNa) << ", PRNd=" << static_cast(it->second.PRN_d) - << ", status= " - << d_helper->verification_status_str(it->second.status); + << ", status=" + << d_helper->verification_status_str(it->second.status) + << ". SV out of sight / NavData unavailable."; it = d_tags_awaiting_verify.erase(it); } else @@ -1563,7 +1575,7 @@ void osnma_msg_receiver::remove_verified_tags() << static_cast(it.second.PRNa) << ", PRNd=" << static_cast(it.second.PRN_d) - << ", status= " + << ", status=" << d_helper->verification_status_str(it.second.status); } } diff --git a/src/core/libs/osnma_nav_data_manager.cc b/src/core/libs/osnma_nav_data_manager.cc index 5a9331dae..03d5a4442 100644 --- a/src/core/libs/osnma_nav_data_manager.cc +++ b/src/core/libs/osnma_nav_data_manager.cc @@ -33,8 +33,9 @@ void OSNMA_NavDataManager::add_navigation_data(const std::string& nav_bits, uint if (not have_nav_data(nav_bits, PRNd, TOW)) { d_satellite_nav_data[PRNd][TOW].add_nav_data(nav_bits); - d_satellite_nav_data[PRNd][TOW].PRNd = PRNd; + d_satellite_nav_data[PRNd][TOW].set_prn_d(PRNd); d_satellite_nav_data[PRNd][TOW].set_tow_sf0(TOW); + d_satellite_nav_data[PRNd][TOW].set_last_received_TOW(TOW); } } @@ -74,7 +75,7 @@ void OSNMA_NavDataManager::update_nav_data(const std::multimap& t // find associated OSNMA_NavData if (tag.second.nav_data == nav_data) { - d_satellite_nav_data[tag.second.PRN_d][tow_it.first].verified_bits += tag_size; + d_satellite_nav_data[tag.second.PRN_d][tow_it.first].set_update_verified_bits(tag_size); } } } @@ -89,10 +90,10 @@ std::vector OSNMA_NavDataManager::get_verified_data() { for (const auto& tow_navdata : prna.second) { - if (tow_navdata.second.verified_bits >= L_t_min) + if (tow_navdata.second.get_verified_bits() >= L_t_min) { result.push_back(tow_navdata.second); - d_satellite_nav_data[prna.first][tow_navdata.first].verified = true; + d_satellite_nav_data[prna.first][tow_navdata.first].set_verified_status(true); } } } @@ -129,31 +130,62 @@ bool OSNMA_NavDataManager::have_nav_data(uint32_t PRNd, uint32_t TOW, uint8_t AD std::string OSNMA_NavDataManager::get_navigation_data(const Tag& tag) const { + // Check if Dummy Tag, navData is all zeros + if (tag.cop == 0) + { + if (tag.ADKD == 0 || tag.ADKD == 12) + { + return std::string(549, '0'); + } + else if (tag.ADKD == 4) + { + return std::string(141, '0'); + } + } auto prn_it = d_satellite_nav_data.find(tag.PRN_d); if (prn_it == d_satellite_nav_data.end()) { return ""; } - // satellite was found, check if TOW exists in inner map - std::map tow_map = prn_it->second; - for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + auto nav_data = prn_it->second.find(tag.TOW - 30); + if (nav_data != prn_it->second.end()) { - // Check if current key (TOW) fulfills condition - if ((tag.TOW - 30 * tag.cop) <= tow_it.first && tow_it.first <= tag.TOW - 30) + if (tag.ADKD == 0 || tag.ADKD == 12) { - if (tag.ADKD == 0 || tag.ADKD == 12) + if (!nav_data->second.get_ephemeris_data().empty()) { - if (!tow_it.second.get_ephemeris_data().empty()) - { - return tow_it.second.get_ephemeris_data(); - } + return nav_data->second.get_ephemeris_data(); } - else if (tag.ADKD == 4) + } + else if (tag.ADKD == 4) + { + if (!nav_data->second.get_utc_data().empty()) { - if (!tow_it.second.get_utc_data().empty()) + return nav_data->second.get_utc_data(); + } + } + } + else + { + for (auto rev_it = prn_it->second.rbegin(); rev_it != prn_it->second.rend(); ++rev_it) // note: starts with largest (i.e. newest) navigation dataset + { + // Check if current key (TOW) fulfills condition + if ((tag.TOW - 30 * tag.cop <= rev_it->first || tag.TOW - 30 * tag.cop <= rev_it->second.get_last_received_TOW()) && rev_it->first < tag.TOW) + { + if (tag.ADKD == 0 || tag.ADKD == 12) { - return tow_it.second.get_utc_data(); + if (!rev_it->second.get_ephemeris_data().empty()) + { + return rev_it->second.get_ephemeris_data(); + } + } + else if (tag.ADKD == 4) + { + if (!rev_it->second.get_utc_data().empty()) + { + return rev_it->second.get_utc_data(); + } } } } @@ -179,7 +211,7 @@ bool OSNMA_NavDataManager::have_nav_data(const std::string& nav_bits, uint32_t P { if (data_timestamp.second.get_ephemeris_data() == nav_bits) { - data_timestamp.second.update_last_received_timestamp(TOW); + data_timestamp.second.set_last_received_TOW(TOW); return true; } } @@ -187,7 +219,7 @@ bool OSNMA_NavDataManager::have_nav_data(const std::string& nav_bits, uint32_t P { if (data_timestamp.second.get_utc_data() == nav_bits) { - data_timestamp.second.update_last_received_timestamp(TOW); + data_timestamp.second.set_last_received_TOW(TOW); return true; } } @@ -204,30 +236,57 @@ bool OSNMA_NavDataManager::have_nav_data(const std::string& nav_bits, uint32_t P */ bool OSNMA_NavDataManager::have_nav_data(const Tag& t) const { + if (t.cop == 0) + { + return true; + } auto prn_it = d_satellite_nav_data.find(t.PRN_d); if (prn_it == d_satellite_nav_data.end()) { return false; } // satellite was found, check if TOW exists in inner map - std::map tow_map = prn_it->second; - for (auto& tow_it : tow_map) // note: starts with smallest (i.e. oldest) navigation dataset + // try find target TOW directly first + auto nav_data = prn_it->second.find(t.TOW - 30); + if (nav_data != prn_it->second.end()) { - // Check if current key (TOW) fulfills condition - if (t.TOW - 30 * t.cop <= tow_it.first && tow_it.first <= t.TOW - 30) + if (t.ADKD == 0 || t.ADKD == 12) { - if (t.ADKD == 0 || t.ADKD == 12) + if (!nav_data->second.get_ephemeris_data().empty()) { - if (!tow_it.second.get_ephemeris_data().empty()) - { - return true; - } + return true; } - else if (t.ADKD == 4) + } + else if (t.ADKD == 4) + { + if (!nav_data->second.get_utc_data().empty()) { - if (!tow_it.second.get_utc_data().empty()) + return true; + } + } + } + else + { + // iterate in reverse order to find matching TOW with Tag's COP value + std::map tow_map = prn_it->second; + for (auto rev_it = tow_map.rbegin(); rev_it != tow_map.rend(); ++rev_it) // note: starts with largest (i.e. newest) navigation dataset + { + // Check if current key (TOW) fulfills cut-off point and is not received after the tag + if ((t.TOW - 30 * t.cop <= rev_it->first || t.TOW - 30 * t.cop <= rev_it->second.get_last_received_TOW()) && rev_it->first < t.TOW) + { + if (t.ADKD == 0 || t.ADKD == 12) { - return true; + if (!rev_it->second.get_ephemeris_data().empty()) + { + return true; + } + } + else if (t.ADKD == 4) + { + if (!rev_it->second.get_utc_data().empty()) + { + return true; + } } } } @@ -245,17 +304,17 @@ void OSNMA_NavDataManager::log_status() const for (const auto& nav_data : tow_data) { LOG(INFO) << "Galileo OSNMA: IOD_nav=0b" << std::uppercase - << std::bitset<10>(nav_data.second.IOD_nav) + << std::bitset<10>(nav_data.second.get_IOD_nav()) << ", TOW_start=" << nav_data.second.get_tow_sf0() << ", TOW_last=" << nav_data.second.get_last_received_TOW() << ", l_t=" - << nav_data.second.verified_bits + << nav_data.second.get_verified_bits() << ", PRNd=" - << nav_data.second.PRNd + << nav_data.second.get_prn_d() << ", verified=" - << nav_data.second.verified; + << nav_data.second.get_verified_status(); } } } diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index ab62b684c..cb23ddac3 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1413,20 +1413,15 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) */ OSNMA_msg Galileo_Inav_Message::get_osnma_msg() { - // TODO - why PRN of word 4 is done separately? nma_position_filled = std::array{}; // Fill TOW and WN nma_msg.WN_sf0 = WN_0; - int32_t TOW_sf0 = TOW_5 - 25; //- 24; // according to OS SIS ICD, TOW of word 5 is 25 seconds after Sf start TODO review + int32_t TOW_sf0 = TOW_5 - 25; if (TOW_sf0 < 0) { TOW_sf0 += 604800; } nma_msg.TOW_sf0 = static_cast(TOW_sf0); - // get ephemeris, clock and iono correction datn and GST-UTC and GST-GPS converstion parameters (may be incomplete) - nma_msg.EphemerisData = get_ephemeris(); - nma_msg.IonoData = get_iono(); - nma_msg.UtcModelData = get_utc_model(); return nma_msg; } diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 6eeffddaf..92f3963a1 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -48,16 +48,9 @@ public: OSNMA_msg() = default; std::array mack{}; std::array hkroot{}; - uint32_t PRN{}; - uint32_t WN_sf0{}; - uint32_t TOW_sf0{}; - std::vector EphemerisClockAndStatusData{}; // TODO _2 rename and substitute this - std::string EphemerisClockAndStatusData_2{}; - std::vector TimingData{}; - std::string TimingData_2{}; - Galileo_Ephemeris EphemerisData{}; - Galileo_Iono IonoData{}; - Galileo_Utc_Model UtcModelData{}; + uint32_t PRN{}; // PRN_a authentication data PRN + uint32_t WN_sf0{}; // Week number at the start of OSNMA subframe + uint32_t TOW_sf0{}; // TOW at the start of OSNMA subframe }; /*! diff --git a/src/core/system_parameters/osnma_data.cc b/src/core/system_parameters/osnma_data.cc index b5355113f..b56d3b940 100644 --- a/src/core/system_parameters/osnma_data.cc +++ b/src/core/system_parameters/osnma_data.cc @@ -35,25 +35,11 @@ bool OSNMA_NavData::add_nav_data(const std::string& nav_data) } return false; } - - std::string OSNMA_NavData::get_utc_data() const { return d_utc; } - - std::string OSNMA_NavData::get_ephemeris_data() const { return d_ephemeris_iono; } - - -/** - * Updates the last TOW the NavData bits were received. - * @param TOW - */ -void OSNMA_NavData::update_last_received_timestamp(uint32_t TOW) -{ - d_last_received_TOW = TOW; -} diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index e3c78cdc4..0816abda6 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -137,30 +137,36 @@ class OSNMA_NavData public: OSNMA_NavData() : nav_data_id(id_counter++) {} const uint32_t nav_data_id; - std::string get_utc_data() const; std::string get_ephemeris_data() const; + uint32_t get_verified_bits() const { return verified_bits; } + uint32_t get_prn_d() const { return PRNd; } + uint32_t get_IOD_nav() const { return IOD_nav; } uint32_t get_last_received_TOW() const { return d_last_received_TOW; } uint32_t get_tow_sf0() const { return d_TOW_sf0; } - + bool have_this_bits(std::string nav_data); + bool get_verified_status() const { return verified; } bool add_nav_data(const std::string& nav_data); void set_tow_sf0(int value) { d_TOW_sf0 = value; } void set_ephemeris_data(std::string value) { d_ephemeris_iono = value; } void set_utc_data(std::string value) { d_utc = value; } void update_last_received_timestamp(uint32_t TOW); - - uint32_t verified_bits{0}; - uint32_t IOD_nav{0}; - uint32_t PRNd{0}; - uint32_t ADKD{}; - bool verified{false}; + void set_prn_d(uint32_t value) { PRNd = value; } + void set_last_received_TOW(uint32_t TOW) { d_last_received_TOW = TOW; }; + void set_update_verified_bits(uint32_t morebits) { verified_bits += morebits; } + void set_verified_status(bool value) { verified = value; } + void set_IOD_nav(uint32_t value) { IOD_nav = value; } private: + static uint32_t id_counter; std::string d_ephemeris_iono{""}; std::string d_utc{""}; uint32_t d_TOW_sf0{0}; uint32_t d_last_received_TOW{0}; - static uint32_t id_counter; + uint32_t PRNd{0}; + uint32_t verified_bits{0}; + uint32_t IOD_nav{0}; + bool verified{false}; }; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 5c097e10b..755725d98 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -85,6 +85,12 @@ TEST_F(OsnmaTestVectors, NominalTestConf1) ASSERT_TRUE(result); // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; ASSERT_EQ(osnma->d_count_failed_tags, 0); ASSERT_EQ(osnma->d_count_failed_Kroot, 0); ASSERT_EQ(osnma->d_count_failed_pubKey, 0); @@ -113,6 +119,12 @@ TEST_F(OsnmaTestVectors, NominalTestConf2) ASSERT_TRUE(result); // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; ASSERT_EQ(osnma->d_count_failed_tags, 0); ASSERT_EQ(osnma->d_count_failed_Kroot, 0); ASSERT_EQ(osnma->d_count_failed_pubKey, 0); @@ -145,6 +157,12 @@ TEST_F(OsnmaTestVectors, PublicKeyRenewal) ASSERT_TRUE(result); // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; ASSERT_EQ(osnma->d_count_failed_tags, 0); ASSERT_EQ(osnma->d_count_failed_Kroot, 0); ASSERT_EQ(osnma->d_count_failed_pubKey, 0); @@ -176,6 +194,12 @@ TEST_F(OsnmaTestVectors, PublicKeyRevocation) ASSERT_TRUE(result); // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; ASSERT_EQ(osnma->d_count_failed_tags, 0); ASSERT_EQ(osnma->d_count_failed_Kroot, 0); ASSERT_EQ(osnma->d_count_failed_pubKey, 0); From e4f4c335bcc0375de374ef8cb8ac81f6f0188d74 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Mon, 12 Aug 2024 12:50:17 +0200 Subject: [PATCH 318/499] [TAS-257][TEST] add osnma benchmarking * Introduced new benchmarks to assess the performance of various OSNMA related functions, such as public key verification. * Mostly recycled code from testing codebase. * TODO: methods are private, could not find a MACRO like FRIEND_TEST to allow for it. Result of this, only one benchmark test is active. --- src/core/libs/osnma_msg_receiver.cc | 5 + src/core/libs/osnma_msg_receiver.h | 10 +- src/tests/benchmarks/CMakeLists.txt | 1 + src/tests/benchmarks/benchmark_osnma.cc | 126 ++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 src/tests/benchmarks/benchmark_osnma.cc diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index ace7dc40e..f5f8d4c0a 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -2026,3 +2026,8 @@ std::pair, uint8_t> osnma_msg_receiver::parse_dsm_kroot() c return {dsm_msg, nma_header}; } + +void osnma_msg_receiver::set_merkle_root(const std::vector& v) +{ + d_crypto->set_merkle_root(v); +} diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 4f3b0107b..8327709da 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -61,9 +61,11 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, class osnma_msg_receiver : public gr::block { public: - ~osnma_msg_receiver() = default; //!< Default destructor - void msg_handler_osnma(const pmt::pmt_t& msg); //!< For testing purposes - void read_merkle_xml(const std::string& merklepath); //!< Public for testing purposes + ~osnma_msg_receiver() = default; //!< Default destructor + void msg_handler_osnma(const pmt::pmt_t& msg); //!< For testing purposes + void read_merkle_xml(const std::string& merklepath); //!< Public for testing purposes + bool verify_dsm_pkr(const DSM_PKR_message& message) const; //!< Public for benchmarking purposes + void set_merkle_root(const std::vector& v); //!< Public for benchmarking purposes private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, bool strict_mode); @@ -89,7 +91,7 @@ private: bool tag_has_nav_data_available(const Tag& t) const; bool tag_has_key_available(const Tag& t) const; bool verify_macseq(const MACK_message& mack); - bool verify_dsm_pkr(const DSM_PKR_message& message) const; + bool store_dsm_kroot(const std::vector& dsm, const uint8_t nma_header) const; std::pair, uint8_t> parse_dsm_kroot() const; diff --git a/src/tests/benchmarks/CMakeLists.txt b/src/tests/benchmarks/CMakeLists.txt index 2d79f4d06..31ebf9f82 100644 --- a/src/tests/benchmarks/CMakeLists.txt +++ b/src/tests/benchmarks/CMakeLists.txt @@ -112,6 +112,7 @@ endif() add_benchmark(benchmark_atan2 Gnuradio::runtime) add_benchmark(benchmark_copy) add_benchmark(benchmark_crypto core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) +add_benchmark(benchmark_osnma core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) diff --git a/src/tests/benchmarks/benchmark_osnma.cc b/src/tests/benchmarks/benchmark_osnma.cc new file mode 100644 index 000000000..727c11e70 --- /dev/null +++ b/src/tests/benchmarks/benchmark_osnma.cc @@ -0,0 +1,126 @@ +/*! +* \file benchmark_osnma.cc +* \brief Benchmarks for osnma functions +* \author Carles Fernandez-Prades, 2024. cfernandez(at)cttc.es +* +* +* ----------------------------------------------------------------------------- +* +* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +* This file is part of GNSS-SDR. +* +* Copyright (C) 2024 (see AUTHORS file for a list of contributors) +* SPDX-License-Identifier: GPL-3.0-or-later +* +* ----------------------------------------------------------------------------- +*/ +#include "osnma_msg_receiver.h" +#include "Galileo_OSNMA.h" +#include "gnss_crypto.h" +#include "osnma_helper.h" +#include +#include + +void bm_verify_public_key(benchmark::State& state) +{ + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(CRTFILE_DEFAULT, MERKLEFILE_DEFAULT); + Osnma_Helper helper; + osnma->set_merkle_root(helper.convert_from_hex_string("A10C440F3AA62453526DB4AF76DF8D9410D35D8277397D7053C700D192702B0D")); + DSM_PKR_message dsm_pkr_message; + dsm_pkr_message.npkt = 0x01; + dsm_pkr_message.npktid = 0x2; + dsm_pkr_message.mid = 0x01; + std::vector vec = helper.convert_from_hex_string( + "7CBE05D9970CFC9E22D0A43A340EF557624453A2E821AADEAC989C405D78BA06" + "956380BAB0D2C939EC6208151040CCFFCF1FB7156178FD1255BA0AECAAA253F7" + "407B6C5DD4DF059FF8789474061301E1C34881DB7A367A913A3674300E21EAB1" + "24EF508389B7D446C3E2ECE8D459FBBD3239A794906F5B1F92469C640164FD87"); + std::copy(vec.begin(), vec.end(), dsm_pkr_message.itn.begin()); + dsm_pkr_message.npk = helper.convert_from_hex_string("0303B2CE64BC207BDD8BC4DF859187FCB686320D63FFA091410FC158FBB77980EA"); + + while (state.KeepRunning()) + { + osnma->verify_dsm_pkr(dsm_pkr_message); + } +} + +void bm_verify_tesla_key(benchmark::State& state) +{ + // osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(CRTFILE_DEFAULT, MERKLEFILE_DEFAULT); + // Osnma_Helper helper; + // osnma->d_tesla_key_verified = false; + // osnma->d_osnma_data.d_dsm_kroot_message.kroot = {0x5B, 0xF8, 0xC9, 0xCB, 0xFC, 0xF7, 0x04, 0x22, 0x08, 0x14, 0x75, 0xFD, 0x44, 0x5D, 0xF0, 0xFF}; // Kroot, TOW 345570 GST_0 - 30 + // osnma->d_osnma_data.d_dsm_kroot_message.ks = 4; // TABLE 10 --> 128 bits + // osnma->d_osnma_data.d_dsm_kroot_message.alpha = 0x610BDF26D77B; + // osnma->d_GST_SIS = (1248 & 0x00000FFF) << 20 | (345630 & 0x000FFFFF); + // osnma->d_GST_0 = ((1248 & 0x00000FFF) << 20 | (345600 & 0x000FFFFF)); // applicable time (GST_Kroot + 30) + // osnma->d_GST_Sf = osnma->d_GST_0 + 30 * std::floor((osnma->d_GST_SIS - osnma->d_GST_0) / 30); // Eq. 3 R.G. + // + // osnma->d_tesla_keys.insert((std::pair>(345600, {0xEF, 0xF9, 0x99, 0x04, 0x0E, 0x19, 0xB5, 0x70, 0x83, 0x50, 0x60, 0xBE, 0xBD, 0x23, 0xED, 0x92}))); // K1, not needed, just for reference. + // std::vector key = {0x2D, 0xC3, 0xA3, 0xCD, 0xB1, 0x17, 0xFA, 0xAD, 0xB8, 0x3B, 0x5F, 0x0B, 0x6F, 0xEA, 0x88, 0xEB}; // K2 + // uint32_t TOW = 345630; + // + // while (state.KeepRunning()) + // { + // osnma->verify_tesla_key(key, TOW); + // } +} + +void bm_verify_tesla_key_24h(benchmark::State& state) +{ + // TODO - copy of normal tesla verification but with 2800 steps instead of only two (max Kroot time is 1 day as per spec.) +} + +void bm_tag_verification(benchmark::State& state) +{ + // osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(CRTFILE_DEFAULT, MERKLEFILE_DEFAULT); + // Osnma_Helper helper; + // uint32_t TOW_Tag0 = 345660; + // uint32_t TOW_NavData = TOW_Tag0 - 30; + // uint32_t TOW_Key_Tag0 = TOW_Tag0 + 30; + // uint32_t WN = 1248; + // uint32_t PRNa = 2; + // uint8_t CTR = 1; + // + // osnma->d_osnma_data.d_dsm_kroot_message.ts = 9; // 40 bit + // osnma->d_tesla_keys[TOW_Key_Tag0] = {0x69, 0xC0, 0x0A, 0xA7, 0x36, 0x42, 0x37, 0xA6, 0x5E, 0xBF, 0x00, 0x6A, 0xD8, 0xDD, 0xBC, 0x73}; // K4 + // osnma->d_osnma_data.d_dsm_kroot_message.mf = 0; + // osnma->d_nav_data_manager->add_navigation_data( + // "000011101001011001000100000101000111010110100100100101100000000000" + // "011101101011001111101110101010000001010000011011111100000011101011" + // "011100101101011010101011011011001001110111101011110110111111001111" + // "001000011111101110011000111111110111111010000011101011111111110000" + // "110111000000100000001110110000110110001110000100001110101100010100" + // "110100010001000110001110011010110000111010000010000000000001101000" + // "000000000011100101100100010000000000000110110100110001111100000000" + // "000000100110100000000101010010100000001011000010001001100000011111" + // "110111111111000000000", + // PRNa, TOW_NavData); + // osnma->d_osnma_data.d_nma_header.nmas = 0b10; + // + // MACK_tag_and_info MTI; + // MTI.tag = static_cast(0xE37BC4F858); + // MTI.tag_info.PRN_d = 0x02; + // MTI.tag_info.ADKD = 0x00; + // MTI.tag_info.cop = 0x0F; + // Tag t0(MTI, TOW_Tag0, WN, PRNa, CTR); + // + // while (state.KeepRunning()) + // { + // osnma->verify_tag(t0); + // } +} + +void bm_kroot_verification(benchmark::State& state) +{ + // TODO - this is essentially the signature verification, maybe could implement it for comparison purposes +} + +BENCHMARK(bm_verify_public_key); +BENCHMARK(bm_verify_tesla_key); +BENCHMARK(bm_verify_tesla_key_24h); +BENCHMARK(bm_tag_verification); +BENCHMARK(bm_kroot_verification); + + +BENCHMARK_MAIN(); \ No newline at end of file From 2e867f2dac0c2a398cbe331dc88685ec1e29e7d5 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Wed, 14 Aug 2024 13:14:23 +0200 Subject: [PATCH 319/499] [TAS-240][FEAT] Implement TESLA Chain Renewal and Revocation I * Implemented a new chain renewal mechanism for OSNMA data structure updates and key management. * Added related flags and data fields. * tested successfully with test vectors. --- src/core/libs/osnma_msg_receiver.cc | 94 ++++++++++++------- src/core/libs/osnma_msg_receiver.h | 3 + src/core/system_parameters/osnma_data.h | 2 + .../osnma/osnma_test_vectors.cc | 38 ++++++++ 4 files changed, 105 insertions(+), 32 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index f5f8d4c0a..b4fb6a29d 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -258,7 +258,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& return; } // TODO - trusting the NMAS and CPKS shall be done upon PKR verification or Tag verification. - // It's ok to activate the flags, but the final decision should happen after verifying it. + // It's ok to activate the flags, but the final decision should happen after verifying it. // For OAM is solved, but NPK and PKREV I think not yet if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 4 /* NPK */ && d_GST_PKR_PKREV_start == 0) { @@ -309,6 +309,27 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& std::cout << "Galileo OSNMA: Alert message :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; } + if (d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 2 /* EOC */ && d_GST_chain_renewal_start == 0) + { + d_flag_chain_renewal = true; + d_GST_chain_renewal_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + LOG(INFO) << "Galileo OSNMA: Chain renewal :: Start at at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; + std::cout << "Galileo OSNMA: Chain renewal :: Start at at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; + } + if (d_flag_chain_renewal && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */) + { + // Step 2, start using the new kroot + d_flag_chain_renewal = false; + uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + double duration_hours = (final_GST - d_GST_chain_renewal_start) / 3600.0; + LOG(INFO) << "Galileo OSNMA: Chain renewal :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" + << ", Duration=" << duration_hours << "h"; + std::cout << "Galileo OSNMA: Chain renewal :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" + << ", Duration=" << duration_hours << "h" << std::endl; + d_osnma_data.d_dsm_kroot_message = d_osnma_data.d_dsm_kroot_new_message; // set new kroot as the one to use from now on + d_tesla_key_verified = false; // force the verification up to the Kroot due to chain change + } + read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 @@ -478,24 +499,27 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg // DSM-KROOT message if ((d_osnma_data.d_dsm_header.dsm_id < 12 || d_flag_hot_start) && d_public_key_verified) { + bool new_chain = (d_dsm_reader->get_cidkr(dsm_msg) != d_osnma_data.d_nma_header.cid) && d_flag_chain_renewal; + DSM_KROOT_message& applicable_kroot_msg = new_chain ? d_osnma_data.d_dsm_kroot_new_message : d_osnma_data.d_dsm_kroot_message; + // Parse Kroot message LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received."; - d_osnma_data.d_dsm_kroot_message.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); - d_osnma_data.d_dsm_kroot_message.pkid = d_dsm_reader->get_pkid(dsm_msg); - d_osnma_data.d_dsm_kroot_message.cidkr = d_dsm_reader->get_cidkr(dsm_msg); - d_osnma_data.d_dsm_kroot_message.reserved1 = d_dsm_reader->get_dsm_reserved1(dsm_msg); - d_osnma_data.d_dsm_kroot_message.hf = d_dsm_reader->get_hf(dsm_msg); - d_osnma_data.d_dsm_kroot_message.mf = d_dsm_reader->get_mf(dsm_msg); - d_osnma_data.d_dsm_kroot_message.ks = d_dsm_reader->get_ks(dsm_msg); - d_osnma_data.d_dsm_kroot_message.ts = d_dsm_reader->get_ts(dsm_msg); - d_osnma_data.d_dsm_kroot_message.maclt = d_dsm_reader->get_maclt(dsm_msg); - d_osnma_data.d_dsm_kroot_message.reserved = d_dsm_reader->get_dsm_reserved(dsm_msg); - d_osnma_data.d_dsm_kroot_message.wn_k = d_dsm_reader->get_wn_k(dsm_msg); - d_osnma_data.d_dsm_kroot_message.towh_k = d_dsm_reader->get_towh_k(dsm_msg); - d_osnma_data.d_dsm_kroot_message.alpha = d_dsm_reader->get_alpha(dsm_msg); + applicable_kroot_msg.nb_dk = d_dsm_reader->get_number_blocks_index(dsm_msg[0]); + applicable_kroot_msg.pkid = d_dsm_reader->get_pkid(dsm_msg); + applicable_kroot_msg.cidkr = d_dsm_reader->get_cidkr(dsm_msg); + applicable_kroot_msg.reserved1 = d_dsm_reader->get_dsm_reserved1(dsm_msg); + applicable_kroot_msg.hf = d_dsm_reader->get_hf(dsm_msg); + applicable_kroot_msg.mf = d_dsm_reader->get_mf(dsm_msg); + applicable_kroot_msg.ks = d_dsm_reader->get_ks(dsm_msg); + applicable_kroot_msg.ts = d_dsm_reader->get_ts(dsm_msg); + applicable_kroot_msg.maclt = d_dsm_reader->get_maclt(dsm_msg); + applicable_kroot_msg.reserved = d_dsm_reader->get_dsm_reserved(dsm_msg); + applicable_kroot_msg.wn_k = d_dsm_reader->get_wn_k(dsm_msg); + applicable_kroot_msg.towh_k = d_dsm_reader->get_towh_k(dsm_msg); + applicable_kroot_msg.alpha = d_dsm_reader->get_alpha(dsm_msg); // Kroot field - const uint16_t l_lk_bytes = d_dsm_reader->get_lk_bits(d_osnma_data.d_dsm_kroot_message.ks) / 8; - d_osnma_data.d_dsm_kroot_message.kroot = d_dsm_reader->get_kroot(dsm_msg, l_lk_bytes); + const uint16_t l_lk_bytes = d_dsm_reader->get_lk_bits(applicable_kroot_msg.ks) / 8; + applicable_kroot_msg.kroot = d_dsm_reader->get_kroot(dsm_msg, l_lk_bytes); // DS field uint16_t l_ds_bits = 0; const auto it = OSNMA_TABLE_15.find(d_crypto->get_public_key_type()); @@ -504,19 +528,19 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg l_ds_bits = it->second; } const uint16_t l_ds_bytes = l_ds_bits / 8; - d_osnma_data.d_dsm_kroot_message.ds = std::vector(l_ds_bytes, 0); // C: this accounts for padding in case needed. + applicable_kroot_msg.ds = std::vector(l_ds_bytes, 0); // C: this accounts for padding in case needed. for (uint16_t k = 0; k < l_ds_bytes; k++) { - d_osnma_data.d_dsm_kroot_message.ds[k] = dsm_msg[13 + l_lk_bytes + k]; + applicable_kroot_msg.ds[k] = dsm_msg[13 + l_lk_bytes + k]; } // Padding - const uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(d_osnma_data.d_dsm_kroot_message.nb_dk); + const uint16_t l_dk_bits = d_dsm_reader->get_l_dk_bits(applicable_kroot_msg.nb_dk); const uint16_t l_dk_bytes = l_dk_bits / 8; const uint16_t l_pdk_bytes = (l_dk_bytes - 13 - l_lk_bytes - l_ds_bytes); - d_osnma_data.d_dsm_kroot_message.p_dk = std::vector(l_pdk_bytes, 0); + applicable_kroot_msg.p_dk = std::vector(l_pdk_bytes, 0); for (uint16_t k = 0; k < l_pdk_bytes; k++) { - d_osnma_data.d_dsm_kroot_message.p_dk[k] = dsm_msg[13 + l_lk_bytes + l_ds_bytes + k]; + applicable_kroot_msg.p_dk[k] = dsm_msg[13 + l_lk_bytes + l_ds_bytes + k]; } const uint16_t check_l_dk = 104 * std::ceil(1.0 + static_cast((l_lk_bytes * 8.0) + l_ds_bits) / 104.0); @@ -539,15 +563,15 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg std::vector message = MSG; // MSG = (M | DS) from ICD. Eq. 7 for (uint16_t k = 0; k < l_ds_bytes; k++) { - MSG.push_back(d_osnma_data.d_dsm_kroot_message.ds[k]); + MSG.push_back(applicable_kroot_msg.ds[k]); } std::vector hash; - if (d_osnma_data.d_dsm_kroot_message.hf == 0) // Table 8. + if (applicable_kroot_msg.hf == 0) // Table 8. { hash = d_crypto->compute_SHA_256(MSG); } - else if (d_osnma_data.d_dsm_kroot_message.hf == 2) + else if (applicable_kroot_msg.hf == 2) { hash = d_crypto->compute_SHA3_256(MSG); } @@ -563,17 +587,16 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg p_dk_truncated.push_back(hash[i]); } // Check that the padding bits received match the computed values - if (d_osnma_data.d_dsm_kroot_message.p_dk == p_dk_truncated) + if (applicable_kroot_msg.p_dk == p_dk_truncated) { LOG(INFO) << "Galileo OSNMA: DSM-KROOT message received ok."; LOG(INFO) << "Galileo OSNMA: DSM-KROOT with CID=" << static_cast(d_osnma_data.d_nma_header.cid) - << ", PKID=" << static_cast(d_osnma_data.d_dsm_kroot_message.pkid) - << ", WN=" << static_cast(d_osnma_data.d_dsm_kroot_message.wn_k) - << ", TOW=" << static_cast(d_osnma_data.d_dsm_kroot_message.towh_k) * 3600; - // local_time_verification(osnma_msg); // FIXME TODO: real time verification needed + << ", PKID=" << static_cast(applicable_kroot_msg.pkid) + << ", WN=" << static_cast(applicable_kroot_msg.wn_k) + << ", TOW=" << static_cast(applicable_kroot_msg.towh_k) * 3600; // If new PK verified and the new KROOT arrived, set the new PK before attempting verification - if (d_flag_PK_renewal && d_osnma_data.d_dsm_kroot_message.pkid == d_new_public_key_id && d_flag_NPK_set == false) + if (d_flag_PK_renewal && applicable_kroot_msg.pkid == d_new_public_key_id && d_flag_NPK_set == false) { d_crypto->set_public_key(d_new_public_key); d_crypto->store_public_key(PEMFILE_DEFAULT); @@ -581,14 +604,15 @@ void osnma_msg_receiver::process_dsm_message(const std::vector& dsm_msg } if (l_ds_bits == 512) { - d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, d_osnma_data.d_dsm_kroot_message.ds); + d_kroot_verified = d_crypto->verify_signature_ecdsa_p256(message, applicable_kroot_msg.ds); } else if (l_ds_bits == 1056) { - d_kroot_verified = d_crypto->verify_signature_ecdsa_p521(message, d_osnma_data.d_dsm_kroot_message.ds); + d_kroot_verified = d_crypto->verify_signature_ecdsa_p521(message, applicable_kroot_msg.ds); } if (d_kroot_verified) { + applicable_kroot_msg.verified = true; std::cout << "Galileo OSNMA: DSM-KROOT authentication successful!" << std::endl; LOG(INFO) << "Galileo OSNMA: DSM-KROOT authentication successful!"; if (d_flag_alert_message) @@ -1271,6 +1295,12 @@ std::vector osnma_msg_receiver::compute_merkle_root(const DSM_PKR_messa } +/** + * @brief Get the Merkle tree base leave from a DSM_PKR_message. + * + * @param dsm_pkr_message The DSM_PKR_message object from which to retrieve the Merkle tree leave. + * @return std::vector The Merkle tree base leave from the DSM_PKR_message object. + */ std::vector osnma_msg_receiver::get_merkle_tree_leaves(const DSM_PKR_message& dsm_pkr_message) const { // build base leaf m_i according to OSNMA SIS ICD v1.1, section 6.2 DSM-PKR Verification diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 8327709da..56d104cf4 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -129,6 +129,7 @@ private: uint32_t d_GST_SIS{}; // GST coming from W6 and W5 of SIS uint32_t d_GST_PKR_PKREV_start{}; uint32_t d_GST_PKR_AM_start{}; + uint32_t d_GST_chain_renewal_start{}; uint32_t d_count_successful_tags{0}; uint32_t d_count_failed_tags{0}; @@ -149,6 +150,7 @@ private: bool d_flag_PK_revocation{false}; bool d_flag_NPK_set{false}; bool d_flag_alert_message{false}; + bool d_flag_chain_renewal{false}; // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); @@ -161,6 +163,7 @@ private: FRIEND_TEST(OsnmaTestVectors, NominalTestConf2); FRIEND_TEST(OsnmaTestVectors, PublicKeyRenewal); FRIEND_TEST(OsnmaTestVectors, PublicKeyRevocation); + FRIEND_TEST(OsnmaTestVectors, ChainRenewal); FRIEND_TEST(OsnmaTestVectors, AlertMessage); }; diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 0816abda6..7e6d03b42 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -116,6 +116,7 @@ public: uint8_t maclt{}; uint8_t reserved{}; uint8_t towh_k{}; + bool verified{false}; }; @@ -182,6 +183,7 @@ public: DSM_dsm_header d_dsm_header; DSM_PKR_message d_dsm_pkr_message; DSM_KROOT_message d_dsm_kroot_message; + DSM_KROOT_message d_dsm_kroot_new_message; MACK_message d_mack_message; OSNMA_NavData d_nav_data; }; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 755725d98..494103499 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -152,6 +152,7 @@ TEST_F(OsnmaTestVectors, PublicKeyRenewal) } std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; + // Act d_flag_NPK = true; bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); ASSERT_TRUE(result); @@ -190,6 +191,43 @@ TEST_F(OsnmaTestVectors, PublicKeyRevocation) } std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; + // Act + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); + + // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); +} + +TEST_F(OsnmaTestVectors, ChainRenewal) +{ + // Arrange + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20231007041500_PKID_7.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007041500_PKID_7.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::tm input_time_step1 = {0, 45, 16, 6, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step2 = {0, 30, 18, 6, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::vector input_times = {input_time_step1, input_time_step2}; + + std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/eoc_step1/06_OCT_2023_GST_16_45_01.csv"); + std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/eoc_step2/06_OCT_2023_GST_18_30_01.csv"); + if (testVectors_step1.empty() || testVectors_step2.empty()) + { + ASSERT_TRUE(false); + } + std::vector> testVectors = {testVectors_step1, testVectors_step2}; + + // Act bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); ASSERT_TRUE(result); From 092a78f580b0e3109fa53a08ea43be6cfdf3bdfe Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 15 Aug 2024 13:10:04 +0200 Subject: [PATCH 320/499] [TAS-145][Feat][PVT] Implement PVT logic for osnma data * Created a map with PRN-> set * osnma transmits every 30 s the list of authenticated PRNs along with the IOD authenticated * PVT takes this into account to consider the observable valid (only strict mode) * ""successfully"" tested. Osnma first tag authenticated: 1:36, TTFAF 2:06 => most of the time the PVT has authenticated solution, except two 30s gaps in which there is no PVT computed. (3-4' firs gap and second from 13:30-14:06) * TODOs: find out reason and improve size management of the maps. --- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 18 +++++++++++------- .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 2 ++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 2ffe95d24..23fd9605d 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -1658,13 +1658,10 @@ void rtklib_pvt_gs::msg_handler_osnma(const pmt::pmt_t& msg) // so with ADKD0 and ADKD12 validated), their corresponding TOW at the beginning // of the authenticated subframe, and maybe the COP. const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code(); - if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) + if (msg_type_hash_code == typeid(std::shared_ptr).hash_code()) { - // Act according to NMA data - if (d_osnma_strict) - { - // TODO - } + const auto osnma_data = wht::any_cast>(pmt::any_ref(msg)); + d_auth_nav_data_map[osnma_data->get_prn_d()].insert(osnma_data->get_IOD_nav()); } } catch (const wht::bad_any_cast& e) @@ -2051,7 +2048,14 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item if (d_osnma_strict && ((std::string(in[i][epoch].Signal, 2) == std::string("1B")) || ((std::string(in[i][epoch].Signal, 2) == std::string("7X"))))) { // Pick up only authenticated satellites - // TODO + auto IOD_nav_list = d_auth_nav_data_map.find(tmp_eph_iter_gal->second.PRN); + if (IOD_nav_list != d_auth_nav_data_map.cend()) + { + if (IOD_nav_list->second.find(tmp_eph_iter_gal->second.IOD_nav) != IOD_nav_list->second.cend()) + { + store_valid_observable = true; + } + } } else { diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 4acc14728..d6f61f1c6 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -20,6 +20,7 @@ #include "gnss_block_interface.h" #include "gnss_synchro.h" #include "gnss_time.h" +#include "osnma_data.h" #include "rtklib.h" #include #include @@ -203,6 +204,7 @@ private: std::map d_gnss_observables_map; std::map d_gnss_observables_map_t0; std::map d_gnss_observables_map_t1; + std::map> d_auth_nav_data_map; std::queue d_TimeChannelTagTimestamps; From ea0684d64019e114b44112ca287420a817e47ec4 Mon Sep 17 00:00:00 2001 From: cesaaargm Date: Thu, 15 Aug 2024 21:48:29 +0200 Subject: [PATCH 321/499] [TAS-240][FEAT] Implement TESLA Chain Renewal and Revocation II * revocation sucessfully tested. * Diagram of step 1 is wrong in that KROOT with CID=0 also received after entering step 1. * Duration of CREV=2.75h * All tags verified succesffully. --- src/core/libs/osnma_msg_receiver.cc | 22 +++++++++++ src/core/libs/osnma_msg_receiver.h | 3 ++ .../osnma/osnma_test_vectors.cc | 39 +++++++++++++++++++ 3 files changed, 64 insertions(+) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index b4fb6a29d..556f3fddf 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -330,6 +330,28 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr& d_tesla_key_verified = false; // force the verification up to the Kroot due to chain change } + if (d_osnma_data.d_nma_header.nmas == 3 /* DU */ && d_osnma_data.d_nma_header.cpks == 3 /* CREV */ && d_GST_chain_revocation_start == 0) + { + d_flag_chain_revocation = true; + d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0; // delete blocks received up to now, new chain must be received. + // d_public_key_verified = false; + d_kroot_verified = false; + d_tesla_key_verified = false; + d_GST_chain_revocation_start = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + LOG(INFO) << "Galileo OSNMA: Chain revocation :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"; + std::cout << "Galileo OSNMA: Chain revocation :: Start at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" << std::endl; + } + if (d_flag_chain_revocation && d_osnma_data.d_nma_header.nmas == 2 /* OP */ && d_osnma_data.d_nma_header.cpks == 1 /* Nominal */) + { + d_flag_chain_revocation = false; + uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0); + double duration_hours = (final_GST - d_GST_chain_revocation_start) / 3600.0; + LOG(INFO) << "Galileo OSNMA: Chain revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" + << ", Duration=" << duration_hours << "h"; + std::cout << "Galileo OSNMA: Chain revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]" + << ", Duration=" << duration_hours << "h" << std::endl; + } + read_dsm_header(osnma_msg->hkroot[1]); read_dsm_block(osnma_msg); process_dsm_block(osnma_msg); // will process dsm block if received a complete one, then will call mack processing upon re-setting the dsm block to 0 diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 56d104cf4..1598e23c2 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -130,6 +130,7 @@ private: uint32_t d_GST_PKR_PKREV_start{}; uint32_t d_GST_PKR_AM_start{}; uint32_t d_GST_chain_renewal_start{}; + uint32_t d_GST_chain_revocation_start{}; uint32_t d_count_successful_tags{0}; uint32_t d_count_failed_tags{0}; @@ -151,6 +152,7 @@ private: bool d_flag_NPK_set{false}; bool d_flag_alert_message{false}; bool d_flag_chain_renewal{false}; + bool d_flag_chain_revocation{false}; // Provide access to inner functions to Gtest FRIEND_TEST(OsnmaMsgReceiverTest, TeslaKeyVerification); @@ -164,6 +166,7 @@ private: FRIEND_TEST(OsnmaTestVectors, PublicKeyRenewal); FRIEND_TEST(OsnmaTestVectors, PublicKeyRevocation); FRIEND_TEST(OsnmaTestVectors, ChainRenewal); + FRIEND_TEST(OsnmaTestVectors, ChainRevocation); FRIEND_TEST(OsnmaTestVectors, AlertMessage); }; diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc index 494103499..7ac04d3c7 100644 --- a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc +++ b/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc @@ -244,6 +244,45 @@ TEST_F(OsnmaTestVectors, ChainRenewal) ASSERT_EQ(osnma->d_count_failed_macseq, 0); } +TEST_F(OsnmaTestVectors, ChainRevocation) +{ + // Arrange + std::string crtFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/PublicKey/OSNMA_PublicKey_20231007041500_PKID_7.crt"; + std::string merkleFilePath = std::string(BASE_OSNMA_TEST_VECTORS) + "cryptographic_material/Merkle_tree_2/MerkleTree/OSNMA_MerkleTree_20231007041500_PKID_7.xml"; + osnma_msg_receiver_sptr osnma = osnma_msg_receiver_make(crtFilePath, merkleFilePath); + + std::tm input_time_step1 = {0, 45, 21, 6, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step2 = {0, 30, 23, 6, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + std::tm input_time_step3 = {0, 30, 00, 7, 10 - 1, 2023 - 1900, 0, 0, 0, 0, 0}; + + std::vector input_times = {input_time_step1, input_time_step2, input_time_step3}; + + std::vector testVectors_step1 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/crev_step1/06_OCT_2023_GST_21_45_01.csv"); + std::vector testVectors_step2 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/crev_step2/06_OCT_2023_GST_23_30_01.csv"); + std::vector testVectors_step3 = readTestVectorsFromFile(std::string(BASE_OSNMA_TEST_VECTORS) + "osnma_test_vectors/crev_step3/07_OCT_2023_GST_00_30_01.csv"); + if (testVectors_step1.empty() || testVectors_step2.empty() || testVectors_step3.empty()) + { + ASSERT_TRUE(false); + } + std::vector> testVectors = {testVectors_step1, testVectors_step2, testVectors_step3}; + + // Act + bool result = feedOsnmaWithTestVectors(osnma, testVectors, input_times); + ASSERT_TRUE(result); + + // Assert + LOG(INFO) << "Successful tags count= " << osnma->d_count_successful_tags; + LOG(INFO) << "Failed tags count= " << osnma->d_count_failed_tags; + LOG(INFO) << "Unverified tags count= " << osnma->d_tags_awaiting_verify.size(); + LOG(INFO) << "Failed Kroot count= " << osnma->d_count_failed_Kroot; + LOG(INFO) << "Failed PK count= " << osnma->d_count_failed_pubKey; + LOG(INFO) << "Failed MACSEQ count= " << osnma->d_count_failed_macseq; + ASSERT_EQ(osnma->d_count_failed_tags, 0); + ASSERT_EQ(osnma->d_count_failed_Kroot, 0); + ASSERT_EQ(osnma->d_count_failed_pubKey, 0); + ASSERT_EQ(osnma->d_count_failed_macseq, 0); +} + TEST_F(OsnmaTestVectors, AlertMessage) { // Arrange From 94d76356128972e8d50b1c10cb213026b3e43847 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 16 Aug 2024 09:40:45 +0200 Subject: [PATCH 322/499] Small fixes (#26) * Decouple the FPGA DMA signal source from the AD9361 FPGA signal source. * Add the MAX2771_EVKIT FPGA signal source and the ENABLE_FPGA_MAX2771_EVKIT flag to enable it. * Adjust cross-compilation flags to properly support FPGA signal sources * fix signal source names for consistency * Detect if the spidev driver is installed when the ENABLE_MAX2771 flag is set. Detect if the DMA proxy driver is installed when the ENABLE_DMA_PROXY flag is set. Check if ENABLE_FPGA is set when either ENABLE_MAX2771 or ENABLE_DMA_PROXY is set. * fix FPGA signal source names for consistency * Fix FPGA-related CMakefile flags * make cpplint happy * make cpplint happy * make cmakelint happy * make clang-format happy * Replaced the AD9361 FPGA signal source with the ADRV9361_Z7035 FPGA and the FMCOMMS5 FPGA signal sources. * Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 * Avoid code duplication in CMake modules * Update clang-tidy job * Clang Tidy fixes * Improve efficiency of Concurrent_Map and Concurrent_Queue classes * Fix segmentation fault if the SignalSource implementation is not available * Moved decimation factor count variable to the class * Avoid possible runtime error when PVT.enable_rx_clock_correction=true * Fix formatting * Fix clang-tidy job * Capitalize FPGA in class implementation names * Capitalize acronyms in FPGA-related class names * Instantiate sources only once * Update changelog * Fix building in some environments and fix CI jobs * Fix clang-tidy complain --------- Co-authored-by: Marc Majoral Co-authored-by: cesaaargm Co-authored-by: Xavier Guerrero-Pau --- CMakeLists.txt | 107 +++ docs/CHANGELOG.md | 19 + .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 3 +- ...lileo_e1_pcps_ambiguous_acquisition_fpga.h | 4 +- .../galileo_e5a_pcps_acquisition_fpga.h | 4 +- .../galileo_e5b_pcps_acquisition_fpga.h | 2 +- .../gps_l1_ca_pcps_acquisition_fpga.h | 4 +- .../adapters/gps_l2_m_pcps_acquisition_fpga.h | 4 +- .../adapters/gps_l5i_pcps_acquisition_fpga.h | 4 +- .../signal_source/adapters/CMakeLists.txt | 22 +- .../adapters/ad9361_fpga_signal_source.cc | 885 ------------------ .../adrv9361_z7035_signal_source_fpga.cc | 398 ++++++++ ....h => adrv9361_z7035_signal_source_fpga.h} | 50 +- .../adapters/dma_signal_source_fpga.cc | 581 ++++++++++++ .../adapters/dma_signal_source_fpga.h | 118 +++ .../adapters/fmcomms5_signal_source_fpga.cc | 347 +++++++ .../adapters/fmcomms5_signal_source_fpga.h | 135 +++ .../max2771_evkit_signal_source_fpga.cc | 467 +++++++++ .../max2771_evkit_signal_source_fpga.h | 164 ++++ .../signal_source/libs/CMakeLists.txt | 16 +- .../signal_source/libs/fpga_buffer_monitor.cc | 18 +- .../signal_source/libs/fpga_buffer_monitor.h | 8 +- .../libs/fpga_dynamic_bit_selection.h | 1 - .../signal_source/libs/fpga_spidev.cc | 131 +++ .../signal_source/libs/fpga_spidev.h | 61 ++ .../signal_source/libs/fpga_switch.cc | 15 +- .../signal_source/libs/fpga_switch.h | 4 +- .../galileo_e1_dll_pll_veml_tracking_fpga.h | 4 +- .../galileo_e5a_dll_pll_tracking_fpga.h | 4 +- .../gps_l1_ca_dll_pll_tracking_fpga.h | 4 +- .../adapters/gps_l2_m_dll_pll_tracking_fpga.h | 4 +- .../adapters/gps_l5_dll_pll_tracking_fpga.h | 4 +- src/core/libs/osnma_msg_receiver.cc | 2 +- src/core/libs/osnma_msg_receiver.h | 10 +- src/core/libs/osnma_nav_data_manager.cc | 10 +- src/core/receiver/CMakeLists.txt | 8 + src/core/receiver/gnss_block_factory.cc | 85 +- src/core/receiver/gnss_flowgraph.cc | 2 +- src/tests/benchmarks/benchmark_osnma.cc | 33 +- ...e1_pcps_ambiguous_acquisition_test_fpga.cc | 6 +- .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 6 +- .../hybrid_observables_test_fpga.cc | 36 +- .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 2 +- .../tracking/tracking_pull-in_test_fpga.cc | 38 +- 44 files changed, 2769 insertions(+), 1061 deletions(-) delete mode 100644 src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc rename src/algorithms/signal_source/adapters/{ad9361_fpga_signal_source.h => adrv9361_z7035_signal_source_fpga.h} (70%) create mode 100644 src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc create mode 100644 src/algorithms/signal_source/adapters/dma_signal_source_fpga.h create mode 100644 src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc create mode 100644 src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h create mode 100644 src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc create mode 100644 src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h create mode 100644 src/algorithms/signal_source/libs/fpga_spidev.cc create mode 100644 src/algorithms/signal_source/libs/fpga_spidev.h diff --git a/CMakeLists.txt b/CMakeLists.txt index e8dfc5825..c10936ca1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,10 @@ option(ENABLE_AD936X_SDR "Enable the use of AD936X front-ends using libiio, requ option(ENABLE_AD9361 "Enable the use of AD9361 direct to FPGA hardware, requires libiio" OFF) +option(ENABLE_MAX2771 "Enable the use of MAX2771 direct to FPGA hardware, requires the spidev driver" OFF) + +option(ENABLE_DMA_PROXY "Enable the use of the DMA direct to FPGA hardware, requires the DMA Proxy driver" OFF) + option(ENABLE_RAW_UDP "Enable the use of high-optimized custom UDP packet sample source, requires libpcap" OFF) option(ENABLE_FLEXIBAND "Enable the use of the signal source adater for the Teleorbit Flexiband GNU Radio driver" OFF) @@ -3267,6 +3271,107 @@ endif() +##################################################################### +# Check signal sources related to FPGA only. +##################################################################### +if(ENABLE_MAX2771 AND NOT ENABLE_FPGA) + message(STATUS "The SPIdev driver is enabled, but the FPGA is not enabled. The FPGA is required when using the SPIdev driver.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "ENABLE_MAX2771 can only be set when ENABLE_FPGA is also set.") + endif() +endif() +if(ENABLE_DMA_PROXY AND NOT ENABLE_FPGA) + message(STATUS "The DMA Proxy driver is enabled, but the FPGA is not enabled. The FPGA is required when using the DMA Proxy driver.") + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "ENABLE_DMA_PROXY can only be set when ENABLE_FPGA is also set.") + endif() +endif() + + + +##################################################################### +# spidev driver - OPTIONAL +# Linux kernel driver that provides user-space access to Serial +# Peripheral Interface) +##################################################################### +if(ENABLE_MAX2771) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + find_program(STRINGS_EXECUTABLE strings) + if(NOT STRINGS_EXECUTABLE) + message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") + message(STATUS " You can try to install it by typing:") + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(STATUS " sudo yum install binutils") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(STATUS " sudo zypper install binutils") + else() + message(STATUS " sudo apt-get install binutils") + endif() + endif() + message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") + endif() + set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") + if(EXISTS "${DTB_FILE}") + message(STATUS "Found DTB file: ${DTB_FILE}") + # Run the strings command and grep for "spidev" + execute_process( + COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} + COMMAND grep "spidev" + OUTPUT_VARIABLE GREP_OUTPUT + RESULT_VARIABLE GREP_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(GREP_RESULT EQUAL 0) + message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") + else() + message(STATUS "SPIdev driver not found, its installation is required.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") + endif() + endif() + else() + message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") + endif() +endif() + + + +##################################################################### +# DMA Proxy driver - OPTIONAL +# Simplified and efficient interface for user-space applications +# to leverage DMA capabilities for Xilinx FPGA and SoC systems +##################################################################### +if(ENABLE_DMA_PROXY) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + if(EXISTS "${DMA_PROXY_FILE}") + message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") + else() + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "DMA Proxy driver is required for building gnss-sdr with -DENABLE_DMA_PROXY=ON.") + endif() + endif() +endif() + + + ############################################## # TELEORBIT FLEXIBAND FRONTEND - OPTIONAL ############################################## @@ -3471,6 +3576,8 @@ add_feature_info(ENABLE_LIMESDR ENABLE_LIMESDR "Enables Limesdr_Signal_Source. R add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio and libad9361-dev.") add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.") add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio and libad9361-dev.") +add_feature_info(ENABLE_MAX2771 ENABLE_MAX2771 "Enables FPGA_MAX2771_EVKIT_Signal_Source for devices with the MAX2771 chipset. Requires the spidev driver") +add_feature_info(ENABLE_DMA_PROXY ENABLE_DMA_PROXY "Enables DMA Signal_Source. Requires the DMA Proxy driver") add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Iio_Signal_Source to access AD936X front-ends using libiio. Requires libiio and libad9361-dev.") add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.") add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.") diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1812c76b7..3963e0b20 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -21,6 +21,25 @@ All notable changes to GNSS-SDR will be documented in this file. wideband device (HackRF/LimeSDR/USRP). Demonstration: https://www.youtube.com/watch?v=ZQs2sFchJ6w https://www.youtube.com/watch?v=HnZkKj9a-QM +- Add the following signal sources for use when GNSS-SDR is operating on SoC + FPGA boards (`-DENABLE_FPGA=ON`): + + - `ADRV9361_Z7035_Signal_Source_FPGA`: Analog Devices ADRV9361-Z7035 board. + - `FMCOMMS5_Signal_Source_FPGA`: FMCOMMS5 analog front-end. + - `MAX2771_EVKIT_Signal_Source_FPGA`: MAX2771 evaluation kit analog front-end. + - `DMA_Signal_Source_FPGA`: FPGA DMA working in post-processing mode. + + When building GNSS-SDR for the SoC FPGA, the following options can be passed + to CMake with possible values of `ON` or `OFF`, and their default value is + `OFF`: + + - `-DENABLE_AD9361`: Checks if the IIO driver is installed and builds the + `ADRV9361_Z7035_Signal_Source_FPGA` and the `FMCOMMS5_Signal_Source_FPGA` + sources. + - `-DENABLE_MAX2771`: Checks if the SPIdev driver is installed and builds the + `MAX2771_EVKIT_Signal_Source_FPGA` source. + - `-DENABLE_DMA_PROXY`: Checks if the DMA proxy driver is installed for + controlling the DMA in the FPGA and enables its usage. ### Improvements in Portability: diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index d6f61f1c6..65f7bd548 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -35,6 +35,7 @@ #include // for map #include // for shared_ptr, unique_ptr #include // for std::queue +#include // for std::set #include // for string #include // for key_t #include // for vector @@ -204,7 +205,7 @@ private: std::map d_gnss_observables_map; std::map d_gnss_observables_map_t0; std::map d_gnss_observables_map_t1; - std::map> d_auth_nav_data_map; + std::map> d_auth_nav_data_map; std::queue d_TimeChannelTagTimestamps; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index 09829267c..b28d63422 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -66,11 +66,11 @@ public: } /*! - * \brief Returns "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga" + * \brief Returns "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA" */ inline std::string implementation() override { - return "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga"; + return "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 12d38bf34..14dae0230 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -66,11 +66,11 @@ public: } /*! - * \brief Returns "Galileo_E5a_Pcps_Acquisition_Fpga" + * \brief Returns "Galileo_E5a_Pcps_Acquisition_FPGA" */ inline std::string implementation() override { - return "Galileo_E5a_Pcps_Acquisition_Fpga"; + return "Galileo_E5a_Pcps_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h index 8ae54e46a..d67bfd4a6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h @@ -65,7 +65,7 @@ public: } /*! - * \brief Returns "Galileo_E5b_Pcps_Acquisition_Fpga" + * \brief Returns "Galileo_E5b_Pcps_Acquisition_FPGA" */ inline std::string implementation() override { diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index cfc483cda..2b7bfd3f9 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -67,11 +67,11 @@ public: } /*! - * \brief Returns "GPS_L1_CA_PCPS_Acquisition_Fpga" + * \brief Returns "GPS_L1_CA_PCPS_Acquisition_FPGA" */ inline std::string implementation() override { - return "GPS_L1_CA_PCPS_Acquisition_Fpga"; + return "GPS_L1_CA_PCPS_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 19acec8cb..81f4d342c 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -60,11 +60,11 @@ public: } /*! - * \brief Returns "GPS_L2_M_PCPS_Acquisition_Fpga" + * \brief Returns "GPS_L2_M_PCPS_Acquisition_FPGA" */ inline std::string implementation() override { - return "GPS_L2_M_PCPS_Acquisition_Fpga"; + return "GPS_L2_M_PCPS_Acquisition_FPGA"; } inline size_t item_size() override diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index 497ab9b90..bf2bfafcf 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -69,11 +69,11 @@ public: } /*! - * \brief Returns "GPS_L5i_PCPS_Acquisition_Fpga" + * \brief Returns "GPS_L5i_PCPS_Acquisition_FPGA" */ inline std::string implementation() override { - return "GPS_L5i_PCPS_Acquisition_Fpga"; + return "GPS_L5i_PCPS_Acquisition_FPGA"; } /*! diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index e4ead311b..0aa745101 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -37,8 +37,26 @@ if(ENABLE_AD9361) ############################################### # AD9361 DIRECT TO FPGA Hardware ############################################### - list(APPEND OPT_DRIVER_SOURCES ad9361_fpga_signal_source.cc) - list(APPEND OPT_DRIVER_HEADERS ad9361_fpga_signal_source.h) + list(APPEND OPT_DRIVER_SOURCES adrv9361_z7035_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS adrv9361_z7035_signal_source_fpga.h) + list(APPEND OPT_DRIVER_SOURCES fmcomms5_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS fmcomms5_signal_source_fpga.h) +endif() + +if(ENABLE_MAX2771) + ############################################### + # MAX2771 EVKIT DIRECT TO FPGA Hardware + ############################################### + list(APPEND OPT_DRIVER_SOURCES max2771_evkit_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS max2771_evkit_signal_source_fpga.h) +endif() + +if(ENABLE_DMA_PROXY) + ############################################### + # FPGA DMA source + ############################################### + list(APPEND OPT_DRIVER_SOURCES dma_signal_source_fpga.cc) + list(APPEND OPT_DRIVER_HEADERS dma_signal_source_fpga.h) endif() if(ENABLE_FLEXIBAND AND TELEORBIT_FOUND) diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc b/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc deleted file mode 100644 index 3a3360bed..000000000 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.cc +++ /dev/null @@ -1,885 +0,0 @@ -/*! - * \file ad9361_fpga_signal_source.cc - * \brief signal source for Analog Devices front-end AD9361 connected directly - * to FPGA accelerators. - * This source implements only the AD9361 control. It is NOT compatible with - * conventional SDR acquisition and tracking blocks. - * Please use the fmcomms2 source if conventional SDR acquisition and tracking - * is selected in the configuration file. - * \authors
      - *
    • Javier Arribas, jarribas(at)cttc.es - *
    • Marc Majoral, mmajoral(at)cttc.es - *
    - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "ad9361_fpga_signal_source.h" -#include "GPS_L1_CA.h" -#include "GPS_L5.h" -#include "ad9361_manager.h" -#include "command_event.h" -#include "configuration_interface.h" -#include "gnss_sdr_flags.h" -#include "gnss_sdr_string_literals.h" -#include "uio_fpga.h" -#include -#include // for std::max -#include // for std::chrono -#include // for std::floor -#include // for std::exception -#include // for open, O_WRONLY -#include // for std::ifstream -#include // for std::setprecision -#include // for std::cout -#include // for write -#include // fr std::vector - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#include -#endif - -using namespace std::string_literals; - -Ad9361FpgaSignalSource::Ad9361FpgaSignalSource(const ConfigurationInterface *configuration, - const std::string &role, unsigned int in_stream, unsigned int out_stream, - Concurrent_Queue *queue __attribute__((unused))) - : SignalSourceBase(configuration, role, "Ad9361_Fpga_Signal_Source"s), - queue_(queue), - gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), - gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), - rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), - filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), - filename0_(configuration->property(role + ".filename", empty_string)), - rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), - rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), - scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", -3.0)), - phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)), - tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)), - freq0_(configuration->property(role + ".freq", 0)), - freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), - sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), - bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), - samples_to_skip_(0), - samples_(configuration->property(role + ".samples", static_cast(0))), - freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))), - freq_rf_tx_hz_(configuration->property(role + ".freq_rf_tx_hz", static_cast(GPS_L1_FREQ_HZ - GPS_L5_FREQ_HZ - freq_dds_tx_hz_))), - tx_bandwidth_(configuration->property(role + ".tx_bandwidth", static_cast(500000))), - Fpass_(configuration->property(role + ".Fpass", static_cast(0.0))), - Fstop_(configuration->property(role + ".Fstop", static_cast(0.0))), - num_input_files_(1), - dma_buff_offset_pos_(0), - in_stream_(in_stream), - out_stream_(out_stream), - switch_position_(configuration->property(role + ".switch_position", 0)), - item_size_(sizeof(int8_t)), - enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)), - filter_auto_(configuration->property(role + ".filter_auto", false)), - quadrature_(configuration->property(role + ".quadrature", true)), - rf_dc_(configuration->property(role + ".rf_dc", true)), - bb_dc_(configuration->property(role + ".bb_dc", true)), - rx1_enable_(configuration->property(role + ".rx1_enable", true)), - rx2_enable_(configuration->property(role + ".rx2_enable", true)), - enable_DMA_(false), - enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), - enable_ovf_check_buffer_monitor_active_(false), - dump_(configuration->property(role + ".dump", false)), -#if USE_GLOG_AND_GFLAGS - rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)), -#else - rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))), -#endif - repeat_(configuration->property(role + ".repeat", false)) -{ - const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", 0.0); - const size_t header_size = configuration->property(role + ".header_size", 0); - - const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || - (configuration->property("Channels_1B.count", 0) > 0)); - const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || - (configuration->property("Channels_L5.count", 0) > 0) || - (configuration->property("Channels_5X.count", 0) > 0)); - - const uint32_t num_freq_bands = ((enable_rx1_band == true) and (enable_rx2_band == true)) ? 2 : 1; - if (freq0_ == 0) - { - // use ".freq0" - freq0_ = configuration->property(role + ".freq0", static_cast(GPS_L1_FREQ_HZ)); - } - - if (filter_auto_) - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); - } - else - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); - } -#if USE_GLOG_AND_GFLAGS - // override value with commandline flag, if present - if (FLAGS_signal_source != "-") - { - filename0_ = FLAGS_signal_source; - } - if (FLAGS_s != "-") - { - filename0_ = FLAGS_s; - } -#else - if (absl::GetFlag(FLAGS_signal_source) != "-") - { - filename0_ = absl::GetFlag(FLAGS_signal_source); - } - if (absl::GetFlag(FLAGS_s) != "-") - { - filename0_ = absl::GetFlag(FLAGS_s); - } -#endif - if (filename0_.empty()) - { - num_input_files_ = 2; - filename0_ = configuration->property(role + ".filename0", empty_string); - filename1_ = configuration->property(role + ".filename1", empty_string); - } - // if only one input file is specified in the configuration file then: - // if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels - // otherwise the DMA transfers the samples to the L2/L5 frequency band channels - // if more than one input file are specified then the DMA transfer the samples to both the L1 and the L2/L5 frequency channels. - if (filename1_.empty()) - { - if (enable_rx1_band) - { - dma_buff_offset_pos_ = 2; - } - } - else - { - dma_buff_offset_pos_ = 2; - } - - if (seconds_to_skip > 0) - { - samples_to_skip_ = static_cast(seconds_to_skip * sample_rate_) * 2; - } - if (header_size > 0) - { - samples_to_skip_ += header_size; - } - - std::string device_io_name; // Switch UIO device file - // find the uio device file corresponding to the switch. - if (find_uio_dev_file_name(device_io_name, switch_device_name, 0) < 0) - { - std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << switch_device_name << '\n'; - return; - } - - if (switch_position_ != 0 && switch_position_ != 2) - { - std::cout << "SignalSource.switch_position configuration parameter must be either 0: read from file(s) via DMA, or 2: read from AD9361\n"; - std::cout << "SignalSource.switch_position configuration parameter set to its default value switch_position=0 - read from file(s)\n"; - switch_position_ = 0; - } - - switch_fpga = std::make_shared(device_io_name); - switch_fpga->set_switch_position(switch_position_); - - if (switch_position_ == 0) // Inject file(s) via DMA - { - enable_DMA_ = true; - - if (samples_ == 0) // read all file - { - /*! - * BUG workaround: The GNU Radio file source does not stop the receiver after reaching the End of File. - * A possible solution is to compute the file length in samples using file size, excluding the last 100 milliseconds, and enable always the - * valve block - */ - std::ifstream file(filename0_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); - std::ifstream::pos_type size; - - if (file.is_open()) - { - size = file.tellg(); - DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); - } - else - { - std::cerr << "SignalSource: Unable to open the samples file " << filename0_.c_str() << '\n'; - return; - } - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(16); - std::cout << "Processing file " << filename0_ << ", which contains " << static_cast(size) << " [bytes]\n"; - std::cout.precision(ss); - - if (size > 0) - { - const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; - const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; - samples_ = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms - } - - if (!filename1_.empty()) - { - std::ifstream file(filename1_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); - std::ifstream::pos_type size; - - if (file.is_open()) - { - size = file.tellg(); - DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); - } - else - { - std::cerr << "SignalSource: Unable to open the samples file " << filename1_.c_str() << '\n'; - return; - } - std::streamsize ss = std::cout.precision(); - std::cout << std::setprecision(16); - std::cout << "Processing file " << filename1_ << ", which contains " << static_cast(size) << " [bytes]\n"; - std::cout.precision(ss); - - int64_t samples_rx2 = 0; - if (size > 0) - { - const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; - const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; - samples_rx2 = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms - } - samples_ = std::min(samples_, samples_rx2); - } - } - - CHECK(samples_ > 0) << "File does not contain enough samples to process."; - double signal_duration_s = (static_cast(samples_) * (1 / static_cast(sample_rate_))) / 2.0; - - DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; - std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]\n"; - - if (filename1_.empty()) - { - DLOG(INFO) << "File source filename " << filename0_; - } - else - { - DLOG(INFO) << "File source filename rx1 " << filename0_; - DLOG(INFO) << "File source filename rx2 " << filename1_; - } - DLOG(INFO) << "Samples " << samples_; - DLOG(INFO) << "Sampling frequency " << sample_rate_; - DLOG(INFO) << "Item type " << std::string("ibyte"); - DLOG(INFO) << "Item size " << item_size_; - DLOG(INFO) << "Repeat " << repeat_; - } - if (switch_position_ == 2) // Real-time via AD9361 - { - std::cout << "Sample rate: " << sample_rate_ << " Sps\n"; - - enable_ovf_check_buffer_monitor_active_ = false; // check buffer overflow and buffer monitor disabled by default - - // some basic checks - if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2")) - { - std::cout << "Configuration parameter rf_port_select should take one of these values:\n"; - std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2\n"; - std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value rf_port_select=" << default_rf_port_select << '\n'; - rf_port_select_ = default_rf_port_select; - LOG(WARNING) << "Invalid configuration value for rf_port_select parameter. Set to rf_port_select=" << default_rf_port_select; - } - - if ((gain_mode_rx1_ != "manual") && (gain_mode_rx1_ != "slow_attack") && (gain_mode_rx1_ != "fast_attack") && (gain_mode_rx1_ != "hybrid")) - { - std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:\n"; - std::cout << " manual, slow_attack, fast_attack, hybrid\n"; - std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value gain_mode_rx1=" << default_gain_mode << '\n'; - gain_mode_rx1_ = default_gain_mode; - LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx1=" << default_gain_mode; - } - - if ((gain_mode_rx2_ != "manual") && (gain_mode_rx2_ != "slow_attack") && (gain_mode_rx2_ != "fast_attack") && (gain_mode_rx2_ != "hybrid")) - { - std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:\n"; - std::cout << " manual, slow_attack, fast_attack, hybrid\n"; - std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value gain_mode_rx2=" << default_gain_mode << '\n'; - gain_mode_rx2_ = default_gain_mode; - LOG(WARNING) << "Invalid configuration value for gain_mode_rx2 parameter. Set to gain_mode_rx2=" << default_gain_mode; - } - - if (gain_mode_rx1_ == "manual") - { - if (rf_gain_rx1_ > 73.0 || rf_gain_rx1_ < -1.0) - { - std::cout << "Configuration parameter rf_gain_rx1 should take values between -1.0 and 73 dB\n"; - std::cout << "Error: provided value rf_gain_rx1=" << rf_gain_rx1_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value rf_gain_rx1=" << default_manual_gain_rx1 << '\n'; - rf_gain_rx1_ = default_manual_gain_rx1; - LOG(WARNING) << "Invalid configuration value for rf_gain_rx1 parameter. Set to rf_gain_rx1=" << default_manual_gain_rx1; - } - } - - if (gain_mode_rx2_ == "manual") - { - if (rf_gain_rx2_ > 73.0 || rf_gain_rx2_ < -1.0) - { - std::cout << "Configuration parameter rf_gain_rx2 should take values between -1.0 and 73 dB\n"; - std::cout << "Error: provided value rf_gain_rx2=" << rf_gain_rx2_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value rf_gain_rx2=" << default_manual_gain_rx2 << '\n'; - rf_gain_rx2_ = default_manual_gain_rx2; - LOG(WARNING) << "Invalid configuration value for rf_gain_rx2 parameter. Set to rf_gain_rx2=" << default_manual_gain_rx2; - } - } - - if ((filter_source_ != "Off") && (filter_source_ != "Auto") && (filter_source_ != "File") && (filter_source_ != "Design")) - { - std::cout << "Configuration parameter filter_source should take one of these values:\n"; - std::cout << " Off: Disable filter\n"; - std::cout << " Auto: Use auto-generated filters\n"; - std::cout << " File: User-provided filter in filter_filename parameter\n"; - std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters\n"; - std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value filter_source=Off\n"; - filter_source_ = std::string("Off"); - LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off"; - } - - if (bandwidth_ < 200000 || bandwidth_ > 56000000) - { - std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz\n"; - std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << '\n'; - bandwidth_ = default_bandwidth; - LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth; - } - - std::cout << "LO frequency : " << freq0_ << " Hz\n"; - try - { - config_ad9361_rx_local(bandwidth_, - sample_rate_, - freq0_, - freq1_, - rf_port_select_, - rx1_enable_, - rx2_enable_, - gain_mode_rx1_, - gain_mode_rx2_, - rf_gain_rx1_, - rf_gain_rx2_, - quadrature_, - rf_dc_, - bb_dc_, - filter_source_, - filter_filename_, - Fpass_, - Fstop_); - } - catch (const std::runtime_error &e) - { - std::cerr << "Exception cached when configuring the RX chain: " << e.what() << '\n'; - return; - } - // LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION - if (enable_dds_lo_ == true) - { - if (tx_bandwidth_ < static_cast(std::floor(static_cast(freq_dds_tx_hz_) * 1.1)) || (tx_bandwidth_ < 200000) || (tx_bandwidth_ > 1000000)) - { - std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz\n"; - std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value tx_bandwidth=500000\n"; - tx_bandwidth_ = 500000; - LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000"; - } - if (tx_attenuation_db_ > 0.0 || tx_attenuation_db_ < -89.75) - { - std::cout << "Configuration parameter tx_attenuation_db should take values between 0.0 and -89.95 in 0.25 dB steps\n"; - std::cout << "Error: provided value tx_attenuation_db=" << tx_attenuation_db_ << " is not among valid values\n"; - std::cout << " This parameter has been set to its default value tx_attenuation_db=" << default_tx_attenuation_db << '\n'; - tx_attenuation_db_ = default_tx_attenuation_db; - LOG(WARNING) << "Invalid configuration value for tx_attenuation_db parameter. Set to tx_attenuation_db=" << default_tx_attenuation_db; - } - try - { - config_ad9361_lo_local(tx_bandwidth_, - sample_rate_, - freq_rf_tx_hz_, - tx_attenuation_db_, - freq_dds_tx_hz_, - scale_dds_dbfs_, - phase_dds_deg_); - } - catch (const std::runtime_error &e) - { - std::cerr << "Exception cached when configuring the TX carrier: " << e.what() << '\n'; - return; - } - } - - // when the receiver is working in real-time mode via AD9361 perform buffer overflow checking, - // and if dump is enabled perform buffer monitoring - enable_ovf_check_buffer_monitor_active_ = true; - - std::string device_io_name_buffer_monitor; - - std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); - - // find the uio device file corresponding to the buffer monitor - if (find_uio_dev_file_name(device_io_name_buffer_monitor, buffer_monitor_device_name, 0) < 0) - { - std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << buffer_monitor_device_name << '\n'; - return; - } - - buffer_monitor_fpga = std::make_shared(device_io_name_buffer_monitor, num_freq_bands, dump_, dump_filename); - thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); - } - - // dynamic bits selection - if (enable_dynamic_bit_selection_) - { - dynamic_bit_selection_fpga = std::make_shared(enable_rx1_band, enable_rx2_band); - thread_dynamic_bit_selection = std::thread([&] { run_dynamic_bit_selection_process(); }); - } - - if (in_stream_ > 0) - { - LOG(ERROR) << "A signal source does not have an input stream"; - } - if (out_stream_ > 1) - { - LOG(ERROR) << "This implementation only supports one output stream"; - } -} - - -Ad9361FpgaSignalSource::~Ad9361FpgaSignalSource() -{ - /* cleanup and exit */ - if (switch_position_ == 0) // read samples from a file via DMA - { - std::unique_lock lock(dma_mutex); - enable_DMA_ = false; // disable the DMA - lock.unlock(); - if (thread_file_to_dma.joinable()) - { - thread_file_to_dma.join(); - } - } - - if (switch_position_ == 2) // Real-time via AD9361 - { - if (rf_shutdown_) - { - std::cout << "* AD9361 Disabling RX streaming channels\n"; - if (!disable_ad9361_rx_local()) - { - LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; - } - if (enable_dds_lo_) - { - try - { - ad9361_disable_lo_local(); - } - catch (const std::exception &e) - { - LOG(WARNING) << "Problem shutting down the AD9361 TX stream: " << e.what(); - } - } - } - - // disable buffer overflow checking and buffer monitoring - std::unique_lock lock(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock.unlock(); - - if (thread_buffer_monitor.joinable()) - { - thread_buffer_monitor.join(); - } - } - - std::unique_lock lock(dynamic_bit_selection_mutex); - bool bit_selection_enabled = enable_dynamic_bit_selection_; - lock.unlock(); - - if (bit_selection_enabled == true) - { - std::unique_lock lock(dynamic_bit_selection_mutex); - enable_dynamic_bit_selection_ = false; - lock.unlock(); - - if (thread_dynamic_bit_selection.joinable()) - { - thread_dynamic_bit_selection.join(); - } - } -} - - -void Ad9361FpgaSignalSource::start() -{ - thread_file_to_dma = std::thread([&] { run_DMA_process(filename0_, filename1_, samples_to_skip_, item_size_, samples_, repeat_, dma_buff_offset_pos_, queue_); }); -} - - -void Ad9361FpgaSignalSource::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) -{ - std::ifstream infile1; - infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); - - - // FPGA DMA control - dma_fpga = std::make_shared(); - - // open the files - try - { - infile1.open(filename0_, std::ios::binary); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception opening file " << filename0_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - - std::ifstream infile2; - if (!filename1_.empty()) - { - infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); - try - { - infile2.open(filename1_, std::ios::binary); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception opening file " << filename1_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - } - - // skip the initial samples if needed - uint64_t bytes_to_skeep = samples_to_skip * item_size; - try - { - infile1.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - - if (!filename1_.empty()) - { - try - { - infile2.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - } - - // rx signal vectors - std::vector input_samples(sample_block_size * 2); // complex samples - // pointer to DMA buffer - int8_t *dma_buffer; - int nread_elements = 0; // num bytes read from the file corresponding to frequency band 1 - bool run_DMA = true; - - // Open DMA device - if (dma_fpga->DMA_open()) - { - std::cerr << "Cannot open loop device\n"; - // stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); - return; - } - dma_buffer = dma_fpga->get_buffer_address(); - - // if only one frequency band is used then clear the samples corresponding to the unused frequency band - uint32_t dma_index = 0; - if (num_input_files_ == 1) - { - // if only one file is enabled then clear the samples corresponding to the frequency band that is not used. - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - dma_buffer[dma_index + (2 - dma_buff_offset_pos)] = 0; - dma_buffer[dma_index + 1 + (2 - dma_buff_offset_pos)] = 0; - dma_index += 4; - } - } - - uint64_t nbytes_remaining = samples * item_size; - uint32_t read_buffer_size = sample_block_size * 2; // complex samples - - // run the DMA - while (run_DMA) - { - dma_index = 0; - if (nbytes_remaining < read_buffer_size) - { - read_buffer_size = nbytes_remaining; - } - nbytes_remaining = nbytes_remaining - read_buffer_size; - - // read filename 0 - try - { - infile1.read(reinterpret_cast(input_samples.data()), read_buffer_size); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << filename0_ << '\n'; - break; - } - if (infile1) - { - nread_elements = read_buffer_size; - } - else - { - // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN - nread_elements = infile1.gcount(); - } - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - // dma_buff_offset_pos is 1 for the L1 band and 0 for the other bands - dma_buffer[dma_index + dma_buff_offset_pos] = input_samples[index0]; - dma_buffer[dma_index + 1 + dma_buff_offset_pos] = input_samples[index0 + 1]; - dma_index += 4; - } - - // read filename 1 (if enabled) - if (num_input_files_ > 1) - { - dma_index = 0; - try - { - infile2.read(reinterpret_cast(input_samples.data()), read_buffer_size); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception reading file " << filename1_ << '\n'; - break; - } - if (infile2) - { - nread_elements = read_buffer_size; - } - else - { - // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN - nread_elements = infile2.gcount(); - } - - for (int index0 = 0; index0 < (nread_elements); index0 += 2) - { - // filename2 is never the L1 band - dma_buffer[dma_index] = input_samples[index0]; - dma_buffer[dma_index + 1] = input_samples[index0 + 1]; - dma_index += 4; - } - } - - if (nread_elements > 0) - { - if (dma_fpga->DMA_write(nread_elements * 2)) - { - std::cerr << "Error: DMA could not send all the required samples\n"; - break; - } - // Throttle the DMA - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } - - if (nbytes_remaining == 0) - { - if (repeat) - { - // read the file again - nbytes_remaining = samples * item_size; - read_buffer_size = sample_block_size * 2; - try - { - infile1.seekg(0); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception resetting the position of the next byte to be extracted to zero " << filename0_ << '\n'; - break; - } - - // skip the initial samples if needed - uint64_t bytes_to_skeep = samples_to_skip * item_size; - try - { - infile1.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; - break; - } - - if (!filename1_.empty()) - { - try - { - infile2.seekg(0); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception setting the position of the next byte to be extracted to zero " << filename1_ << '\n'; - break; - } - - try - { - infile2.ignore(bytes_to_skeep); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; - break; - } - } - } - else - { - // the input file is completely processed. Stop the receiver. - run_DMA = false; - } - } - std::unique_lock lock(dma_mutex); - if (enable_DMA_ == false) - { - run_DMA = false; - } - lock.unlock(); - } - - if (dma_fpga->DMA_close()) - { - std::cerr << "Error closing loop device " << '\n'; - } - try - { - infile1.close(); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception closing file " << filename0_ << '\n'; - } - - if (num_input_files_ > 1) - { - try - { - infile2.close(); - } - catch (const std::ifstream::failure &e) - { - std::cerr << "Exception closing file " << filename1_ << '\n'; - } - } - - // Stop the receiver - queue->push(pmt::make_any(command_event_make(200, 0))); -} - - -void Ad9361FpgaSignalSource::run_dynamic_bit_selection_process() -{ - bool dynamic_bit_selection_active = true; - - while (dynamic_bit_selection_active) - { - // setting the bit selection to the top bits - dynamic_bit_selection_fpga->bit_selection(); - std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); - std::unique_lock lock(dynamic_bit_selection_mutex); - if (enable_dynamic_bit_selection_ == false) - { - dynamic_bit_selection_active = false; - } - lock.unlock(); - } -} - - -void Ad9361FpgaSignalSource::run_buffer_monitor_process() -{ - bool enable_ovf_check_buffer_monitor_active = true; - - std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitoring_initial_delay_ms)); - - while (enable_ovf_check_buffer_monitor_active) - { - buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); - std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); - if (enable_ovf_check_buffer_monitor_active_ == false) - { - enable_ovf_check_buffer_monitor_active = false; - } - lock.unlock(); - } -} - - -void Ad9361FpgaSignalSource::connect(gr::top_block_sptr top_block) -{ - if (top_block) - { /* top_block is not null */ - }; - DLOG(INFO) << "AD9361 FPGA source nothing to connect"; -} - - -void Ad9361FpgaSignalSource::disconnect(gr::top_block_sptr top_block) -{ - if (top_block) - { /* top_block is not null */ - }; - DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; -} - - -gr::basic_block_sptr Ad9361FpgaSignalSource::get_left_block() -{ - LOG(WARNING) << "Trying to get signal source left block."; - return {}; -} - - -gr::basic_block_sptr Ad9361FpgaSignalSource::get_right_block() -{ - return {}; -} diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc new file mode 100644 index 000000000..9d29e2de2 --- /dev/null +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -0,0 +1,398 @@ +/*! + * \file adrv9361_z7035_signal_source_fpga.cc + * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * directly connected to the FPGA accelerators. + * This source implements only the AD9361 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * Please use the fmcomms2 source if conventional SDR acquisition and tracking + * is selected in the configuration file. + * \authors
      + *
    • Javier Arribas, jarribas(at)cttc.es + *
    • Marc Majoral, mmajoral(at)cttc.es + *
    + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "adrv9361_z7035_signal_source_fpga.h" +#include "GPS_L1_CA.h" +#include "GPS_L5.h" +#include "ad9361_manager.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::max +#include // for std::chrono +#include // for std::floor +#include // for std::exception +#include // for std::cout + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "ADRV9361_Z7035_Signal_Source_FPGA"s), + gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), + gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), + rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), + rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), + rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), + scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", -3.0)), + phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)), + tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)), + freq0_(configuration->property(role + ".freq", 0)), + freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), + sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), + bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), + freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))), + freq_rf_tx_hz_(configuration->property(role + ".freq_rf_tx_hz", static_cast(GPS_L1_FREQ_HZ - GPS_L5_FREQ_HZ - freq_dds_tx_hz_))), + tx_bandwidth_(configuration->property(role + ".tx_bandwidth", static_cast(500000))), + Fpass_(configuration->property(role + ".Fpass", static_cast(0.0))), + Fstop_(configuration->property(role + ".Fstop", static_cast(0.0))), + in_stream_(in_stream), + out_stream_(out_stream), + item_size_(sizeof(int8_t)), + enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)), + filter_auto_(configuration->property(role + ".filter_auto", false)), + quadrature_(configuration->property(role + ".quadrature", true)), + rf_dc_(configuration->property(role + ".rf_dc", true)), + bb_dc_(configuration->property(role + ".bb_dc", true)), + rx1_enable_(configuration->property(role + ".rx1_enable", true)), + rx2_enable_(configuration->property(role + ".rx2_enable", true)), + enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), + enable_ovf_check_buffer_monitor_active_(true), + dump_(configuration->property(role + ".dump", false)), +#if USE_GLOG_AND_GFLAGS + rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)) +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))) +#endif +{ + const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || + (configuration->property("Channels_1B.count", 0) > 0)); + const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || + (configuration->property("Channels_L5.count", 0) > 0) || + (configuration->property("Channels_5X.count", 0) > 0)); + + const uint32_t num_freq_bands = ((enable_rx1_band == true) and (enable_rx2_band == true)) ? 2 : 1; + if (freq0_ == 0) + { + // use ".freq0" + freq0_ = configuration->property(role + ".freq0", static_cast(GPS_L1_FREQ_HZ)); + } + + if (filter_auto_) + { + filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); + } + else + { + filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); + } + + switch_fpga = std::make_shared(); + switch_fpga->set_switch_position(switch_to_real_time_mode); + + std::cout << "Sample rate: " << sample_rate_ << " Sps\n"; + + // some basic checks + if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2")) + { + std::cout << "Configuration parameter rf_port_select should take one of these values:\n"; + std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2\n"; + std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_port_select=" << default_rf_port_select << '\n'; + rf_port_select_ = default_rf_port_select; + LOG(WARNING) << "Invalid configuration value for rf_port_select parameter. Set to rf_port_select=" << default_rf_port_select; + } + + if ((gain_mode_rx1_ != "manual") && (gain_mode_rx1_ != "slow_attack") && (gain_mode_rx1_ != "fast_attack") && (gain_mode_rx1_ != "hybrid")) + { + std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx1=" << default_gain_mode << '\n'; + gain_mode_rx1_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx1=" << default_gain_mode; + } + + if ((gain_mode_rx2_ != "manual") && (gain_mode_rx2_ != "slow_attack") && (gain_mode_rx2_ != "fast_attack") && (gain_mode_rx2_ != "hybrid")) + { + std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx2=" << default_gain_mode << '\n'; + gain_mode_rx2_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx2 parameter. Set to gain_mode_rx2=" << default_gain_mode; + } + + if (gain_mode_rx1_ == "manual") + { + if (rf_gain_rx1_ > 73.0 || rf_gain_rx1_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx1 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx1=" << rf_gain_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx1=" << default_manual_gain_rx1 << '\n'; + rf_gain_rx1_ = default_manual_gain_rx1; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx1 parameter. Set to rf_gain_rx1=" << default_manual_gain_rx1; + } + } + + if (gain_mode_rx2_ == "manual") + { + if (rf_gain_rx2_ > 73.0 || rf_gain_rx2_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx2 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx2=" << rf_gain_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx2=" << default_manual_gain_rx2 << '\n'; + rf_gain_rx2_ = default_manual_gain_rx2; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx2 parameter. Set to rf_gain_rx2=" << default_manual_gain_rx2; + } + } + + if ((filter_source_ != "Off") && (filter_source_ != "Auto") && (filter_source_ != "File") && (filter_source_ != "Design")) + { + std::cout << "Configuration parameter filter_source should take one of these values:\n"; + std::cout << " Off: Disable filter\n"; + std::cout << " Auto: Use auto-generated filters\n"; + std::cout << " File: User-provided filter in filter_filename parameter\n"; + std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters\n"; + std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value filter_source=Off\n"; + filter_source_ = std::string("Off"); + LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off"; + } + + if (bandwidth_ < 200000 || bandwidth_ > 56000000) + { + std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz\n"; + std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << '\n'; + bandwidth_ = default_bandwidth; + LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth; + } + + std::cout << "LO frequency : " << freq0_ << " Hz\n"; + try + { + config_ad9361_rx_local(bandwidth_, + sample_rate_, + freq0_, + freq1_, + rf_port_select_, + rx1_enable_, + rx2_enable_, + gain_mode_rx1_, + gain_mode_rx2_, + rf_gain_rx1_, + rf_gain_rx2_, + quadrature_, + rf_dc_, + bb_dc_, + filter_source_, + filter_filename_, + Fpass_, + Fstop_); + } + catch (const std::runtime_error &e) + { + std::cerr << "Exception cached when configuring the RX chain: " << e.what() << '\n'; + return; + } + // LOCAL OSCILLATOR DDS GENERATOR FOR DUAL FREQUENCY OPERATION + if (enable_dds_lo_ == true) + { + if (tx_bandwidth_ < static_cast(std::floor(static_cast(freq_dds_tx_hz_) * 1.1)) || (tx_bandwidth_ < 200000) || (tx_bandwidth_ > 1000000)) + { + std::cout << "Configuration parameter tx_bandwidth value should be between " << std::max(static_cast(freq_dds_tx_hz_) * 1.1, 200000.0) << " and 1000000 Hz\n"; + std::cout << "Error: provided value tx_bandwidth=" << tx_bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value tx_bandwidth=500000\n"; + tx_bandwidth_ = 500000; + LOG(WARNING) << "Invalid configuration value for tx_bandwidth parameter. Set to tx_bandwidth=500000"; + } + if (tx_attenuation_db_ > 0.0 || tx_attenuation_db_ < -89.75) + { + std::cout << "Configuration parameter tx_attenuation_db should take values between 0.0 and -89.95 in 0.25 dB steps\n"; + std::cout << "Error: provided value tx_attenuation_db=" << tx_attenuation_db_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value tx_attenuation_db=" << default_tx_attenuation_db << '\n'; + tx_attenuation_db_ = default_tx_attenuation_db; + LOG(WARNING) << "Invalid configuration value for tx_attenuation_db parameter. Set to tx_attenuation_db=" << default_tx_attenuation_db; + } + try + { + config_ad9361_lo_local(tx_bandwidth_, + sample_rate_, + freq_rf_tx_hz_, + tx_attenuation_db_, + freq_dds_tx_hz_, + scale_dds_dbfs_, + phase_dds_deg_); + } + catch (const std::runtime_error &e) + { + std::cerr << "Exception cached when configuring the TX carrier: " << e.what() << '\n'; + return; + } + } + + std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + + buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); + thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); + + + // dynamic bits selection + if (enable_dynamic_bit_selection_) + { + dynamic_bit_selection_fpga = std::make_shared(enable_rx1_band, enable_rx2_band); + thread_dynamic_bit_selection = std::thread([&] { run_dynamic_bit_selection_process(); }); + } + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() +{ + /* cleanup and exit */ + + if (rf_shutdown_) + { + std::cout << "* AD9361 Disabling RX streaming channels\n"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } + if (enable_dds_lo_) + { + try + { + ad9361_disable_lo_local(); + } + catch (const std::exception &e) + { + LOG(WARNING) << "Problem shutting down the AD9361 TX stream: " << e.what(); + } + } + } + + // disable buffer overflow checking and buffer monitoring + std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + lock_buffer_monitor.unlock(); + + if (thread_buffer_monitor.joinable()) + { + thread_buffer_monitor.join(); + } + + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bool bit_selection_enabled = enable_dynamic_bit_selection_; + lock_dyn_bit_sel.unlock(); + + if (bit_selection_enabled == true) + { + std::unique_lock lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + lock.unlock(); + + if (thread_dynamic_bit_selection.joinable()) + { + thread_dynamic_bit_selection.join(); + } + } +} + + +void Adrv9361z7035SignalSourceFPGA::run_dynamic_bit_selection_process() +{ + bool dynamic_bit_selection_active = true; + + while (dynamic_bit_selection_active) + { + // setting the bit selection to the top bits + dynamic_bit_selection_fpga->bit_selection(); + std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); + std::unique_lock lock(dynamic_bit_selection_mutex); + if (enable_dynamic_bit_selection_ == false) + { + dynamic_bit_selection_active = false; + } + lock.unlock(); + } +} + + +void Adrv9361z7035SignalSourceFPGA::run_buffer_monitor_process() +{ + bool enable_ovf_check_buffer_monitor_active = true; + + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitoring_initial_delay_ms)); + + while (enable_ovf_check_buffer_monitor_active) + { + buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); + std::unique_lock lock(buffer_monitor_mutex); + if (enable_ovf_check_buffer_monitor_active_ == false) + { + enable_ovf_check_buffer_monitor_active = false; + } + lock.unlock(); + } +} + + +void Adrv9361z7035SignalSourceFPGA::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void Adrv9361z7035SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr Adrv9361z7035SignalSourceFPGA::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr Adrv9361z7035SignalSourceFPGA::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h similarity index 70% rename from src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h rename to src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h index bedd25ad5..5e7e8b7e4 100644 --- a/src/algorithms/signal_source/adapters/ad9361_fpga_signal_source.h +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h @@ -1,7 +1,7 @@ /*! - * \file ad9361_fpga_signal_source.h - * \brief signal source for Analog Devices front-end AD9361 connected directly - * to FPGA accelerators. + * \file adrv9361_z7035_signal_source_fpga.h + * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. * Please use the fmcomms2 source if conventional SDR acquisition and tracking @@ -12,14 +12,14 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H -#define GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" @@ -44,16 +44,14 @@ class ConfigurationInterface; -class Ad9361FpgaSignalSource : public SignalSourceBase +class Adrv9361z7035SignalSourceFPGA : public SignalSourceBase { public: - Ad9361FpgaSignalSource(const ConfigurationInterface *configuration, + Adrv9361z7035SignalSourceFPGA(const ConfigurationInterface *configuration, const std::string &role, unsigned int in_stream, unsigned int out_stream, Concurrent_Queue *queue); - ~Ad9361FpgaSignalSource(); - - void start() override; + ~Adrv9361z7035SignalSourceFPGA(); inline size_t item_size() override { @@ -66,13 +64,9 @@ public: gr::basic_block_sptr get_right_block() override; private: - const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name - const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name - const std::string buffer_monitor_device_name = std::string("buffer_monitor"); // buffer monitor device name const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); const std::string default_rf_port_select = std::string("A_BALANCED"); const std::string default_gain_mode = std::string("slow_attack"); - const std::string empty_string; const double default_tx_attenuation_db = -10.0; const double default_manual_gain_rx1 = 64.0; const double default_manual_gain_rx2 = 64.0; @@ -86,42 +80,27 @@ private: const uint32_t buffer_monitoring_initial_delay_ms = 2000; // sample block size when running in post-processing mode const int sample_block_size = 16384; - - void run_DMA_process(const std::string &filename0, - const std::string &filename1, - uint64_t &samples_to_skip, - size_t &item_size, - int64_t &samples, - bool &repeat, - uint32_t &dma_buff_offset_pos, - Concurrent_Queue *queue); + const int32_t switch_to_real_time_mode = 2; void run_dynamic_bit_selection_process(); void run_buffer_monitor_process(); - std::thread thread_file_to_dma; std::thread thread_dynamic_bit_selection; std::thread thread_buffer_monitor; std::shared_ptr switch_fpga; std::shared_ptr dynamic_bit_selection_fpga; std::shared_ptr buffer_monitor_fpga; - std::shared_ptr dma_fpga; - std::mutex dma_mutex; std::mutex dynamic_bit_selection_mutex; std::mutex buffer_monitor_mutex; - Concurrent_Queue *queue_; - std::string gain_mode_rx1_; std::string gain_mode_rx2_; std::string rf_port_select_; std::string filter_file_; std::string filter_source_; std::string filter_filename_; - std::string filename0_; - std::string filename1_; double rf_gain_rx1_; double rf_gain_rx2_; @@ -133,19 +112,14 @@ private: uint64_t freq1_; // frequency of local oscillator for ADRV9361-B (if present) uint64_t sample_rate_; uint64_t bandwidth_; - uint64_t samples_to_skip_; - int64_t samples_; uint64_t freq_dds_tx_hz_; uint64_t freq_rf_tx_hz_; uint64_t tx_bandwidth_; float Fpass_; float Fstop_; - uint32_t num_input_files_; - uint32_t dma_buff_offset_pos_; uint32_t in_stream_; uint32_t out_stream_; - int32_t switch_position_; size_t item_size_; @@ -156,15 +130,13 @@ private: bool bb_dc_; bool rx1_enable_; bool rx2_enable_; - bool enable_DMA_; bool enable_dynamic_bit_selection_; bool enable_ovf_check_buffer_monitor_active_; bool dump_; bool rf_shutdown_; - bool repeat_; }; /** \} */ /** \} */ -#endif // GNSS_SDR_AD9361_FPGA_SIGNAL_SOURCE_H +#endif // GNSS_SDR_ADRV9361_Z7035_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc new file mode 100644 index 000000000..6d4f91b03 --- /dev/null +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.cc @@ -0,0 +1,581 @@ +/*! + * \file dma_signal_source_fpga.cc + * \brief signal source for a DMA connected directly to FPGA accelerators. + * This source implements only the DMA control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * \author Marc Majoral, mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "dma_signal_source_fpga.h" +#include "command_event.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::min +#include // for std::chrono +#include // for open, O_WRONLY +#include // for std::ifstream +#include // for std::setprecision +#include // for std::cout +#include // fr std::vector + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +DMASignalSourceFPGA::DMASignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "DMA_Signal_Source_FPGA"s), + queue_(queue), + filename0_(configuration->property(role + ".filename", empty_string)), + sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), + samples_to_skip_(0), + samples_(configuration->property(role + ".samples", static_cast(0))), + num_input_files_(1), + dma_buff_offset_pos_(0), + in_stream_(in_stream), + out_stream_(out_stream), + item_size_(sizeof(int8_t)), + enable_DMA_(false), + enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), + repeat_(configuration->property(role + ".repeat", false)) +{ + const double seconds_to_skip = configuration->property(role + ".seconds_to_skip", 0.0); + const size_t header_size = configuration->property(role + ".header_size", 0); + + const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || + (configuration->property("Channels_1B.count", 0) > 0)); + const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || + (configuration->property("Channels_L5.count", 0) > 0) || + (configuration->property("Channels_5X.count", 0) > 0)); + +#if USE_GLOG_AND_GFLAGS + // override value with commandline flag, if present + if (FLAGS_signal_source != "-") + { + filename0_ = FLAGS_signal_source; + } + if (FLAGS_s != "-") + { + filename0_ = FLAGS_s; + } +#else + if (absl::GetFlag(FLAGS_signal_source) != "-") + { + filename0_ = absl::GetFlag(FLAGS_signal_source); + } + if (absl::GetFlag(FLAGS_s) != "-") + { + filename0_ = absl::GetFlag(FLAGS_s); + } +#endif + if (filename0_.empty()) + { + num_input_files_ = 2; + filename0_ = configuration->property(role + ".filename0", empty_string); + filename1_ = configuration->property(role + ".filename1", empty_string); + } + // if only one input file is specified in the configuration file then: + // if there is at least one channel assigned to frequency band 1 then the DMA transfers the samples to the L1 frequency band channels + // otherwise the DMA transfers the samples to the L2/L5 frequency band channels + // if more than one input file are specified then the DMA transfer the samples to both the L1 and the L2/L5 frequency channels. + if (filename1_.empty()) + { + if (enable_rx1_band) + { + dma_buff_offset_pos_ = 2; + } + } + else + { + dma_buff_offset_pos_ = 2; + } + + if (seconds_to_skip > 0) + { + samples_to_skip_ = static_cast(seconds_to_skip * sample_rate_) * 2; + } + if (header_size > 0) + { + samples_to_skip_ += header_size; + } + + switch_fpga = std::make_shared(); + switch_fpga->set_switch_position(switch_to_DMA); + + enable_DMA_ = true; + + if (samples_ == 0) // read all file + { + std::ifstream file(filename0_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); + std::ifstream::pos_type size; + + if (file.is_open()) + { + size = file.tellg(); + DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); + } + else + { + std::cerr << "SignalSource: Unable to open the samples file " << filename0_.c_str() << '\n'; + return; + } + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(16); + std::cout << "Processing file " << filename0_ << ", which contains " << static_cast(size) << " [bytes]\n"; + std::cout.precision(ss); + + if (size > 0) + { + const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; + const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; + samples_ = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms + } + + if (!filename1_.empty()) + { + std::ifstream file(filename1_.c_str(), std::ios::in | std::ios::binary | std::ios::ate); + std::ifstream::pos_type size; + + if (file.is_open()) + { + size = file.tellg(); + DLOG(INFO) << "Total samples in the file= " << floor(static_cast(size) / static_cast(item_size_)); + } + else + { + std::cerr << "SignalSource: Unable to open the samples file " << filename1_.c_str() << '\n'; + return; + } + std::streamsize ss = std::cout.precision(); + std::cout << std::setprecision(16); + std::cout << "Processing file " << filename1_ << ", which contains " << static_cast(size) << " [bytes]\n"; + std::cout.precision(ss); + + int64_t samples_rx2 = 0; + if (size > 0) + { + const uint64_t bytes_to_skip = samples_to_skip_ * item_size_; + const uint64_t bytes_to_process = static_cast(size) - bytes_to_skip; + samples_rx2 = floor(static_cast(bytes_to_process) / static_cast(item_size_) - ceil(0.002 * static_cast(sample_rate_))); // process all the samples available in the file excluding at least the last 1 ms + } + samples_ = std::min(samples_, samples_rx2); + } + } + + CHECK(samples_ > 0) << "File does not contain enough samples to process."; + double signal_duration_s = (static_cast(samples_) * (1 / static_cast(sample_rate_))) / 2.0; + + DLOG(INFO) << "Total number samples to be processed= " << samples_ << " GNSS signal duration= " << signal_duration_s << " [s]"; + std::cout << "GNSS signal recorded time to be processed: " << signal_duration_s << " [s]\n"; + + if (filename1_.empty()) + { + DLOG(INFO) << "File source filename " << filename0_; + } + else + { + DLOG(INFO) << "File source filename rx1 " << filename0_; + DLOG(INFO) << "File source filename rx2 " << filename1_; + } + DLOG(INFO) << "Samples " << samples_; + DLOG(INFO) << "Sampling frequency " << sample_rate_; + DLOG(INFO) << "Item type " << std::string("ibyte"); + DLOG(INFO) << "Item size " << item_size_; + DLOG(INFO) << "Repeat " << repeat_; + // } + + // dynamic bits selection + if (enable_dynamic_bit_selection_) + { + dynamic_bit_selection_fpga = std::make_shared(enable_rx1_band, enable_rx2_band); + thread_dynamic_bit_selection = std::thread([&] { run_dynamic_bit_selection_process(); }); + } + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +DMASignalSourceFPGA::~DMASignalSourceFPGA() +{ + std::unique_lock lock_DMA(dma_mutex); + enable_DMA_ = false; // disable the DMA + lock_DMA.unlock(); + if (thread_file_to_dma.joinable()) + { + thread_file_to_dma.join(); + } + + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bool bit_selection_enabled = enable_dynamic_bit_selection_; + lock_dyn_bit_sel.unlock(); + + if (bit_selection_enabled == true) + { + std::unique_lock lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + lock.unlock(); + + if (thread_dynamic_bit_selection.joinable()) + { + thread_dynamic_bit_selection.join(); + } + } +} + + +void DMASignalSourceFPGA::start() +{ + thread_file_to_dma = std::thread([&] { run_DMA_process(filename0_, filename1_, samples_to_skip_, item_size_, samples_, repeat_, dma_buff_offset_pos_, queue_); }); +} + + +void DMASignalSourceFPGA::run_DMA_process(const std::string &filename0_, const std::string &filename1_, uint64_t &samples_to_skip, size_t &item_size, int64_t &samples, bool &repeat, uint32_t &dma_buff_offset_pos, Concurrent_Queue *queue) +{ + std::ifstream infile1; + infile1.exceptions(std::ifstream::failbit | std::ifstream::badbit); + + + // FPGA DMA control + dma_fpga = std::make_shared(); + + // open the files + try + { + infile1.open(filename0_, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception opening file " << filename0_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + + std::ifstream infile2; + if (!filename1_.empty()) + { + infile2.exceptions(std::ifstream::failbit | std::ifstream::badbit); + try + { + infile2.open(filename1_, std::ios::binary); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception opening file " << filename1_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + } + + // skip the initial samples if needed + uint64_t bytes_to_skeep = samples_to_skip * item_size; + try + { + infile1.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + + if (!filename1_.empty()) + { + try + { + infile2.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + } + + // rx signal vectors + std::vector input_samples(sample_block_size * 2); // complex samples + // pointer to DMA buffer + int8_t *dma_buffer; + int nread_elements = 0; // num bytes read from the file corresponding to frequency band 1 + bool run_DMA = true; + + // Open DMA device + if (dma_fpga->DMA_open()) + { + std::cerr << "Cannot open loop device\n"; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + dma_buffer = dma_fpga->get_buffer_address(); + + // if only one frequency band is used then clear the samples corresponding to the unused frequency band + uint32_t dma_index = 0; + if (num_input_files_ == 1) + { + // if only one file is enabled then clear the samples corresponding to the frequency band that is not used. + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + dma_buffer[dma_index + (2 - dma_buff_offset_pos)] = 0; + dma_buffer[dma_index + 1 + (2 - dma_buff_offset_pos)] = 0; + dma_index += 4; + } + } + + uint64_t nbytes_remaining = samples * item_size; + uint32_t read_buffer_size = sample_block_size * 2; // complex samples + + // run the DMA + while (run_DMA) + { + dma_index = 0; + if (nbytes_remaining < read_buffer_size) + { + read_buffer_size = nbytes_remaining; + } + nbytes_remaining = nbytes_remaining - read_buffer_size; + + // read filename 0 + try + { + infile1.read(reinterpret_cast(input_samples.data()), read_buffer_size); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << filename0_ << '\n'; + break; + } + if (infile1) + { + nread_elements = read_buffer_size; + } + else + { + // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN + nread_elements = infile1.gcount(); + } + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // dma_buff_offset_pos is 1 for the L1 band and 0 for the other bands + dma_buffer[dma_index + dma_buff_offset_pos] = input_samples[index0]; + dma_buffer[dma_index + 1 + dma_buff_offset_pos] = input_samples[index0 + 1]; + dma_index += 4; + } + + // read filename 1 (if enabled) + if (num_input_files_ > 1) + { + dma_index = 0; + try + { + infile2.read(reinterpret_cast(input_samples.data()), read_buffer_size); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception reading file " << filename1_ << '\n'; + break; + } + if (infile2) + { + nread_elements = read_buffer_size; + } + else + { + // FLAG AS ERROR !! IT SHOULD NEVER HAPPEN + nread_elements = infile2.gcount(); + } + + for (int index0 = 0; index0 < (nread_elements); index0 += 2) + { + // filename2 is never the L1 band + dma_buffer[dma_index] = input_samples[index0]; + dma_buffer[dma_index + 1] = input_samples[index0 + 1]; + dma_index += 4; + } + } + + if (nread_elements > 0) + { + if (dma_fpga->DMA_write(nread_elements * 2)) + { + std::cerr << "Error: DMA could not send all the required samples\n"; + break; + } + // Throttle the DMA + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } + + if (nbytes_remaining == 0) + { + if (repeat) + { + // read the file again + nbytes_remaining = samples * item_size; + read_buffer_size = sample_block_size * 2; + try + { + infile1.seekg(0); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception resetting the position of the next byte to be extracted to zero " << filename0_ << '\n'; + break; + } + + // skip the initial samples if needed + uint64_t bytes_to_skeep = samples_to_skip * item_size; + try + { + infile1.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename0_ << '\n'; + break; + } + + if (!filename1_.empty()) + { + try + { + infile2.seekg(0); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception setting the position of the next byte to be extracted to zero " << filename1_ << '\n'; + break; + } + + try + { + infile2.ignore(bytes_to_skeep); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception skipping initial samples file " << filename1_ << '\n'; + break; + } + } + } + else + { + // the input file is completely processed. Stop the receiver. + run_DMA = false; + } + } + std::unique_lock lock_DMA(dma_mutex); + if (enable_DMA_ == false) + { + run_DMA = false; + } + lock_DMA.unlock(); + } + + if (dma_fpga->DMA_close()) + { + std::cerr << "Error closing loop device " << '\n'; + } + try + { + infile1.close(); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception closing file " << filename0_ << '\n'; + } + + if (num_input_files_ > 1) + { + try + { + infile2.close(); + } + catch (const std::ifstream::failure &e) + { + std::cerr << "Exception closing file " << filename1_ << '\n'; + } + } + + // Stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); +} + + +void DMASignalSourceFPGA::run_dynamic_bit_selection_process() +{ + bool dynamic_bit_selection_active = true; + + while (dynamic_bit_selection_active) + { + // setting the bit selection to the top bits + dynamic_bit_selection_fpga->bit_selection(); + std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + if (enable_dynamic_bit_selection_ == false) + { + dynamic_bit_selection_active = false; + } + lock_dyn_bit_sel.unlock(); + } +} + + +void DMASignalSourceFPGA::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void DMASignalSourceFPGA::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr DMASignalSourceFPGA::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr DMASignalSourceFPGA::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/dma_signal_source_fpga.h b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.h new file mode 100644 index 000000000..efbad3b23 --- /dev/null +++ b/src/algorithms/signal_source/adapters/dma_signal_source_fpga.h @@ -0,0 +1,118 @@ +/*! + * \file dma_signal_source_fpga.h + * \brief signal source for a DMA connected directly to FPGA accelerators. + * This source implements only the DMA control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * \author Marc Majoral, mmajoral(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_DMA_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_DMA_SIGNAL_SOURCE_FPGA_H + +#include "concurrent_queue.h" +#include "fpga_dma-proxy.h" +#include "fpga_dynamic_bit_selection.h" +#include "fpga_switch.h" +#include "gnss_block_interface.h" +#include "signal_source_base.h" +#include +#include +#include +#include +#include +#include + + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + + +class ConfigurationInterface; + +class DMASignalSourceFPGA : public SignalSourceBase +{ +public: + DMASignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); + + ~DMASignalSourceFPGA(); + + void start() override; + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name + const std::string empty_string; + const uint64_t default_bandwidth = 12500000; + // perform dynamic bit selection every 500 ms by default + const uint32_t Gain_control_period_ms = 500; + // sample block size when running in post-processing mode + const int sample_block_size = 16384; + const int32_t switch_to_DMA = 0; + + void run_DMA_process(const std::string &filename0, + const std::string &filename1, + uint64_t &samples_to_skip, + size_t &item_size, + int64_t &samples, + bool &repeat, + uint32_t &dma_buff_offset_pos, + Concurrent_Queue *queue); + + void run_dynamic_bit_selection_process(); + + std::thread thread_file_to_dma; + std::thread thread_dynamic_bit_selection; + + std::shared_ptr switch_fpga; + std::shared_ptr dynamic_bit_selection_fpga; + std::shared_ptr dma_fpga; + + std::mutex dma_mutex; + std::mutex dynamic_bit_selection_mutex; + + Concurrent_Queue *queue_; + + std::string filename0_; + std::string filename1_; + + uint64_t sample_rate_; + uint64_t samples_to_skip_; + int64_t samples_; + uint32_t num_input_files_; + uint32_t dma_buff_offset_pos_; + uint32_t in_stream_; + uint32_t out_stream_; + size_t item_size_; + + bool enable_DMA_; + bool enable_dynamic_bit_selection_; + bool repeat_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_DMA_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc new file mode 100644 index 000000000..d8c5a65c0 --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc @@ -0,0 +1,347 @@ +/*! + * \file fmcomms5_signal_source_fpga.cc + * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * to the FPGA accelerators. + * This source implements only the AD9361 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * Please use the fmcomms2 source if conventional SDR acquisition and tracking + * is selected in the configuration file. + * \authors
      + *
    • Javier Arribas, jarribas(at)cttc.es + *
    • Marc Majoral, mmajoral(at)cttc.es + *
    + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "fmcomms5_signal_source_fpga.h" +#include "GPS_L1_CA.h" +#include "GPS_L5.h" +#include "ad9361_manager.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::max +#include // for std::chrono +#include // for std::floor +#include // for std::exception +#include // for std::cout + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "FMCOMMS5_Signal_Source_FPGA"s), + gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), + gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), + rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), + rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), + rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), + freq0_(configuration->property(role + ".freq0", static_cast(GPS_L1_FREQ_HZ))), + freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), + sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), + bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), + Fpass_(configuration->property(role + ".Fpass", static_cast(0.0))), + Fstop_(configuration->property(role + ".Fstop", static_cast(0.0))), + in_stream_(in_stream), + out_stream_(out_stream), + item_size_(sizeof(int8_t)), + filter_auto_(configuration->property(role + ".filter_auto", false)), + quadrature_(configuration->property(role + ".quadrature", true)), + rf_dc_(configuration->property(role + ".rf_dc", true)), + bb_dc_(configuration->property(role + ".bb_dc", true)), + rx1_enable_(configuration->property(role + ".rx1_enable", true)), + rx2_enable_(configuration->property(role + ".rx2_enable", true)), + enable_dynamic_bit_selection_(configuration->property(role + ".enable_dynamic_bit_selection", true)), + enable_ovf_check_buffer_monitor_active_(true), + dump_(configuration->property(role + ".dump", false)), +#if USE_GLOG_AND_GFLAGS + rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)) +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))) +#endif +{ + const bool enable_rx1_band((configuration->property("Channels_1C.count", 0) > 0) || + (configuration->property("Channels_1B.count", 0) > 0)); + const bool enable_rx2_band((configuration->property("Channels_L2.count", 0) > 0) || + (configuration->property("Channels_L5.count", 0) > 0) || + (configuration->property("Channels_5X.count", 0) > 0)); + + const uint32_t num_freq_bands = ((enable_rx1_band == true) and (enable_rx2_band == true)) ? 2 : 1; + + if (filter_auto_) + { + filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); + } + else + { + filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); + } + + switch_fpga = std::make_shared(); + switch_fpga->set_switch_position(switch_to_real_time_mode); + + std::cout << "Sample rate: " << sample_rate_ << " Sps\n"; + + // some basic checks + if ((rf_port_select_ != "A_BALANCED") && (rf_port_select_ != "B_BALANCED") && (rf_port_select_ != "A_N") && (rf_port_select_ != "B_N") && (rf_port_select_ != "B_P") && (rf_port_select_ != "C_N") && (rf_port_select_ != "C_P") && (rf_port_select_ != "TX_MONITOR1") && (rf_port_select_ != "TX_MONITOR2") && (rf_port_select_ != "TX_MONITOR1_2")) + { + std::cout << "Configuration parameter rf_port_select should take one of these values:\n"; + std::cout << " A_BALANCED, B_BALANCED, A_N, B_N, B_P, C_N, C_P, TX_MONITOR1, TX_MONITOR2, TX_MONITOR1_2\n"; + std::cout << "Error: provided value rf_port_select=" << rf_port_select_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_port_select=" << default_rf_port_select << '\n'; + rf_port_select_ = default_rf_port_select; + LOG(WARNING) << "Invalid configuration value for rf_port_select parameter. Set to rf_port_select=" << default_rf_port_select; + } + + if ((gain_mode_rx1_ != "manual") && (gain_mode_rx1_ != "slow_attack") && (gain_mode_rx1_ != "fast_attack") && (gain_mode_rx1_ != "hybrid")) + { + std::cout << "Configuration parameter gain_mode_rx1 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx1=" << gain_mode_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx1=" << default_gain_mode << '\n'; + gain_mode_rx1_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx1 parameter. Set to gain_mode_rx1=" << default_gain_mode; + } + + if ((gain_mode_rx2_ != "manual") && (gain_mode_rx2_ != "slow_attack") && (gain_mode_rx2_ != "fast_attack") && (gain_mode_rx2_ != "hybrid")) + { + std::cout << "Configuration parameter gain_mode_rx2 should take one of these values:\n"; + std::cout << " manual, slow_attack, fast_attack, hybrid\n"; + std::cout << "Error: provided value gain_mode_rx2=" << gain_mode_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value gain_mode_rx2=" << default_gain_mode << '\n'; + gain_mode_rx2_ = default_gain_mode; + LOG(WARNING) << "Invalid configuration value for gain_mode_rx2 parameter. Set to gain_mode_rx2=" << default_gain_mode; + } + + if (gain_mode_rx1_ == "manual") + { + if (rf_gain_rx1_ > 73.0 || rf_gain_rx1_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx1 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx1=" << rf_gain_rx1_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx1=" << default_manual_gain_rx1 << '\n'; + rf_gain_rx1_ = default_manual_gain_rx1; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx1 parameter. Set to rf_gain_rx1=" << default_manual_gain_rx1; + } + } + + if (gain_mode_rx2_ == "manual") + { + if (rf_gain_rx2_ > 73.0 || rf_gain_rx2_ < -1.0) + { + std::cout << "Configuration parameter rf_gain_rx2 should take values between -1.0 and 73 dB\n"; + std::cout << "Error: provided value rf_gain_rx2=" << rf_gain_rx2_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value rf_gain_rx2=" << default_manual_gain_rx2 << '\n'; + rf_gain_rx2_ = default_manual_gain_rx2; + LOG(WARNING) << "Invalid configuration value for rf_gain_rx2 parameter. Set to rf_gain_rx2=" << default_manual_gain_rx2; + } + } + + if ((filter_source_ != "Off") && (filter_source_ != "Auto") && (filter_source_ != "File") && (filter_source_ != "Design")) + { + std::cout << "Configuration parameter filter_source should take one of these values:\n"; + std::cout << " Off: Disable filter\n"; + std::cout << " Auto: Use auto-generated filters\n"; + std::cout << " File: User-provided filter in filter_filename parameter\n"; + std::cout << " Design: Create filter from Fpass, Fstop, sampling_frequency and bandwidth parameters\n"; + std::cout << "Error: provided value filter_source=" << filter_source_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value filter_source=Off\n"; + filter_source_ = std::string("Off"); + LOG(WARNING) << "Invalid configuration value for filter_source parameter. Set to filter_source=Off"; + } + + if (bandwidth_ < 200000 || bandwidth_ > 56000000) + { + std::cout << "Configuration parameter bandwidth should take values between 200000 and 56000000 Hz\n"; + std::cout << "Error: provided value bandwidth=" << bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value bandwidth=" << default_bandwidth << '\n'; + bandwidth_ = default_bandwidth; + LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth=" << default_bandwidth; + } + + if (enable_rx1_band) + { + std::cout << "LO 0 frequency : " << freq0_ << " Hz\n"; + } + if (enable_rx2_band) + { + std::cout << "LO 1 frequency : " << freq1_ << " Hz\n"; + } + try + { + config_ad9361_rx_local(bandwidth_, + sample_rate_, + freq0_, + freq1_, + rf_port_select_, + rx1_enable_, + rx2_enable_, + gain_mode_rx1_, + gain_mode_rx2_, + rf_gain_rx1_, + rf_gain_rx2_, + quadrature_, + rf_dc_, + bb_dc_, + filter_source_, + filter_filename_, + Fpass_, + Fstop_); + } + catch (const std::runtime_error &e) + { + std::cerr << "Exception cached when configuring the RX chain: " << e.what() << '\n'; + return; + } + + std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + + buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); + thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); + + + // dynamic bits selection + if (enable_dynamic_bit_selection_) + { + dynamic_bit_selection_fpga = std::make_shared(enable_rx1_band, enable_rx2_band); + thread_dynamic_bit_selection = std::thread([&] { run_dynamic_bit_selection_process(); }); + } + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +Fmcomms5SignalSourceFPGA::~Fmcomms5SignalSourceFPGA() +{ + /* cleanup and exit */ + + if (rf_shutdown_) + { + std::cout << "* Disabling RX streaming channels\n"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } + } + + // disable buffer overflow checking and buffer monitoring + std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + lock_buffer_monitor.unlock(); + + if (thread_buffer_monitor.joinable()) + { + thread_buffer_monitor.join(); + } + + std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bool bit_selection_enabled = enable_dynamic_bit_selection_; + lock_dyn_bit_sel.unlock(); + + if (bit_selection_enabled == true) + { + std::unique_lock lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + lock.unlock(); + + if (thread_dynamic_bit_selection.joinable()) + { + thread_dynamic_bit_selection.join(); + } + } +} + + +void Fmcomms5SignalSourceFPGA::run_dynamic_bit_selection_process() +{ + bool dynamic_bit_selection_active = true; + + while (dynamic_bit_selection_active) + { + // setting the bit selection to the top bits + dynamic_bit_selection_fpga->bit_selection(); + std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); + std::unique_lock lock(dynamic_bit_selection_mutex); + if (enable_dynamic_bit_selection_ == false) + { + dynamic_bit_selection_active = false; + } + lock.unlock(); + } +} + + +void Fmcomms5SignalSourceFPGA::run_buffer_monitor_process() +{ + bool enable_ovf_check_buffer_monitor_active = true; + + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitoring_initial_delay_ms)); + + while (enable_ovf_check_buffer_monitor_active) + { + buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); + std::unique_lock lock(buffer_monitor_mutex); + if (enable_ovf_check_buffer_monitor_active_ == false) + { + enable_ovf_check_buffer_monitor_active = false; + } + lock.unlock(); + } +} + + +void Fmcomms5SignalSourceFPGA::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void Fmcomms5SignalSourceFPGA::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr Fmcomms5SignalSourceFPGA::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr Fmcomms5SignalSourceFPGA::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h new file mode 100644 index 000000000..1bdcf4e6f --- /dev/null +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h @@ -0,0 +1,135 @@ +/*! + * \file fmcomms5_signal_source_fpga.h + * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * to the FPGA accelerators. + * This source implements only the AD9361 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * Please use the fmcomms2 source if conventional SDR acquisition and tracking + * is selected in the configuration file. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FMCOMMS5_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_FMCOMMS5_SIGNAL_SOURCE_FPGA_H + +#include "concurrent_queue.h" +#include "fpga_buffer_monitor.h" +#include "fpga_dma-proxy.h" +#include "fpga_dynamic_bit_selection.h" +#include "fpga_switch.h" +#include "gnss_block_interface.h" +#include "signal_source_base.h" +#include +#include +#include +#include +#include +#include + + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + + +class ConfigurationInterface; + +class Fmcomms5SignalSourceFPGA : public SignalSourceBase +{ +public: + Fmcomms5SignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); + + ~Fmcomms5SignalSourceFPGA(); + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); + const std::string default_rf_port_select = std::string("A_BALANCED"); + const std::string default_gain_mode = std::string("slow_attack"); + const double default_tx_attenuation_db = -10.0; + const double default_manual_gain_rx1 = 64.0; + const double default_manual_gain_rx2 = 64.0; + const uint64_t default_bandwidth = 12500000; + + // perform dynamic bit selection every 500 ms by default + const uint32_t Gain_control_period_ms = 500; + // check buffer overflow and perform buffer monitoring every 1s by default + const uint32_t buffer_monitor_period_ms = 1000; + // buffer overflow and buffer monitoring initial delay + const uint32_t buffer_monitoring_initial_delay_ms = 2000; + // sample block size when running in post-processing mode + const int sample_block_size = 16384; + const int32_t switch_to_real_time_mode = 2; + + void run_dynamic_bit_selection_process(); + void run_buffer_monitor_process(); + + std::thread thread_dynamic_bit_selection; + std::thread thread_buffer_monitor; + + std::shared_ptr switch_fpga; + std::shared_ptr dynamic_bit_selection_fpga; + std::shared_ptr buffer_monitor_fpga; + + std::mutex dynamic_bit_selection_mutex; + std::mutex buffer_monitor_mutex; + + std::string gain_mode_rx1_; + std::string gain_mode_rx2_; + std::string rf_port_select_; + std::string filter_file_; + std::string filter_source_; + std::string filter_filename_; + + double rf_gain_rx1_; + double rf_gain_rx2_; + + uint64_t freq0_; // frequency of local oscillator for ADRV9361-A + uint64_t freq1_; // frequency of local oscillator for ADRV9361-B + uint64_t sample_rate_; + uint64_t bandwidth_; + + float Fpass_; + float Fstop_; + uint32_t in_stream_; + uint32_t out_stream_; + + size_t item_size_; + + bool filter_auto_; + bool quadrature_; + bool rf_dc_; + bool bb_dc_; + bool rx1_enable_; + bool rx2_enable_; + bool enable_dynamic_bit_selection_; + bool enable_ovf_check_buffer_monitor_active_; + bool dump_; + bool rf_shutdown_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_FMCOMMS5_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc new file mode 100644 index 000000000..788b50e77 --- /dev/null +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -0,0 +1,467 @@ +/*! + * \file max2771_evkit_signal_source_fpga.cc + * \brief Signal source for the MAX2771EVKIT evaluation board connected directly + * to FPGA accelerators. + * This source implements only the MAX2771 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "max2771_evkit_signal_source_fpga.h" +#include "GPS_L1_CA.h" +#include "GPS_L2C.h" +#include "GPS_L5.h" +#include "configuration_interface.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include // for std::max +#include // for std::chrono +#include // for std::floor +#include // for std::exception +#include // for std::cout +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#include +#endif + +using namespace std::string_literals; + +MAX2771EVKITSignalSourceFPGA::MAX2771EVKITSignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, unsigned int out_stream, + Concurrent_Queue *queue __attribute__((unused))) + : SignalSourceBase(configuration, role, "MAX2771_EVKIT_Signal_Source_FPGA"s), + freq_(configuration->property(role + ".freq", static_cast(GPS_L1_FREQ_HZ))), + sample_rate_(configuration->property(role + ".sampling_frequency", default_sampling_rate)), + in_stream_(in_stream), + out_stream_(out_stream), + bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), + filter_order_(configuration->property(role + ".filter_order", default_filter_order)), + gain_in_(configuration->property(role + ".PGA_gain", default_PGA_gain_value)), + item_size_(sizeof(int8_t)), + chipen_(true), + if_filter_gain_(configuration->property(role + ".enable_IF_filter_gain", true)), + LNA_active_(configuration->property(role + ".LNA_active", false)), + enable_agc_(configuration->property(role + ".enable_AGC", true)), + enable_ovf_check_buffer_monitor_active_(true), + dump_(configuration->property(role + ".dump", false)), +#if USE_GLOG_AND_GFLAGS + rf_shutdown_(configuration->property(role + ".rf_shutdown", FLAGS_rf_shutdown)) +#else + rf_shutdown_(configuration->property(role + ".rf_shutdown", absl::GetFlag(FLAGS_rf_shutdown))) +#endif +{ + // some basic checks + if (freq_ != GPS_L1_FREQ_HZ and freq_ != GPS_L2_FREQ_HZ and freq_ != GPS_L5_FREQ_HZ) + { + std::cout << "Configuration parameter freq should take values " << GPS_L1_FREQ_HZ << ", " << GPS_L2_FREQ_HZ << ", or " << GPS_L5_FREQ_HZ << "\n"; + std::cout << "Error: provided value freq = " << freq_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value freq = " << GPS_L1_FREQ_HZ << '\n'; + LOG(WARNING) << "Invalid configuration value for freq parameter. Set to freq = " << GPS_L1_FREQ_HZ; + freq_ = GPS_L1_FREQ_HZ; + } + if (sample_rate_ != 4092000 and sample_rate_ != 8184000 and sample_rate_ != 16368000 and sample_rate_ != 32736000) + { + std::cout << "Configuration parameter sampling_frequency should take values 4092000, 8184000, 16368000, or 32736000\n"; + std::cout << "Error: provided value sampling_frequency = " << sample_rate_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value sampling_frequency = " << default_sampling_rate << '\n'; + LOG(WARNING) << "Invalid configuration value for sampling_frequency parameter. Set to sampling_frequency = " << default_sampling_rate; + sample_rate_ = default_sampling_rate; + } + if (bandwidth_ != 2500000 and bandwidth_ != 4200000 and bandwidth_ != 8700000 and bandwidth_ != 16400000 and bandwidth_ != 23400000 and bandwidth_ != 36000000) + { + std::cout << "Configuration parameter bandwidth can only take the following values: 2500000, 4200000, 8700000, 16400000, 23400000, and 36000000 Hz\n"; + std::cout << "Error: provided value bandwidth = " << bandwidth_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value bandwidth = " << default_bandwidth << '\n'; + LOG(WARNING) << "Invalid configuration value for bandwidth parameter. Set to bandwidth = " << default_bandwidth; + bandwidth_ = default_bandwidth; + } + if (filter_order_ != 3 and filter_order_ != 5) + { + std::cout << "Configuration parameter filter_order should take values 3 or 5\n"; + std::cout << "Error: provided value filter_order = " << filter_order_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value filter_order = " << default_filter_order << '\n'; + LOG(WARNING) << "Invalid configuration value for filter_order parameter. Set to filter_order = " << default_filter_order; + filter_order_ = default_filter_order; + } + if (gain_in_ > max_PGA_gain_value) + { + std::cout << "Configuration parameter PGA_gain should be up to " << max_PGA_gain_value << "\n"; + std::cout << "Error: provided value PGA_gain = " << gain_in_ << " is not among valid values\n"; + std::cout << " This parameter has been set to its default value PGA_gain = " << default_PGA_gain_value << '\n'; + LOG(WARNING) << "Invalid configuration value for PGA_gain parameter. Set to PGA_gain = " << default_PGA_gain_value; + gain_in_ = default_PGA_gain_value; + } + + std::vector register_values = setup_regs(); + + spidev_fpga = std::make_shared(); + + if (spidev_fpga->SPI_open()) + { + std::cerr << "Cannot open SPI device\n"; + // stop the receiver + queue->push(pmt::make_any(command_event_make(200, 0))); + return; + } + + if (configure(register_values)) + { + std::cerr << "Error configuring the MAX2771 device " << '\n'; + } + + if (spidev_fpga->SPI_close()) + { + std::cerr << "Error closing SPI device " << '\n'; + } + + std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + + buffer_monitor_fpga = std::make_shared(NUM_FREQ_BANDS, dump_, dump_filename); + thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); + + if (in_stream_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_stream_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + +std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) +{ + std::vector register_values = std::vector(MAX2771_NUM_REGS); + + + uint32_t LNA_mode = (LNA_active_) ? 0x0 : 0x2; + + uint32_t Filter_Bandwidth; + + switch (bandwidth_) + { + case 2500000: + Filter_Bandwidth = 0x0; + break; + case 4200000: + Filter_Bandwidth = 0x2; + break; + case 8700000: + Filter_Bandwidth = 0x1; + break; + case 16400000: + Filter_Bandwidth = 0x7; + break; + case 23400000: + Filter_Bandwidth = 0x3; + break; + case 36000000: + Filter_Bandwidth = 0x4; + break; + default: + Filter_Bandwidth = 0x0; // default bandwidth + } + + uint32_t chipen_select = (chipen_) ? 0x1 : 0x0; + uint32_t Filter_order_sel = (filter_order_ == 5) ? 0x0 : 0x1; + uint32_t IF_filter_gain_sel = (if_filter_gain_) ? 0x1 : 0x0; + + register_values[0] = // configuration 1 register + (chipen_select << 31) + + (IDLE << 30) + + (0x8 << 26) + // reserved + (0x8 << 22) + // reserved + (0x2 << 20) + // reserved + (0x1 << 18) + // reserved + (MIXPOLE << 17) + + (LNA_mode << 15) + + (MIXERMODE << 13) + + (FCEN << 6) + + (Filter_Bandwidth << 3) + + (Filter_order_sel << 2) + + (FCENX << 1) + + IF_filter_gain_sel; + + uint32_t AGC_mode = (enable_agc_) ? 0x0 : 0x2; + + register_values[1] = // configuration 2 register + (0x0 << 31) + // reserved + (0x1 << 29) + // reserved + (ANAIMON << 28) + + (IQEN << 27) + + (GAINREF << 15) + + (SPI_SDIO_CONFIG << 13) + + (AGC_mode << 11) + + (FORMAT << 9) + + (BITS << 6) + + (DRVCFG << 4) + + (0x1 << 3) + // reserved + (0x0 << 2) + // reserved + DIEID; + + register_values[2] = // configuration 3 register + (0x0 << 28) + // reserved + (gain_in_ << 22) + + (0x1 << 21) + // reserved + (HILOADEN << 20) + + (0x1 << 19) + // reserved + (0x1 << 18) + // reserved + (0x1 << 17) + // reserved + (0x1 << 16) + // reserved + (FHIPEN << 15) + + (0x0 << 14) + // reserved + (PGAIEN << 13) + + (PGAQEN << 12) + + (STRMEN << 11) + + (STRMSTART << 10) + + (STRMSTOP << 9) + + (0x7 << 6) + // reserved + (STRMBITS << 4) + + (STAMPEN << 3) + + (TIMESYNCEN << 2) + + (DATASYNCEN << 1) + + STRMRST; + + uint32_t clock_out_div_ratio; + + switch (sample_rate_) + { + case 4092000: + clock_out_div_ratio = 0x1; // XTAL frequency /4 + break; + case 8184000: + clock_out_div_ratio = 0x2; // XTAL frequency /2 + break; + case 16368000: + clock_out_div_ratio = 0x3; // XTAL frequency + break; + case 32736000: + clock_out_div_ratio = 0x0; // XTAL Frequency x2 + break; + default: + clock_out_div_ratio = 0x1; // default XTAL frequency + } + + register_values[3] = // PLL configuration register + (clock_out_div_ratio << 29) + + (LOBAND << 28) + + (0x1 << 27) + // reserved + (0x0 << 26) + // reserved + (0x0 << 25) + // reserved + (REFOUTEN << 24) + + (0x1 << 23) + // reserved + (0x0 << 21) + // reserved + (IXTAL << 19) + + (0x10 << 14) + // reserved + (0x0 << 13) + // reserved + (0x0 << 10) + // reserved + (ICP << 9) + + (0x0 << 8) + // reserved + (0x0 << 7) + // reserved + (0x0 << 4) + // reserved + (INT_PLL << 3) + + (PWRSAV << 2) + + (0x0 << 1) + // reserved + 0x0; // reserved + + uint32_t freq_sel; + switch (freq_) + { + case static_cast(GPS_L1_FREQ_HZ): + freq_sel = 0x604; + break; + case static_cast(GPS_L2_FREQ_HZ): + freq_sel = 0x4B0; + break; + case static_cast(GPS_L5_FREQ_HZ): + freq_sel = 0x47E; + break; + default: + freq_sel = 0x604; + } + + register_values[4] = // PLL integer division register + (0x0 << 28) + // reserved + (freq_sel << 13) + + (RDIV << 3) + + 0x0; // reserved + + register_values[5] = // PLL fractional division register + (0x0 << 28) + // reserved + (FDIV << 8) + + (0x7 << 4) + // reserved + (0x0 << 3) + // reserved + (0x0 << 2) + // reserved + (0x0 << 1) + // reserved + 0x0; // reserved + + register_values[6] = // DSP interface register + (0x0 << 28) + // reserved + 0x8000000; // reserved + + register_values[7] = // clock configuration 1 register + (0x0 << 29) + // reserved + (EXTADCCLK << 28) + + (REFCLK_L_CNT << 16) + + (REFCLK_M_CNT << 4) + + (FCLKIN << 3) + + (ADCCLK << 2) + + (0x1 << 1) + // reserved + MODE; + + register_values[8] = TEST_MODE_1_REG_VAL; // test mode 1 register + + register_values[9] = TEST_MODE_2_REG_VAL; // test mode 2 register + + register_values[10] = // clock configuration 2 register + (0x0 << 29) + // reserved + (0x0 << 28) + // reserved + (ADCCLK_L_CNT << 16) + + (ADCCLK_M_CNT << 4) + + (PRE_FRACDIV_SEL << 3) + + (CLKOUT_SEL << 2) + + 0x0; // reserved + + return register_values; +} + + +bool MAX2771EVKITSignalSourceFPGA::configure(std::vector register_values) +{ + // write the registers + std::cerr << "Configuring MAX2771 registers" << std::endl; + uint32_t status = 0; + for (uint32_t k = 0; k < register_values.size(); k++) + { + status = spidev_fpga->write_reg32(k, register_values[k]); + if (status) + { + std::cerr << "Error writing the MAX2771 registers" << std::endl; + break; + } + } + + // Read the registers and verify that the values are correctly written + std::vector reg_read = std::vector(register_values.size()); + + for (uint8_t n = 0; n < register_values.size(); ++n) + { + status = spidev_fpga->read_reg32(n, ®_read[n]); + if (status) + { + std::cerr << "Error reading the MAX2771 registers" << std::endl; + return status; + } + else + { + if (reg_read[n] != register_values[n]) + { + std::cerr << "Error: Failed to verify the MAX2771 registers " << std::endl; + return -1; + } + } + } + + return 0; +} + +MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() +{ + /* cleanup and exit */ + + if (rf_shutdown_) + { + chipen_ = false; + std::cout << "* MAX2771 Disabling RX streaming channels\n"; + std::vector register_values = setup_regs(); + + if (spidev_fpga->SPI_open()) + { + std::cerr << "Cannot open SPI device\n"; + return; + } + + + if (configure(register_values)) + { + std::cerr << "Error disabling the MAX2771 device " << '\n'; + } + + if (spidev_fpga->SPI_close()) + { + std::cerr << "Error closing SPI device " << '\n'; + } + } + + // disable buffer overflow checking and buffer monitoring + std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + lock_buffer_monitor.unlock(); + + if (thread_buffer_monitor.joinable()) + { + thread_buffer_monitor.join(); + } +} + + +void MAX2771EVKITSignalSourceFPGA::run_buffer_monitor_process() +{ + bool enable_ovf_check_buffer_monitor_active = true; + + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitoring_initial_delay_ms)); + + while (enable_ovf_check_buffer_monitor_active) + { + buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); + std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); + std::unique_lock lock(buffer_monitor_mutex); + if (enable_ovf_check_buffer_monitor_active_ == false) + { + enable_ovf_check_buffer_monitor_active = false; + } + lock.unlock(); + } +} + + +void MAX2771EVKITSignalSourceFPGA::connect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to connect"; +} + + +void MAX2771EVKITSignalSourceFPGA::disconnect(gr::top_block_sptr top_block) +{ + if (top_block) + { /* top_block is not null */ + }; + DLOG(INFO) << "AD9361 FPGA source nothing to disconnect"; +} + + +gr::basic_block_sptr MAX2771EVKITSignalSourceFPGA::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + return {}; +} + + +gr::basic_block_sptr MAX2771EVKITSignalSourceFPGA::get_right_block() +{ + return {}; +} diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h new file mode 100644 index 000000000..3008aa384 --- /dev/null +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h @@ -0,0 +1,164 @@ +/*! + * \file max2771_evkit_signal_source_fpga.h + * \brief Signal source for the MAX2771EVKIT evaluation board connected directly + * to FPGA accelerators. + * This source implements only the MAX2771 control. It is NOT compatible with + * conventional SDR acquisition and tracking blocks. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_MAX2771_EVKIT_SIGNAL_SOURCE_FPGA_H +#define GNSS_SDR_MAX2771_EVKIT_SIGNAL_SOURCE_FPGA_H + +#include "command_event.h" +#include "concurrent_queue.h" +#include "fpga_buffer_monitor.h" +#include "fpga_spidev.h" +#include "gnss_block_interface.h" +#include "signal_source_base.h" +#include // for pmt::pmt_t +#include // for fixed-width integer types +#include // for smart pointers +#include // for mutex +#include // for strings +#include // for threads +#include // for std::vector + + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + + +class ConfigurationInterface; + +class MAX2771EVKITSignalSourceFPGA : public SignalSourceBase +{ +public: + MAX2771EVKITSignalSourceFPGA(const ConfigurationInterface *configuration, + const std::string &role, unsigned int in_stream, + unsigned int out_stream, Concurrent_Queue *queue); + + ~MAX2771EVKITSignalSourceFPGA(); + + std::vector setup_regs(void); + + + inline size_t item_size() override + { + return item_size_; + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); + const uint64_t default_bandwidth = 2500000; + const uint32_t default_filter_order = 5; + const uint64_t default_sampling_rate = 4092000; + const uint32_t default_PGA_gain_value = 0x3A; // default PGA gain when AGC is off + // max PGA gain value + const uint32_t max_PGA_gain_value = 0x3F; + // check buffer overflow and perform buffer monitoring every 1s by default + const uint32_t buffer_monitor_period_ms = 1000; + // buffer overflow and buffer monitoring initial delay + const uint32_t buffer_monitoring_initial_delay_ms = 2000; + // MAX2771 number of configuration registers + const uint32_t MAX2771_NUM_REGS = 11; + // MAX2771 configuration register fields + const uint32_t NUM_FREQ_BANDS = 1; + const uint32_t IDLE = 0x0; // Idle mode disabled + const uint32_t MIXPOLE = 0x0; // set the passive filter pole at mixer output at 13 MHz. + const uint32_t MIXERMODE = 0x0; // L1 band enabled + const uint32_t FCEN = 0x58; // Center frequency not used when in low-pass filter mode. Set to default value. + const uint32_t FCENX = 0x0; // POlyphase filter selection set to Lowpass filter + const uint32_t ANAIMON = 0x0; // analog monitor disabled + const uint32_t IQEN = 0x1; // I and Q channels enable + const uint32_t GAINREF = 0xAA; // AGC Gain ref + const uint32_t SPI_SDIO_CONFIG = 0x0; // SPI SDIO config when tri-stated: nothing applied + const uint32_t FORMAT = 0x1; // sign and magnitude + const uint32_t BITS = 0x2; // number of bits in the ADC = 2 + const uint32_t DRVCFG = 0x0; // output driver configuration = CMOS Logic + const uint32_t DIEID = 0x0; // identifies version of IC + const uint32_t HILOADEN = 0x0; // disable output driver for high loads + const uint32_t FHIPEN = 0x1; // enable highpass coupling between filter and PGA. + const uint32_t PGAIEN = 0x1; // I-Channel PGA Enable + const uint32_t PGAQEN = 0x1; // Q-Channel PGA Enable + const uint32_t STRMEN = 0x0; // disable DSP interface for serial streaming of data + const uint32_t STRMSTART = 0x0; // the rising edge of this bit enables data streaming to the output, clock, data, sync and frame sync outputs. + const uint32_t STRMSTOP = 0x0; // the rising edge of this bit disables data streaming to the output, clock, data sync and frame sync outputs. + const uint32_t STRMBITS = 0x1; // number of bits to be streamed: I MSB, I LSB + const uint32_t STAMPEN = 0x1; // enable frame number insertion + const uint32_t TIMESYNCEN = 0x1; // enable the output of the time sync pulses at all times when streaming is enabled. + const uint32_t DATASYNCEN = 0x0; // disable the sync pulses at the DATASYNC output + const uint32_t STRMRST = 0x0; // counter reset not active + const uint32_t LOBAND = 0x0; // L1 band + const uint32_t REFOUTEN = 0x1; // Output clock buffer enable + const uint32_t IXTAL = 0x1; // XTAL osscillator/buffer set to normal current + const uint32_t ICP = 0x0; // charge pump current selection set to 0.5 mA + const uint32_t INT_PLL = 0x1; // PLL mode set to integer-N PLL + const uint32_t PWRSAV = 0x0; // PLL power save mode disabled + const uint32_t RDIV = 0x10; // Set the PLL reference division ratio such that the L1 band is tuned to 1575.42 Mhz + const uint32_t FDIV = 0x80000; // PLL fractional division ratio not used. Set to default value + const uint32_t EXTADCCLK = 0x0; // use internally generated clock + const uint32_t REFCLK_L_CNT = 0x100; // set the L counter of the reference clock configuration to its default value + const uint32_t REFCLK_M_CNT = 0x61B; // set the M counter of the reference clock configuration to its default value + const uint32_t FCLKIN = 0x0; // fractional clock divider set to default value + const uint32_t ADCCLK = 0x0; // ADC clock selection set to reference clock divider/multiplier + const uint32_t MODE = 0x0; // DSP interface mode selection + const uint32_t ADCCLK_L_CNT = 0x100; // set the L counter of the ADC clock configuration to its default value + const uint32_t ADCCLK_M_CNT = 0x61B; // set the M counter of the ADC clock configuration to its default value + const uint32_t PRE_FRACDIV_SEL = 0x0; // bypass fractional clock divider + const uint32_t CLKOUT_SEL = 0x1; // CLKOUT selection set to ADC clock + // MAX2771 configuration register registers + const uint32_t TEST_MODE_1_REG_VAL = 0x01E0F401; // reserved + const uint32_t TEST_MODE_2_REG_VAL = 0x00000002; + + bool configure(std::vector register_values); + void run_buffer_monitor_process(); + + + std::thread thread_buffer_monitor; + + std::shared_ptr buffer_monitor_fpga; + std::shared_ptr spidev_fpga; + + std::mutex buffer_monitor_mutex; + + uint64_t freq_; // frequency of local oscillator + uint64_t sample_rate_; + + uint32_t in_stream_; + uint32_t out_stream_; + uint32_t bandwidth_; // 2500000, 4200000, 8700000, 16400000, 23400000, 36000000 + uint32_t filter_order_; // 3, 5 + uint32_t gain_in_; // 0 to 0x3F + + size_t item_size_; // 1 + + bool chipen_; // chip enable + bool if_filter_gain_; // true, false + bool LNA_active_; // true, false + bool enable_agc_; // true, false + bool enable_ovf_check_buffer_monitor_active_; + bool dump_; + bool rf_shutdown_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_MAX2771_EVKIT_SIGNAL_SOURCE_FPGA_H diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 2b0eb6a86..3506dc4f7 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -12,17 +12,27 @@ if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.h) endif() -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_MAX2771) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.h) +endif() + +if(ENABLE_FPGA) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_switch.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_switch.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dynamic_bit_selection.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dynamic_bit_selection.h) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) +endif() + +if(ENABLE_DMA_PROXY) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_dma-proxy.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_dma-proxy.h) endif() +if((ENABLE_FPGA AND ENABLE_AD9361) OR ENABLE_MAX2771) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_buffer_monitor.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) +endif() if(ENABLE_PLUTOSDR) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.cc) diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc index 0b250d131..1f56afbf4 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.cc @@ -25,6 +25,7 @@ #include "fpga_buffer_monitor.h" #include "gnss_sdr_create_directory.h" #include "gnss_sdr_filesystem.h" +#include "uio_fpga.h" #include // for time, localtime #include // for open, O_RDWR, O_SYNC #include // for string, ofstream @@ -40,7 +41,7 @@ #endif -Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, +Fpga_buffer_monitor::Fpga_buffer_monitor( uint32_t num_freq_bands, bool dump, std::string dump_filename) @@ -50,10 +51,19 @@ Fpga_buffer_monitor::Fpga_buffer_monitor(const std::string &device_name, d_max_buff_occ_freq_band_1(0), d_dump(dump) { - // open device descriptor - if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) + std::string device_io_name; + + // find the uio device file corresponding to the buffer monitor + if (find_uio_dev_file_name(device_io_name, BUFFER_MONITOR_DEVICE_NAME, 0) < 0) { - LOG(WARNING) << "Cannot open deviceio" << device_name; + std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << BUFFER_MONITOR_DEVICE_NAME << '\n'; + return; + } + + // open device descriptor + if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1) + { + LOG(WARNING) << "Cannot open deviceio" << device_io_name; } // device memory map diff --git a/src/algorithms/signal_source/libs/fpga_buffer_monitor.h b/src/algorithms/signal_source/libs/fpga_buffer_monitor.h index 00b413e30..7231c5ae3 100644 --- a/src/algorithms/signal_source/libs/fpga_buffer_monitor.h +++ b/src/algorithms/signal_source/libs/fpga_buffer_monitor.h @@ -45,10 +45,13 @@ public: /*! * \brief Constructor */ - explicit Fpga_buffer_monitor(const std::string& device_name, - uint32_t num_freq_bands, + explicit Fpga_buffer_monitor(uint32_t num_freq_bands, bool dump, std::string dump_filename); + // explicit Fpga_buffer_monitor(const std::string& device_name, + // uint32_t num_freq_bands, + // bool dump, + // std::string dump_filename); /*! * \brief Destructor @@ -61,6 +64,7 @@ public: void check_buffer_overflow_and_monitor_buffer_status(); private: + const std::string BUFFER_MONITOR_DEVICE_NAME = std::string("buffer_monitor"); // buffer monitor device name static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t test_register_writeval = 0x55AA; static const uint32_t num_sapmples_per_buffer_element = 2; diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h index 3f4b73a5a..53729b265 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.h @@ -56,7 +56,6 @@ public: void bit_selection(void); private: - const std::string switch_device_name = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name const std::string dyn_bit_sel_device_name = std::string("dynamic_bits_selector"); // Switch dhnamic bit selector device name static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t Num_bits_ADC = 12; // Number of bits in the ADC diff --git a/src/algorithms/signal_source/libs/fpga_spidev.cc b/src/algorithms/signal_source/libs/fpga_spidev.cc new file mode 100644 index 000000000..f90cf4ac9 --- /dev/null +++ b/src/algorithms/signal_source/libs/fpga_spidev.cc @@ -0,0 +1,131 @@ +/*! + * \file fpga_spidev.cc + * \brief FPGA SPI control. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "fpga_spidev.h" +#include // for memset() +#include // for open(), O_RDWR +#include // for std::cerr +#include // spidev driver +#include // for ioctl() +#include // for close() + + +int Fpga_spidev::SPI_open() +{ + if ((d_fd = open(SPI_DEVICE_NAME.c_str(), O_RDWR)) < 0) + { + std::cerr << "Failed to open the " << SPI_DEVICE_NAME << " device file \n"; + return -1; + } + + int ret; + int32_t mode = 0; + + ret = ioctl(d_fd, SPI_IOC_WR_MODE32, &mode); + if (ret == -1) + { + std::cerr << "can't set spi mode\n"; + return -1; + } + + ret = ioctl(d_fd, SPI_IOC_RD_MODE32, &mode); // le digo al spi "algo" + if (ret == -1) + { + std::cerr << "can't set spi mode\n"; + return -1; + } + + return 0; +} + +int Fpga_spidev::write_reg32(char addr, uint32_t data) +{ + uint8_t data_buffer[2]; + uint8_t recv_buffer[4]; + int res = 0; + struct spi_ioc_transfer xfer[2]; + memset(xfer, 0, sizeof(xfer)); + xfer[0].bits_per_word = 8; + xfer[0].speed_hz = SPI_SPEED; + xfer[1].bits_per_word = 8; + xfer[1].speed_hz = SPI_SPEED; + + memset(&recv_buffer, 0, sizeof(recv_buffer)); + memset(&data_buffer, 0, sizeof(data_buffer)); + + data_buffer[1] = addr << 4 | 0 << 3; + xfer[0].tx_buf = (unsigned long)data_buffer; + xfer[0].len = 2; + + // Would use memcpy but 'data' is in little endian + ((char*)recv_buffer)[0] = ((char*)&data)[3]; + ((char*)recv_buffer)[1] = ((char*)&data)[2]; + ((char*)recv_buffer)[2] = ((char*)&data)[1]; + ((char*)recv_buffer)[3] = ((char*)&data)[0]; + + xfer[1].tx_buf = (unsigned long)recv_buffer; + xfer[1].len = 4; + res = ioctl(d_fd, SPI_IOC_MESSAGE(2), xfer); + if (res < 0) + { + std::cout << "Error sending SPI message\n"; + return res; + } + return 0; +} + +int Fpga_spidev::read_reg32(uint8_t addr, uint32_t* copy_to) +{ + uint8_t data_buffer[2]; + uint8_t recv_buffer[4]; + int res; + struct spi_ioc_transfer xfer[2]; + memset(xfer, 0, sizeof(xfer)); + xfer[0].bits_per_word = 8; + xfer[0].speed_hz = SPI_SPEED; + xfer[1].bits_per_word = 8; + xfer[1].speed_hz = SPI_SPEED; + + memset(&recv_buffer, 0, sizeof(recv_buffer)); + memset(&data_buffer, 0, sizeof(data_buffer)); + + data_buffer[1] = addr << 4 | 1 << 3; + xfer[0].tx_buf = (unsigned long)data_buffer; + xfer[0].len = 2; + + xfer[1].rx_buf = (unsigned long)recv_buffer; + xfer[1].len = 4; + res = ioctl(d_fd, SPI_IOC_MESSAGE(2), xfer); + if (res < 0) + { + std::cout << "Error sending SPI message\n"; + return res; + } + + // the register data is received in the reverse order + uint32_t tmp_result = 0; + for (uint32_t k = 0; k < 4; ++k) + { + tmp_result = tmp_result + ((recv_buffer[3 - k]) << 8 * k); + } + *copy_to = tmp_result; + + return 0; +} + +int Fpga_spidev::SPI_close() const +{ + return close(d_fd); +} diff --git a/src/algorithms/signal_source/libs/fpga_spidev.h b/src/algorithms/signal_source/libs/fpga_spidev.h new file mode 100644 index 000000000..5fbe2f41c --- /dev/null +++ b/src/algorithms/signal_source/libs/fpga_spidev.h @@ -0,0 +1,61 @@ +/*! + * \file fpga_spidev.h + * \brief FPGA SPI control. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_FPGA_SPIDEV_H +#define GNSS_SDR_FPGA_SPIDEV_H + +#include + +class Fpga_spidev +{ +public: + /*! + * \brief Default constructor. + */ + Fpga_spidev() = default; + + /*! + * \brief Default destructor. + */ + ~Fpga_spidev() = default; + + /*! + * \brief write a register through the SPI. + */ + int write_reg32(char addr, uint32_t data); + + /*! + * \brief read a register through the SPI. + */ + int read_reg32(uint8_t addr, uint32_t* copy_to); + /*! + * \brief Open the SPI device driver. + */ + int SPI_open(void); + + /*! + * \brief Close the SPI device driver + */ + int SPI_close(void) const; + +private: + static const uint32_t SPI_SPEED = 250000; + const std::string SPI_DEVICE_NAME = std::string("/dev/spidev2.0"); // Switch UIO device name + + int d_fd; +}; + + +#endif // GNSS_SDR_FPGA_SPIDEV_H diff --git a/src/algorithms/signal_source/libs/fpga_switch.cc b/src/algorithms/signal_source/libs/fpga_switch.cc index f2d51c2fb..2730bdf36 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.cc +++ b/src/algorithms/signal_source/libs/fpga_switch.cc @@ -21,6 +21,7 @@ */ #include "fpga_switch.h" +#include "uio_fpga.h" #include // for open, O_RDWR, O_SYNC #include // for cout #include // for mmap @@ -32,11 +33,19 @@ #include #endif -Fpga_Switch::Fpga_Switch(const std::string &device_name) +Fpga_Switch::Fpga_Switch(void) { - if ((d_device_descriptor = open(device_name.c_str(), O_RDWR | O_SYNC)) == -1) + std::string device_io_name; // Switch UIO device file + // find the uio device file corresponding to the switch. + if (find_uio_dev_file_name(device_io_name, SWITCH_DEVICE_NAME, 0) < 0) { - LOG(WARNING) << "Cannot open deviceio" << device_name; + std::cerr << "Cannot find the FPGA uio device file corresponding to device name " << SWITCH_DEVICE_NAME << '\n'; + return; + } + + if ((d_device_descriptor = open(device_io_name.c_str(), O_RDWR | O_SYNC)) == -1) + { + LOG(WARNING) << "Cannot open deviceio" << device_io_name; } d_map_base = reinterpret_cast(mmap(nullptr, FPGA_PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, d_device_descriptor, 0)); diff --git a/src/algorithms/signal_source/libs/fpga_switch.h b/src/algorithms/signal_source/libs/fpga_switch.h index b4a73cb4f..8a46c214d 100644 --- a/src/algorithms/signal_source/libs/fpga_switch.h +++ b/src/algorithms/signal_source/libs/fpga_switch.h @@ -42,8 +42,7 @@ public: /*! * \brief Constructor */ - explicit Fpga_Switch(const std::string& device_name); - + Fpga_Switch(void); /*! * \brief Destructor */ @@ -55,6 +54,7 @@ public: void set_switch_position(int32_t switch_position); private: + const std::string SWITCH_DEVICE_NAME = std::string("AXIS_Switch_v1_0_0"); // Switch UIO device name static const size_t FPGA_PAGE_SIZE = 0x1000; static const uint32_t TEST_REGISTER_TRACK_WRITEVAL = 0x55AA; static const uint32_t MAX_LENGTH_DEVICEIO_NAME = 50; diff --git a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h index 722440f32..8de75e087 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e1_dll_pll_veml_tracking_fpga.h @@ -65,11 +65,11 @@ public: } /*! - * \brief Returns "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga" + * \brief Returns "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA" */ inline std::string implementation() override { - return "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga"; + return "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h index 510df45ea..1b3c8f52b 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.h @@ -59,11 +59,11 @@ public: } /*! - * \brief Returns "Galileo_E5a_DLL_PLL_Tracking_Fpga" + * \brief Returns "Galileo_E5a_DLL_PLL_Tracking_FPGA" */ inline std::string implementation() override { - return "Galileo_E5a_DLL_PLL_Tracking_Fpga"; + return "Galileo_E5a_DLL_PLL_Tracking_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h index dedefd7c5..ed3b23f4a 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l1_ca_dll_pll_tracking_fpga.h @@ -64,11 +64,11 @@ public: } /*! - * \brief Returns "GPS_L1_CA_DLL_PLL_Tracking_Fpga" + * \brief Returns "GPS_L1_CA_DLL_PLL_Tracking_FPGA" */ inline std::string implementation() override { - return "GPS_L1_CA_DLL_PLL_Tracking_Fpga"; + return "GPS_L1_CA_DLL_PLL_Tracking_FPGA"; } /*! diff --git a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h index 506e8fec6..a89dd5d55 100644 --- a/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l2_m_dll_pll_tracking_fpga.h @@ -57,10 +57,10 @@ public: return role_; } - //! Returns "GPS_L2_M_DLL_PLL_Tracking_Fpga" + //! Returns "GPS_L2_M_DLL_PLL_Tracking_FPGA" inline std::string implementation() override { - return "GPS_L2_M_DLL_PLL_Tracking_Fpga"; + return "GPS_L2_M_DLL_PLL_Tracking_FPGA"; } inline size_t item_size() override diff --git a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h index 24fc37a14..ed85735b2 100644 --- a/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h +++ b/src/algorithms/tracking/adapters/gps_l5_dll_pll_tracking_fpga.h @@ -65,11 +65,11 @@ public: } /*! - * \brief Returns "GPS_L5_DLL_PLL_Tracking_Fpga" + * \brief Returns "GPS_L5_DLL_PLL_Tracking_FPGA" */ inline std::string implementation() override { - return "GPS_L5_DLL_PLL_Tracking_Fpga"; + return "GPS_L5_DLL_PLL_Tracking_FPGA"; } /*! diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 556f3fddf..9e07f998c 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -2026,7 +2026,7 @@ void osnma_msg_receiver::send_data_to_pvt(const std::vector& data { if (!data.empty()) { - for (auto& i : data) + for (const auto& i : data) { const auto tmp_obj = std::make_shared(i); this->message_port_pub(pmt::mp("OSNMA_to_PVT"), pmt::make_any(tmp_obj)); diff --git a/src/core/libs/osnma_msg_receiver.h b/src/core/libs/osnma_msg_receiver.h index 1598e23c2..4240d7df8 100644 --- a/src/core/libs/osnma_msg_receiver.h +++ b/src/core/libs/osnma_msg_receiver.h @@ -61,11 +61,11 @@ osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, class osnma_msg_receiver : public gr::block { public: - ~osnma_msg_receiver() = default; //!< Default destructor - void msg_handler_osnma(const pmt::pmt_t& msg); //!< For testing purposes - void read_merkle_xml(const std::string& merklepath); //!< Public for testing purposes - bool verify_dsm_pkr(const DSM_PKR_message& message) const; //!< Public for benchmarking purposes - void set_merkle_root(const std::vector& v); //!< Public for benchmarking purposes + ~osnma_msg_receiver() = default; //!< Default destructor + bool verify_dsm_pkr(const DSM_PKR_message& message) const; //!< Public for benchmarking purposes + void msg_handler_osnma(const pmt::pmt_t& msg); //!< For testing purposes + void read_merkle_xml(const std::string& merklepath); //!< Public for testing purposes + void set_merkle_root(const std::vector& v); //!< Public for benchmarking purposes private: friend osnma_msg_receiver_sptr osnma_msg_receiver_make(const std::string& pemFilePath, const std::string& merkleFilePath, bool strict_mode); diff --git a/src/core/libs/osnma_nav_data_manager.cc b/src/core/libs/osnma_nav_data_manager.cc index 03d5a4442..73392db5b 100644 --- a/src/core/libs/osnma_nav_data_manager.cc +++ b/src/core/libs/osnma_nav_data_manager.cc @@ -135,11 +135,11 @@ std::string OSNMA_NavDataManager::get_navigation_data(const Tag& tag) const { if (tag.ADKD == 0 || tag.ADKD == 12) { - return std::string(549, '0'); + return {std::string(549, '0')}; } else if (tag.ADKD == 4) { - return std::string(141, '0'); + return {std::string(141, '0')}; } } auto prn_it = d_satellite_nav_data.find(tag.PRN_d); @@ -168,8 +168,9 @@ std::string OSNMA_NavDataManager::get_navigation_data(const Tag& tag) const } else { - for (auto rev_it = prn_it->second.rbegin(); rev_it != prn_it->second.rend(); ++rev_it) // note: starts with largest (i.e. newest) navigation dataset + for (auto rev_it = prn_it->second.rbegin(); rev_it != prn_it->second.rend(); ++rev_it) // NOLINT(modernize-loop-convert) { + // note: starts with largest (i.e. newest) navigation dataset // Check if current key (TOW) fulfills condition if ((tag.TOW - 30 * tag.cop <= rev_it->first || tag.TOW - 30 * tag.cop <= rev_it->second.get_last_received_TOW()) && rev_it->first < tag.TOW) { @@ -269,8 +270,9 @@ bool OSNMA_NavDataManager::have_nav_data(const Tag& t) const { // iterate in reverse order to find matching TOW with Tag's COP value std::map tow_map = prn_it->second; - for (auto rev_it = tow_map.rbegin(); rev_it != tow_map.rend(); ++rev_it) // note: starts with largest (i.e. newest) navigation dataset + for (auto rev_it = tow_map.rbegin(); rev_it != tow_map.rend(); ++rev_it) // NOLINT(modernize-loop-convert) { + // note: starts with largest (i.e. newest) navigation dataset // Check if current key (TOW) fulfills cut-off point and is not received after the tag if ((t.TOW - 30 * t.cop <= rev_it->first || t.TOW - 30 * t.cop <= rev_it->second.get_last_received_TOW()) && rev_it->first < t.TOW) { diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 0dfc09a84..cacef7f6f 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -98,6 +98,14 @@ if(ENABLE_AD9361) target_compile_definitions(core_receiver PRIVATE -DAD9361_DRIVER=1) endif() +if(ENABLE_MAX2771) + target_compile_definitions(core_receiver PRIVATE -DMAX2771_DRIVER=1) +endif() + +if(ENABLE_DMA_PROXY) + target_compile_definitions(core_receiver PRIVATE -DDMA_PROXY_DRIVER=1) +endif() + if(ENABLE_OSMOSDR) if(GROSMOSDR_FOUND) target_compile_definitions(core_receiver PRIVATE -DOSMOSDR_DRIVER=1) diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index dda8452a8..ce77442ee 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -167,8 +167,17 @@ #include "fmcomms2_signal_source.h" #endif -#if AD9361_DRIVER -#include "ad9361_fpga_signal_source.h" +#if ENABLE_FPGA and AD9361_DRIVER +#include "adrv9361_z7035_signal_source_fpga.h" +#include "fmcomms5_signal_source_fpga.h" +#endif + +#if MAX2771_DRIVER +#include "max2771_evkit_signal_source_fpga.h" +#endif + +#if DMA_PROXY_DRIVER +#include "dma_signal_source_fpga.h" #endif #if LIMESDR_DRIVER @@ -812,12 +821,34 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif -#if AD9361_DRIVER - // The AD9361_DRIVER Driver must be instantiated last. In this way, when using the FPGA, and when using the GNSS receiver - // in post-processing mode, the receiver is configured and ready when the DMA starts sending samples to the receiver. - else if (implementation == "Ad9361_Fpga_Signal_Source") +#if ENABLE_FPGA and AD9361_DRIVER + else if (implementation == "ADRV9361_Z7035_Signal_Source_FPGA") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } + else if (implementation == "FMCOMMS5_Signal_Source_FPGA") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } +#endif + +#if ENABLE_FPGA and MAX2771_DRIVER + else if (implementation == "MAX2771_EVKIT_Signal_Source_FPGA") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } +#endif + +#if ENABLE_FPGA and DMA_PROXY_DRIVER + else if (implementation == "DMA_Signal_Source_FPGA") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } @@ -1054,31 +1085,31 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L1_CA_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga") + else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L2_M_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L5i_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L5i_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_Pcps_Acquisition_Fpga") + else if (implementation == "Galileo_E5a_Pcps_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); @@ -1204,31 +1235,31 @@ std::unique_ptr GNSSBlockFactory::GetBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_Fpga") or (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga")) + else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_FPGA") or (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA")) { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); @@ -1492,31 +1523,31 @@ std::unique_ptr GNSSBlockFactory::GetAcqBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L1_CA_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga") + else if (implementation == "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L2_M_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L5i_PCPS_Acquisition_Fpga") + else if (implementation == "GPS_L5i_PCPS_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_Pcps_Acquisition_Fpga") + else if (implementation == "Galileo_E5a_Pcps_Acquisition_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); @@ -1660,31 +1691,31 @@ std::unique_ptr GNSSBlockFactory::GetTrkBlock( } #endif #if ENABLE_FPGA - else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L2_M_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_Fpga") or (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga")) + else if ((implementation == "GPS_L5i_DLL_PLL_Tracking_FPGA") or (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA")) { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); block = std::move(block_); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 0d1606924..593c9912c 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -582,7 +582,7 @@ int GNSSFlowgraph::connect_fpga_flowgraph() if (src == nullptr) { help_hint_ += " * Check implementation name for SignalSource block.\n"; - help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Fpga_Signal_Source\n"; + help_hint_ += " Signal Source block implementation for FPGA off-loading should be Ad9361_Signal_Source_Fpga or Fpga_DMA_2Signal_Source\n"; return 1; } if (src->item_size() == 0) diff --git a/src/tests/benchmarks/benchmark_osnma.cc b/src/tests/benchmarks/benchmark_osnma.cc index 727c11e70..b99c3efd0 100644 --- a/src/tests/benchmarks/benchmark_osnma.cc +++ b/src/tests/benchmarks/benchmark_osnma.cc @@ -1,23 +1,24 @@ /*! -* \file benchmark_osnma.cc -* \brief Benchmarks for osnma functions -* \author Carles Fernandez-Prades, 2024. cfernandez(at)cttc.es -* -* -* ----------------------------------------------------------------------------- -* -* GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -* This file is part of GNSS-SDR. -* -* Copyright (C) 2024 (see AUTHORS file for a list of contributors) -* SPDX-License-Identifier: GPL-3.0-or-later -* -* ----------------------------------------------------------------------------- -*/ -#include "osnma_msg_receiver.h" + * \file benchmark_osnma.cc + * \brief Benchmarks for osnma functions + * \author Carles Fernandez-Prades, 2024. cfernandez(at)cttc.es + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + #include "Galileo_OSNMA.h" #include "gnss_crypto.h" #include "osnma_helper.h" +#include "osnma_msg_receiver.h" #include #include diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc index 816dbfe1a..4d68363f8 100644 --- a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc @@ -67,7 +67,7 @@ class GalileoE1PcpsAmbiguousAcquisitionTestFpga : public ::testing::Test { public: bool acquire_signal(); - std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_Fpga"; + std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_FPGA"; std::vector gnss_synchro_vec; const int32_t TEST_ACQ_SKIP_SAMPLES = 1024; @@ -321,7 +321,7 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal() // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal @@ -397,7 +397,7 @@ bool GalileoE1PcpsAmbiguousAcquisitionTestFpga::acquire_signal() void GalileoE1PcpsAmbiguousAcquisitionTestFpga::init() { config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition_Fpga"); + config->set_property("Acquisition.implementation", "Galileo_E1_PCPS_Ambiguous_Acquisition_FPGA"); config->set_property("Acquisition.threshold", "0.00001"); config->set_property("Acquisition.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition.doppler_step", std::to_string(doppler_step)); 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 ee06f57ce..47ddc54aa 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 @@ -66,7 +66,7 @@ class GpsL1CaPcpsAcquisitionTestFpga : public ::testing::Test { public: bool acquire_signal(); - std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_Fpga"; + std::string implementation = "GPS_L1_CA_DLL_PLL_Tracking_FPGA"; std::vector gnss_synchro_vec; const int32_t TEST_ACQ_SKIP_SAMPLES = 1024; @@ -320,7 +320,7 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal() // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal @@ -396,7 +396,7 @@ bool GpsL1CaPcpsAcquisitionTestFpga::acquire_signal() void GpsL1CaPcpsAcquisitionTestFpga::init() { config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition_Fpga"); + config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition_FPGA"); config->set_property("Acquisition.threshold", "0.00001"); config->set_property("Acquisition.doppler_max", std::to_string(doppler_max)); config->set_property("Acquisition.doppler_step", std::to_string(doppler_step)); 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 9824e1d17..c466a277b 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 @@ -638,11 +638,11 @@ bool HybridObservablesTestFpga::acquire_signal() // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "1C"; @@ -654,7 +654,7 @@ bool HybridObservablesTestFpga::acquire_signal() args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "1B"; @@ -666,7 +666,7 @@ bool HybridObservablesTestFpga::acquire_signal() args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "5X"; @@ -678,7 +678,7 @@ bool HybridObservablesTestFpga::acquire_signal() args.freq_band = 1; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "L5"; @@ -732,19 +732,19 @@ bool HybridObservablesTestFpga::acquire_signal() // number of samples that the DMA has to transfer unsigned int nsamples_to_transfer; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); } - else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)) + else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_FPGA") == 0)) { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS))); } @@ -762,7 +762,7 @@ bool HybridObservablesTestFpga::acquire_signal() acquisition->init(); acquisition->set_local_code(); - if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga")) + if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA")) { // Skip the first TEST_OBS_SKIP_SAMPLES samples args.skip_used_samples = 0; @@ -910,7 +910,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); std::string System_and_Signal; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { gnss_synchro_master.System = 'G'; std::string signal = "1C"; @@ -923,7 +923,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { gnss_synchro_master.System = 'E'; std::string signal = "1B"; @@ -939,7 +939,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("TelemetryDecoder.implementation", "Galileo_E1B_Telemetry_Decoder"); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") // or implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") // or implementation.compare("Galileo_E5a_DLL_PLL_Tracking_b") == 0) { gnss_synchro_master.System = 'E'; std::string signal = "5X"; @@ -953,7 +953,7 @@ void HybridObservablesTestFpga::configure_receiver( config->set_property("TelemetryDecoder.implementation", "Galileo_E5a_Telemetry_Decoder"); } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { gnss_synchro_master.System = 'G'; std::string signal = "L5"; @@ -2031,22 +2031,22 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults) args.scaling_factor = DMA_SIGNAL_SCALING_FACTOR; // reset the HW to clear the sample counters: the acquisition constructor generates a reset - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index 4bd43fc30..d5f2348af 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -355,7 +355,7 @@ void GpsL1CADllPllTrackingTestFpga::configure_receiver() std::to_string(baseband_sampling_freq)); // Set Tracking config->set_property("Tracking_1C.implementation", - "GPS_L1_CA_DLL_PLL_Tracking_Fpga"); + "GPS_L1_CA_DLL_PLL_Tracking_FPGA"); config->set_property("Tracking_1C.item_type", "cshort"); config->set_property("Tracking_1C.dump", "true"); config->set_property("Tracking_1C.dump_filename", "./tracking_ch_"); diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index 39f87bdfa..a2f27204e 100644 --- a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -536,7 +536,7 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(baseband_sampling_freq)); std::string System_and_Signal; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { gnss_synchro.System = 'G'; std::string signal = "1C"; @@ -545,7 +545,7 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("Tracking.early_late_space_chips", "0.5"); config->set_property("Tracking.early_late_space_narrow_chips", "0.5"); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { gnss_synchro.System = 'E'; std::string signal = "1B"; @@ -557,7 +557,7 @@ void TrackingPullInTestFpga::configure_receiver( config->set_property("Tracking.very_early_late_space_narrow_chips", "0.6"); config->set_property("Tracking.track_pilot", "true"); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga" or implementation == "Galileo_E5a_DLL_PLL_Tracking_b_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA" or implementation == "Galileo_E5a_DLL_PLL_Tracking_b_Fpga") { gnss_synchro.System = 'E'; std::string signal = "5X"; @@ -565,13 +565,13 @@ void TrackingPullInTestFpga::configure_receiver( signal.copy(gnss_synchro.Signal, 2, 0); if (implementation == "Galileo_E5a_DLL_PLL_Tracking_b") { - config->supersede_property("Tracking.implementation", std::string("Galileo_E5a_DLL_PLL_Tracking_Fpga")); + config->supersede_property("Tracking.implementation", std::string("Galileo_E5a_DLL_PLL_Tracking_FPGA")); } config->set_property("Tracking.early_late_space_chips", "0.5"); config->set_property("Tracking.track_pilot", "true"); config->set_property("Tracking.order", "2"); } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { gnss_synchro.System = 'G'; std::string signal = "L5"; @@ -634,11 +634,11 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) // instantiate the FPGA switch and set the // switch position to DMA. std::shared_ptr switch_fpga; - switch_fpga = std::make_shared("/dev/uio1"); + switch_fpga = std::make_shared(); switch_fpga->set_switch_position(0); // set switch position to DMA // create the correspondign acquisition block according to the desired tracking signal - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "1C"; @@ -650,7 +650,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "1B"; @@ -662,7 +662,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) args.freq_band = 0; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'E'; signal = "5X"; @@ -674,7 +674,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) args.freq_band = 1; // frequency band on which the DMA has to transfer the samples } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { tmp_gnss_synchro.System = 'G'; signal = "L5"; @@ -732,19 +732,19 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) // number of samples that the DMA has to transfer unsigned int nsamples_to_transfer; - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GALILEO_E5A_CODE_CHIP_RATE_CPS / GALILEO_E5A_CODE_LENGTH_CHIPS))); } - else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_Fpga") == 0)) + else // (if (implementation.compare("GPS_L5_DLL_PLL_Tracking_FPGA") == 0)) { nsamples_to_transfer = static_cast(std::round(static_cast(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_CPS / GPS_L5I_CODE_LENGTH_CHIPS))); } @@ -762,7 +762,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID) acquisition->init(); acquisition->set_local_code(); - if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga")) + if ((implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") or (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA")) { // Configure the DMA to send TEST_TRK_PULL_IN_TEST_SKIP_SAMPLES in order to initialize the internal // states of the downsampling filter in the FPGA @@ -1079,22 +1079,22 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) std::shared_ptr acquisition; // reset the HW to clear the sample counters: the acquisition constructor generates a reset - if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_Fpga") + if (implementation == "GPS_L1_CA_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_Fpga") + else if (implementation == "Galileo_E1_DLL_PLL_VEML_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 0; } - else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_Fpga") + else if (implementation == "Galileo_E5a_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; } - else if (implementation == "GPS_L5_DLL_PLL_Tracking_Fpga") + else if (implementation == "GPS_L5_DLL_PLL_Tracking_FPGA") { acquisition = std::make_shared(config.get(), "Acquisition", 0, 0); args.freq_band = 1; From 9b393098a6e79c3c9ab2eaf431ebb80939cb062f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 16 Aug 2024 13:27:36 +0200 Subject: [PATCH 323/499] Bump version of google benchmark to 1.9.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ffa66cf5b..3696eede2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,7 +361,7 @@ set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.5") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.0") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) From dbd94e005d5b0352874b5918a16772dfc54e54b1 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 24 Jun 2024 04:15:33 +0200 Subject: [PATCH 324/499] Fix CMakeLists header file list in signal source libs Header file paths were being appended to the source files list. This is not that important since, in general, you don't need to add the header files to the cmake target. --- src/algorithms/signal_source/libs/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 3506dc4f7..fd5c664d5 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -9,7 +9,7 @@ set(OPT_SIGNAL_SOURCE_LIB_SOURCES "") set(OPT_SIGNAL_SOURCE_LIB_HEADERS "") if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad9361_manager.h) endif() if(ENABLE_MAX2771) @@ -36,12 +36,12 @@ endif() if(ENABLE_PLUTOSDR) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_samples.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.h) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} pps_samplestamp.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_custom.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} pps_samplestamp.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ppstcprx.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ppstcprx.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ppstcprx.h) endif() From 1f3047c67acd926146746b6e80b8580066f4c23e Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 24 Jun 2024 04:17:40 +0200 Subject: [PATCH 325/499] Added ION GNSS SDR Metadata Standard signal source --- CMakeLists.txt | 15 + .../signal_source/adapters/CMakeLists.txt | 2 + .../adapters/ion_gnss_ms_signal_source.cc | 119 +++++++ .../adapters/ion_gnss_ms_signal_source.h | 78 +++++ .../signal_source/libs/CMakeLists.txt | 11 + .../libs/ion_gnss_sdr_metadata_standard.cc | 304 +++++++++++++++++ .../libs/ion_gnss_sdr_metadata_standard.h | 319 ++++++++++++++++++ src/core/receiver/gnss_block_factory.cc | 7 + 8 files changed, 855 insertions(+) create mode 100644 src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h create mode 100644 src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc create mode 100644 src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h diff --git a/CMakeLists.txt b/CMakeLists.txt index ffa66cf5b..0bb716ad9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" ON) +option(ENABLE_ION "Enable ION GNSS-SDR Metadata Standard signal source" ON) + # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) @@ -1422,6 +1424,19 @@ else() endif() +################################################################################ +# ION GNSS-SDR Metadata Standard +################################################################################ +include(FetchContent) +FetchContent_Declare( + gnss_metadata_standard + GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard + GIT_TAG master + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard + CMAKE_ARGS -DABSL_PROPAGATE_CXX_STD=ON -ABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard ${ABSEIL_TOOLCHAIN_FILE} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard +) +FetchContent_MakeAvailable(gnss_metadata_standard) ################################################################################ # Abseil C++ - https://abseil.io/docs/cpp/ diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 0aa745101..54d577c53 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -119,6 +119,7 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES two_bit_packed_file_signal_source.cc four_bit_cpx_file_signal_source.cc file_timestamp_signal_source.cc + ion_gnss_ms_signal_source.cc ${OPT_DRIVER_SOURCES} ) @@ -138,6 +139,7 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS two_bit_packed_file_signal_source.h four_bit_cpx_file_signal_source.h file_timestamp_signal_source.h + ion_gnss_ms_signal_source.h ${OPT_DRIVER_HEADERS} ) diff --git a/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc new file mode 100644 index 000000000..fe81e4556 --- /dev/null +++ b/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc @@ -0,0 +1,119 @@ +/*! + * \file file_timestamp_signal_source.cc + * \brief This class reads samples stored in a file and generate stream tags + * with its timestamp information stored in separated file + * \author Javier Arribas, jarribas(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "ion_gnss_ms_signal_source.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +using namespace std::string_literals; + +std::vector parse_comma_list(const std::string& str) +{ + std::vector list{}; + std::size_t prev_comma_at{0}; + + while (prev_comma_at < str.size()) + { + std::size_t comma_at = str.find_first_of(',', prev_comma_at); + if (comma_at == std::string::npos) + { + comma_at = str.size(); + } + list.emplace_back(str.substr(prev_comma_at, (comma_at - prev_comma_at))); + prev_comma_at = comma_at + 1; + } + + return list; +} + +IONMetadataStandardSignalSource::IONMetadataStandardSignalSource(const ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams, + Concurrent_Queue* queue) + : SignalSourceBase(configuration, role, "ION_Metadata_Standard_Signal_Source"s), + metadata_file_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), + stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), + metadata_(metadata_file_), + timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)) +{ + if (in_streams > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + + sources_ = metadata_.make_stream_sources(stream_ids_); + + for (const auto& source : sources_) + { + for (int i = 0; i < source->output_stream_count(); ++i) + { + copy_blocks_.push_back(gr::blocks::copy::make(source->output_stream_item_size(i))); + } + } +} + + +void IONMetadataStandardSignalSource::connect(gr::top_block_sptr top_block) +{ + std::size_t cumulative_index = 0; + for (const auto& source : sources_) + { + for (int i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + { + top_block->connect(source, i, copy_blocks_[cumulative_index], 0); + } + } +} + +void IONMetadataStandardSignalSource::disconnect(gr::top_block_sptr top_block) +{ + std::size_t cumulative_index = 0; + for (const auto& source : sources_) + { + for (int i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + { + top_block->disconnect(source, i, copy_blocks_[cumulative_index], 0); + } + } +} + +gr::basic_block_sptr IONMetadataStandardSignalSource::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + // return gr_basic_block_sptr(); + return IONMetadataStdFileSource::sptr(); +} + +gr::basic_block_sptr IONMetadataStandardSignalSource::get_right_block() +{ + return get_right_block(0); +} + +gr::basic_block_sptr IONMetadataStandardSignalSource::get_right_block(int RF_channel) +{ + return copy_blocks_[RF_channel]; +} diff --git a/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h new file mode 100644 index 000000000..ed84cab5c --- /dev/null +++ b/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h @@ -0,0 +1,78 @@ +/*! + * \file file_timestamp_signal_source.h + * \brief This class reads samples stored in a file and generate stream tags + * with its timestamp information stored in separated file + * \author Javier Arribas, jarribas(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_ION_METADATA_STANDARD_SIGNAL_SOURCE_H +#define GNSS_SDR_ION_METADATA_STANDARD_SIGNAL_SOURCE_H + +#include "configuration_interface.h" +#include "file_source_base.h" +#include "gnss_sdr_timestamp.h" +#include "ion_gnss_sdr_metadata_standard.h" +#include + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + +/*! + * \brief Class that reads signals samples from a file + * and adapts it to a SignalSourceInterface + */ +class IONMetadataStandardSignalSource : public SignalSourceBase +{ +public: + IONMetadataStandardSignalSource(const ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams, + Concurrent_Queue* queue); + + ~IONMetadataStandardSignalSource() override = default; + +protected: + // std::tuple itemTypeToSize() override; + // double packetsPerSample() const override; + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + gr::basic_block_sptr get_right_block(int RF_channel) override; + + inline size_t item_size() override + { + return (*sources_.begin())->output_stream_item_size(0); + } +private: + std::string metadata_file_; + std::vector stream_ids_; + std::vector sources_; + std::vector> copy_blocks_; + GnssMetadataHandler metadata_; + + gnss_shared_ptr timestamp_block_; + std::string timestamp_file_; + double timestamp_clock_offset_ms_; + + uint32_t in_streams_; + uint32_t out_streams_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_ION_METADATA_STANDARD_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index fd5c664d5..f0b2c09fd 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -7,6 +7,7 @@ set(OPT_SIGNAL_SOURCE_LIB_SOURCES "") set(OPT_SIGNAL_SOURCE_LIB_HEADERS "") + if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad9361_manager.h) @@ -44,6 +45,11 @@ if(ENABLE_PLUTOSDR) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ppstcprx.h) endif() +if(ENABLE_ION) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gnss_sdr_metadata_standard.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gnss_sdr_metadata_standard.h) +endif() + set(SIGNAL_SOURCE_LIB_SOURCES rtl_tcp_commands.cc @@ -139,6 +145,11 @@ if(ENABLE_CLANG_TIDY) endif() endif() +if(ENABLE_ION) + target_include_directories(signal_source_libs PUBLIC ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc) + target_link_libraries(signal_source_libs PUBLIC api xml) +endif() + set_property(TARGET signal_source_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ ) diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc new file mode 100644 index 000000000..c31ec3d1d --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc @@ -0,0 +1,304 @@ +// +// Created by castle on 6/24/24. +// + +#include "ion_gnss_sdr_metadata_standard.h" + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +GnssMetadataHandler::GnssMetadataHandler(const std::string& metadata_filepath) + : metadata_filepath_(metadata_filepath) +{ + load_metadata(); +} + +const std::string& GnssMetadataHandler::metadata_filepath() const +{ + return metadata_filepath_; +} + +void GnssMetadataHandler::load_metadata() +{ + try + { + GnssMetadata::XmlProcessor xml_proc; + if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) + { + LOG(ERROR) << "Could not load XML metadata file:"; + } + } + catch (GnssMetadata::ApiException& e) + { + LOG(ERROR) << "API Exception while loadind XML metadata file: " << e.what(); + } + catch (std::exception& e) + { + LOG(ERROR) << "Exception while loading XML metadata file: " << e.what(); + } +} + +std::vector GnssMetadataHandler::make_stream_sources(const std::vector& stream_ids) const +{ + std::vector sources{}; + for (const auto& file : metadata_.Files()) + { + for (const auto& block : file.Lane().Blocks()) + { + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + auto source = gnss_make_shared( + file, + block, + stream_ids); + + sources.push_back(source); + + // This file source will take care of any other matching streams in this block + // We can skip the rest of this block + goto next_block; + } + } + } + } + next_block: + } + } + + return sources; +} + + +IONMetadataStdFileSource::IONMetadataStdFileSource( + const GnssMetadata::File& file, + const GnssMetadata::Block& block, + const std::vector& stream_ids) + : gr::sync_block( + "ion_metadata_standard_source", + gr::io_signature::make(0, 0, 0), + make_output_signature(block)), + file_metadata_(file), + block_metadata_(block) +{ + fd_ = std::fopen(file.Url().Value().c_str(), "rb"); + std::size_t block_offset = file.Offset(); + std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET); + + std::size_t output_stream_offset = 0; + for (const auto& chunk : block.Chunks()) + { + chunk_data_.emplace_back(std::make_shared(chunk, stream_ids, output_stream_offset)); + const std::size_t out_count = chunk_data_.back()->output_stream_count(); + output_stream_offset += out_count; + for (std::size_t i = 0; i < out_count; ++i) + { + output_stream_item_sizes_.push_back(chunk_data_.back()->output_stream_item_size(i)); + } + } + output_stream_count_ = output_stream_offset; +} + +IONMetadataStdFileSource::~IONMetadataStdFileSource() +{ + std::fclose(fd_); +} + +int IONMetadataStdFileSource::work( + int noutput_items, + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) +{ + for (int i = 0; i < noutput_items; ++i) + { + read_chunk_pattern(output_items); + } + return WORK_CALLED_PRODUCE; +} + +std::size_t IONMetadataStdFileSource::output_stream_count() const +{ + return output_stream_count_; +} + +std::size_t IONMetadataStdFileSource::output_stream_item_size(std::size_t stream_index) const +{ + return output_stream_item_sizes_[stream_index]; +} + + +void IONMetadataStdFileSource::read_chunk_pattern(gr_vector_void_star& output_items) +{ + gr_vector_void_star chunk_outputs = output_items; + for (auto& c : chunk_data_) + { + c->read_from_file(fd_); + c->write_to_output(output_items, [this](int output, int nitems) { + produce(output, nitems); + }); + } +} + +gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block) +{ + int nstreams = 0; + std::vector item_sizes{}; + + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + ++nstreams; + item_sizes.emplace_back(stream.RateFactor() * stream.Quantization()); + } + } + } + + return gr::io_signature::make( + nstreams, + nstreams, + item_sizes); +} + + +chunk_data_t::chunk_data_t(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset) + : chunk_(chunk), + sizeword_(chunk_.SizeWord()), + countwords_(chunk_.CountWords()) +{ + switch (sizeword_) + { + case 1: + buffer_ = new uint8_t[countwords_]; + break; + case 2: + buffer_ = new uint16_t[countwords_]; + break; + case 4: + buffer_ = new uint32_t[countwords_]; + break; + case 8: + buffer_ = new uint64_t[countwords_]; + break; + default: + LOG(ERROR) << "Unknown word size: " << std::to_string(sizeword_); + break; + } + + + const std::size_t total_bitsize = sizeword_ * countwords_ * 8; + std::size_t used_bitsize = 0; + std::size_t output_streams = 0; + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + used_bitsize += stream.Packedbits(); + + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + streams_.emplace_back(lump, stream, output_streams + output_stream_offset); + ++output_streams; + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + if (sample_bitsize <= 8) + { + output_stream_item_size_.push_back(1); + } + else if (sample_bitsize <= 16) + { + output_stream_item_size_.push_back(2); + } + else if (sample_bitsize <= 32) + { + output_stream_item_size_.push_back(4); + } + else if (sample_bitsize <= 64) + { + output_stream_item_size_.push_back(8); + } + else + { + // This shouldn't happen + output_stream_item_size_.push_back(1); + } + } + else + { + streams_.emplace_back(lump, stream, -1); + } + } + } + + output_stream_count_ = output_streams; + padding_bitsize_ = total_bitsize - used_bitsize; +} +chunk_data_t::~chunk_data_t() +{ + switch (sizeword_) + { + case 1: + delete[] static_cast(buffer_); + break; + case 2: + delete[] static_cast(buffer_); + break; + case 4: + delete[] static_cast(buffer_); + break; + case 8: + delete[] static_cast(buffer_); + break; + default: + break; + } +} + +void chunk_data_t::read_from_file(FILE* fd) +{ + std::fread(buffer_, sizeword_, countwords_, fd); +} + +void chunk_data_t::write_to_output(gr_vector_void_star& outputs, const std::function& produce) +{ + switch (sizeword_) + { + case 1: + unpack_words(outputs, produce); + break; + case 2: + unpack_words(outputs, produce); + break; + case 4: + unpack_words(outputs, produce); + break; + case 8: + unpack_words(outputs, produce); + break; + default: + break; + } +} + +std::size_t chunk_data_t::output_stream_count() const +{ + return output_stream_count_; +} + +std::size_t chunk_data_t::output_stream_item_size(std::size_t stream_index) const +{ + return output_stream_item_size_[stream_index]; +} diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h new file mode 100644 index 000000000..badf834c1 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h @@ -0,0 +1,319 @@ +// +// Created by castle on 6/24/24. +// + +#ifndef GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H +#define GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H + +#include "GnssMetadata.h" +#include "gnss_block_interface.h" +#include +#include + +class chunk_data_t +{ +public: + chunk_data_t(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset); + + ~chunk_data_t(); + + chunk_data_t(const chunk_data_t& rhl) = delete; + chunk_data_t& operator=(const chunk_data_t& rhl) = delete; + + chunk_data_t(chunk_data_t&& rhl) = delete; + chunk_data_t& operator=(chunk_data_t&& rhl) = delete; + + void read_from_file(FILE* fd); + + void write_to_output(gr_vector_void_star& outputs, const std::function& produce); + + std::size_t output_stream_count() const; + std::size_t output_stream_item_size(std::size_t stream_index) const; + +private: + template + struct unpacking_context_t + { + WT* iterator_; + WT current_word_; + uint8_t bitshift_ = 0; + }; + + template + void unpack_words(gr_vector_void_star& outputs, const std::function& produce) + { + WT* data = static_cast(buffer_); + // TODO - Swap endiannes if needed + + unpacking_context_t ctx{}; + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ctx.iterator_ = data; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + ctx.iterator_ = &data[countwords_]; + } + advance_word(ctx); // Initializes ctx.current_word_ + + // Head padding + if (padding_bitsize_ > 0 && chunk_.Padding() == GnssMetadata::Chunk::Head) + { + shift_padding(ctx, padding_bitsize_); + } + + // Samples + for (const auto& [lump, stream, output_index] : streams_) + { + if (output_index == -1) + { + skip_stream(ctx, lump, stream); + } + else + { + produce(output_index, write_stream_samples(ctx, lump, stream, outputs[output_index])); + } + } + } + + template + void skip_stream( + unpacking_context_t& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream) + { + shift_padding(ctx, stream.Packedbits()); + } + + template + std::size_t write_stream_samples( + unpacking_context_t& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream, + void*& out) + { + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_count = stream.RateFactor(); + if (sample_bitsize <= 8) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); + } + else if (sample_bitsize <= 16) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); + } + else if (sample_bitsize <= 32) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); + } + else if (sample_bitsize <= 64) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); + } + + return sample_count; + } + + template + void write_n_samples( + unpacking_context_t& ctx, + GnssMetadata::Lump::LumpShift lump_shift, + uint8_t sample_bitsize, + std::size_t sample_count, + void*& out) + { + if (lump_shift == GnssMetadata::Lump::shiftLeft) + { + auto* sample = static_cast(out); + for (int i = 0; i < sample_count; ++i) + { + shift_sample(ctx, sample_bitsize, sample); + ++sample; + } + } + else if (lump_shift == GnssMetadata::Lump::shiftRight) + { + auto* sample = static_cast(out); + sample += sample_count; + for (int i = 0; i < sample_count; ++i) + { + shift_sample(ctx, sample_bitsize, sample); + --sample; + } + } + } + + template + void shift_sample(unpacking_context_t& ctx, uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) + { + const uint8_t word_bitsize = sizeword_ * 8; + + if ((sample_bitsize + (ctx.bitshift_ % word_bitsize)) > word_bitsize) + { + uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); + + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize - bits_shifted)) - 1); + *output |= ((ctx.current_word_ & mask) >> output_bit_offset); + ctx.current_word_ <<= bits_shifted; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (bits_shifted)) - 1); + *output |= (ctx.current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + ctx.current_word_ >>= bits_shifted; + } + + advance_word(ctx); + ctx.bitshift_ += bits_shifted; + shift_sample(ctx, sample_bitsize - bits_shifted, output, bits_shifted); + } + else + { + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize - sample_bitsize)) - 1); + *output |= (ctx.current_word_ & mask) >> output_bit_offset; + ctx.current_word_ <<= sample_bitsize; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (sample_bitsize)) - 1); + *output |= (ctx.current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + ctx.current_word_ >>= sample_bitsize; + } + + ctx.bitshift_ += sample_bitsize; + } + } + + template + void shift_padding(unpacking_context_t& ctx, uint8_t n_bits) + { + const uint8_t word_bitsize = sizeword_ * 8; + + if ((n_bits + (ctx.bitshift_ % word_bitsize)) > word_bitsize) + { + uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); + + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ctx.current_word_ <<= bits_shifted; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + ctx.current_word_ >>= bits_shifted; + } + + advance_word(ctx); + ctx.bitshift_ += bits_shifted; + shift_padding(ctx, n_bits - bits_shifted); + } + else + { + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ctx.current_word_ <<= n_bits; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + ctx.current_word_ >>= n_bits; + } + + ctx.bitshift_ += n_bits; + } + } + + template + void advance_word(unpacking_context_t& ctx) + { + WT word = *ctx.iterator_; + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ++ctx.iterator_; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + --ctx.iterator_; + } + + ctx.current_word_ = word; + } + +private: + const GnssMetadata::Chunk& chunk_; + uint8_t sizeword_; + uint8_t countwords_; + uint8_t padding_bitsize_; + std::size_t output_stream_count_; + std::vector output_stream_item_size_; + + struct stream_metadata_t + { + const GnssMetadata::Lump& lump; + const GnssMetadata::IonStream& stream; + int output_index = -1; + }; + std::vector streams_; + + void* buffer_; +}; + +class IONMetadataStdFileSource : public gr::sync_block +{ +public: + using sptr = gnss_shared_ptr; + + IONMetadataStdFileSource( + const GnssMetadata::File& file, + const GnssMetadata::Block& block, + const std::vector& stream_ids); + + ~IONMetadataStdFileSource() override; + + int work( + int noutput_items, + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) override; + + std::size_t output_stream_count() const; + std::size_t output_stream_item_size(std::size_t stream_index) const; + +private: + void read_chunk_pattern(gr_vector_void_star& output_items); + +private: + static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block); + +private: + const GnssMetadata::File& file_metadata_; + const GnssMetadata::Block& block_metadata_; + FILE* fd_; + std::size_t output_stream_count_; + std::vector output_stream_item_sizes_; + std::vector> chunk_data_; +}; + +class GnssMetadataHandler +{ +public: + explicit GnssMetadataHandler(const std::string& metadata_filepath); + + std::vector make_stream_sources(const std::vector& stream_ids) const; + +public: // Getters + const std::string& metadata_filepath() const; + +private: + void load_metadata(); + +private: + std::string metadata_filepath_; + GnssMetadata::Metadata metadata_; +}; + + +#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index ce77442ee..69406a711 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -113,6 +113,7 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" +#include "ion_gnss_ms_signal_source.h" #include // for exit #include // for exception #include // for cerr @@ -759,6 +760,12 @@ std::unique_ptr GNSSBlockFactory::GetBlock( block = std::move(block_); } #endif + else if (implementation == "ION_Metadata_Standard_Signal_Source") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } #if RAW_ARRAY_DRIVER else if (implementation == "Raw_Array_Signal_Source") From 38d548ba5090b193bb0681fccd7edd526e30a92e Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 24 Jun 2024 18:03:36 +0200 Subject: [PATCH 326/499] Only specify outputs for the requested streams --- .../libs/ion_gnss_sdr_metadata_standard.cc | 34 ++++++++++++++++--- .../libs/ion_gnss_sdr_metadata_standard.h | 2 +- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc index c31ec3d1d..9466e798f 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc @@ -87,7 +87,7 @@ IONMetadataStdFileSource::IONMetadataStdFileSource( : gr::sync_block( "ion_metadata_standard_source", gr::io_signature::make(0, 0, 0), - make_output_signature(block)), + make_output_signature(block, stream_ids)), file_metadata_(file), block_metadata_(block) { @@ -149,7 +149,7 @@ void IONMetadataStdFileSource::read_chunk_pattern(gr_vector_void_star& output_it } } -gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block) +gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) { int nstreams = 0; std::vector item_sizes{}; @@ -160,8 +160,34 @@ gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const Gns { for (const auto& stream : lump.Streams()) { - ++nstreams; - item_sizes.emplace_back(stream.RateFactor() * stream.Quantization()); + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + ++nstreams; + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + if (sample_bitsize <= 8) + { + item_sizes.push_back(1); + } + else if (sample_bitsize <= 16) + { + item_sizes.push_back(2); + } + else if (sample_bitsize <= 32) + { + item_sizes.push_back(4); + } + else if (sample_bitsize <= 64) + { + item_sizes.push_back(8); + } + else + { + // This shouldn't happen + item_sizes.push_back(1); + } + } } } } diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h index badf834c1..b97a84576 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h @@ -286,7 +286,7 @@ private: void read_chunk_pattern(gr_vector_void_star& output_items); private: - static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block); + static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); private: const GnssMetadata::File& file_metadata_; From 5c442c8aae637510d05276890dfb7f08106f35bd Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 24 Jun 2024 18:06:01 +0200 Subject: [PATCH 327/499] Fixed block iteration withing a file The `File` object only holds a shallow reference to its `Lane` (without the list of blocks). So we must retrieve the full reference manually. --- .../libs/ion_gnss_sdr_metadata_standard.cc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc index 9466e798f..45e3eebbe 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc @@ -46,10 +46,14 @@ std::vector GnssMetadataHandler::make_stream_sou std::vector sources{}; for (const auto& file : metadata_.Files()) { - for (const auto& block : file.Lane().Blocks()) + for (const auto& lane : metadata_.Lanes()) { - for (const auto& chunk : block.Chunks()) + if (lane.Id() == file.Lane().Id()) { + for (const auto& block : lane.Blocks()) + { + for (const auto& chunk : block.Chunks()) + { for (const auto& lump : chunk.Lumps()) { for (const auto& stream : lump.Streams()) @@ -71,8 +75,11 @@ std::vector GnssMetadataHandler::make_stream_sou } } } + } + next_block: + } + break; } - next_block: } } From 598fa283b80ca5873d7eb0e78195442548c1aa6f Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 24 Jun 2024 18:08:40 +0200 Subject: [PATCH 328/499] Treat data file paths as relative to the metadata file The data file paths are actually not native paths but URLs, this covers most cases but not all of them. --- .../libs/ion_gnss_sdr_metadata_standard.cc | 39 ++++++++++--------- .../libs/ion_gnss_sdr_metadata_standard.h | 2 + 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc index 45e3eebbe..3c8f1809d 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc @@ -54,28 +54,29 @@ std::vector GnssMetadataHandler::make_stream_sou { for (const auto& chunk : block.Chunks()) { - for (const auto& lump : chunk.Lumps()) - { - for (const auto& stream : lump.Streams()) - { - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) + for (const auto& lump : chunk.Lumps()) { - auto source = gnss_make_shared( - file, - block, - stream_ids); + for (const auto& stream : lump.Streams()) + { + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + auto source = gnss_make_shared( + metadata_filepath_, + file, + block, + stream_ids); - sources.push_back(source); + sources.push_back(source); - // This file source will take care of any other matching streams in this block - // We can skip the rest of this block - goto next_block; + // This file source will take care of any other matching streams in this block + // We can skip the rest of this block + goto next_block; + } + } } } - } - } next_block: } break; @@ -88,6 +89,7 @@ std::vector GnssMetadataHandler::make_stream_sou IONMetadataStdFileSource::IONMetadataStdFileSource( + const std::filesystem::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, const std::vector& stream_ids) @@ -98,7 +100,8 @@ IONMetadataStdFileSource::IONMetadataStdFileSource( file_metadata_(file), block_metadata_(block) { - fd_ = std::fopen(file.Url().Value().c_str(), "rb"); + std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); + fd_ = std::fopen(data_filepath.c_str(), "rb"); std::size_t block_offset = file.Offset(); std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET); diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h index b97a84576..0543de71d 100644 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h +++ b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h @@ -9,6 +9,7 @@ #include "gnss_block_interface.h" #include #include +#include class chunk_data_t { @@ -268,6 +269,7 @@ public: using sptr = gnss_shared_ptr; IONMetadataStdFileSource( + const std::filesystem::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, const std::vector& stream_ids); From 469eaf76e5cc241e1f0c452e1a1665292c3ff6b8 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Tue, 23 Jul 2024 01:13:34 +0200 Subject: [PATCH 329/499] Fixed decoding errors and refactored each class into its own file --- .../signal_source/adapters/CMakeLists.txt | 4 +- ...al_source.cc => ion_gsms_signal_source.cc} | 27 +- ...gnal_source.h => ion_gsms_signal_source.h} | 19 +- .../signal_source/libs/CMakeLists.txt | 8 +- .../libs/ion_gnss_sdr_metadata_standard.cc | 340 ------------ .../libs/ion_gnss_sdr_metadata_standard.h | 321 ----------- src/algorithms/signal_source/libs/ion_gsms.cc | 123 +++++ src/algorithms/signal_source/libs/ion_gsms.h | 64 +++ .../signal_source/libs/ion_gsms_chunk_data.cc | 108 ++++ .../signal_source/libs/ion_gsms_chunk_data.h | 510 ++++++++++++++++++ .../libs/ion_gsms_metadata_handler.cc | 101 ++++ .../libs/ion_gsms_metadata_handler.h | 47 ++ src/core/receiver/gnss_block_factory.cc | 6 +- 13 files changed, 987 insertions(+), 691 deletions(-) rename src/algorithms/signal_source/adapters/{ion_gnss_ms_signal_source.cc => ion_gsms_signal_source.cc} (78%) rename src/algorithms/signal_source/adapters/{ion_gnss_ms_signal_source.h => ion_gsms_signal_source.h} (76%) delete mode 100644 src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc delete mode 100644 src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h create mode 100644 src/algorithms/signal_source/libs/ion_gsms.cc create mode 100644 src/algorithms/signal_source/libs/ion_gsms.h create mode 100644 src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc create mode 100644 src/algorithms/signal_source/libs/ion_gsms_chunk_data.h create mode 100644 src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc create mode 100644 src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 54d577c53..9ff0ab434 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -119,7 +119,7 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES two_bit_packed_file_signal_source.cc four_bit_cpx_file_signal_source.cc file_timestamp_signal_source.cc - ion_gnss_ms_signal_source.cc + ion_gsms_signal_source.cc ${OPT_DRIVER_SOURCES} ) @@ -139,7 +139,7 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS two_bit_packed_file_signal_source.h four_bit_cpx_file_signal_source.h file_timestamp_signal_source.h - ion_gnss_ms_signal_source.h + ion_gsms_signal_source.h ${OPT_DRIVER_HEADERS} ) diff --git a/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc similarity index 78% rename from src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc rename to src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index fe81e4556..e4becf5e3 100644 --- a/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -1,8 +1,7 @@ /*! - * \file file_timestamp_signal_source.cc - * \brief This class reads samples stored in a file and generate stream tags - * with its timestamp information stored in separated file - * \author Javier Arribas, jarribas(at)cttc.es + * \file ion_gsms_signal_source.h + * \brief GNSS-SDR Signal Source that reads sample streams following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com * * ----------------------------------------------------------------------------- * @@ -15,9 +14,9 @@ * ----------------------------------------------------------------------------- */ -#include "ion_gnss_ms_signal_source.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" +#include "ion_gsms_signal_source.h" #include #include #include @@ -49,7 +48,7 @@ std::vector parse_comma_list(const std::string& str) return list; } -IONMetadataStandardSignalSource::IONMetadataStandardSignalSource(const ConfigurationInterface* configuration, +IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, @@ -58,7 +57,9 @@ IONMetadataStandardSignalSource::IONMetadataStandardSignalSource(const Configura metadata_file_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), metadata_(metadata_file_), - timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)) + timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)), + in_streams_(in_streams), + out_streams_(out_streams) { if (in_streams > 0) { @@ -77,7 +78,7 @@ IONMetadataStandardSignalSource::IONMetadataStandardSignalSource(const Configura } -void IONMetadataStandardSignalSource::connect(gr::top_block_sptr top_block) +void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) { std::size_t cumulative_index = 0; for (const auto& source : sources_) @@ -89,7 +90,7 @@ void IONMetadataStandardSignalSource::connect(gr::top_block_sptr top_block) } } -void IONMetadataStandardSignalSource::disconnect(gr::top_block_sptr top_block) +void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) { std::size_t cumulative_index = 0; for (const auto& source : sources_) @@ -101,19 +102,19 @@ void IONMetadataStandardSignalSource::disconnect(gr::top_block_sptr top_block) } } -gr::basic_block_sptr IONMetadataStandardSignalSource::get_left_block() +gr::basic_block_sptr IONGSMSSignalSource::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; // return gr_basic_block_sptr(); - return IONMetadataStdFileSource::sptr(); + return IONGSMSFileSource::sptr(); } -gr::basic_block_sptr IONMetadataStandardSignalSource::get_right_block() +gr::basic_block_sptr IONGSMSSignalSource::get_right_block() { return get_right_block(0); } -gr::basic_block_sptr IONMetadataStandardSignalSource::get_right_block(int RF_channel) +gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel) { return copy_blocks_[RF_channel]; } diff --git a/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h similarity index 76% rename from src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h rename to src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index ed84cab5c..9d959279f 100644 --- a/src/algorithms/signal_source/adapters/ion_gnss_ms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -1,8 +1,7 @@ /*! - * \file file_timestamp_signal_source.h - * \brief This class reads samples stored in a file and generate stream tags - * with its timestamp information stored in separated file - * \author Javier Arribas, jarribas(at)cttc.es + * \file ion_gsms_signal_source.h + * \brief GNSS-SDR Signal Source that reads sample streams following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com * * ----------------------------------------------------------------------------- * @@ -22,7 +21,7 @@ #include "configuration_interface.h" #include "file_source_base.h" #include "gnss_sdr_timestamp.h" -#include "ion_gnss_sdr_metadata_standard.h" +#include "ion_gsms.h" #include /** \addtogroup Signal_Source @@ -34,14 +33,14 @@ * \brief Class that reads signals samples from a file * and adapts it to a SignalSourceInterface */ -class IONMetadataStandardSignalSource : public SignalSourceBase +class IONGSMSSignalSource : public SignalSourceBase { public: - IONMetadataStandardSignalSource(const ConfigurationInterface* configuration, const std::string& role, + IONGSMSSignalSource(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, unsigned int out_streams, Concurrent_Queue* queue); - ~IONMetadataStandardSignalSource() override = default; + ~IONGSMSSignalSource() override = default; protected: // std::tuple itemTypeToSize() override; @@ -60,9 +59,9 @@ protected: private: std::string metadata_file_; std::vector stream_ids_; - std::vector sources_; + std::vector sources_; std::vector> copy_blocks_; - GnssMetadataHandler metadata_; + IONGSMSMetadataHandler metadata_; gnss_shared_ptr timestamp_block_; std::string timestamp_file_; diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index f0b2c09fd..fb7faf9ee 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -46,8 +46,12 @@ if(ENABLE_PLUTOSDR) endif() if(ENABLE_ION) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gnss_sdr_metadata_standard.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gnss_sdr_metadata_standard.h) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms.h) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_chunk_data.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_data.h) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_metadata_handler.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_metadata_handler.h) endif() diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc deleted file mode 100644 index 3c8f1809d..000000000 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.cc +++ /dev/null @@ -1,340 +0,0 @@ -// -// Created by castle on 6/24/24. -// - -#include "ion_gnss_sdr_metadata_standard.h" - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -GnssMetadataHandler::GnssMetadataHandler(const std::string& metadata_filepath) - : metadata_filepath_(metadata_filepath) -{ - load_metadata(); -} - -const std::string& GnssMetadataHandler::metadata_filepath() const -{ - return metadata_filepath_; -} - -void GnssMetadataHandler::load_metadata() -{ - try - { - GnssMetadata::XmlProcessor xml_proc; - if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) - { - LOG(ERROR) << "Could not load XML metadata file:"; - } - } - catch (GnssMetadata::ApiException& e) - { - LOG(ERROR) << "API Exception while loadind XML metadata file: " << e.what(); - } - catch (std::exception& e) - { - LOG(ERROR) << "Exception while loading XML metadata file: " << e.what(); - } -} - -std::vector GnssMetadataHandler::make_stream_sources(const std::vector& stream_ids) const -{ - std::vector sources{}; - for (const auto& file : metadata_.Files()) - { - for (const auto& lane : metadata_.Lanes()) - { - if (lane.Id() == file.Lane().Id()) - { - for (const auto& block : lane.Blocks()) - { - for (const auto& chunk : block.Chunks()) - { - for (const auto& lump : chunk.Lumps()) - { - for (const auto& stream : lump.Streams()) - { - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) - { - auto source = gnss_make_shared( - metadata_filepath_, - file, - block, - stream_ids); - - sources.push_back(source); - - // This file source will take care of any other matching streams in this block - // We can skip the rest of this block - goto next_block; - } - } - } - } - next_block: - } - break; - } - } - } - - return sources; -} - - -IONMetadataStdFileSource::IONMetadataStdFileSource( - const std::filesystem::path& metadata_filepath, - const GnssMetadata::File& file, - const GnssMetadata::Block& block, - const std::vector& stream_ids) - : gr::sync_block( - "ion_metadata_standard_source", - gr::io_signature::make(0, 0, 0), - make_output_signature(block, stream_ids)), - file_metadata_(file), - block_metadata_(block) -{ - std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); - fd_ = std::fopen(data_filepath.c_str(), "rb"); - std::size_t block_offset = file.Offset(); - std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET); - - std::size_t output_stream_offset = 0; - for (const auto& chunk : block.Chunks()) - { - chunk_data_.emplace_back(std::make_shared(chunk, stream_ids, output_stream_offset)); - const std::size_t out_count = chunk_data_.back()->output_stream_count(); - output_stream_offset += out_count; - for (std::size_t i = 0; i < out_count; ++i) - { - output_stream_item_sizes_.push_back(chunk_data_.back()->output_stream_item_size(i)); - } - } - output_stream_count_ = output_stream_offset; -} - -IONMetadataStdFileSource::~IONMetadataStdFileSource() -{ - std::fclose(fd_); -} - -int IONMetadataStdFileSource::work( - int noutput_items, - gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items) -{ - for (int i = 0; i < noutput_items; ++i) - { - read_chunk_pattern(output_items); - } - return WORK_CALLED_PRODUCE; -} - -std::size_t IONMetadataStdFileSource::output_stream_count() const -{ - return output_stream_count_; -} - -std::size_t IONMetadataStdFileSource::output_stream_item_size(std::size_t stream_index) const -{ - return output_stream_item_sizes_[stream_index]; -} - - -void IONMetadataStdFileSource::read_chunk_pattern(gr_vector_void_star& output_items) -{ - gr_vector_void_star chunk_outputs = output_items; - for (auto& c : chunk_data_) - { - c->read_from_file(fd_); - c->write_to_output(output_items, [this](int output, int nitems) { - produce(output, nitems); - }); - } -} - -gr::io_signature::sptr IONMetadataStdFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) -{ - int nstreams = 0; - std::vector item_sizes{}; - - for (const auto& chunk : block.Chunks()) - { - for (const auto& lump : chunk.Lumps()) - { - for (const auto& stream : lump.Streams()) - { - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) - { - ++nstreams; - std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); - if (sample_bitsize <= 8) - { - item_sizes.push_back(1); - } - else if (sample_bitsize <= 16) - { - item_sizes.push_back(2); - } - else if (sample_bitsize <= 32) - { - item_sizes.push_back(4); - } - else if (sample_bitsize <= 64) - { - item_sizes.push_back(8); - } - else - { - // This shouldn't happen - item_sizes.push_back(1); - } - } - } - } - } - - return gr::io_signature::make( - nstreams, - nstreams, - item_sizes); -} - - -chunk_data_t::chunk_data_t(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset) - : chunk_(chunk), - sizeword_(chunk_.SizeWord()), - countwords_(chunk_.CountWords()) -{ - switch (sizeword_) - { - case 1: - buffer_ = new uint8_t[countwords_]; - break; - case 2: - buffer_ = new uint16_t[countwords_]; - break; - case 4: - buffer_ = new uint32_t[countwords_]; - break; - case 8: - buffer_ = new uint64_t[countwords_]; - break; - default: - LOG(ERROR) << "Unknown word size: " << std::to_string(sizeword_); - break; - } - - - const std::size_t total_bitsize = sizeword_ * countwords_ * 8; - std::size_t used_bitsize = 0; - std::size_t output_streams = 0; - for (const auto& lump : chunk.Lumps()) - { - for (const auto& stream : lump.Streams()) - { - used_bitsize += stream.Packedbits(); - - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) - { - streams_.emplace_back(lump, stream, output_streams + output_stream_offset); - ++output_streams; - std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); - if (sample_bitsize <= 8) - { - output_stream_item_size_.push_back(1); - } - else if (sample_bitsize <= 16) - { - output_stream_item_size_.push_back(2); - } - else if (sample_bitsize <= 32) - { - output_stream_item_size_.push_back(4); - } - else if (sample_bitsize <= 64) - { - output_stream_item_size_.push_back(8); - } - else - { - // This shouldn't happen - output_stream_item_size_.push_back(1); - } - } - else - { - streams_.emplace_back(lump, stream, -1); - } - } - } - - output_stream_count_ = output_streams; - padding_bitsize_ = total_bitsize - used_bitsize; -} -chunk_data_t::~chunk_data_t() -{ - switch (sizeword_) - { - case 1: - delete[] static_cast(buffer_); - break; - case 2: - delete[] static_cast(buffer_); - break; - case 4: - delete[] static_cast(buffer_); - break; - case 8: - delete[] static_cast(buffer_); - break; - default: - break; - } -} - -void chunk_data_t::read_from_file(FILE* fd) -{ - std::fread(buffer_, sizeword_, countwords_, fd); -} - -void chunk_data_t::write_to_output(gr_vector_void_star& outputs, const std::function& produce) -{ - switch (sizeword_) - { - case 1: - unpack_words(outputs, produce); - break; - case 2: - unpack_words(outputs, produce); - break; - case 4: - unpack_words(outputs, produce); - break; - case 8: - unpack_words(outputs, produce); - break; - default: - break; - } -} - -std::size_t chunk_data_t::output_stream_count() const -{ - return output_stream_count_; -} - -std::size_t chunk_data_t::output_stream_item_size(std::size_t stream_index) const -{ - return output_stream_item_size_[stream_index]; -} diff --git a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h b/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h deleted file mode 100644 index 0543de71d..000000000 --- a/src/algorithms/signal_source/libs/ion_gnss_sdr_metadata_standard.h +++ /dev/null @@ -1,321 +0,0 @@ -// -// Created by castle on 6/24/24. -// - -#ifndef GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H -#define GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H - -#include "GnssMetadata.h" -#include "gnss_block_interface.h" -#include -#include -#include - -class chunk_data_t -{ -public: - chunk_data_t(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset); - - ~chunk_data_t(); - - chunk_data_t(const chunk_data_t& rhl) = delete; - chunk_data_t& operator=(const chunk_data_t& rhl) = delete; - - chunk_data_t(chunk_data_t&& rhl) = delete; - chunk_data_t& operator=(chunk_data_t&& rhl) = delete; - - void read_from_file(FILE* fd); - - void write_to_output(gr_vector_void_star& outputs, const std::function& produce); - - std::size_t output_stream_count() const; - std::size_t output_stream_item_size(std::size_t stream_index) const; - -private: - template - struct unpacking_context_t - { - WT* iterator_; - WT current_word_; - uint8_t bitshift_ = 0; - }; - - template - void unpack_words(gr_vector_void_star& outputs, const std::function& produce) - { - WT* data = static_cast(buffer_); - // TODO - Swap endiannes if needed - - unpacking_context_t ctx{}; - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ctx.iterator_ = data; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - ctx.iterator_ = &data[countwords_]; - } - advance_word(ctx); // Initializes ctx.current_word_ - - // Head padding - if (padding_bitsize_ > 0 && chunk_.Padding() == GnssMetadata::Chunk::Head) - { - shift_padding(ctx, padding_bitsize_); - } - - // Samples - for (const auto& [lump, stream, output_index] : streams_) - { - if (output_index == -1) - { - skip_stream(ctx, lump, stream); - } - else - { - produce(output_index, write_stream_samples(ctx, lump, stream, outputs[output_index])); - } - } - } - - template - void skip_stream( - unpacking_context_t& ctx, - const GnssMetadata::Lump& lump, - const GnssMetadata::IonStream& stream) - { - shift_padding(ctx, stream.Packedbits()); - } - - template - std::size_t write_stream_samples( - unpacking_context_t& ctx, - const GnssMetadata::Lump& lump, - const GnssMetadata::IonStream& stream, - void*& out) - { - std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); - std::size_t sample_count = stream.RateFactor(); - if (sample_bitsize <= 8) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); - } - else if (sample_bitsize <= 16) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); - } - else if (sample_bitsize <= 32) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); - } - else if (sample_bitsize <= 64) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, out); - } - - return sample_count; - } - - template - void write_n_samples( - unpacking_context_t& ctx, - GnssMetadata::Lump::LumpShift lump_shift, - uint8_t sample_bitsize, - std::size_t sample_count, - void*& out) - { - if (lump_shift == GnssMetadata::Lump::shiftLeft) - { - auto* sample = static_cast(out); - for (int i = 0; i < sample_count; ++i) - { - shift_sample(ctx, sample_bitsize, sample); - ++sample; - } - } - else if (lump_shift == GnssMetadata::Lump::shiftRight) - { - auto* sample = static_cast(out); - sample += sample_count; - for (int i = 0; i < sample_count; ++i) - { - shift_sample(ctx, sample_bitsize, sample); - --sample; - } - } - } - - template - void shift_sample(unpacking_context_t& ctx, uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) - { - const uint8_t word_bitsize = sizeword_ * 8; - - if ((sample_bitsize + (ctx.bitshift_ % word_bitsize)) > word_bitsize) - { - uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); - - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - WT mask = ~((1 << (word_bitsize - bits_shifted)) - 1); - *output |= ((ctx.current_word_ & mask) >> output_bit_offset); - ctx.current_word_ <<= bits_shifted; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - WT mask = ((1 << (bits_shifted)) - 1); - *output |= (ctx.current_word_ & mask) << output_bit_offset; - // TODO - reverse bit order of sample? maybe? - ctx.current_word_ >>= bits_shifted; - } - - advance_word(ctx); - ctx.bitshift_ += bits_shifted; - shift_sample(ctx, sample_bitsize - bits_shifted, output, bits_shifted); - } - else - { - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - WT mask = ~((1 << (word_bitsize - sample_bitsize)) - 1); - *output |= (ctx.current_word_ & mask) >> output_bit_offset; - ctx.current_word_ <<= sample_bitsize; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - WT mask = ((1 << (sample_bitsize)) - 1); - *output |= (ctx.current_word_ & mask) << output_bit_offset; - // TODO - reverse bit order of sample? maybe? - ctx.current_word_ >>= sample_bitsize; - } - - ctx.bitshift_ += sample_bitsize; - } - } - - template - void shift_padding(unpacking_context_t& ctx, uint8_t n_bits) - { - const uint8_t word_bitsize = sizeword_ * 8; - - if ((n_bits + (ctx.bitshift_ % word_bitsize)) > word_bitsize) - { - uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); - - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ctx.current_word_ <<= bits_shifted; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - ctx.current_word_ >>= bits_shifted; - } - - advance_word(ctx); - ctx.bitshift_ += bits_shifted; - shift_padding(ctx, n_bits - bits_shifted); - } - else - { - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ctx.current_word_ <<= n_bits; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - ctx.current_word_ >>= n_bits; - } - - ctx.bitshift_ += n_bits; - } - } - - template - void advance_word(unpacking_context_t& ctx) - { - WT word = *ctx.iterator_; - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ++ctx.iterator_; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - --ctx.iterator_; - } - - ctx.current_word_ = word; - } - -private: - const GnssMetadata::Chunk& chunk_; - uint8_t sizeword_; - uint8_t countwords_; - uint8_t padding_bitsize_; - std::size_t output_stream_count_; - std::vector output_stream_item_size_; - - struct stream_metadata_t - { - const GnssMetadata::Lump& lump; - const GnssMetadata::IonStream& stream; - int output_index = -1; - }; - std::vector streams_; - - void* buffer_; -}; - -class IONMetadataStdFileSource : public gr::sync_block -{ -public: - using sptr = gnss_shared_ptr; - - IONMetadataStdFileSource( - const std::filesystem::path& metadata_filepath, - const GnssMetadata::File& file, - const GnssMetadata::Block& block, - const std::vector& stream_ids); - - ~IONMetadataStdFileSource() override; - - int work( - int noutput_items, - gr_vector_const_void_star& input_items, - gr_vector_void_star& output_items) override; - - std::size_t output_stream_count() const; - std::size_t output_stream_item_size(std::size_t stream_index) const; - -private: - void read_chunk_pattern(gr_vector_void_star& output_items); - -private: - static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); - -private: - const GnssMetadata::File& file_metadata_; - const GnssMetadata::Block& block_metadata_; - FILE* fd_; - std::size_t output_stream_count_; - std::vector output_stream_item_sizes_; - std::vector> chunk_data_; -}; - -class GnssMetadataHandler -{ -public: - explicit GnssMetadataHandler(const std::string& metadata_filepath); - - std::vector make_stream_sources(const std::vector& stream_ids) const; - -public: // Getters - const std::string& metadata_filepath() const; - -private: - void load_metadata(); - -private: - std::string metadata_filepath_; - GnssMetadata::Metadata metadata_; -}; - - -#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc new file mode 100644 index 000000000..8110b3af1 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -0,0 +1,123 @@ +/*! + * \file ion_gsms.cc + * \brief GNU Radio block that reads a Block from a file following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "gnuradio/block.h" +#include "ion_gsms.h" + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include + +#include +#endif + + +IONGSMSFileSource::IONGSMSFileSource( + const std::filesystem::path& metadata_filepath, + const GnssMetadata::File& file, + const GnssMetadata::Block& block, + const std::vector& stream_ids) + : gr::sync_block( + "ion_metadata_standard_source", + gr::io_signature::make(0, 0, 0), + make_output_signature(block, stream_ids)), + file_metadata_(file), + block_metadata_(block) +{ + std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); + fd_ = std::fopen(data_filepath.c_str(), "rb"); + std::size_t block_offset = file.Offset(); + std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET); + + std::size_t output_stream_offset = 0; + for (const auto& chunk : block.Chunks()) + { + chunk_data_.emplace_back(std::make_shared(chunk, stream_ids, output_stream_offset)); + const std::size_t out_count = chunk_data_.back()->output_stream_count(); + output_stream_offset += out_count; + for (std::size_t i = 0; i < out_count; ++i) + { + output_stream_item_sizes_.push_back(chunk_data_.back()->output_stream_item_size(i)); + } + } + output_stream_count_ = output_stream_offset; +} + +IONGSMSFileSource::~IONGSMSFileSource() +{ + std::fclose(fd_); +} + +int IONGSMSFileSource::work( + int noutput_items, + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) +{ + // for (int i = 0; i < noutput_items; ++i) + // { + for (auto& c : chunk_data_) + { + c->read_from_file(fd_); + c->write_to_output(output_items, [&](int output, int nitems) { + produce(output, nitems); + }); + } + // } + return WORK_CALLED_PRODUCE; +} + +std::size_t IONGSMSFileSource::output_stream_count() const +{ + return output_stream_count_; +} + +std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) const +{ + return output_stream_item_sizes_[stream_index]; +} + + +gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) +{ + int nstreams = 0; + std::vector item_sizes{}; + + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + ++nstreams; + const std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + item_sizes.push_back(bits_to_item_size(sample_bitsize)); + } + } + } + } + + return gr::io_signature::make( + nstreams, + nstreams, + item_sizes); +} + + diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h new file mode 100644 index 000000000..a15206b84 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -0,0 +1,64 @@ +/*! + * \file ion_gsms.h + * \brief GNU Radio block that reads a Block from a file following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H +#define GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H + +#include "gnss_block_interface.h" +#include "ion_gsms_chunk_data.h" +#include +#include +#include +#include + + +class IONGSMSFileSource : public gr::sync_block +{ +public: + using sptr = gnss_shared_ptr; + + IONGSMSFileSource( + const std::filesystem::path& metadata_filepath, + const GnssMetadata::File& file, + const GnssMetadata::Block& block, + const std::vector& stream_ids); + + ~IONGSMSFileSource() override; + + int work( + int noutput_items, + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) override; + + std::size_t output_stream_count() const; + std::size_t output_stream_item_size(std::size_t stream_index) const; + +private: + static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); + +private: + const GnssMetadata::File& file_metadata_; + const GnssMetadata::Block& block_metadata_; + FILE* fd_; + std::size_t output_stream_count_; + std::vector output_stream_item_sizes_; + std::vector> chunk_data_; +}; + +#include "ion_gsms_metadata_handler.h" + + +#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc new file mode 100644 index 000000000..f961772a0 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -0,0 +1,108 @@ +/*! + * \file ion_gsms_chunk_data.cc + * \brief Holds logic for reading and decoding samples from a chunk + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "ion_gsms_chunk_data.h" +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset) + : chunk_(chunk), + sizeword_(chunk_.SizeWord()), + countwords_(chunk_.CountWords()) +{ + with_word_type(sizeword_, [&] + { + buffer_ = new WordType[countwords_]; + }); + + const std::size_t total_bitsize = sizeword_ * countwords_ * 8; + std::size_t used_bitsize = 0; + std::size_t output_streams = 0; + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + used_bitsize += stream.Packedbits(); + + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()),output_streams + output_stream_offset); + ++output_streams; + const std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + output_stream_item_size_.push_back(bits_to_item_size(sample_bitsize)); + } + else + { + streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()), -1); + } + } + } + + output_stream_count_ = output_streams; + padding_bitsize_ = total_bitsize - used_bitsize; +} + + +IONGSMSChunkData::~IONGSMSChunkData() +{ + with_word_type(sizeword_, [&] + { + delete[] static_cast(buffer_); + }); +} + +void IONGSMSChunkData::read_from_file(FILE* fd) +{ + std::fread(buffer_, sizeword_, countwords_, fd); +} + +void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, const std::function& produce) +{ + with_word_type(sizeword_, [&] + { + unpack_words(outputs, produce); + }); +} + +std::size_t IONGSMSChunkData::output_stream_count() const +{ + return output_stream_count_; +} + +std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) const +{ + return output_stream_item_size_[stream_index]; +} + + + +void IONGSMSChunkData::dump_sample(auto value) +{ + static int count = 100; + if (count > 0) + { + --count; + std::cout << "SAMPLE: " << std::bitset<32>(value) << std::endl; + } +} + diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h new file mode 100644 index 000000000..f87a03aef --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -0,0 +1,510 @@ +/*! + * \file ion_gsms_chunk_data.h + * \brief Holds logic for reading and decoding samples from a chunk + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef ION_GSM_CHUNK_DATA_H +#define ION_GSM_CHUNK_DATA_H + +#include "GnssMetadata.h" +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +inline std::size_t bits_to_item_size(const std::size_t bit_count) +{ + if (bit_count <= 8) + { + return 1; + } + if (bit_count <= 16) + { + return 2; + } + if (bit_count <= 32) + { + return 4; + } + if (bit_count <= 64) + { + return 8; + } + + // You are asking too much of this humble processor + LOG(ERROR) << "Item size too large (" << std::to_string(bit_count) << "), returning nonsense."; + return 1; +} + +void with_word_type(const uint8_t word_size, auto&& callback) +{ + switch (word_size) + { + case 1: + callback.template operator()(); + break; + case 2: + callback.template operator()(); + break; + case 4: + callback.template operator()(); + break; + case 8: + callback.template operator()(); + break; + default: + LOG(ERROR) << "Unknown word size (" << std::to_string(word_size) << "), returning nonsense."; + break; + } +} + +namespace GnssMetadata +{ + using StreamEncoding = unsigned char; + + namespace StreamEncodings + { + constexpr unsigned char SIGN = 0; + constexpr unsigned char OB = 1; + constexpr unsigned char SM = 2; + constexpr unsigned char MS = 3; + constexpr unsigned char TC = 4; + constexpr unsigned char OG = 5; + constexpr unsigned char OBA = 6; + constexpr unsigned char SMA = 7; + constexpr unsigned char MSA = 8; + constexpr unsigned char TCA = 9; + constexpr unsigned char OGA = 10; + constexpr unsigned char FP = 11; + } + + inline StreamEncoding encoding_from_string(const std::string& str) + { + if (str == "SIGN") + { + return StreamEncodings::SIGN; + } + if (str == "OB") + { + return StreamEncodings::OB; + } + if (str == "SM") + { + return StreamEncodings::SM; + } + if (str == "MS") + { + return StreamEncodings::MS; + } + if (str == "TC") + { + return StreamEncodings::TC; + } + if (str == "OG") + { + return StreamEncodings::OG; + } + if (str == "OBA") + { + return StreamEncodings::OBA; + } + if (str == "SMA") + { + return StreamEncodings::SMA; + } + if (str == "MSA") + { + return StreamEncodings::MSA; + } + if (str == "TCA") + { + return StreamEncodings::TCA; + } + if (str == "OGA") + { + return StreamEncodings::OGA; + } + if (str == "FP") + { + return StreamEncodings::FP; + } + return 0; + } + + template + inline T two_bit_look_up[11][4] + { + [0] = {}, + [1 /*OB*/] = {-2, -1, 0, 1}, + [2 /*SM*/] = {0, 1, 0, -1}, + [3 /*MS*/] = {0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, -2, -1}, + [5 /*OG*/] = {-2, -1, 1, 0}, + [6 /*OBA*/] = {-3, -1, 1, 3}, + [7 /*SMA*/] = {1, 3, -1, -3}, + [8 /*MSA*/] = {1, -1, 3, -3}, + [9 /*TCA*/] = {1, 3, -3, -1}, + [10 /*OGA*/] = {-3, -1, 3, 1}, + }; + + template + inline T three_bit_look_up[11][8] + { + [0] = {}, + [1 /*OB*/] = {-4, -3, -2, -1, 0, 1, 2, 3}, + [2 /*SM*/] = {0, 1, 2, 3, 0, -1, -2, -3}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, -4, -3, -2, -1}, + [5 /*OG*/] = {-4, -3, -1, -2, 3, 2, 0, 1}, + [6 /*OBA*/] = {-7, -5, -3, -1, 1, 3, 5, 7}, + [7 /*SMA*/] = {1, 3, 5, 7, -1, -3, -5, -7}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7}, + [9 /*TCA*/] = {1, 3, 5, 7, -7, -5, -3, -1}, + [10 /*OGA*/] = {-7, -5, -1, -3, 7, 5, 1, 3}, + }; + + template + inline T four_bit_look_up[11][16] + { + [0] = {}, + [1 /*OB*/] = {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, + [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, + [5 /*OG*/] = {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, + [6 /*OBA*/] = {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, + [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, + [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, + [10 /*OGA*/] = {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, + }; + + template + inline T five_bit_look_up[11][32] + { + [0] = {}, + [1 /*OB*/] = {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, + [5 /*OG*/] = {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, + [6 /*OBA*/] = {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, + [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, + [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, + [10 /*OGA*/] = {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, + }; +} + +class IONGSMSChunkData +{ +public: + IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset); + + ~IONGSMSChunkData(); + + IONGSMSChunkData(const IONGSMSChunkData& rhl) = delete; + IONGSMSChunkData& operator=(const IONGSMSChunkData& rhl) = delete; + + IONGSMSChunkData(IONGSMSChunkData&& rhl) = delete; + IONGSMSChunkData& operator=(IONGSMSChunkData&& rhl) = delete; + + void read_from_file(FILE* fd); + + void write_to_output(gr_vector_void_star& outputs, const std::function& produce); + + std::size_t output_stream_count() const; + std::size_t output_stream_item_size(std::size_t stream_index) const; + +private: + template + struct unpacking_context_t + { + WT* iterator_; + WT current_word_; + uint8_t bitshift_ = 0; + }; + + template + void unpack_words(gr_vector_void_star& outputs, const std::function& produce) + { + WT* data = static_cast(buffer_); + // TODO - Swap endiannes if needed + + unpacking_context_t ctx{}; + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ctx.iterator_ = data; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + ctx.iterator_ = &data[countwords_]; + } + advance_word(ctx); // Initializes ctx.current_word_ + + // Head padding + if (padding_bitsize_ > 0 && chunk_.Padding() == GnssMetadata::Chunk::Head) + { + shift_padding(ctx, padding_bitsize_); + } + + // Samples + for (const auto& [lump, stream, encoding, output_index] : streams_) + { + if (output_index == -1) + { + skip_stream(ctx, lump, stream); + } + else + { + produce(output_index, write_stream_samples(ctx, lump, stream, encoding, outputs[output_index])); + } + } + } + + template + void skip_stream( + unpacking_context_t& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream) + { + shift_padding(ctx, stream.Packedbits()); + } + + template + std::size_t write_stream_samples( + unpacking_context_t& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream, + const GnssMetadata::StreamEncoding stream_encoding, + void*& out) + { + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_count = stream.RateFactor(); + + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + sample_count *= 2; + } + + if (sample_bitsize <= 8) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + else if (sample_bitsize <= 16) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + else if (sample_bitsize <= 32) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + else if (sample_bitsize <= 64) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + + return sample_count; + } + + template + void write_n_samples( + unpacking_context_t& ctx, + GnssMetadata::Lump::LumpShift lump_shift, + uint8_t sample_bitsize, + std::size_t sample_count, + GnssMetadata::StreamEncoding stream_encoding, + void*& out) + { + if (lump_shift == GnssMetadata::Lump::shiftRight) + { + auto* sample = static_cast(out); + sample += sample_count; + for (std::size_t i = 0; i < sample_count; ++i) + { + shift_sample(ctx, sample_bitsize, sample); + decode_sample(sample_bitsize, sample, stream_encoding); + --sample; + } + } + else // if (lump_shift == GnssMetadata::Lump::shiftLeft || lump_shift == GnssMetadata::Lump::shiftUndefined) + { + auto* sample = static_cast(out); + for (std::size_t i = 0; i < sample_count; ++i) + { + shift_sample(ctx, sample_bitsize, sample); + decode_sample(sample_bitsize, sample, stream_encoding); + ++sample; + } + } + } + + template + void shift_sample(unpacking_context_t& ctx, uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) + { + const uint8_t word_bitsize = sizeword_ * 8; + + if ((sample_bitsize + (ctx.bitshift_ % word_bitsize)) > word_bitsize) + { + uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); + + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize - bits_shifted)) - 1); + dump_sample(ctx.current_word_ & mask); + *output |= ((ctx.current_word_ & mask) >> output_bit_offset); + ctx.current_word_ <<= bits_shifted; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (bits_shifted)) - 1); + dump_sample(ctx.current_word_ & mask); + *output |= (ctx.current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + ctx.current_word_ >>= bits_shifted; + } + + advance_word(ctx); + ctx.bitshift_ += bits_shifted; + shift_sample(ctx, sample_bitsize - bits_shifted, output, bits_shifted); + } + else + { + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize - sample_bitsize)) - 1); + OT sample = (ctx.current_word_ & mask) >> (word_bitsize - sample_bitsize); + dump_sample(sample); + *output |= (sample) >> output_bit_offset; + ctx.current_word_ <<= sample_bitsize; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (sample_bitsize)) - 1); + dump_sample(ctx.current_word_ & mask); + *output |= (ctx.current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + ctx.current_word_ >>= sample_bitsize; + } + + ctx.bitshift_ += sample_bitsize; + } + } + + template + void shift_padding(unpacking_context_t& ctx, uint8_t n_bits) + { + if(n_bits == 0) return; + + const uint8_t word_bitsize = sizeword_ * 8; + + if ((n_bits + (ctx.bitshift_ % word_bitsize)) >= word_bitsize) + { + uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); + + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ctx.current_word_ <<= bits_shifted; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + ctx.current_word_ >>= bits_shifted; + } + + advance_word(ctx); + ctx.bitshift_ += bits_shifted; + shift_padding(ctx, n_bits - bits_shifted); + } + else + { + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ctx.current_word_ <<= n_bits; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + ctx.current_word_ >>= n_bits; + } + + ctx.bitshift_ += n_bits; + } + } + + template + void advance_word(unpacking_context_t& ctx) + { + WT word = *ctx.iterator_; + if (chunk_.Shift() == GnssMetadata::Chunk::Left) + { + ++ctx.iterator_; + } + else if (chunk_.Shift() == GnssMetadata::Chunk::Right) + { + --ctx.iterator_; + } + + ctx.current_word_ = word; + } + + template + static void decode_sample(const uint8_t sample_bitsize, ST* sample, const GnssMetadata::StreamEncoding encoding) + { + switch (sample_bitsize) + { + case 2: + *sample = GnssMetadata::two_bit_look_up[encoding][*sample]; + break; + case 3: + *sample = GnssMetadata::three_bit_look_up[encoding][*sample]; + break; + case 4: + *sample = GnssMetadata::four_bit_look_up[encoding][*sample]; + break; + case 5: + *sample = GnssMetadata::five_bit_look_up[encoding][*sample]; + break; + default: + // TODO - Is this an error that can happen? + break; + } + } + + static void dump_sample(auto value); + +private: + const GnssMetadata::Chunk& chunk_; + uint8_t sizeword_; + uint8_t countwords_; + uint8_t padding_bitsize_; + std::size_t output_stream_count_; + std::vector output_stream_item_size_; + + struct stream_metadata_t + { + const GnssMetadata::Lump& lump; + const GnssMetadata::IonStream& stream; + GnssMetadata::StreamEncoding stream_encoding; + int output_index = -1; + }; + std::vector streams_; + + void* buffer_; +}; + +#endif //ION_GSM_CHUNK_DATA_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc new file mode 100644 index 000000000..48aced035 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -0,0 +1,101 @@ +/*! + * \file ion_gsms_metadata_handler.cc + * \brief Build instances of IONGSMSFileSource as needed given a list of stream ids + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "ion_gsms.h" + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +IONGSMSMetadataHandler::IONGSMSMetadataHandler(const std::string& metadata_filepath) + : metadata_filepath_(metadata_filepath) +{ + load_metadata(); +} + +const std::string& IONGSMSMetadataHandler::metadata_filepath() const +{ + return metadata_filepath_; +} + +void IONGSMSMetadataHandler::load_metadata() +{ + try + { + GnssMetadata::XmlProcessor xml_proc; + if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) + { + LOG(ERROR) << "Could not load XML metadata file:"; + } + } + catch (GnssMetadata::ApiException& e) + { + LOG(ERROR) << "API Exception while loadind XML metadata file: " << e.what(); + } + catch (std::exception& e) + { + LOG(ERROR) << "Exception while loading XML metadata file: " << e.what(); + } +} + +std::vector IONGSMSMetadataHandler::make_stream_sources(const std::vector& stream_ids) const +{ + std::vector sources{}; + for (const auto& file : metadata_.Files()) + { + for (const auto& lane : metadata_.Lanes()) + { + if (lane.Id() == file.Lane().Id()) + { + for (const auto& block : lane.Blocks()) + { + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { + return stream.Id() == it; + })) + { + auto source = gnss_make_shared( + metadata_filepath_, + file, + block, + stream_ids); + + sources.push_back(source); + + // This file source will take care of any other matching streams in this block + // We can skip the rest of this block + goto next_block; + } + } + } + } + next_block: + } + break; + } + } + } + + return sources; +} + diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h new file mode 100644 index 000000000..0cbf634f6 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -0,0 +1,47 @@ +/*! + * \file ion_gsms_metadata_handler.h + * \brief Build instances of IONGSMSFileSource as needed given a list of stream ids + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef ION_GSMS_METADATA_HANDLER_H +#define ION_GSMS_METADATA_HANDLER_H + +#include "GnssMetadata.h" +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +class IONGSMSMetadataHandler +{ +public: + explicit IONGSMSMetadataHandler(const std::string& metadata_filepath); + + std::vector make_stream_sources(const std::vector& stream_ids) const; + +public: // Getters + const std::string& metadata_filepath() const; + +private: // Private methods + void load_metadata(); + +private: // State + std::string metadata_filepath_; + GnssMetadata::Metadata metadata_; +}; + +#endif //ION_GSMS_METADATA_HANDLER_H diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 69406a711..99a05e95c 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -93,6 +93,7 @@ #include "ibyte_to_complex.h" #include "ibyte_to_cshort.h" #include "in_memory_configuration.h" +#include "ion_gsms_signal_source.h" #include "ishort_to_complex.h" #include "ishort_to_cshort.h" #include "labsat_signal_source.h" @@ -113,7 +114,6 @@ #include "tracking_interface.h" #include "two_bit_cpx_file_signal_source.h" #include "two_bit_packed_file_signal_source.h" -#include "ion_gnss_ms_signal_source.h" #include // for exit #include // for exception #include // for cerr @@ -760,9 +760,9 @@ std::unique_ptr GNSSBlockFactory::GetBlock( block = std::move(block_); } #endif - else if (implementation == "ION_Metadata_Standard_Signal_Source") + else if (implementation == "ION_GSMS_Signal_Source") { - std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } From 00fd1821b17f0512b13dc556d6478989c7271c95 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Tue, 23 Jul 2024 15:24:28 +0200 Subject: [PATCH 330/499] Fixed sample count error & refactored --- .../adapters/ion_gsms_signal_source.cc | 2 +- .../signal_source/libs/CMakeLists.txt | 2 + src/algorithms/signal_source/libs/ion_gsms.cc | 9 +- .../signal_source/libs/ion_gsms_chunk_data.cc | 140 ++++++- .../signal_source/libs/ion_gsms_chunk_data.h | 386 +----------------- .../libs/ion_gsms_chunk_unpacking_ctx.h | 153 +++++++ .../libs/ion_gsms_stream_encodings.h | 164 ++++++++ 7 files changed, 474 insertions(+), 382 deletions(-) create mode 100644 src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h create mode 100644 src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index e4becf5e3..d01268d67 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -53,7 +53,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura unsigned int in_streams, unsigned int out_streams, Concurrent_Queue* queue) - : SignalSourceBase(configuration, role, "ION_Metadata_Standard_Signal_Source"s), + : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), metadata_file_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), metadata_(metadata_file_), diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index fb7faf9ee..36f327931 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -52,6 +52,8 @@ if(ENABLE_ION) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_data.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_metadata_handler.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_metadata_handler.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_stream_encodings.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_unpacking_ctx.h) endif() diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 8110b3af1..2034f12d1 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -32,7 +32,7 @@ IONGSMSFileSource::IONGSMSFileSource( const GnssMetadata::Block& block, const std::vector& stream_ids) : gr::sync_block( - "ion_metadata_standard_source", + "ion_gsms_file_source", gr::io_signature::make(0, 0, 0), make_output_signature(block, stream_ids)), file_metadata_(file), @@ -107,7 +107,12 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada })) { ++nstreams; - const std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + } item_sizes.push_back(bits_to_item_size(sample_bitsize)); } } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index f961772a0..8a0d1a7b4 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -48,7 +48,12 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: { streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()),output_streams + output_stream_offset); ++output_streams; - const std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + } output_stream_item_size_.push_back(bits_to_item_size(sample_bitsize)); } else @@ -95,6 +100,137 @@ std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) } +template +void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, const std::function& produce) +{ + WT* data = static_cast(buffer_); + // TODO - Swap endiannes if needed + + IONGSMSChunkUnpackingCtx ctx{ + chunk_.Shift(), + data, + countwords_, + }; + + // Head padding + if (padding_bitsize_ > 0 && chunk_.Padding() == GnssMetadata::Chunk::Head) + { + ctx.shift_padding(padding_bitsize_); + } + + // Samples + for (const auto& [lump, stream, encoding, output_index] : streams_) + { + if (output_index == -1) + { + // skip stream + ctx.shift_padding(stream.Packedbits()); + } + else + { + produce(output_index, write_stream_samples(ctx, lump, stream, encoding, outputs[output_index])); + } + } +} + +template +std::size_t IONGSMSChunkData::write_stream_samples( + IONGSMSChunkUnpackingCtx& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream, + const GnssMetadata::StreamEncoding stream_encoding, + void*& out) +{ + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_count = stream.RateFactor(); + + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + sample_count *= 2; + } + + if (sample_bitsize <= 8) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + else if (sample_bitsize <= 16) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + else if (sample_bitsize <= 32) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + else if (sample_bitsize <= 64) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + } + + return sample_count; +} + +template +void IONGSMSChunkData::write_n_samples( + IONGSMSChunkUnpackingCtx& ctx, + GnssMetadata::Lump::LumpShift lump_shift, + uint8_t sample_bitsize, + std::size_t sample_count, + GnssMetadata::StreamEncoding stream_encoding, + void*& out) +{ + if (lump_shift == GnssMetadata::Lump::shiftRight) + { + auto* sample = static_cast(out); + sample += sample_count; + for (std::size_t i = 0; i < sample_count; ++i) + { + ctx.shift_sample(sample_bitsize, sample); + dump_sample(*sample); + decode_sample(sample_bitsize, sample, stream_encoding); + --sample; + } + } + else // if (lump_shift == GnssMetadata::Lump::shiftLeft || lump_shift == GnssMetadata::Lump::shiftUndefined) + { + auto* sample = static_cast(out); + for (std::size_t i = 0; i < sample_count; ++i) + { + ctx.shift_sample(sample_bitsize, sample); + dump_sample(*sample); + decode_sample(sample_bitsize, sample, stream_encoding); + ++sample; + } + } +} + + + +// Static utilities +void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, auto* sample, const GnssMetadata::StreamEncoding encoding) +{ + using SampleType = std::remove_pointer_t; + switch (sample_bitsize) + { + case 2: + *sample = GnssMetadata::two_bit_look_up[encoding][*sample]; + break; + case 3: + *sample = GnssMetadata::three_bit_look_up[encoding][*sample]; + break; + case 4: + *sample = GnssMetadata::four_bit_look_up[encoding][*sample]; + break; + case 5: + *sample = GnssMetadata::five_bit_look_up[encoding][*sample]; + break; + default: + // TODO - Is this an error that can happen? + // for now we'll just do nothing, if the sample is this wide it may need no decoding + break; + } +} void IONGSMSChunkData::dump_sample(auto value) { @@ -102,7 +238,7 @@ void IONGSMSChunkData::dump_sample(auto value) if (count > 0) { --count; - std::cout << "SAMPLE: " << std::bitset<32>(value) << std::endl; + // std::cout << "SAMPLE: [0x" << std::hex << value << "] " << std::bitset<32>(value) << std::endl; } } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index f87a03aef..c5fc3e6f7 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -18,6 +18,8 @@ #define ION_GSM_CHUNK_DATA_H #include "GnssMetadata.h" +#include "ion_gsms_stream_encodings.h" +#include "ion_gsms_chunk_unpacking_ctx.h" #include #if USE_GLOG_AND_GFLAGS @@ -72,144 +74,6 @@ void with_word_type(const uint8_t word_size, auto&& callback) } } -namespace GnssMetadata -{ - using StreamEncoding = unsigned char; - - namespace StreamEncodings - { - constexpr unsigned char SIGN = 0; - constexpr unsigned char OB = 1; - constexpr unsigned char SM = 2; - constexpr unsigned char MS = 3; - constexpr unsigned char TC = 4; - constexpr unsigned char OG = 5; - constexpr unsigned char OBA = 6; - constexpr unsigned char SMA = 7; - constexpr unsigned char MSA = 8; - constexpr unsigned char TCA = 9; - constexpr unsigned char OGA = 10; - constexpr unsigned char FP = 11; - } - - inline StreamEncoding encoding_from_string(const std::string& str) - { - if (str == "SIGN") - { - return StreamEncodings::SIGN; - } - if (str == "OB") - { - return StreamEncodings::OB; - } - if (str == "SM") - { - return StreamEncodings::SM; - } - if (str == "MS") - { - return StreamEncodings::MS; - } - if (str == "TC") - { - return StreamEncodings::TC; - } - if (str == "OG") - { - return StreamEncodings::OG; - } - if (str == "OBA") - { - return StreamEncodings::OBA; - } - if (str == "SMA") - { - return StreamEncodings::SMA; - } - if (str == "MSA") - { - return StreamEncodings::MSA; - } - if (str == "TCA") - { - return StreamEncodings::TCA; - } - if (str == "OGA") - { - return StreamEncodings::OGA; - } - if (str == "FP") - { - return StreamEncodings::FP; - } - return 0; - } - - template - inline T two_bit_look_up[11][4] - { - [0] = {}, - [1 /*OB*/] = {-2, -1, 0, 1}, - [2 /*SM*/] = {0, 1, 0, -1}, - [3 /*MS*/] = {0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, -2, -1}, - [5 /*OG*/] = {-2, -1, 1, 0}, - [6 /*OBA*/] = {-3, -1, 1, 3}, - [7 /*SMA*/] = {1, 3, -1, -3}, - [8 /*MSA*/] = {1, -1, 3, -3}, - [9 /*TCA*/] = {1, 3, -3, -1}, - [10 /*OGA*/] = {-3, -1, 3, 1}, - }; - - template - inline T three_bit_look_up[11][8] - { - [0] = {}, - [1 /*OB*/] = {-4, -3, -2, -1, 0, 1, 2, 3}, - [2 /*SM*/] = {0, 1, 2, 3, 0, -1, -2, -3}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, -4, -3, -2, -1}, - [5 /*OG*/] = {-4, -3, -1, -2, 3, 2, 0, 1}, - [6 /*OBA*/] = {-7, -5, -3, -1, 1, 3, 5, 7}, - [7 /*SMA*/] = {1, 3, 5, 7, -1, -3, -5, -7}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7}, - [9 /*TCA*/] = {1, 3, 5, 7, -7, -5, -3, -1}, - [10 /*OGA*/] = {-7, -5, -1, -3, 7, 5, 1, 3}, - }; - - template - inline T four_bit_look_up[11][16] - { - [0] = {}, - [1 /*OB*/] = {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, - [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, - [5 /*OG*/] = {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, - [6 /*OBA*/] = {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, - [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, - [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, - [10 /*OGA*/] = {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, - }; - - template - inline T five_bit_look_up[11][32] - { - [0] = {}, - [1 /*OB*/] = {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, - [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, - [5 /*OG*/] = {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, - [6 /*OBA*/] = {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, - [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, - [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, - [10 /*OGA*/] = {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, - }; -} - class IONGSMSChunkData { public: @@ -232,258 +96,26 @@ public: private: template - struct unpacking_context_t - { - WT* iterator_; - WT current_word_; - uint8_t bitshift_ = 0; - }; - - template - void unpack_words(gr_vector_void_star& outputs, const std::function& produce) - { - WT* data = static_cast(buffer_); - // TODO - Swap endiannes if needed - - unpacking_context_t ctx{}; - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ctx.iterator_ = data; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - ctx.iterator_ = &data[countwords_]; - } - advance_word(ctx); // Initializes ctx.current_word_ - - // Head padding - if (padding_bitsize_ > 0 && chunk_.Padding() == GnssMetadata::Chunk::Head) - { - shift_padding(ctx, padding_bitsize_); - } - - // Samples - for (const auto& [lump, stream, encoding, output_index] : streams_) - { - if (output_index == -1) - { - skip_stream(ctx, lump, stream); - } - else - { - produce(output_index, write_stream_samples(ctx, lump, stream, encoding, outputs[output_index])); - } - } - } - - template - void skip_stream( - unpacking_context_t& ctx, - const GnssMetadata::Lump& lump, - const GnssMetadata::IonStream& stream) - { - shift_padding(ctx, stream.Packedbits()); - } + void unpack_words(gr_vector_void_star& outputs, const std::function& produce); template std::size_t write_stream_samples( - unpacking_context_t& ctx, + IONGSMSChunkUnpackingCtx& ctx, const GnssMetadata::Lump& lump, const GnssMetadata::IonStream& stream, - const GnssMetadata::StreamEncoding stream_encoding, - void*& out) - { - std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); - std::size_t sample_count = stream.RateFactor(); - - if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) - { - // Samples have 'Complex' format - sample_bitsize /= 2; - sample_count *= 2; - } - - if (sample_bitsize <= 8) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); - } - else if (sample_bitsize <= 16) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); - } - else if (sample_bitsize <= 32) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); - } - else if (sample_bitsize <= 64) - { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); - } - - return sample_count; - } + GnssMetadata::StreamEncoding stream_encoding, + void*& out); template void write_n_samples( - unpacking_context_t& ctx, + IONGSMSChunkUnpackingCtx& ctx, GnssMetadata::Lump::LumpShift lump_shift, uint8_t sample_bitsize, std::size_t sample_count, GnssMetadata::StreamEncoding stream_encoding, - void*& out) - { - if (lump_shift == GnssMetadata::Lump::shiftRight) - { - auto* sample = static_cast(out); - sample += sample_count; - for (std::size_t i = 0; i < sample_count; ++i) - { - shift_sample(ctx, sample_bitsize, sample); - decode_sample(sample_bitsize, sample, stream_encoding); - --sample; - } - } - else // if (lump_shift == GnssMetadata::Lump::shiftLeft || lump_shift == GnssMetadata::Lump::shiftUndefined) - { - auto* sample = static_cast(out); - for (std::size_t i = 0; i < sample_count; ++i) - { - shift_sample(ctx, sample_bitsize, sample); - decode_sample(sample_bitsize, sample, stream_encoding); - ++sample; - } - } - } + void*& out); - template - void shift_sample(unpacking_context_t& ctx, uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) - { - const uint8_t word_bitsize = sizeword_ * 8; - - if ((sample_bitsize + (ctx.bitshift_ % word_bitsize)) > word_bitsize) - { - uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); - - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - WT mask = ~((1 << (word_bitsize - bits_shifted)) - 1); - dump_sample(ctx.current_word_ & mask); - *output |= ((ctx.current_word_ & mask) >> output_bit_offset); - ctx.current_word_ <<= bits_shifted; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - WT mask = ((1 << (bits_shifted)) - 1); - dump_sample(ctx.current_word_ & mask); - *output |= (ctx.current_word_ & mask) << output_bit_offset; - // TODO - reverse bit order of sample? maybe? - ctx.current_word_ >>= bits_shifted; - } - - advance_word(ctx); - ctx.bitshift_ += bits_shifted; - shift_sample(ctx, sample_bitsize - bits_shifted, output, bits_shifted); - } - else - { - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - WT mask = ~((1 << (word_bitsize - sample_bitsize)) - 1); - OT sample = (ctx.current_word_ & mask) >> (word_bitsize - sample_bitsize); - dump_sample(sample); - *output |= (sample) >> output_bit_offset; - ctx.current_word_ <<= sample_bitsize; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - WT mask = ((1 << (sample_bitsize)) - 1); - dump_sample(ctx.current_word_ & mask); - *output |= (ctx.current_word_ & mask) << output_bit_offset; - // TODO - reverse bit order of sample? maybe? - ctx.current_word_ >>= sample_bitsize; - } - - ctx.bitshift_ += sample_bitsize; - } - } - - template - void shift_padding(unpacking_context_t& ctx, uint8_t n_bits) - { - if(n_bits == 0) return; - - const uint8_t word_bitsize = sizeword_ * 8; - - if ((n_bits + (ctx.bitshift_ % word_bitsize)) >= word_bitsize) - { - uint8_t bits_shifted = word_bitsize - (ctx.bitshift_ % word_bitsize); - - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ctx.current_word_ <<= bits_shifted; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - ctx.current_word_ >>= bits_shifted; - } - - advance_word(ctx); - ctx.bitshift_ += bits_shifted; - shift_padding(ctx, n_bits - bits_shifted); - } - else - { - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ctx.current_word_ <<= n_bits; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - ctx.current_word_ >>= n_bits; - } - - ctx.bitshift_ += n_bits; - } - } - - template - void advance_word(unpacking_context_t& ctx) - { - WT word = *ctx.iterator_; - if (chunk_.Shift() == GnssMetadata::Chunk::Left) - { - ++ctx.iterator_; - } - else if (chunk_.Shift() == GnssMetadata::Chunk::Right) - { - --ctx.iterator_; - } - - ctx.current_word_ = word; - } - - template - static void decode_sample(const uint8_t sample_bitsize, ST* sample, const GnssMetadata::StreamEncoding encoding) - { - switch (sample_bitsize) - { - case 2: - *sample = GnssMetadata::two_bit_look_up[encoding][*sample]; - break; - case 3: - *sample = GnssMetadata::three_bit_look_up[encoding][*sample]; - break; - case 4: - *sample = GnssMetadata::four_bit_look_up[encoding][*sample]; - break; - case 5: - *sample = GnssMetadata::five_bit_look_up[encoding][*sample]; - break; - default: - // TODO - Is this an error that can happen? - break; - } - } + static void decode_sample(uint8_t sample_bitsize, auto* sample, GnssMetadata::StreamEncoding encoding); static void dump_sample(auto value); diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h new file mode 100644 index 000000000..249063e4d --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -0,0 +1,153 @@ +/*! + * \file ion_gsms_chunk_unpacking_ctx.h + * \brief Holds state and provides utilities for unpacking samples from a chunk + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * This is a template class, and thus, its member functions must be defined in the header file. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef ION_GSM_CHUNK_UNPACKING_CTX_H +#define ION_GSM_CHUNK_UNPACKING_CTX_H + +#include "GnssMetadata.h" +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +template +struct IONGSMSChunkUnpackingCtx +{ + static constexpr uint8_t word_bitsize_ = sizeof(WT) * 8; + + const GnssMetadata::Chunk::WordShift word_shift_direction_; + WT* iterator_; // Not owned by this class, must not destroy + WT current_word_; + uint8_t bitshift_ = 0; + + IONGSMSChunkUnpackingCtx( + const GnssMetadata::Chunk::WordShift word_shift, + WT* data_buffer, + uint8_t data_buffer_word_count) : word_shift_direction_(word_shift) + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + iterator_ = data_buffer; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + iterator_ = &data_buffer[data_buffer_word_count]; + } + advance_word(); // Initializes current_word_ + } + + void advance_word() + { + WT word = *iterator_; + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + ++iterator_; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + --iterator_; + } + + current_word_ = word; + } + + void shift_current_word(uint8_t n) + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + current_word_ <<= n; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + current_word_ >>= n; + } + + bitshift_ += n; + if (bitshift_ >= word_bitsize_) + { + advance_word(); + bitshift_ -= word_bitsize_; + } + } + + void shift_padding(uint8_t n_bits) + { + if (n_bits == 0) + { + return; + } + + if ((n_bits + (bitshift_ % word_bitsize_)) >= word_bitsize_) + { + const uint8_t bits_shifted = word_bitsize_ - (bitshift_ % word_bitsize_); + + shift_current_word(bits_shifted); + shift_padding(n_bits - bits_shifted); + } + else + { + shift_current_word(n_bits); + } + } + + template + void shift_sample(const uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) + { + if ((sample_bitsize + (bitshift_ % word_bitsize_)) > word_bitsize_) + { + const uint8_t bits_shifted = word_bitsize_ - (bitshift_ % word_bitsize_); + + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize_ - bits_shifted)) - 1); + *output |= ((current_word_ & mask) >> output_bit_offset); + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (bits_shifted)) - 1); + *output |= (current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + } + + shift_current_word(bits_shifted); + shift_sample(sample_bitsize - bits_shifted, output, bits_shifted); + } + else + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize_ - sample_bitsize)) - 1); + OT sample = (current_word_ & mask) >> (word_bitsize_ - sample_bitsize); + *output |= (sample) >> output_bit_offset; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (sample_bitsize)) - 1); + *output |= (current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + } + + shift_current_word(sample_bitsize); + } + } +}; + +#endif //ION_GSM_CHUNK_UNPACKING_CTX_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h new file mode 100644 index 000000000..8f965ad99 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -0,0 +1,164 @@ +/*! + * \file ion_gsms_stream_encodings.h + * \brief Implements look up tables for all encodings in the standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef ION_GSM_STREAM_ENCODINGS_H +#define ION_GSM_STREAM_ENCODINGS_H + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +namespace GnssMetadata +{ + using StreamEncoding = unsigned char; + + namespace StreamEncodings + { + constexpr unsigned char SIGN = 0; + constexpr unsigned char OB = 1; + constexpr unsigned char SM = 2; + constexpr unsigned char MS = 3; + constexpr unsigned char TC = 4; + constexpr unsigned char OG = 5; + constexpr unsigned char OBA = 6; + constexpr unsigned char SMA = 7; + constexpr unsigned char MSA = 8; + constexpr unsigned char TCA = 9; + constexpr unsigned char OGA = 10; + constexpr unsigned char FP = 11; + } + + inline StreamEncoding encoding_from_string(const std::string& str) + { + if (str == "SIGN") + { + return StreamEncodings::SIGN; + } + if (str == "OB") + { + return StreamEncodings::OB; + } + if (str == "SM") + { + return StreamEncodings::SM; + } + if (str == "MS") + { + return StreamEncodings::MS; + } + if (str == "TC") + { + return StreamEncodings::TC; + } + if (str == "OG") + { + return StreamEncodings::OG; + } + if (str == "OBA") + { + return StreamEncodings::OBA; + } + if (str == "SMA") + { + return StreamEncodings::SMA; + } + if (str == "MSA") + { + return StreamEncodings::MSA; + } + if (str == "TCA") + { + return StreamEncodings::TCA; + } + if (str == "OGA") + { + return StreamEncodings::OGA; + } + if (str == "FP") + { + return StreamEncodings::FP; + } + return 0; + } + + template + inline T two_bit_look_up[11][4] + { + [0] = {}, + [1 /*OB*/] = {-2, -1, 0, 1}, + [2 /*SM*/] = {0, 1, 0, -1}, + [3 /*MS*/] = {0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, -2, -1}, + [5 /*OG*/] = {-2, -1, 1, 0}, + [6 /*OBA*/] = {-3, -1, 1, 3}, + [7 /*SMA*/] = {1, 3, -1, -3}, + [8 /*MSA*/] = {1, -1, 3, -3}, + [9 /*TCA*/] = {1, 3, -3, -1}, + [10 /*OGA*/] = {-3, -1, 3, 1}, + }; + + template + inline T three_bit_look_up[11][8] + { + [0] = {}, + [1 /*OB*/] = {-4, -3, -2, -1, 0, 1, 2, 3}, + [2 /*SM*/] = {0, 1, 2, 3, 0, -1, -2, -3}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, -4, -3, -2, -1}, + [5 /*OG*/] = {-4, -3, -1, -2, 3, 2, 0, 1}, + [6 /*OBA*/] = {-7, -5, -3, -1, 1, 3, 5, 7}, + [7 /*SMA*/] = {1, 3, 5, 7, -1, -3, -5, -7}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7}, + [9 /*TCA*/] = {1, 3, 5, 7, -7, -5, -3, -1}, + [10 /*OGA*/] = {-7, -5, -1, -3, 7, 5, 1, 3}, + }; + + template + inline T four_bit_look_up[11][16] + { + [0] = {}, + [1 /*OB*/] = {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, + [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, + [5 /*OG*/] = {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, + [6 /*OBA*/] = {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, + [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, + [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, + [10 /*OGA*/] = {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, + }; + + template + inline T five_bit_look_up[11][32] + { + [0] = {}, + [1 /*OB*/] = {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, + [5 /*OG*/] = {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, + [6 /*OBA*/] = {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, + [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, + [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, + [10 /*OGA*/] = {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, + }; +} + +#endif //ION_GSM_STREAM_ENCODINGS_H From cd2614a4dc2d6acaca3f1ee90ae4137ee765f53f Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sun, 28 Jul 2024 17:36:29 +0200 Subject: [PATCH 331/499] Bufferef IO & propagate configuration inside ION source --- .../adapters/ion_gsms_signal_source.cc | 2 +- src/algorithms/signal_source/libs/ion_gsms.cc | 43 ++++++++++++++++--- src/algorithms/signal_source/libs/ion_gsms.h | 7 +++ .../signal_source/libs/ion_gsms_chunk_data.cc | 9 +++- .../signal_source/libs/ion_gsms_chunk_data.h | 2 +- .../libs/ion_gsms_metadata_handler.cc | 4 +- .../libs/ion_gsms_metadata_handler.h | 3 +- 7 files changed, 58 insertions(+), 12 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index d01268d67..0be954a4a 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -66,7 +66,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura LOG(ERROR) << "A signal source does not have an input stream"; } - sources_ = metadata_.make_stream_sources(stream_ids_); + sources_ = metadata_.make_stream_sources(configuration, role, stream_ids_); for (const auto& source : sources_) { diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 2034f12d1..66acb865c 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -25,8 +25,11 @@ #include #endif +using namespace std::string_literals; IONGSMSFileSource::IONGSMSFileSource( + const ConfigurationInterface* configuration, + const std::string& role, const std::filesystem::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, @@ -36,7 +39,9 @@ IONGSMSFileSource::IONGSMSFileSource( gr::io_signature::make(0, 0, 0), make_output_signature(block, stream_ids)), file_metadata_(file), - block_metadata_(block) + block_metadata_(block), + io_buffer_offset_(0), + chunk_cycle_length_(0) { std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); fd_ = std::fopen(data_filepath.c_str(), "rb"); @@ -47,6 +52,7 @@ IONGSMSFileSource::IONGSMSFileSource( for (const auto& chunk : block.Chunks()) { chunk_data_.emplace_back(std::make_shared(chunk, stream_ids, output_stream_offset)); + chunk_cycle_length_ += chunk.CountWords() * chunk.SizeWord(); const std::size_t out_count = chunk_data_.back()->output_stream_count(); output_stream_offset += out_count; for (std::size_t i = 0; i < out_count; ++i) @@ -55,6 +61,8 @@ IONGSMSFileSource::IONGSMSFileSource( } } output_stream_count_ = output_stream_offset; + + io_buffer_.resize(1024 * chunk_cycle_length_); } IONGSMSFileSource::~IONGSMSFileSource() @@ -67,16 +75,39 @@ int IONGSMSFileSource::work( gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) { - // for (int i = 0; i < noutput_items; ++i) - // { + io_buffer_offset_ = 0; + std::fread(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type), io_buffer_.size(), fd_); + std::vector items_produced{}; + + items_produced.resize(output_items.size()); + for (int i = 0; i < items_produced.size(); ++i) + { + items_produced[i] = 0; + } + + + while (io_buffer_offset_ < io_buffer_.size()) + { for (auto& c : chunk_data_) { - c->read_from_file(fd_); + io_buffer_offset_ += c->read_from_buffer(io_buffer_.data(), io_buffer_offset_); c->write_to_output(output_items, [&](int output, int nitems) { - produce(output, nitems); + items_produced[output] += nitems; + + // if (nitems_written(output) % 100 == 0) + // { + // add_item_tag(output, nitems_written(output), pmt::mp("tag_test"), pmt::from_uint64(nitems_written(output))); + // } }); } - // } + } + + std::cout << "produced: " << std::to_string(items_produced[0]) << std::endl; + for (int i = 0; i < items_produced.size(); ++i) + { + produce(i, items_produced[i]); + } + return WORK_CALLED_PRODUCE; } diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index a15206b84..a1091e700 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -19,10 +19,12 @@ #include "gnss_block_interface.h" #include "ion_gsms_chunk_data.h" +#include "configuration_interface.h" #include #include #include #include +#include class IONGSMSFileSource : public gr::sync_block @@ -31,6 +33,8 @@ public: using sptr = gnss_shared_ptr; IONGSMSFileSource( + const ConfigurationInterface* configuration, + const std::string& role, const std::filesystem::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, @@ -53,9 +57,12 @@ private: const GnssMetadata::File& file_metadata_; const GnssMetadata::Block& block_metadata_; FILE* fd_; + std::vector io_buffer_; + std::size_t io_buffer_offset_; std::size_t output_stream_count_; std::vector output_stream_item_sizes_; std::vector> chunk_data_; + std::size_t chunk_cycle_length_; }; #include "ion_gsms_metadata_handler.h" diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index 8a0d1a7b4..54d74e084 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -76,9 +76,11 @@ IONGSMSChunkData::~IONGSMSChunkData() }); } -void IONGSMSChunkData::read_from_file(FILE* fd) +std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offset) { - std::fread(buffer_, sizeword_, countwords_, fd); + memset(buffer_, 0, sizeword_ * countwords_); + memcpy(buffer_, &buffer[offset], sizeword_ * countwords_); + return sizeword_ * countwords_; } void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, const std::function& produce) @@ -89,6 +91,7 @@ void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, const std:: }); } + std::size_t IONGSMSChunkData::output_stream_count() const { return output_stream_count_; @@ -203,6 +206,8 @@ void IONGSMSChunkData::write_n_samples( ++sample; } } + + out += sample_count * sizeof(OT); } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index c5fc3e6f7..6a4f7e49e 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -87,7 +87,7 @@ public: IONGSMSChunkData(IONGSMSChunkData&& rhl) = delete; IONGSMSChunkData& operator=(IONGSMSChunkData&& rhl) = delete; - void read_from_file(FILE* fd); + std::size_t read_from_buffer(uint8_t* buffer, std::size_t offset); void write_to_output(gr_vector_void_star& outputs, const std::function& produce); diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index 48aced035..e9568bb93 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -53,7 +53,7 @@ void IONGSMSMetadataHandler::load_metadata() } } -std::vector IONGSMSMetadataHandler::make_stream_sources(const std::vector& stream_ids) const +std::vector IONGSMSMetadataHandler::make_stream_sources(const ConfigurationInterface* configuration, const std::string& role, const std::vector& stream_ids) const { std::vector sources{}; for (const auto& file : metadata_.Files()) @@ -75,6 +75,8 @@ std::vector IONGSMSMetadataHandler::make_stream_sources })) { auto source = gnss_make_shared( + configuration, + role, metadata_filepath_, file, block, diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 0cbf634f6..28da13564 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -18,6 +18,7 @@ #define ION_GSMS_METADATA_HANDLER_H #include "GnssMetadata.h" +#include "configuration_interface.h" #include #if USE_GLOG_AND_GFLAGS @@ -31,7 +32,7 @@ class IONGSMSMetadataHandler public: explicit IONGSMSMetadataHandler(const std::string& metadata_filepath); - std::vector make_stream_sources(const std::vector& stream_ids) const; + std::vector make_stream_sources(const ConfigurationInterface* configuration, const std::string& role, const std::vector& stream_ids) const; public: // Getters const std::string& metadata_filepath() const; From 38a24f525040e4079ac86984e0b8bc2fd9aef8b1 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Fri, 16 Aug 2024 15:51:24 +0200 Subject: [PATCH 332/499] Reset sample value before writing new one Sample values are ORed into the output buffer because they may need a few read/write operations depending on alignment. So, if we don't set the value to 0 before doing this, all samples quickly become 0xFF after a few cycles of the output buffer. --- src/algorithms/signal_source/libs/ion_gsms.cc | 4 ++-- src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc | 2 ++ .../signal_source/libs/ion_gsms_metadata_handler.cc | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 66acb865c..fed13c8a2 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -62,7 +62,7 @@ IONGSMSFileSource::IONGSMSFileSource( } output_stream_count_ = output_stream_offset; - io_buffer_.resize(1024 * chunk_cycle_length_); + io_buffer_.resize((16*1024 - 1) * chunk_cycle_length_); } IONGSMSFileSource::~IONGSMSFileSource() @@ -102,7 +102,7 @@ int IONGSMSFileSource::work( } } - std::cout << "produced: " << std::to_string(items_produced[0]) << std::endl; + // std::cout << "produced: " << std::to_string(items_produced[0]) << " out of " << std::to_string(noutput_items) << std::endl; for (int i = 0; i < items_produced.size(); ++i) { produce(i, items_produced[i]); diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index 54d74e084..e8fb0157a 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -189,6 +189,7 @@ void IONGSMSChunkData::write_n_samples( sample += sample_count; for (std::size_t i = 0; i < sample_count; ++i) { + *sample = 0; ctx.shift_sample(sample_bitsize, sample); dump_sample(*sample); decode_sample(sample_bitsize, sample, stream_encoding); @@ -200,6 +201,7 @@ void IONGSMSChunkData::write_n_samples( auto* sample = static_cast(out); for (std::size_t i = 0; i < sample_count; ++i) { + *sample = 0; ctx.shift_sample(sample_bitsize, sample); dump_sample(*sample); decode_sample(sample_bitsize, sample, stream_encoding); diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index e9568bb93..47ae4e6ed 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -45,7 +45,7 @@ void IONGSMSMetadataHandler::load_metadata() } catch (GnssMetadata::ApiException& e) { - LOG(ERROR) << "API Exception while loadind XML metadata file: " << e.what(); + LOG(ERROR) << "API Exception while loading XML metadata file: " << std::to_string(e.Error()); } catch (std::exception& e) { From 01bbc39fa64f018839f035644f5d4a6fd45f858b Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 20:14:31 +0200 Subject: [PATCH 333/499] Simpler handling of simpler bit formats If a sample is the same size as a word, it is much easier to read. --- .../libs/ion_gsms_chunk_unpacking_ctx.h | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h index 249063e4d..758e9b197 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -34,7 +34,7 @@ struct IONGSMSChunkUnpackingCtx static constexpr uint8_t word_bitsize_ = sizeof(WT) * 8; const GnssMetadata::Chunk::WordShift word_shift_direction_; - WT* iterator_; // Not owned by this class, must not destroy + WT* iterator_; // Not owned by this class, MUST NOT destroy WT current_word_; uint8_t bitshift_ = 0; @@ -71,6 +71,15 @@ struct IONGSMSChunkUnpackingCtx void shift_current_word(uint8_t n) { + if ((n % word_bitsize_) == 0) + { + for (uint8_t i = 0; i < (n / word_bitsize_); ++i) + { + advance_word(); + } + return; + } + if (word_shift_direction_ == GnssMetadata::Chunk::Left) { current_word_ <<= n; @@ -111,7 +120,24 @@ struct IONGSMSChunkUnpackingCtx template void shift_sample(const uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) { - if ((sample_bitsize + (bitshift_ % word_bitsize_)) > word_bitsize_) + if (sample_bitsize % word_bitsize_ == 0) + { + const uint8_t words_per_sample = sample_bitsize / word_bitsize_; + for (uint8_t i = 0; i < words_per_sample; ++i) + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + *output |= (current_word_ << ((words_per_sample - 1 - i) * word_bitsize_)); + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + *output |= (current_word_ << (i * word_bitsize_)); + // TODO - reverse bit order of sample? maybe? + } + advance_word(); + } + } + else if ((sample_bitsize + (bitshift_ % word_bitsize_)) > word_bitsize_) { const uint8_t bits_shifted = word_bitsize_ - (bitshift_ % word_bitsize_); From 33067d631d1398c5b41ec7f952fee93d00858426 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 20:20:27 +0200 Subject: [PATCH 334/499] Less callback shenanigans --- src/algorithms/signal_source/libs/ion_gsms.cc | 25 ++++++----------- src/algorithms/signal_source/libs/ion_gsms.h | 1 + .../signal_source/libs/ion_gsms_chunk_data.cc | 28 ++++++++++++++----- .../signal_source/libs/ion_gsms_chunk_data.h | 4 +-- 4 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index fed13c8a2..1f6841224 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -77,35 +77,26 @@ int IONGSMSFileSource::work( { io_buffer_offset_ = 0; std::fread(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type), io_buffer_.size(), fd_); - std::vector items_produced{}; - items_produced.resize(output_items.size()); - for (int i = 0; i < items_produced.size(); ++i) + items_produced_.resize(output_items.size()); + for (int i = 0; i < items_produced_.size(); ++i) { - items_produced[i] = 0; + items_produced_[i] = 0; } - while (io_buffer_offset_ < io_buffer_.size()) { for (auto& c : chunk_data_) { - io_buffer_offset_ += c->read_from_buffer(io_buffer_.data(), io_buffer_offset_); - c->write_to_output(output_items, [&](int output, int nitems) { - items_produced[output] += nitems; - - // if (nitems_written(output) % 100 == 0) - // { - // add_item_tag(output, nitems_written(output), pmt::mp("tag_test"), pmt::from_uint64(nitems_written(output))); - // } - }); + auto* chunk = c.get(); + io_buffer_offset_ += chunk->read_from_buffer(io_buffer_.data(), io_buffer_offset_); + chunk->write_to_output(output_items, items_produced_); } } - // std::cout << "produced: " << std::to_string(items_produced[0]) << " out of " << std::to_string(noutput_items) << std::endl; - for (int i = 0; i < items_produced.size(); ++i) + for (int i = 0; i < items_produced_.size(); ++i) { - produce(i, items_produced[i]); + produce(i, items_produced_[i]); } return WORK_CALLED_PRODUCE; diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index a1091e700..629e00866 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -59,6 +59,7 @@ private: FILE* fd_; std::vector io_buffer_; std::size_t io_buffer_offset_; + std::vector items_produced_; std::size_t output_stream_count_; std::vector output_stream_item_sizes_; std::vector> chunk_data_; diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index e8fb0157a..dd2a09865 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -83,12 +83,26 @@ std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offs return sizeword_ * countwords_; } -void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, const std::function& produce) +void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, std::vector& output_items) { - with_word_type(sizeword_, [&] - { - unpack_words(outputs, produce); - }); + switch (sizeword_) + { + case 1: + unpack_words(outputs, output_items); + break; + case 2: + unpack_words(outputs, output_items); + break; + case 4: + unpack_words(outputs, output_items); + break; + case 8: + unpack_words(outputs, output_items); + break; + default: + LOG(ERROR) << "Unknown word size (" << std::to_string(sizeword_) << "), unpacking nothing."; + break; + } } @@ -104,7 +118,7 @@ std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) template -void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, const std::function& produce) +void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector& output_items) { WT* data = static_cast(buffer_); // TODO - Swap endiannes if needed @@ -131,7 +145,7 @@ void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, const std::fun } else { - produce(output_index, write_stream_samples(ctx, lump, stream, encoding, outputs[output_index])); + output_items[output_index] += write_stream_samples(ctx, lump, stream, encoding, outputs[output_index]); } } } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 6a4f7e49e..4f517cf3f 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -89,14 +89,14 @@ public: std::size_t read_from_buffer(uint8_t* buffer, std::size_t offset); - void write_to_output(gr_vector_void_star& outputs, const std::function& produce); + void write_to_output(gr_vector_void_star& outputs, std::vector& output_items); std::size_t output_stream_count() const; std::size_t output_stream_item_size(std::size_t stream_index) const; private: template - void unpack_words(gr_vector_void_star& outputs, const std::function& produce); + void unpack_words(gr_vector_void_star& outputs, std::vector& output_items); template std::size_t write_stream_samples( From b36894246393f691b211432e8a475393e05029d7 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 20:22:39 +0200 Subject: [PATCH 335/499] Fix wrong buffer size --- src/algorithms/signal_source/libs/ion_gsms.cc | 6 ++++-- src/algorithms/signal_source/libs/ion_gsms.h | 1 + src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc | 8 ++++++++ src/algorithms/signal_source/libs/ion_gsms_chunk_data.h | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 1f6841224..d7036907a 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -41,6 +41,7 @@ IONGSMSFileSource::IONGSMSFileSource( file_metadata_(file), block_metadata_(block), io_buffer_offset_(0), + maximum_item_rate_(0), chunk_cycle_length_(0) { std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); @@ -58,11 +59,10 @@ IONGSMSFileSource::IONGSMSFileSource( for (std::size_t i = 0; i < out_count; ++i) { output_stream_item_sizes_.push_back(chunk_data_.back()->output_stream_item_size(i)); + maximum_item_rate_ = std::max(chunk_data_.back()->output_stream_item_rate(i), maximum_item_rate_); } } output_stream_count_ = output_stream_offset; - - io_buffer_.resize((16*1024 - 1) * chunk_cycle_length_); } IONGSMSFileSource::~IONGSMSFileSource() @@ -75,6 +75,8 @@ int IONGSMSFileSource::work( gr_vector_const_void_star& input_items, gr_vector_void_star& output_items) { + const std::size_t max_sample_output = std::floor((noutput_items-1.0) / maximum_item_rate_); + io_buffer_.resize(max_sample_output * chunk_cycle_length_); io_buffer_offset_ = 0; std::fread(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type), io_buffer_.size(), fd_); diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index 629e00866..443ed3a81 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -62,6 +62,7 @@ private: std::vector items_produced_; std::size_t output_stream_count_; std::vector output_stream_item_sizes_; + std::size_t maximum_item_rate_; std::vector> chunk_data_; std::size_t chunk_cycle_length_; }; diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index dd2a09865..229d7a0d5 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -49,12 +49,15 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()),output_streams + output_stream_offset); ++output_streams; std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_rate = stream.RateFactor(); if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) { // Samples have 'Complex' format sample_bitsize /= 2; + sample_rate *= 2; } output_stream_item_size_.push_back(bits_to_item_size(sample_bitsize)); + output_stream_item_rate_.push_back(sample_rate); } else { @@ -116,6 +119,11 @@ std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) return output_stream_item_size_[stream_index]; } +std::size_t IONGSMSChunkData::output_stream_item_rate(std::size_t stream_index) const +{ + return output_stream_item_rate_[stream_index]; +} + template void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector& output_items) diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 4f517cf3f..97ce022c4 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -93,6 +93,7 @@ public: std::size_t output_stream_count() const; std::size_t output_stream_item_size(std::size_t stream_index) const; + std::size_t output_stream_item_rate(std::size_t stream_index) const; private: template @@ -126,6 +127,7 @@ private: uint8_t padding_bitsize_; std::size_t output_stream_count_; std::vector output_stream_item_size_; + std::vector output_stream_item_rate_; struct stream_metadata_t { From cf01a2d37a3ab9317489bad69792db7f7ff81e82 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 20:40:13 +0200 Subject: [PATCH 336/499] Fixed conditional compilation issues And added a comment --- .../signal_source/libs/ion_gsms_stream_encodings.h | 2 ++ src/core/receiver/CMakeLists.txt | 4 ++++ src/core/receiver/gnss_block_factory.cc | 8 ++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h index 8f965ad99..f8551159b 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -3,6 +3,8 @@ * \brief Implements look up tables for all encodings in the standard * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com * + * These tables are taken from the stardard's official document. + * * ----------------------------------------------------------------------------- * * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index cacef7f6f..604449390 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -70,6 +70,10 @@ if(ENABLE_FPGA) target_compile_definitions(core_receiver PUBLIC -DENABLE_FPGA=1) endif() +if(ENABLE_ION) + target_compile_definitions(core_receiver PRIVATE -DENABLE_ION_SOURCE=1) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(core_receiver PUBLIC -DGNURADIO_USES_STD_POINTERS=1) endif() diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 99a05e95c..07069ed9e 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -93,7 +93,6 @@ #include "ibyte_to_complex.h" #include "ibyte_to_cshort.h" #include "in_memory_configuration.h" -#include "ion_gsms_signal_source.h" #include "ishort_to_complex.h" #include "ishort_to_cshort.h" #include "labsat_signal_source.h" @@ -197,6 +196,10 @@ #include "gps_l1_ca_dll_pll_tracking_gpu.h" #endif +#if ENABLE_ION_SOURCE +#include "ion_gsms_signal_source.h" +#endif + using namespace std::string_literals; namespace @@ -760,13 +763,14 @@ std::unique_ptr GNSSBlockFactory::GetBlock( block = std::move(block_); } #endif +#if ENABLE_ION_SOURCE else if (implementation == "ION_GSMS_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, out_streams, queue); block = std::move(block_); } - +#endif #if RAW_ARRAY_DRIVER else if (implementation == "Raw_Array_Signal_Source") { From 61a9e179b061aa2432aa1b0b6c26423b7c854415 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 23:05:38 +0200 Subject: [PATCH 337/499] Linting fixes --- .../adapters/ion_gsms_signal_source.cc | 1 + .../adapters/ion_gsms_signal_source.h | 1 + src/algorithms/signal_source/libs/ion_gsms.cc | 3 + src/algorithms/signal_source/libs/ion_gsms.h | 3 +- .../signal_source/libs/ion_gsms_chunk_data.cc | 4 +- .../signal_source/libs/ion_gsms_chunk_data.h | 4 +- .../libs/ion_gsms_chunk_unpacking_ctx.h | 2 +- .../libs/ion_gsms_metadata_handler.h | 8 +- .../libs/ion_gsms_stream_encodings.h | 266 +++++++++--------- 9 files changed, 155 insertions(+), 137 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 0be954a4a..9a6d9d9a0 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -19,6 +19,7 @@ #include "ion_gsms_signal_source.h" #include #include +#include #include #if USE_GLOG_AND_GFLAGS diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index 9d959279f..19d91083c 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -23,6 +23,7 @@ #include "gnss_sdr_timestamp.h" #include "ion_gsms.h" #include +#include /** \addtogroup Signal_Source * \{ */ diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index d7036907a..c19011dfd 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -16,6 +16,9 @@ #include "gnuradio/block.h" #include "ion_gsms.h" +#include +#include +#include #if USE_GLOG_AND_GFLAGS #include diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index 443ed3a81..b7aa06b0b 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -24,7 +24,8 @@ #include #include #include -#include +#include +#include class IONGSMSFileSource : public gr::sync_block diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index 229d7a0d5..03bcab79c 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -16,6 +16,8 @@ #include "ion_gsms_chunk_data.h" #include +#include +#include #if USE_GLOG_AND_GFLAGS #include @@ -46,7 +48,7 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: return stream.Id() == it; })) { - streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()),output_streams + output_stream_offset); + streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()), output_streams + output_stream_offset); ++output_streams; std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); std::size_t sample_rate = stream.RateFactor(); diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 97ce022c4..bc0c5834d 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -21,6 +21,8 @@ #include "ion_gsms_stream_encodings.h" #include "ion_gsms_chunk_unpacking_ctx.h" #include +#include +#include #if USE_GLOG_AND_GFLAGS #include @@ -141,4 +143,4 @@ private: void* buffer_; }; -#endif //ION_GSM_CHUNK_DATA_H +#endif // ION_GSM_CHUNK_DATA_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h index 758e9b197..1dad11902 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -176,4 +176,4 @@ struct IONGSMSChunkUnpackingCtx } }; -#endif //ION_GSM_CHUNK_UNPACKING_CTX_H +#endif // ION_GSM_CHUNK_UNPACKING_CTX_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 28da13564..710233d72 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -20,6 +20,8 @@ #include "GnssMetadata.h" #include "configuration_interface.h" #include +#include +#include #if USE_GLOG_AND_GFLAGS #include @@ -37,12 +39,12 @@ public: public: // Getters const std::string& metadata_filepath() const; -private: // Private methods +private: // Private methods void load_metadata(); -private: // State +private: // State std::string metadata_filepath_; GnssMetadata::Metadata metadata_; }; -#endif //ION_GSMS_METADATA_HANDLER_H +#endif // ION_GSMS_METADATA_HANDLER_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h index f8551159b..8bae4b7e5 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -19,6 +19,8 @@ #ifndef ION_GSM_STREAM_ENCODINGS_H #define ION_GSM_STREAM_ENCODINGS_H +#include + #if USE_GLOG_AND_GFLAGS #include #else @@ -27,140 +29,144 @@ namespace GnssMetadata { - using StreamEncoding = unsigned char; - namespace StreamEncodings - { - constexpr unsigned char SIGN = 0; - constexpr unsigned char OB = 1; - constexpr unsigned char SM = 2; - constexpr unsigned char MS = 3; - constexpr unsigned char TC = 4; - constexpr unsigned char OG = 5; - constexpr unsigned char OBA = 6; - constexpr unsigned char SMA = 7; - constexpr unsigned char MSA = 8; - constexpr unsigned char TCA = 9; - constexpr unsigned char OGA = 10; - constexpr unsigned char FP = 11; - } +using StreamEncoding = unsigned char; - inline StreamEncoding encoding_from_string(const std::string& str) - { - if (str == "SIGN") - { - return StreamEncodings::SIGN; - } - if (str == "OB") - { - return StreamEncodings::OB; - } - if (str == "SM") - { - return StreamEncodings::SM; - } - if (str == "MS") - { - return StreamEncodings::MS; - } - if (str == "TC") - { - return StreamEncodings::TC; - } - if (str == "OG") - { - return StreamEncodings::OG; - } - if (str == "OBA") - { - return StreamEncodings::OBA; - } - if (str == "SMA") - { - return StreamEncodings::SMA; - } - if (str == "MSA") - { - return StreamEncodings::MSA; - } - if (str == "TCA") - { - return StreamEncodings::TCA; - } - if (str == "OGA") - { - return StreamEncodings::OGA; - } - if (str == "FP") - { - return StreamEncodings::FP; - } - return 0; - } +namespace StreamEncodings +{ - template - inline T two_bit_look_up[11][4] - { - [0] = {}, - [1 /*OB*/] = {-2, -1, 0, 1}, - [2 /*SM*/] = {0, 1, 0, -1}, - [3 /*MS*/] = {0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, -2, -1}, - [5 /*OG*/] = {-2, -1, 1, 0}, - [6 /*OBA*/] = {-3, -1, 1, 3}, - [7 /*SMA*/] = {1, 3, -1, -3}, - [8 /*MSA*/] = {1, -1, 3, -3}, - [9 /*TCA*/] = {1, 3, -3, -1}, - [10 /*OGA*/] = {-3, -1, 3, 1}, - }; +constexpr unsigned char SIGN = 0; +constexpr unsigned char OB = 1; +constexpr unsigned char SM = 2; +constexpr unsigned char MS = 3; +constexpr unsigned char TC = 4; +constexpr unsigned char OG = 5; +constexpr unsigned char OBA = 6; +constexpr unsigned char SMA = 7; +constexpr unsigned char MSA = 8; +constexpr unsigned char TCA = 9; +constexpr unsigned char OGA = 10; +constexpr unsigned char FP = 11; - template - inline T three_bit_look_up[11][8] - { - [0] = {}, - [1 /*OB*/] = {-4, -3, -2, -1, 0, 1, 2, 3}, - [2 /*SM*/] = {0, 1, 2, 3, 0, -1, -2, -3}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, -4, -3, -2, -1}, - [5 /*OG*/] = {-4, -3, -1, -2, 3, 2, 0, 1}, - [6 /*OBA*/] = {-7, -5, -3, -1, 1, 3, 5, 7}, - [7 /*SMA*/] = {1, 3, 5, 7, -1, -3, -5, -7}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7}, - [9 /*TCA*/] = {1, 3, 5, 7, -7, -5, -3, -1}, - [10 /*OGA*/] = {-7, -5, -1, -3, 7, 5, 1, 3}, - }; +} // namespace StreamEncodings - template - inline T four_bit_look_up[11][16] - { - [0] = {}, - [1 /*OB*/] = {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, - [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, - [5 /*OG*/] = {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, - [6 /*OBA*/] = {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, - [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, - [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, - [10 /*OGA*/] = {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, - }; - - template - inline T five_bit_look_up[11][32] - { - [0] = {}, - [1 /*OB*/] = {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, - [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, - [5 /*OG*/] = {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, - [6 /*OBA*/] = {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, - [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, - [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, - [10 /*OGA*/] = {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, - }; +inline StreamEncoding encoding_from_string(const std::string& str) +{ + if (str == "SIGN") + { + return StreamEncodings::SIGN; + } + if (str == "OB") + { + return StreamEncodings::OB; + } + if (str == "SM") + { + return StreamEncodings::SM; + } + if (str == "MS") + { + return StreamEncodings::MS; + } + if (str == "TC") + { + return StreamEncodings::TC; + } + if (str == "OG") + { + return StreamEncodings::OG; + } + if (str == "OBA") + { + return StreamEncodings::OBA; + } + if (str == "SMA") + { + return StreamEncodings::SMA; + } + if (str == "MSA") + { + return StreamEncodings::MSA; + } + if (str == "TCA") + { + return StreamEncodings::TCA; + } + if (str == "OGA") + { + return StreamEncodings::OGA; + } + if (str == "FP") + { + return StreamEncodings::FP; + } + return 0; } -#endif //ION_GSM_STREAM_ENCODINGS_H +template +inline T two_bit_look_up[11][4] +{ + [0] = {}, + [1 /*OB*/] = {-2, -1, 0, 1}, + [2 /*SM*/] = {0, 1, 0, -1}, + [3 /*MS*/] = {0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, -2, -1}, + [5 /*OG*/] = {-2, -1, 1, 0}, + [6 /*OBA*/] = {-3, -1, 1, 3}, + [7 /*SMA*/] = {1, 3, -1, -3}, + [8 /*MSA*/] = {1, -1, 3, -3}, + [9 /*TCA*/] = {1, 3, -3, -1}, + [10 /*OGA*/] = {-3, -1, 3, 1}, +}; + +template +inline T three_bit_look_up[11][8] +{ + [0] = {}, + [1 /*OB*/] = {-4, -3, -2, -1, 0, 1, 2, 3}, + [2 /*SM*/] = {0, 1, 2, 3, 0, -1, -2, -3}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, -4, -3, -2, -1}, + [5 /*OG*/] = {-4, -3, -1, -2, 3, 2, 0, 1}, + [6 /*OBA*/] = {-7, -5, -3, -1, 1, 3, 5, 7}, + [7 /*SMA*/] = {1, 3, 5, 7, -1, -3, -5, -7}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7}, + [9 /*TCA*/] = {1, 3, 5, 7, -7, -5, -3, -1}, + [10 /*OGA*/] = {-7, -5, -1, -3, 7, 5, 1, 3}, +}; + +template +inline T four_bit_look_up[11][16] +{ + [0] = {}, + [1 /*OB*/] = {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, + [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, + [5 /*OG*/] = {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, + [6 /*OBA*/] = {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, + [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, + [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, + [10 /*OGA*/] = {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, +}; + +template +inline T five_bit_look_up[11][32] +{ + [0] = {}, + [1 /*OB*/] = {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, + [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, + [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, + [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, + [5 /*OG*/] = {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, + [6 /*OBA*/] = {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, + [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, + [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, + [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, + [10 /*OGA*/] = {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, +}; + +} // namespace GnssMetadata + +#endif // ION_GSM_STREAM_ENCODINGS_H From a99ceafe851ecccaca2633af258bee3e39179080 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 23:06:24 +0200 Subject: [PATCH 338/499] Fixed arithmetic operations on pointers --- src/algorithms/signal_source/libs/ion_gsms.cc | 4 ++-- .../signal_source/libs/ion_gsms_chunk_data.cc | 20 +++++++++---------- .../signal_source/libs/ion_gsms_chunk_data.h | 4 ++-- .../libs/ion_gsms_metadata_handler.cc | 13 +++++++++--- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index c19011dfd..0c9670030 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -84,7 +84,7 @@ int IONGSMSFileSource::work( std::fread(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type), io_buffer_.size(), fd_); items_produced_.resize(output_items.size()); - for (int i = 0; i < items_produced_.size(); ++i) + for (std::size_t i = 0; i < items_produced_.size(); ++i) { items_produced_[i] = 0; } @@ -99,7 +99,7 @@ int IONGSMSFileSource::work( } } - for (int i = 0; i < items_produced_.size(); ++i) + for (std::size_t i = 0; i < items_produced_.size(); ++i) { produce(i, items_produced_[i]); } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index 03bcab79c..6e64e23a9 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -155,7 +155,7 @@ void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int8_t**)(out)); } else if (sample_bitsize <= 16) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int16_t**)(out)); } else if (sample_bitsize <= 32) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int32_t**)(out)); } else if (sample_bitsize <= 64) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, out); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int64_t**)(out)); } return sample_count; @@ -205,11 +205,11 @@ void IONGSMSChunkData::write_n_samples( uint8_t sample_bitsize, std::size_t sample_count, GnssMetadata::StreamEncoding stream_encoding, - void*& out) + OT** out) { if (lump_shift == GnssMetadata::Lump::shiftRight) { - auto* sample = static_cast(out); + auto* sample = static_cast(*out); sample += sample_count; for (std::size_t i = 0; i < sample_count; ++i) { @@ -222,7 +222,7 @@ void IONGSMSChunkData::write_n_samples( } else // if (lump_shift == GnssMetadata::Lump::shiftLeft || lump_shift == GnssMetadata::Lump::shiftUndefined) { - auto* sample = static_cast(out); + auto* sample = static_cast(*out); for (std::size_t i = 0; i < sample_count; ++i) { *sample = 0; @@ -233,7 +233,7 @@ void IONGSMSChunkData::write_n_samples( } } - out += sample_count * sizeof(OT); + (*out) += sample_count; } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index bc0c5834d..3081c823b 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -107,7 +107,7 @@ private: const GnssMetadata::Lump& lump, const GnssMetadata::IonStream& stream, GnssMetadata::StreamEncoding stream_encoding, - void*& out); + void** out); template void write_n_samples( @@ -116,7 +116,7 @@ private: uint8_t sample_bitsize, std::size_t sample_count, GnssMetadata::StreamEncoding stream_encoding, - void*& out); + OT** out); static void decode_sample(uint8_t sample_bitsize, auto* sample, GnssMetadata::StreamEncoding encoding); diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index 47ae4e6ed..c5fccef61 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -70,9 +70,16 @@ std::vector IONGSMSMetadataHandler::make_stream_sources { for (const auto& stream : lump.Streams()) { - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) + bool found = false; + for (const auto & stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) { auto source = gnss_make_shared( configuration, From 27465f6a70d0a7ce4e90e7254915943ee5ce6249 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Sat, 17 Aug 2024 23:31:27 +0200 Subject: [PATCH 339/499] Fix formatting --- .../adapters/ion_gsms_signal_source.cc | 12 +-- .../adapters/ion_gsms_signal_source.h | 1 + src/algorithms/signal_source/libs/ion_gsms.cc | 36 ++++--- src/algorithms/signal_source/libs/ion_gsms.h | 4 +- .../signal_source/libs/ion_gsms_chunk_data.cc | 37 +++---- .../signal_source/libs/ion_gsms_chunk_data.h | 15 ++- .../libs/ion_gsms_metadata_handler.cc | 17 ++- .../libs/ion_gsms_stream_encodings.h | 100 +++++++++--------- src/core/receiver/gnss_block_factory.cc | 1 + 9 files changed, 117 insertions(+), 106 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 9a6d9d9a0..b4edd615f 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -14,13 +14,13 @@ * ----------------------------------------------------------------------------- */ +#include "ion_gsms_signal_source.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" -#include "ion_gsms_signal_source.h" #include #include -#include #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -53,7 +53,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura const std::string& role, unsigned int in_streams, unsigned int out_streams, - Concurrent_Queue* queue) + Concurrent_Queue* queue __attribute__((unused))) : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), metadata_file_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), @@ -71,7 +71,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura for (const auto& source : sources_) { - for (int i = 0; i < source->output_stream_count(); ++i) + for (std::size_t i = 0; i < source->output_stream_count(); ++i) { copy_blocks_.push_back(gr::blocks::copy::make(source->output_stream_item_size(i))); } @@ -84,7 +84,7 @@ void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) std::size_t cumulative_index = 0; for (const auto& source : sources_) { - for (int i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) { top_block->connect(source, i, copy_blocks_[cumulative_index], 0); } @@ -96,7 +96,7 @@ void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) std::size_t cumulative_index = 0; for (const auto& source : sources_) { - for (int i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) { top_block->disconnect(source, i, copy_blocks_[cumulative_index], 0); } diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index 19d91083c..5063b4e80 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -57,6 +57,7 @@ protected: { return (*sources_.begin())->output_stream_item_size(0); } + private: std::string metadata_file_; std::vector stream_ids_; diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 0c9670030..8389afd10 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -14,25 +14,24 @@ * ----------------------------------------------------------------------------- */ -#include "gnuradio/block.h" #include "ion_gsms.h" -#include +#include "gnuradio/block.h" #include +#include #include #if USE_GLOG_AND_GFLAGS #include #else #include - #include #endif using namespace std::string_literals; IONGSMSFileSource::IONGSMSFileSource( - const ConfigurationInterface* configuration, - const std::string& role, + const ConfigurationInterface* configuration __attribute__((unused)), + const std::string& role __attribute__((unused)), const std::filesystem::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, @@ -75,18 +74,18 @@ IONGSMSFileSource::~IONGSMSFileSource() int IONGSMSFileSource::work( int noutput_items, - gr_vector_const_void_star& input_items, + gr_vector_const_void_star& input_items __attribute__((unused)), gr_vector_void_star& output_items) { - const std::size_t max_sample_output = std::floor((noutput_items-1.0) / maximum_item_rate_); + const std::size_t max_sample_output = std::floor((noutput_items - 1.0) / maximum_item_rate_); io_buffer_.resize(max_sample_output * chunk_cycle_length_); io_buffer_offset_ = 0; std::fread(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type), io_buffer_.size(), fd_); items_produced_.resize(output_items.size()); - for (std::size_t i = 0; i < items_produced_.size(); ++i) + for (int& i : items_produced_) { - items_produced_[i] = 0; + i = 0; } while (io_buffer_offset_ < io_buffer_.size()) @@ -121,7 +120,7 @@ std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) { int nstreams = 0; - std::vector item_sizes{}; + std::vector item_sizes{}; for (const auto& chunk : block.Chunks()) { @@ -129,9 +128,16 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada { for (const auto& stream : lump.Streams()) { - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) + bool found = false; + for (const auto& stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) { ++nstreams; std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); @@ -146,10 +152,8 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada } } - return gr::io_signature::make( + return gr::io_signature::makev( nstreams, nstreams, item_sizes); } - - diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index b7aa06b0b..5164e3581 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -17,14 +17,14 @@ #ifndef GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H #define GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H +#include "configuration_interface.h" #include "gnss_block_interface.h" #include "ion_gsms_chunk_data.h" -#include "configuration_interface.h" #include #include #include -#include #include +#include #include diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index 6e64e23a9..f6d1b18b9 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -30,9 +30,8 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: sizeword_(chunk_.SizeWord()), countwords_(chunk_.CountWords()) { - with_word_type(sizeword_, [&] - { - buffer_ = new WordType[countwords_]; + with_word_type(sizeword_, [&] { + buffer_ = new WordType[countwords_]; }); const std::size_t total_bitsize = sizeword_ * countwords_ * 8; @@ -44,9 +43,16 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: { used_bitsize += stream.Packedbits(); - if (std::ranges::any_of(stream_ids.begin(), stream_ids.end(), [&](const std::string& it) { - return stream.Id() == it; - })) + bool found = false; + for (const auto& stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) { streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()), output_streams + output_stream_offset); ++output_streams; @@ -75,9 +81,8 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: IONGSMSChunkData::~IONGSMSChunkData() { - with_word_type(sizeword_, [&] - { - delete[] static_cast(buffer_); + with_word_type(sizeword_, [&] { + delete[] static_cast(buffer_); }); } @@ -215,7 +220,6 @@ void IONGSMSChunkData::write_n_samples( { *sample = 0; ctx.shift_sample(sample_bitsize, sample); - dump_sample(*sample); decode_sample(sample_bitsize, sample, stream_encoding); --sample; } @@ -227,7 +231,6 @@ void IONGSMSChunkData::write_n_samples( { *sample = 0; ctx.shift_sample(sample_bitsize, sample); - dump_sample(*sample); decode_sample(sample_bitsize, sample, stream_encoding); ++sample; } @@ -237,7 +240,6 @@ void IONGSMSChunkData::write_n_samples( } - // Static utilities void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, auto* sample, const GnssMetadata::StreamEncoding encoding) { @@ -262,14 +264,3 @@ void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, auto* sample, break; } } - -void IONGSMSChunkData::dump_sample(auto value) -{ - static int count = 100; - if (count > 0) - { - --count; - // std::cout << "SAMPLE: [0x" << std::hex << value << "] " << std::bitset<32>(value) << std::endl; - } -} - diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 3081c823b..881c431f6 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -18,8 +18,8 @@ #define ION_GSM_CHUNK_DATA_H #include "GnssMetadata.h" -#include "ion_gsms_stream_encodings.h" #include "ion_gsms_chunk_unpacking_ctx.h" +#include "ion_gsms_stream_encodings.h" #include #include #include @@ -120,8 +120,6 @@ private: static void decode_sample(uint8_t sample_bitsize, auto* sample, GnssMetadata::StreamEncoding encoding); - static void dump_sample(auto value); - private: const GnssMetadata::Chunk& chunk_; uint8_t sizeword_; @@ -137,6 +135,17 @@ private: const GnssMetadata::IonStream& stream; GnssMetadata::StreamEncoding stream_encoding; int output_index = -1; + + stream_metadata_t( + const GnssMetadata::Lump& lump_, + const GnssMetadata::IonStream& stream_, + GnssMetadata::StreamEncoding stream_encoding_, + int output_index_ = -1) : lump(lump_), + stream(stream_), + stream_encoding(stream_encoding_), + output_index(output_index_) + { + } }; std::vector streams_; diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index c5fccef61..9a05e372d 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -64,6 +64,7 @@ std::vector IONGSMSMetadataHandler::make_stream_sources { for (const auto& block : lane.Blocks()) { + bool block_done = false; for (const auto& chunk : block.Chunks()) { for (const auto& lump : chunk.Lumps()) @@ -71,7 +72,7 @@ std::vector IONGSMSMetadataHandler::make_stream_sources for (const auto& stream : lump.Streams()) { bool found = false; - for (const auto & stream_id : stream_ids) + for (const auto& stream_id : stream_ids) { if (stream_id == stream.Id()) { @@ -93,12 +94,21 @@ std::vector IONGSMSMetadataHandler::make_stream_sources // This file source will take care of any other matching streams in this block // We can skip the rest of this block - goto next_block; + block_done = true; + break; } } + + if (block_done) + { + break; + } + } + if (block_done) + { + break; } } - next_block: } break; } @@ -107,4 +117,3 @@ std::vector IONGSMSMetadataHandler::make_stream_sources return sources; } - diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h index 8bae4b7e5..443a6e823 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -104,67 +104,63 @@ inline StreamEncoding encoding_from_string(const std::string& str) } template -inline T two_bit_look_up[11][4] -{ - [0] = {}, - [1 /*OB*/] = {-2, -1, 0, 1}, - [2 /*SM*/] = {0, 1, 0, -1}, - [3 /*MS*/] = {0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, -2, -1}, - [5 /*OG*/] = {-2, -1, 1, 0}, - [6 /*OBA*/] = {-3, -1, 1, 3}, - [7 /*SMA*/] = {1, 3, -1, -3}, - [8 /*MSA*/] = {1, -1, 3, -3}, - [9 /*TCA*/] = {1, 3, -3, -1}, - [10 /*OGA*/] = {-3, -1, 3, 1}, +inline T two_bit_look_up[11][4]{ + {}, // [0] + {-2, -1, 0, 1}, // [1 /*OB*/] + {0, 1, 0, -1}, // [2 /*SM*/] + {0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, -2, -1}, // [4 /*TC*/] + {-2, -1, 1, 0}, // [5 /*OG*/] + {-3, -1, 1, 3}, // [6 /*OBA*/] + {1, 3, -1, -3}, // [7 /*SMA*/] + {1, -1, 3, -3}, // [8 /*MSA*/] + {1, 3, -3, -1}, // [9 /*TCA*/] + {-3, -1, 3, 1}, // [10 /*OGA*/] }; template -inline T three_bit_look_up[11][8] -{ - [0] = {}, - [1 /*OB*/] = {-4, -3, -2, -1, 0, 1, 2, 3}, - [2 /*SM*/] = {0, 1, 2, 3, 0, -1, -2, -3}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, -4, -3, -2, -1}, - [5 /*OG*/] = {-4, -3, -1, -2, 3, 2, 0, 1}, - [6 /*OBA*/] = {-7, -5, -3, -1, 1, 3, 5, 7}, - [7 /*SMA*/] = {1, 3, 5, 7, -1, -3, -5, -7}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7}, - [9 /*TCA*/] = {1, 3, 5, 7, -7, -5, -3, -1}, - [10 /*OGA*/] = {-7, -5, -1, -3, 7, 5, 1, 3}, +inline T three_bit_look_up[11][8]{ + {}, // [0] + {-4, -3, -2, -1, 0, 1, 2, 3}, // [1 /*OB*/] + {0, 1, 2, 3, 0, -1, -2, -3}, // [2 /*SM*/] + {0, 0, 1, -1, 0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, 2, 3, -4, -3, -2, -1}, // [4 /*TC*/] + {-4, -3, -1, -2, 3, 2, 0, 1}, // [5 /*OG*/] + {-7, -5, -3, -1, 1, 3, 5, 7}, // [6 /*OBA*/] + {1, 3, 5, 7, -1, -3, -5, -7}, // [7 /*SMA*/] + {1, -1, 3, -3, 5, -5, 7, -7}, // [8 /*MSA*/] + {1, 3, 5, 7, -7, -5, -3, -1}, // [9 /*TCA*/] + {-7, -5, -1, -3, 7, 5, 1, 3}, // [10 /*OGA*/] }; template -inline T four_bit_look_up[11][16] -{ - [0] = {}, - [1 /*OB*/] = {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, - [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, - [5 /*OG*/] = {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, - [6 /*OBA*/] = {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, - [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, - [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, - [10 /*OGA*/] = {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, +inline T four_bit_look_up[11][16]{ + {}, // [0] + {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, // [1 /*OB*/] + {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, // [2 /*SM*/] + {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, // [4 /*TC*/] + {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, // [5 /*OG*/] + {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, // [6 /*OBA*/] + {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, // [7 /*SMA*/] + {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, // [8 /*MSA*/] + {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, // [9 /*TCA*/] + {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, // [10 /*OGA*/] }; template -inline T five_bit_look_up[11][32] -{ - [0] = {}, - [1 /*OB*/] = {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, - [2 /*SM*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, - [3 /*MS*/] = {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, - [4 /*TC*/] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, - [5 /*OG*/] = {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, - [6 /*OBA*/] = {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, - [7 /*SMA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, - [8 /*MSA*/] = {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, - [9 /*TCA*/] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, - [10 /*OGA*/] = {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, +inline T five_bit_look_up[11][32]{ + {}, // [0] + {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, // [1 /*OB*/] + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, // [2 /*SM*/] + {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, // [4 /*TC*/] + {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, // [5 /*OG*/] + {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, // [6 /*OBA*/] + {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, // [7 /*SMA*/] + {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, // [8 /*MSA*/] + {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, // [9 /*TCA*/] + {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, // [10 /*OGA*/] }; } // namespace GnssMetadata diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 07069ed9e..222b93cad 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -197,6 +197,7 @@ #endif #if ENABLE_ION_SOURCE +#undef Owner #include "ion_gsms_signal_source.h" #endif From 7aa19d9642bcc730087681cc2e982106fedb05ca Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 18 Aug 2024 10:57:40 +0200 Subject: [PATCH 340/499] Use lock_guard instead of unique_lock --- .../adrv9361_z7035_signal_source_fpga.cc | 35 +++++++++---------- .../adrv9361_z7035_signal_source_fpga.h | 10 +++--- .../adapters/fmcomms5_signal_source_fpga.cc | 35 +++++++++---------- .../adapters/fmcomms5_signal_source_fpga.h | 11 +++--- .../max2771_evkit_signal_source_fpga.cc | 21 +++++------ .../max2771_evkit_signal_source_fpga.h | 4 +-- 6 files changed, 52 insertions(+), 64 deletions(-) diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc index 9d29e2de2..392d91b13 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -1,6 +1,6 @@ /*! * \file adrv9361_z7035_signal_source_fpga.cc - * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * \brief Signal source for the Analog Devices ADRV9361-Z7035 evaluation board * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -257,7 +257,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); - // dynamic bits selection if (enable_dynamic_bit_selection_) { @@ -278,8 +277,7 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() { - /* cleanup and exit */ - + // cleanup and exit if (rf_shutdown_) { std::cout << "* AD9361 Disabling RX streaming channels\n"; @@ -301,24 +299,27 @@ Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() } // disable buffer overflow checking and buffer monitoring - std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock_buffer_monitor.unlock(); + { + std::lock_guard lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + } if (thread_buffer_monitor.joinable()) { thread_buffer_monitor.join(); } - - std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); - bool bit_selection_enabled = enable_dynamic_bit_selection_; - lock_dyn_bit_sel.unlock(); + bool bit_selection_enabled = false; + { + std::lock_guard lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bit_selection_enabled = enable_dynamic_bit_selection_; + } if (bit_selection_enabled == true) { - std::unique_lock lock(dynamic_bit_selection_mutex); - enable_dynamic_bit_selection_ = false; - lock.unlock(); + { + std::lock_guard lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + } if (thread_dynamic_bit_selection.joinable()) { @@ -337,12 +338,11 @@ void Adrv9361z7035SignalSourceFPGA::run_dynamic_bit_selection_process() // setting the bit selection to the top bits dynamic_bit_selection_fpga->bit_selection(); std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); - std::unique_lock lock(dynamic_bit_selection_mutex); + std::lock_guard lock(dynamic_bit_selection_mutex); if (enable_dynamic_bit_selection_ == false) { dynamic_bit_selection_active = false; } - lock.unlock(); } } @@ -357,12 +357,11 @@ void Adrv9361z7035SignalSourceFPGA::run_buffer_monitor_process() { buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); + std::lock_guard lock(buffer_monitor_mutex); if (enable_ovf_check_buffer_monitor_active_ == false) { enable_ovf_check_buffer_monitor_active = false; } - lock.unlock(); } } diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h index 5e7e8b7e4..beffb3c70 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h @@ -1,6 +1,6 @@ /*! * \file adrv9361_z7035_signal_source_fpga.h - * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * \brief Signal source for the Analog Devices ADRV9361-Z7035 evaluation board * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -78,13 +78,14 @@ private: const uint32_t buffer_monitor_period_ms = 1000; // buffer overflow and buffer monitoring initial delay const uint32_t buffer_monitoring_initial_delay_ms = 2000; - // sample block size when running in post-processing mode - const int sample_block_size = 16384; const int32_t switch_to_real_time_mode = 2; void run_dynamic_bit_selection_process(); void run_buffer_monitor_process(); + mutable std::mutex dynamic_bit_selection_mutex; + mutable std::mutex buffer_monitor_mutex; + std::thread thread_dynamic_bit_selection; std::thread thread_buffer_monitor; @@ -92,9 +93,6 @@ private: std::shared_ptr dynamic_bit_selection_fpga; std::shared_ptr buffer_monitor_fpga; - std::mutex dynamic_bit_selection_mutex; - std::mutex buffer_monitor_mutex; - std::string gain_mode_rx1_; std::string gain_mode_rx2_; std::string rf_port_select_; diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc index d8c5a65c0..096e422db 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc @@ -1,6 +1,6 @@ /*! * \file fmcomms5_signal_source_fpga.cc - * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * \brief Signal source for the Analog Devices FMCOMMS5 directly connected * to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -217,7 +217,6 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); - // dynamic bits selection if (enable_dynamic_bit_selection_) { @@ -238,8 +237,7 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface Fmcomms5SignalSourceFPGA::~Fmcomms5SignalSourceFPGA() { - /* cleanup and exit */ - + // cleanup and exit if (rf_shutdown_) { std::cout << "* Disabling RX streaming channels\n"; @@ -250,24 +248,27 @@ Fmcomms5SignalSourceFPGA::~Fmcomms5SignalSourceFPGA() } // disable buffer overflow checking and buffer monitoring - std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock_buffer_monitor.unlock(); + { + std::lock_guard lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + } if (thread_buffer_monitor.joinable()) { thread_buffer_monitor.join(); } - - std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); - bool bit_selection_enabled = enable_dynamic_bit_selection_; - lock_dyn_bit_sel.unlock(); + bool bit_selection_enabled = false; + { + std::lock_guard lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bit_selection_enabled = enable_dynamic_bit_selection_; + } if (bit_selection_enabled == true) { - std::unique_lock lock(dynamic_bit_selection_mutex); - enable_dynamic_bit_selection_ = false; - lock.unlock(); + { + std::lock_guard lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + } if (thread_dynamic_bit_selection.joinable()) { @@ -286,12 +287,11 @@ void Fmcomms5SignalSourceFPGA::run_dynamic_bit_selection_process() // setting the bit selection to the top bits dynamic_bit_selection_fpga->bit_selection(); std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); - std::unique_lock lock(dynamic_bit_selection_mutex); + std::lock_guard lock(dynamic_bit_selection_mutex); if (enable_dynamic_bit_selection_ == false) { dynamic_bit_selection_active = false; } - lock.unlock(); } } @@ -306,12 +306,11 @@ void Fmcomms5SignalSourceFPGA::run_buffer_monitor_process() { buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); + std::lock_guard lock(buffer_monitor_mutex); if (enable_ovf_check_buffer_monitor_active_ == false) { enable_ovf_check_buffer_monitor_active = false; } - lock.unlock(); } } diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h index 1bdcf4e6f..1c5c37c73 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h @@ -1,6 +1,6 @@ /*! * \file fmcomms5_signal_source_fpga.h - * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * \brief Signal source for the Analog Devices FMCOMMS5 directly connected * to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -67,7 +67,6 @@ private: const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); const std::string default_rf_port_select = std::string("A_BALANCED"); const std::string default_gain_mode = std::string("slow_attack"); - const double default_tx_attenuation_db = -10.0; const double default_manual_gain_rx1 = 64.0; const double default_manual_gain_rx2 = 64.0; const uint64_t default_bandwidth = 12500000; @@ -78,13 +77,14 @@ private: const uint32_t buffer_monitor_period_ms = 1000; // buffer overflow and buffer monitoring initial delay const uint32_t buffer_monitoring_initial_delay_ms = 2000; - // sample block size when running in post-processing mode - const int sample_block_size = 16384; const int32_t switch_to_real_time_mode = 2; void run_dynamic_bit_selection_process(); void run_buffer_monitor_process(); + mutable std::mutex dynamic_bit_selection_mutex; + mutable std::mutex buffer_monitor_mutex; + std::thread thread_dynamic_bit_selection; std::thread thread_buffer_monitor; @@ -92,9 +92,6 @@ private: std::shared_ptr dynamic_bit_selection_fpga; std::shared_ptr buffer_monitor_fpga; - std::mutex dynamic_bit_selection_mutex; - std::mutex buffer_monitor_mutex; - std::string gain_mode_rx1_; std::string gain_mode_rx2_; std::string rf_port_select_; diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc index 788b50e77..80b310034 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -140,13 +140,11 @@ MAX2771EVKITSignalSourceFPGA::MAX2771EVKITSignalSourceFPGA(const ConfigurationIn } } + std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) { - std::vector register_values = std::vector(MAX2771_NUM_REGS); - - + auto register_values = std::vector(MAX2771_NUM_REGS); uint32_t LNA_mode = (LNA_active_) ? 0x0 : 0x2; - uint32_t Filter_Bandwidth; switch (bandwidth_) @@ -376,10 +374,10 @@ bool MAX2771EVKITSignalSourceFPGA::configure(std::vector register_valu return 0; } + MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() { - /* cleanup and exit */ - + // cleanup and exit if (rf_shutdown_) { chipen_ = false; @@ -392,7 +390,6 @@ MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() return; } - if (configure(register_values)) { std::cerr << "Error disabling the MAX2771 device " << '\n'; @@ -405,9 +402,10 @@ MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() } // disable buffer overflow checking and buffer monitoring - std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock_buffer_monitor.unlock(); + { + std::lock_guard lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + } if (thread_buffer_monitor.joinable()) { @@ -426,12 +424,11 @@ void MAX2771EVKITSignalSourceFPGA::run_buffer_monitor_process() { buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); + std::lock_guard lock(buffer_monitor_mutex); if (enable_ovf_check_buffer_monitor_active_ == false) { enable_ovf_check_buffer_monitor_active = false; } - lock.unlock(); } } diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h index 3008aa384..5ba036ca3 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h @@ -53,7 +53,6 @@ public: std::vector setup_regs(void); - inline size_t item_size() override { return item_size_; @@ -130,14 +129,13 @@ private: bool configure(std::vector register_values); void run_buffer_monitor_process(); + mutable std::mutex buffer_monitor_mutex; std::thread thread_buffer_monitor; std::shared_ptr buffer_monitor_fpga; std::shared_ptr spidev_fpga; - std::mutex buffer_monitor_mutex; - uint64_t freq_; // frequency of local oscillator uint64_t sample_rate_; From 62cb96ae03a5f3ae14b6ba7062e93ffdf7e67e2e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 09:25:05 +0200 Subject: [PATCH 341/499] Create a CMake target for the ION dependency for consistency --- CMakeLists.txt | 68 +++++++++++++++---- .../signal_source/libs/CMakeLists.txt | 9 ++- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f70609a92..8b081522b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" ON) -option(ENABLE_ION "Enable ION GNSS-SDR Metadata Standard signal source" ON) +option(ENABLE_ION "Enable ION GNSS-SDR Metadata Standard signal source" OFF) # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) @@ -1424,20 +1424,6 @@ else() endif() -################################################################################ -# ION GNSS-SDR Metadata Standard -################################################################################ -include(FetchContent) -FetchContent_Declare( - gnss_metadata_standard - GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard - GIT_TAG master - SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard - CMAKE_ARGS -DABSL_PROPAGATE_CXX_STD=ON -ABSL_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard ${ABSEIL_TOOLCHAIN_FILE} - BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard -) -FetchContent_MakeAvailable(gnss_metadata_standard) - ################################################################################ # Abseil C++ - https://abseil.io/docs/cpp/ ################################################################################ @@ -3371,6 +3357,57 @@ if(ENABLE_AD9361 OR ENABLE_FMCOMMS2) endif() +################################################################################ +# ION GNSS-SDR Metadata Standard https://sdr.ion.org/ (OPTIONAL) +################################################################################ +if(ENABLE_ION) + include(FetchContent) + set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) + FetchContent_Declare( + gnss_metadata_standard + GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard + GIT_TAG origin/master + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard + ) + FetchContent_MakeAvailable(gnss_metadata_standard) + + if(NOT TARGET ION::ion) + add_library(ION::ion STATIC IMPORTED) + add_dependencies(ION::ion gnss_metadata_standard) + if(CMAKE_GENERATOR STREQUAL "Xcode") + set_target_properties(ION::ion PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION_DEBUG "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_RELEASE "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Release/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_RELWITHDEBINFO "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_MINSIZEREL "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc" + ) + set_property(TARGET ION::ion APPEND PROPERTY + INTERFACE_LINK_LIBRARIES + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Release/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Release/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + ) + else() + set_target_properties(ION::ion PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc" + INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + endif() + endif() +endif() + ##################################################################### # Check signal sources related to FPGA only. @@ -3684,6 +3721,7 @@ add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.") add_feature_info(ENABLE_ARRAY ENABLE_ARRAY "Enables Raw_Array_Signal_Source and Array_Signal_Conditioner for using CTTC's antenna array. Requires gr-dbfcttc.") add_feature_info(ENABLE_ZMQ ENABLE_ZMQ "Enables ZMQ_Signal_Source for GNU Radio ZeroMQ messages. Requires gr-zeromq.") +add_feature_info(ENABLE_ION ENABLE_ION "Enables ION_GSMS_Signal_Source for the ION Metadata Standard.") add_feature_info(ENABLE_GPERFTOOLS ENABLE_GPERFTOOLS "Enables performance analysis. Requires Gperftools.") add_feature_info(ENABLE_GPROF ENABLE_GPROF "Enables performance analysis with 'gprof'.") add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Runs clang-tidy along with the compiler. Requires Clang.") diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 36f327931..aa4fa8eea 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -142,6 +142,10 @@ if(ENABLE_FPGA OR ENABLE_AD9361) ) endif() +if(ENABLE_ION) + target_link_libraries(signal_source_libs PUBLIC ION::ion algorithms_libs) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(signal_source_libs @@ -151,11 +155,6 @@ if(ENABLE_CLANG_TIDY) endif() endif() -if(ENABLE_ION) - target_include_directories(signal_source_libs PUBLIC ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc) - target_link_libraries(signal_source_libs PUBLIC api xml) -endif() - set_property(TARGET signal_source_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ ) From da21ff4fd9747ec52c7122c370e652bc943e1850 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 09:26:21 +0200 Subject: [PATCH 342/499] Improve formatting, add missing include --- .../adapters/ion_gsms_signal_source.cc | 13 +++++++++++-- .../signal_source/adapters/ion_gsms_signal_source.h | 5 ++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index b4edd615f..c0db26e71 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -8,7 +8,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -49,6 +49,7 @@ std::vector parse_comma_list(const std::string& str) return list; } + IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configuration, const std::string& role, unsigned int in_streams, @@ -62,10 +63,14 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura in_streams_(in_streams), out_streams_(out_streams) { - if (in_streams > 0) + if (in_streams_ > 0) { LOG(ERROR) << "A signal source does not have an input stream"; } + if (out_streams_ <= 0) + { + LOG(ERROR) << "A signal source does not have an output stream"; + } sources_ = metadata_.make_stream_sources(configuration, role, stream_ids_); @@ -91,6 +96,7 @@ void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) } } + void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) { std::size_t cumulative_index = 0; @@ -103,6 +109,7 @@ void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) } } + gr::basic_block_sptr IONGSMSSignalSource::get_left_block() { LOG(WARNING) << "Trying to get signal source left block."; @@ -110,11 +117,13 @@ gr::basic_block_sptr IONGSMSSignalSource::get_left_block() return IONGSMSFileSource::sptr(); } + gr::basic_block_sptr IONGSMSSignalSource::get_right_block() { return get_right_block(0); } + gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel) { return copy_blocks_[RF_channel]; diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index 5063b4e80..d724d101b 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -8,7 +8,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -22,6 +22,7 @@ #include "file_source_base.h" #include "gnss_sdr_timestamp.h" #include "ion_gsms.h" +#include #include #include @@ -44,8 +45,6 @@ public: ~IONGSMSSignalSource() override = default; protected: - // std::tuple itemTypeToSize() override; - // double packetsPerSample() const override; void connect(gr::top_block_sptr top_block) override; void disconnect(gr::top_block_sptr top_block) override; From e37855d43ee85d10c5ac2ac7e247349407ad6700 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 09:27:29 +0200 Subject: [PATCH 343/499] Fixes for C++ standards older than 20. Avoid C++20-specific lambda templates --- src/algorithms/signal_source/libs/ion_gsms.cc | 22 +++---- src/algorithms/signal_source/libs/ion_gsms.h | 18 +++--- .../signal_source/libs/ion_gsms_chunk_data.cc | 47 ++++++++------- .../signal_source/libs/ion_gsms_chunk_data.h | 57 +++++++++++++++---- .../libs/ion_gsms_chunk_unpacking_ctx.h | 16 +++--- .../libs/ion_gsms_metadata_handler.cc | 19 +++++-- .../libs/ion_gsms_metadata_handler.h | 21 +++---- .../libs/ion_gsms_stream_encodings.h | 14 +++-- 8 files changed, 132 insertions(+), 82 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 8389afd10..e44c0abab 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -8,7 +8,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -17,22 +17,14 @@ #include "ion_gsms.h" #include "gnuradio/block.h" #include -#include -#include - -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#include -#endif +#include using namespace std::string_literals; IONGSMSFileSource::IONGSMSFileSource( const ConfigurationInterface* configuration __attribute__((unused)), const std::string& role __attribute__((unused)), - const std::filesystem::path& metadata_filepath, + const fs::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, const std::vector& stream_ids) @@ -40,13 +32,11 @@ IONGSMSFileSource::IONGSMSFileSource( "ion_gsms_file_source", gr::io_signature::make(0, 0, 0), make_output_signature(block, stream_ids)), - file_metadata_(file), - block_metadata_(block), io_buffer_offset_(0), maximum_item_rate_(0), chunk_cycle_length_(0) { - std::filesystem::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); + fs::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); fd_ = std::fopen(data_filepath.c_str(), "rb"); std::size_t block_offset = file.Offset(); std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET); @@ -67,11 +57,13 @@ IONGSMSFileSource::IONGSMSFileSource( output_stream_count_ = output_stream_offset; } + IONGSMSFileSource::~IONGSMSFileSource() { std::fclose(fd_); } + int IONGSMSFileSource::work( int noutput_items, gr_vector_const_void_star& input_items __attribute__((unused)), @@ -106,11 +98,13 @@ int IONGSMSFileSource::work( return WORK_CALLED_PRODUCE; } + std::size_t IONGSMSFileSource::output_stream_count() const { return output_stream_count_; } + std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) const { return output_stream_item_sizes_[stream_index]; diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index 5164e3581..054b1e9dd 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -8,7 +8,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -19,14 +19,20 @@ #include "configuration_interface.h" #include "gnss_block_interface.h" +#include "gnss_sdr_filesystem.h" #include "ion_gsms_chunk_data.h" #include #include -#include +#include +#include #include #include #include +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ class IONGSMSFileSource : public gr::sync_block { @@ -36,7 +42,7 @@ public: IONGSMSFileSource( const ConfigurationInterface* configuration, const std::string& role, - const std::filesystem::path& metadata_filepath, + const fs::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, const std::vector& stream_ids); @@ -54,9 +60,6 @@ public: private: static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); -private: - const GnssMetadata::File& file_metadata_; - const GnssMetadata::Block& block_metadata_; FILE* fd_; std::vector io_buffer_; std::size_t io_buffer_offset_; @@ -70,5 +73,6 @@ private: #include "ion_gsms_metadata_handler.h" - +/** \} */ +/** \} */ #endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index f6d1b18b9..5a8cd823c 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -8,31 +8,30 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- */ #include "ion_gsms_chunk_data.h" -#include -#include -#include - +#include #if USE_GLOG_AND_GFLAGS #include #else #include #endif + IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset) : chunk_(chunk), sizeword_(chunk_.SizeWord()), countwords_(chunk_.CountWords()) { - with_word_type(sizeword_, [&] { - buffer_ = new WordType[countwords_]; - }); + // Instantiate the Allocator functor + Allocator allocator(countwords_, buffer_); + // Call with_word_type with the Allocator functor + with_word_type(sizeword_, allocator); const std::size_t total_bitsize = sizeword_ * countwords_ * 8; std::size_t used_bitsize = 0; @@ -81,11 +80,11 @@ IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std:: IONGSMSChunkData::~IONGSMSChunkData() { - with_word_type(sizeword_, [&] { - delete[] static_cast(buffer_); - }); + Deleter deleter(static_cast(buffer_)); + with_word_type(sizeword_, deleter); } + std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offset) { memset(buffer_, 0, sizeword_ * countwords_); @@ -93,6 +92,7 @@ std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offs return sizeword_ * countwords_; } + void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, std::vector& output_items) { switch (sizeword_) @@ -121,11 +121,13 @@ std::size_t IONGSMSChunkData::output_stream_count() const return output_stream_count_; } + std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) const { return output_stream_item_size_[stream_index]; } + std::size_t IONGSMSChunkData::output_stream_item_rate(std::size_t stream_index) const { return output_stream_item_rate_[stream_index]; @@ -165,6 +167,7 @@ void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector std::size_t IONGSMSChunkData::write_stream_samples( IONGSMSChunkUnpackingCtx& ctx, @@ -185,24 +188,25 @@ std::size_t IONGSMSChunkData::write_stream_samples( if (sample_bitsize <= 8) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int8_t**)(out)); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); } else if (sample_bitsize <= 16) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int16_t**)(out)); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); } else if (sample_bitsize <= 32) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int32_t**)(out)); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); } else if (sample_bitsize <= 64) { - write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, (int64_t**)(out)); + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); } return sample_count; } + template void IONGSMSChunkData::write_n_samples( IONGSMSChunkUnpackingCtx& ctx, @@ -241,22 +245,23 @@ void IONGSMSChunkData::write_n_samples( // Static utilities -void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, auto* sample, const GnssMetadata::StreamEncoding encoding) +template +void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, Sample* sample, const GnssMetadata::StreamEncoding encoding) { - using SampleType = std::remove_pointer_t; + // using SampleType = std::remove_pointer_t; switch (sample_bitsize) { case 2: - *sample = GnssMetadata::two_bit_look_up[encoding][*sample]; + *sample = GnssMetadata::two_bit_look_up[encoding][*sample]; break; case 3: - *sample = GnssMetadata::three_bit_look_up[encoding][*sample]; + *sample = GnssMetadata::three_bit_look_up[encoding][*sample]; break; case 4: - *sample = GnssMetadata::four_bit_look_up[encoding][*sample]; + *sample = GnssMetadata::four_bit_look_up[encoding][*sample]; break; case 5: - *sample = GnssMetadata::five_bit_look_up[encoding][*sample]; + *sample = GnssMetadata::five_bit_look_up[encoding][*sample]; break; default: // TODO - Is this an error that can happen? diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 881c431f6..5a6b98aba 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -8,7 +8,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,16 +21,14 @@ #include "ion_gsms_chunk_unpacking_ctx.h" #include "ion_gsms_stream_encodings.h" #include +#include +#include +#include #include #include -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif -inline std::size_t bits_to_item_size(const std::size_t bit_count) +inline std::size_t bits_to_item_size(std::size_t bit_count) { if (bit_count <= 8) { @@ -50,11 +48,46 @@ inline std::size_t bits_to_item_size(const std::size_t bit_count) } // You are asking too much of this humble processor - LOG(ERROR) << "Item size too large (" << std::to_string(bit_count) << "), returning nonsense."; + std::cerr << "Item size too large (" << std::to_string(bit_count) << "), returning nonsense.\n"; return 1; } -void with_word_type(const uint8_t word_size, auto&& callback) + +// Define a functor that has a templated operator() +struct Allocator +{ + size_t countwords_; + void*& buffer_; // Using void* to hold any type of pointer + + Allocator(size_t countwords, void*& buffer) + : countwords_(countwords), buffer_(buffer) {} + + template + void operator()() const + { + buffer_ = new WordType[countwords_]; + } +}; + + +// Define a functor to delete the allocated memory +struct Deleter +{ + void* buffer_; + + explicit Deleter(void* buffer) + : buffer_(buffer) {} + + template + void operator()() const + { + delete[] static_cast(buffer_); + } +}; + + +template +void with_word_type(uint8_t word_size, Callback callback) { switch (word_size) { @@ -71,7 +104,7 @@ void with_word_type(const uint8_t word_size, auto&& callback) callback.template operator()(); break; default: - LOG(ERROR) << "Unknown word size (" << std::to_string(word_size) << "), returning nonsense."; + std::cerr << "Unknown word size (" << std::to_string(word_size) << "), returning nonsense.\n"; break; } } @@ -118,9 +151,9 @@ private: GnssMetadata::StreamEncoding stream_encoding, OT** out); - static void decode_sample(uint8_t sample_bitsize, auto* sample, GnssMetadata::StreamEncoding encoding); + template + static void decode_sample(uint8_t sample_bitsize, Sample* sample, GnssMetadata::StreamEncoding encoding); -private: const GnssMetadata::Chunk& chunk_; uint8_t sizeword_; uint8_t countwords_; diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h index 1dad11902..c4d839de1 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -10,7 +10,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,12 +21,12 @@ #include "GnssMetadata.h" #include +#include -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ template struct IONGSMSChunkUnpackingCtx @@ -118,7 +118,7 @@ struct IONGSMSChunkUnpackingCtx } template - void shift_sample(const uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) + void shift_sample(uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) { if (sample_bitsize % word_bitsize_ == 0) { @@ -176,4 +176,6 @@ struct IONGSMSChunkUnpackingCtx } }; +/** \} */ +/** \} */ #endif // ION_GSM_CHUNK_UNPACKING_CTX_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index 9a05e372d..eea6e9c5f 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -8,14 +8,14 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- */ #include "ion_gsms.h" - +#include #if USE_GLOG_AND_GFLAGS #include #else @@ -40,16 +40,25 @@ void IONGSMSMetadataHandler::load_metadata() GnssMetadata::XmlProcessor xml_proc; if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) { - LOG(ERROR) << "Could not load XML metadata file:"; + LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_; + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); } } catch (GnssMetadata::ApiException& e) { - LOG(ERROR) << "API Exception while loading XML metadata file: " << std::to_string(e.Error()); + LOG(WARNING) << "API Exception while loading XML metadata file: " << std::to_string(e.Error()); + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << std::to_string(e.Error()) << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); } catch (std::exception& e) { - LOG(ERROR) << "Exception while loading XML metadata file: " << e.what(); + LOG(WARNING) << "Exception while loading XML metadata file: " << e.what(); + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << e.what() << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); } } diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 710233d72..62077c82a 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -8,7 +8,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -23,11 +23,11 @@ #include #include -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + class IONGSMSMetadataHandler { @@ -35,16 +35,17 @@ public: explicit IONGSMSMetadataHandler(const std::string& metadata_filepath); std::vector make_stream_sources(const ConfigurationInterface* configuration, const std::string& role, const std::vector& stream_ids) const; - -public: // Getters const std::string& metadata_filepath() const; -private: // Private methods +private: void load_metadata(); -private: // State + // State std::string metadata_filepath_; GnssMetadata::Metadata metadata_; }; + +/** \} */ +/** \} */ #endif // ION_GSMS_METADATA_HANDLER_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h index 443a6e823..90ba15cac 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -10,7 +10,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -21,11 +21,10 @@ #include -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ namespace GnssMetadata { @@ -165,4 +164,7 @@ inline T five_bit_look_up[11][32]{ } // namespace GnssMetadata + +/** \} */ +/** \} */ #endif // ION_GSM_STREAM_ENCODINGS_H From bc2a1e02b893be7fafcbf40baa384e41f2cb6d58 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 09:28:03 +0200 Subject: [PATCH 344/499] Update changelog --- docs/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 931e8988f..abdc04427 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -41,6 +41,11 @@ All notable changes to GNSS-SDR will be documented in this file. - `-DENABLE_DMA_PROXY`: Checks if the DMA proxy driver is installed for controlling the DMA in the FPGA and enables its usage. +- Add the `ION_GSMS_Signal_Source`, which is able to process raw data files + described with the + [ION GNSS Software Defined Receiver Metadata Standard](https://sdr.ion.org/). + It requires the `-DENABLE_ION=ON` building configuration option. + ### Improvements in Portability: - Fix building against google-glog 0.7.x. From fc5148bf44377e9062a697f4d1ae01b9d8276ae6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 09:28:35 +0200 Subject: [PATCH 345/499] Add Victor to the list of authors --- AUTHORS | 1 + CITATION.cff | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/AUTHORS b/AUTHORS index ad0660662..d1251f1fc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -64,6 +64,7 @@ Marc Sales marcsales92@gmail.com Contributor Piyush Gupta piyush04111999@gmail.com Contributor Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor Stefan van der Linden spvdlinden@gmail.com Contributor +Victor Castillo-Agüero victorcastilloaguero@gmail.com Contributor Will Silberman wsilberm@google.com Contributor Carlos Paniego carpanie@hotmail.com Artwork diff --git a/CITATION.cff b/CITATION.cff index 0f11b55f1..2be1e1880 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -34,6 +34,11 @@ authors: email: mara.branzanti@gmail.com family-names: Branzanti given-names: Mara + - alias: castle055 + affiliation: "Instituto Nacional de Técnica Aeroespacial" + email: victorcastilloaguero@gmail.com + family-names: "Castillo-Agüero" + given-names: Victor - alias: acebrianjuan email: acebrianjuan@gmail.com family-names: "Cebrián-Juan" From c212bac26d856308bd01040625639b39a280c2af Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 09:58:33 +0200 Subject: [PATCH 346/499] Fix CMake error --- src/algorithms/signal_source/adapters/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 9ff0ab434..d6491098f 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -171,7 +171,7 @@ target_include_directories(signal_source_adapters ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_FPGA OR ENABLE_AD9361 OR ENABLE_ION) target_link_libraries(signal_source_adapters PUBLIC signal_source_libs From 614693ea0f34fed42aa35c5e4fa788c05a116478 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 10:21:51 +0200 Subject: [PATCH 347/499] Fix building error --- src/algorithms/signal_source/libs/ion_gsms_chunk_data.h | 2 +- .../signal_source/libs/ion_gsms_chunk_unpacking_ctx.h | 2 +- src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 5a6b98aba..1dd712351 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -17,10 +17,10 @@ #ifndef ION_GSM_CHUNK_DATA_H #define ION_GSM_CHUNK_DATA_H -#include "GnssMetadata.h" #include "ion_gsms_chunk_unpacking_ctx.h" #include "ion_gsms_stream_encodings.h" #include +#include #include #include #include diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h index c4d839de1..44c125889 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -19,8 +19,8 @@ #ifndef ION_GSM_CHUNK_UNPACKING_CTX_H #define ION_GSM_CHUNK_UNPACKING_CTX_H -#include "GnssMetadata.h" #include +#include #include /** \addtogroup Signal_Source diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 62077c82a..2431fbec8 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -17,9 +17,9 @@ #ifndef ION_GSMS_METADATA_HANDLER_H #define ION_GSMS_METADATA_HANDLER_H -#include "GnssMetadata.h" #include "configuration_interface.h" #include +#include #include #include From f3ba1822b17d95bc1eb25d0ddd18481183aff238 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 10:24:48 +0200 Subject: [PATCH 348/499] Fix building --- src/algorithms/signal_source/adapters/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index d6491098f..6b58e1abe 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -103,6 +103,11 @@ if(ENABLE_ZMQ) list(APPEND OPT_DRIVER_HEADERS zmq_signal_source.h) endif() +if(ENABLE_ION) + list(APPEND OPT_DRIVER_SOURCES ion_gsms_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS ion_gsms_signal_source.h) +endif() + set(SIGNAL_SOURCE_ADAPTER_SOURCES signal_source_base.cc file_source_base.cc @@ -119,7 +124,6 @@ set(SIGNAL_SOURCE_ADAPTER_SOURCES two_bit_packed_file_signal_source.cc four_bit_cpx_file_signal_source.cc file_timestamp_signal_source.cc - ion_gsms_signal_source.cc ${OPT_DRIVER_SOURCES} ) @@ -139,7 +143,6 @@ set(SIGNAL_SOURCE_ADAPTER_HEADERS two_bit_packed_file_signal_source.h four_bit_cpx_file_signal_source.h file_timestamp_signal_source.h - ion_gsms_signal_source.h ${OPT_DRIVER_HEADERS} ) From 45d31cb3b9a637b14adc4bb497fb1336c27cfd06 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 10:29:48 +0200 Subject: [PATCH 349/499] Add -DENABLE_ION=ON to CI jobs --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32dc29f9b..7bc294b0f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev \ python3-mako liborc-0.4-dev - name: configure - run: cd build && cmake -GNinja .. + run: cd build && cmake -GNinja -DENABLE_ION=ON .. - name: build run: cd build && ninja - name: check @@ -60,7 +60,7 @@ jobs: brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure - run: cd build && cmake -GNinja .. + run: cd build && cmake -GNinja -DENABLE_ION=ON .. - name: build run: cd build && ninja - name: check @@ -92,7 +92,7 @@ jobs: brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure - run: cd build && cmake -GXcode .. + run: cd build && cmake -GXcode -DENABLE_ION=ON .. - name: build run: cd build && xcodebuild -configuration Release - name: check From df1314945f43afdb531f9b5df848e26e28e87178 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 10:56:11 +0200 Subject: [PATCH 350/499] Fix CMake lists --- src/algorithms/signal_source/libs/CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 3506dc4f7..19235ceac 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -9,12 +9,12 @@ set(OPT_SIGNAL_SOURCE_LIB_SOURCES "") set(OPT_SIGNAL_SOURCE_LIB_HEADERS "") if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad9361_manager.h) endif() if(ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_spidev.h) endif() if(ENABLE_FPGA) @@ -36,10 +36,10 @@ endif() if(ENABLE_PLUTOSDR) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_samples.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.h) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} pps_samplestamp.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_custom.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} pps_samplestamp.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ppstcprx.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ppstcprx.h) endif() From 126421f8476be402d4ab99f7c1aaa2fd0932a50d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 12:30:25 +0200 Subject: [PATCH 351/499] Catch all exceptions --- .../adapters/adrv9361_z7035_signal_source_fpga.cc | 13 +++++++++++-- .../adapters/fmcomms5_signal_source_fpga.cc | 11 +++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc index 392d91b13..cc8f7fe32 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -281,10 +281,19 @@ Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() if (rf_shutdown_) { std::cout << "* AD9361 Disabling RX streaming channels\n"; - if (!disable_ad9361_rx_local()) + try { - LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } } + catch (const std::exception &e) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels: " << e.what(); + std::cerr << "Problem shutting down the AD9361 RX channels: " << e.what() << '\n'; + } + if (enable_dds_lo_) { try diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc index 096e422db..be2108aa4 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc @@ -241,9 +241,16 @@ Fmcomms5SignalSourceFPGA::~Fmcomms5SignalSourceFPGA() if (rf_shutdown_) { std::cout << "* Disabling RX streaming channels\n"; - if (!disable_ad9361_rx_local()) + try { - LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } + } + catch (const std::exception &e) + { + std::cerr << "Problem shutting down the AD9361 RX channels: " << e.what() << '\n'; } } From 6836ac44fb5cb8d9fc5327aac5bb1b8ab1d9b370 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 19 Aug 2024 14:21:59 +0200 Subject: [PATCH 352/499] Fix building for -DENABLE_PLUTOSDR=ON --- CMakeLists.txt | 2 +- .../signal_source/adapters/CMakeLists.txt | 2 +- .../gnuradio_blocks/ad936x_iio_source.cc | 2 +- .../signal_source/libs/ad936x_iio_custom.cc | 3 +- .../signal_source/libs/ad936x_iio_custom.h | 32 +++++++++---------- .../signal_source/libs/ad936x_iio_samples.h | 12 +++++-- 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3696eede2..8c0e25d25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3338,7 +3338,7 @@ set_package_properties(LIBIIO PROPERTIES PURPOSE "Used for communication with the AD9361 chipset." TYPE OPTIONAL ) -if(ENABLE_AD9361 OR ENABLE_FMCOMMS2) +if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR) if(NOT LIBIIO_FOUND) message(STATUS "libiio not found, its installation is required.") message(STATUS "Please build and install the following projects:") diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 0aa745101..6b253d8c7 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -239,7 +239,7 @@ if(ENABLE_LIMESDR AND GRLIMESDR_FOUND) ) endif() -if(ENABLE_AD9361 AND LIBIIO_FOUND) +if(LIBIIO_FOUND) target_link_libraries(signal_source_adapters PRIVATE Iio::iio diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc index 0cf885fe2..375edf7da 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc @@ -87,7 +87,7 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out) { - int32_t current_byte = 0; + uint32_t current_byte = 0; int16_t ch = 0; // std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n"; while (current_byte < samples_in->n_bytes) diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 72461bafd..ad983aa6b 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_custom.cc - * \brief A direct IIO custom front-end driver for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end driver for the AD936x AD front-end + * family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * ----------------------------------------------------------------------------- * diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.h b/src/algorithms/signal_source/libs/ad936x_iio_custom.h index 83a61282a..ab58f36cc 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.h @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_custom.h - * \brief A direct IIO custom front-end driver for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end driver for the AD936x AD front-end + * family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * ----------------------------------------------------------------------------- * @@ -14,27 +15,27 @@ */ -#ifndef SRC_LIBS_ad936x_iio_custom_H_ -#define SRC_LIBS_ad936x_iio_custom_H_ +#ifndef GNSS_SDR_AD936X_IIO_CUSTOM_H +#define GNSS_SDR_AD936X_IIO_CUSTOM_H +#include "ad936x_iio_samples.h" #include "concurrent_queue.h" #include "gnss_time.h" #include "pps_samplestamp.h" #include +#include +#include // multichip sync and high level functions #include #include - -#ifdef __APPLE__ -#include -#else -#include -#endif - -#include "ad936x_iio_samples.h" -#include // multichip sync and high level functions #include #include +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + + class ad936x_iio_custom { public: @@ -121,10 +122,7 @@ private: struct iio_device *dds_dev; // stream - uint64_t sample_rate_sps; - - int debug_level; int log_level; bool PPS_mode; @@ -144,4 +142,6 @@ private: std::thread capture_time_thread; }; -#endif /* SRC_LIBS_ad936x_iio_custom_H_ */ +/** \} */ +/** \} */ +#endif // GNSS_SDR_AD936X_IIO_CUSTOM_H diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.h b/src/algorithms/signal_source/libs/ad936x_iio_samples.h index 63d30545b..53fff2c9e 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.h @@ -15,17 +15,21 @@ */ -#ifndef SRC_LIBS_ad936x_iio_samples_H_ -#define SRC_LIBS_ad936x_iio_samples_H_ +#ifndef GNSS_SDR_AD936X_IIO_SAMPLES_H +#define GNSS_SDR_AD936X_IIO_SAMPLES_H #define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768 * 4 - #define IIO_INPUTRAMFIFOSIZE 256 #include #include #include +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + class ad936x_iio_samples { public: @@ -37,4 +41,6 @@ public: char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; // max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q) }; +/** \} */ +/** \} */ #endif From 4d1540181d7dd98ce4fa73db68b4454c052a01c5 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:36:03 +0200 Subject: [PATCH 353/499] Removed unused member fields and function parameters --- .../signal_source/adapters/ion_gsms_signal_source.cc | 5 ++--- .../signal_source/adapters/ion_gsms_signal_source.h | 1 - src/algorithms/signal_source/libs/ion_gsms.cc | 2 -- src/algorithms/signal_source/libs/ion_gsms.h | 3 --- .../signal_source/libs/ion_gsms_metadata_handler.cc | 4 +--- .../signal_source/libs/ion_gsms_metadata_handler.h | 2 +- 6 files changed, 4 insertions(+), 13 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index c0db26e71..5dde9915c 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -56,9 +56,8 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura unsigned int out_streams, Concurrent_Queue* queue __attribute__((unused))) : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), - metadata_file_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), - metadata_(metadata_file_), + metadata_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)), in_streams_(in_streams), out_streams_(out_streams) @@ -72,7 +71,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura LOG(ERROR) << "A signal source does not have an output stream"; } - sources_ = metadata_.make_stream_sources(configuration, role, stream_ids_); + sources_ = metadata_.make_stream_sources(stream_ids_); for (const auto& source : sources_) { diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index d724d101b..6e0aa6364 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -58,7 +58,6 @@ protected: } private: - std::string metadata_file_; std::vector stream_ids_; std::vector sources_; std::vector> copy_blocks_; diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index e44c0abab..78f9060bd 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -22,8 +22,6 @@ using namespace std::string_literals; IONGSMSFileSource::IONGSMSFileSource( - const ConfigurationInterface* configuration __attribute__((unused)), - const std::string& role __attribute__((unused)), const fs::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index 054b1e9dd..64a3e8c16 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -17,7 +17,6 @@ #ifndef GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H #define GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H -#include "configuration_interface.h" #include "gnss_block_interface.h" #include "gnss_sdr_filesystem.h" #include "ion_gsms_chunk_data.h" @@ -40,8 +39,6 @@ public: using sptr = gnss_shared_ptr; IONGSMSFileSource( - const ConfigurationInterface* configuration, - const std::string& role, const fs::path& metadata_filepath, const GnssMetadata::File& file, const GnssMetadata::Block& block, diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index eea6e9c5f..7d4c96fa5 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -62,7 +62,7 @@ void IONGSMSMetadataHandler::load_metadata() } } -std::vector IONGSMSMetadataHandler::make_stream_sources(const ConfigurationInterface* configuration, const std::string& role, const std::vector& stream_ids) const +std::vector IONGSMSMetadataHandler::make_stream_sources(const std::vector& stream_ids) const { std::vector sources{}; for (const auto& file : metadata_.Files()) @@ -92,8 +92,6 @@ std::vector IONGSMSMetadataHandler::make_stream_sources if (found) { auto source = gnss_make_shared( - configuration, - role, metadata_filepath_, file, block, diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 2431fbec8..969a3f4be 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -34,7 +34,7 @@ class IONGSMSMetadataHandler public: explicit IONGSMSMetadataHandler(const std::string& metadata_filepath); - std::vector make_stream_sources(const ConfigurationInterface* configuration, const std::string& role, const std::vector& stream_ids) const; + std::vector make_stream_sources(const std::vector& stream_ids) const; const std::string& metadata_filepath() const; private: From f1957476b8b83438a994542b82b10117d63b3587 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:37:58 +0200 Subject: [PATCH 354/499] Use std::ifstream instead of FILE for reading sample data --- src/algorithms/signal_source/libs/ion_gsms.cc | 14 ++++---------- src/algorithms/signal_source/libs/ion_gsms.h | 7 +++---- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index 78f9060bd..ca46c7c53 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -30,14 +30,14 @@ IONGSMSFileSource::IONGSMSFileSource( "ion_gsms_file_source", gr::io_signature::make(0, 0, 0), make_output_signature(block, stream_ids)), + file_stream_(metadata_filepath.parent_path() / file.Url().Value()), io_buffer_offset_(0), maximum_item_rate_(0), chunk_cycle_length_(0) { fs::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); - fd_ = std::fopen(data_filepath.c_str(), "rb"); std::size_t block_offset = file.Offset(); - std::fseek(fd_, file.Offset() + block_offset + block.SizeHeader(), SEEK_SET); + file_stream_.seekg(file.Offset() + block_offset + block.SizeHeader()); std::size_t output_stream_offset = 0; for (const auto& chunk : block.Chunks()) @@ -56,12 +56,6 @@ IONGSMSFileSource::IONGSMSFileSource( } -IONGSMSFileSource::~IONGSMSFileSource() -{ - std::fclose(fd_); -} - - int IONGSMSFileSource::work( int noutput_items, gr_vector_const_void_star& input_items __attribute__((unused)), @@ -70,7 +64,7 @@ int IONGSMSFileSource::work( const std::size_t max_sample_output = std::floor((noutput_items - 1.0) / maximum_item_rate_); io_buffer_.resize(max_sample_output * chunk_cycle_length_); io_buffer_offset_ = 0; - std::fread(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type), io_buffer_.size(), fd_); + file_stream_.read(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type) * io_buffer_.size()); items_produced_.resize(output_items.size()); for (int& i : items_produced_) @@ -83,7 +77,7 @@ int IONGSMSFileSource::work( for (auto& c : chunk_data_) { auto* chunk = c.get(); - io_buffer_offset_ += chunk->read_from_buffer(io_buffer_.data(), io_buffer_offset_); + io_buffer_offset_ += chunk->read_from_buffer(reinterpret_cast(io_buffer_.data()), io_buffer_offset_); chunk->write_to_output(output_items, items_produced_); } } diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index 64a3e8c16..c9bc8efd2 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -27,6 +27,7 @@ #include #include #include +#include /** \addtogroup Signal_Source * \{ */ @@ -44,8 +45,6 @@ public: const GnssMetadata::Block& block, const std::vector& stream_ids); - ~IONGSMSFileSource() override; - int work( int noutput_items, gr_vector_const_void_star& input_items, @@ -57,8 +56,8 @@ public: private: static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); - FILE* fd_; - std::vector io_buffer_; + std::ifstream file_stream_; + std::vector io_buffer_; std::size_t io_buffer_offset_; std::vector items_produced_; std::size_t output_stream_count_; From 3bdc7b9f21452c91a143e68d323ea87765998e28 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:39:17 +0200 Subject: [PATCH 355/499] Fixed includes and code style --- .../signal_source/adapters/ion_gsms_signal_source.h | 2 +- src/algorithms/signal_source/libs/ion_gsms.cc | 5 +---- src/algorithms/signal_source/libs/ion_gsms.h | 2 -- .../signal_source/libs/ion_gsms_metadata_handler.cc | 2 +- .../signal_source/libs/ion_gsms_metadata_handler.h | 2 +- 5 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index 6e0aa6364..5bddfc147 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -21,7 +21,7 @@ #include "configuration_interface.h" #include "file_source_base.h" #include "gnss_sdr_timestamp.h" -#include "ion_gsms.h" +#include "ion_gsms_metadata_handler.h" #include #include #include diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/libs/ion_gsms.cc index ca46c7c53..515bb1cf5 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.cc +++ b/src/algorithms/signal_source/libs/ion_gsms.cc @@ -66,11 +66,8 @@ int IONGSMSFileSource::work( io_buffer_offset_ = 0; file_stream_.read(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type) * io_buffer_.size()); + items_produced_.clear(); items_produced_.resize(output_items.size()); - for (int& i : items_produced_) - { - i = 0; - } while (io_buffer_offset_ < io_buffer_.size()) { diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/libs/ion_gsms.h index c9bc8efd2..a4f7e2625 100644 --- a/src/algorithms/signal_source/libs/ion_gsms.h +++ b/src/algorithms/signal_source/libs/ion_gsms.h @@ -67,8 +67,6 @@ private: std::size_t chunk_cycle_length_; }; -#include "ion_gsms_metadata_handler.h" - /** \} */ /** \} */ #endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc index 7d4c96fa5..154ad6904 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc @@ -14,7 +14,7 @@ * ----------------------------------------------------------------------------- */ -#include "ion_gsms.h" +#include "ion_gsms_metadata_handler.h" #include #if USE_GLOG_AND_GFLAGS #include diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 969a3f4be..4b6f5be81 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -17,7 +17,7 @@ #ifndef ION_GSMS_METADATA_HANDLER_H #define ION_GSMS_METADATA_HANDLER_H -#include "configuration_interface.h" +#include "ion_gsms.h" #include #include #include From 7cdda8e0dc1a82e444106c65118d7a13aab47947 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:42:26 +0200 Subject: [PATCH 356/499] Simplified disconnect() function We can disconnect the sources directly instead of disconnecting each of their outputs. --- .../signal_source/adapters/ion_gsms_signal_source.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 5dde9915c..0a4f065ee 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -98,13 +98,9 @@ void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) { - std::size_t cumulative_index = 0; for (const auto& source : sources_) { - for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) - { - top_block->disconnect(source, i, copy_blocks_[cumulative_index], 0); - } + top_block->disconnect(source); } } From 174364af319a6686757249dd1f4aca873867ec87 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:46:28 +0200 Subject: [PATCH 357/499] Implemented range check in `IONGSMSSignalSource::get_right_block(int)` --- .../signal_source/adapters/ion_gsms_signal_source.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 0a4f065ee..e608cf10b 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -121,5 +121,10 @@ gr::basic_block_sptr IONGSMSSignalSource::get_right_block() gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel) { + if (RF_channel < 0 || RF_channel >= static_cast(copy_blocks_.size())) + { + LOG(WARNING) << "'RF_channel' out of bounds while trying to get signal source right block."; + return copy_blocks_[0]; + } return copy_blocks_[RF_channel]; } From c10eceb9731c67014935cbfbd397ca364eb52491 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 15:58:37 +0200 Subject: [PATCH 358/499] Moved ION GSMS file source to `gnuradio_blocks/` directory Also fixed some header guards. --- src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt | 5 +++++ .../signal_source/{libs => gnuradio_blocks}/ion_gsms.cc | 0 .../signal_source/{libs => gnuradio_blocks}/ion_gsms.h | 0 src/algorithms/signal_source/libs/CMakeLists.txt | 2 -- src/algorithms/signal_source/libs/ion_gsms_chunk_data.h | 6 +++--- .../signal_source/libs/ion_gsms_chunk_unpacking_ctx.h | 6 +++--- .../signal_source/libs/ion_gsms_metadata_handler.h | 6 +++--- .../signal_source/libs/ion_gsms_stream_encodings.h | 6 +++--- 8 files changed, 17 insertions(+), 14 deletions(-) rename src/algorithms/signal_source/{libs => gnuradio_blocks}/ion_gsms.cc (100%) rename src/algorithms/signal_source/{libs => gnuradio_blocks}/ion_gsms.h (100%) diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 24f067be6..a217648b4 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -21,6 +21,11 @@ if(ENABLE_PLUTOSDR) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_iio_source.h) endif() +if(ENABLE_ION) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ion_gsms.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ion_gsms.h) +endif() + set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES fifo_reader.cc unpack_byte_2bit_samples.cc diff --git a/src/algorithms/signal_source/libs/ion_gsms.cc b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc similarity index 100% rename from src/algorithms/signal_source/libs/ion_gsms.cc rename to src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc diff --git a/src/algorithms/signal_source/libs/ion_gsms.h b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h similarity index 100% rename from src/algorithms/signal_source/libs/ion_gsms.h rename to src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index aa4fa8eea..b674ef5f5 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -46,8 +46,6 @@ if(ENABLE_PLUTOSDR) endif() if(ENABLE_ION) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_chunk_data.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_data.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_metadata_handler.cc) diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h index 1dd712351..5170af848 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -14,8 +14,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef ION_GSM_CHUNK_DATA_H -#define ION_GSM_CHUNK_DATA_H +#ifndef GNSS_SDR_ION_GSMS_CHUNK_DATA_H +#define GNSS_SDR_ION_GSMS_CHUNK_DATA_H #include "ion_gsms_chunk_unpacking_ctx.h" #include "ion_gsms_stream_encodings.h" @@ -185,4 +185,4 @@ private: void* buffer_; }; -#endif // ION_GSM_CHUNK_DATA_H +#endif // GNSS_SDR_ION_GSMS_CHUNK_DATA_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h index 44c125889..3c5d7b662 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -16,8 +16,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef ION_GSM_CHUNK_UNPACKING_CTX_H -#define ION_GSM_CHUNK_UNPACKING_CTX_H +#ifndef GNSS_SDR_ION_GSMS_CHUNK_UNPACKING_CTX_H +#define GNSS_SDR_ION_GSMS_CHUNK_UNPACKING_CTX_H #include #include @@ -178,4 +178,4 @@ struct IONGSMSChunkUnpackingCtx /** \} */ /** \} */ -#endif // ION_GSM_CHUNK_UNPACKING_CTX_H +#endif // GNSS_SDR_ION_GSMS_CHUNK_UNPACKING_CTX_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h index 4b6f5be81..6d01567c5 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h @@ -14,8 +14,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef ION_GSMS_METADATA_HANDLER_H -#define ION_GSMS_METADATA_HANDLER_H +#ifndef GNSS_SDR_ION_GSMSS_METADATA_HANDLER_H +#define GNSS_SDR_ION_GSMSS_METADATA_HANDLER_H #include "ion_gsms.h" #include @@ -48,4 +48,4 @@ private: /** \} */ /** \} */ -#endif // ION_GSMS_METADATA_HANDLER_H +#endif // GNSS_SDR_ION_GSMSS_METADATA_HANDLER_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h index 90ba15cac..5b39e6497 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -16,8 +16,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef ION_GSM_STREAM_ENCODINGS_H -#define ION_GSM_STREAM_ENCODINGS_H +#ifndef GNSS_SDR_ION_GSMS_STREAM_ENCODINGS_H +#define GNSS_SDR_ION_GSMS_STREAM_ENCODINGS_H #include @@ -167,4 +167,4 @@ inline T five_bit_look_up[11][32]{ /** \} */ /** \} */ -#endif // ION_GSM_STREAM_ENCODINGS_H +#endif // GNSS_SDR_ION_GSMS_STREAM_ENCODINGS_H From 54e18adb61fc39b741b6ab97de3642814815409d Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 17:39:33 +0200 Subject: [PATCH 359/499] Fixed ION GNSS Metadata Standard dependency version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b081522b..781e98a23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3366,7 +3366,7 @@ if(ENABLE_ION) FetchContent_Declare( gnss_metadata_standard GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard - GIT_TAG origin/master + GIT_TAG 220d116e10db5e403e21b77a1fa25aa35feda198 SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard From 92dcec67e076d9db0a0d590d7fadd2eb76ce2663 Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 17:43:18 +0200 Subject: [PATCH 360/499] Simplified by removing a very shallow class `ion_gnss_metadata_handler` was only reading the metadata file, which can easily be done in `ion_gsms_signal_source`. --- .../adapters/ion_gsms_signal_source.cc | 99 +++++++++++++- .../adapters/ion_gsms_signal_source.h | 12 +- .../signal_source/libs/CMakeLists.txt | 2 - .../libs/ion_gsms_metadata_handler.cc | 126 ------------------ .../libs/ion_gsms_metadata_handler.h | 51 ------- 5 files changed, 107 insertions(+), 183 deletions(-) delete mode 100644 src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc delete mode 100644 src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index e608cf10b..ba02529b6 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -57,7 +57,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura Concurrent_Queue* queue __attribute__((unused))) : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), - metadata_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), + metadata_filepath_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)), in_streams_(in_streams), out_streams_(out_streams) @@ -71,7 +71,11 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura LOG(ERROR) << "A signal source does not have an output stream"; } - sources_ = metadata_.make_stream_sources(stream_ids_); + // Parse XML metadata file + load_metadata(); + + // Make source vector + sources_ = make_stream_sources(stream_ids_); for (const auto& source : sources_) { @@ -82,6 +86,97 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura } } +void IONGSMSSignalSource::load_metadata() +{ + try + { + GnssMetadata::XmlProcessor xml_proc; + if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) + { + LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_; + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + } + catch (GnssMetadata::ApiException& e) + { + LOG(WARNING) << "API Exception while loading XML metadata file: " << std::to_string(e.Error()); + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << std::to_string(e.Error()) << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + catch (std::exception& e) + { + LOG(WARNING) << "Exception while loading XML metadata file: " << e.what(); + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << e.what() << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } +} + +std::vector IONGSMSSignalSource::make_stream_sources(const std::vector& stream_ids) const +{ + std::vector sources{}; + for (const auto& file : metadata_.Files()) + { + for (const auto& lane : metadata_.Lanes()) + { + if (lane.Id() == file.Lane().Id()) + { + for (const auto& block : lane.Blocks()) + { + bool block_done = false; + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + bool found = false; + for (const auto& stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) + { + auto source = gnss_make_shared( + metadata_filepath_, + file, + block, + stream_ids); + + sources.push_back(source); + + // This file source will take care of any other matching streams in this block + // We can skip the rest of this block + block_done = true; + break; + } + } + + if (block_done) + { + break; + } + } + if (block_done) + { + break; + } + } + } + break; + } + } + } + + return sources; +} void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) { diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index 5bddfc147..31d0f7815 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -21,7 +21,8 @@ #include "configuration_interface.h" #include "file_source_base.h" #include "gnss_sdr_timestamp.h" -#include "ion_gsms_metadata_handler.h" +#include "ion_gsms.h" +#include #include #include #include @@ -58,10 +59,17 @@ protected: } private: + std::vector make_stream_sources(const std::vector& stream_ids) const; + + void load_metadata(); + std::vector stream_ids_; std::vector sources_; std::vector> copy_blocks_; - IONGSMSMetadataHandler metadata_; + std::vector> valves_; + + std::string metadata_filepath_; + GnssMetadata::Metadata metadata_; gnss_shared_ptr timestamp_block_; std::string timestamp_file_; diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index b674ef5f5..4ad4caf93 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -48,8 +48,6 @@ endif() if(ENABLE_ION) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_chunk_data.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_data.h) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_metadata_handler.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_metadata_handler.h) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_stream_encodings.h) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_unpacking_ctx.h) endif() diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc deleted file mode 100644 index 154ad6904..000000000 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.cc +++ /dev/null @@ -1,126 +0,0 @@ -/*! - * \file ion_gsms_metadata_handler.cc - * \brief Build instances of IONGSMSFileSource as needed given a list of stream ids - * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "ion_gsms_metadata_handler.h" -#include -#if USE_GLOG_AND_GFLAGS -#include -#else -#include -#endif - -IONGSMSMetadataHandler::IONGSMSMetadataHandler(const std::string& metadata_filepath) - : metadata_filepath_(metadata_filepath) -{ - load_metadata(); -} - -const std::string& IONGSMSMetadataHandler::metadata_filepath() const -{ - return metadata_filepath_; -} - -void IONGSMSMetadataHandler::load_metadata() -{ - try - { - GnssMetadata::XmlProcessor xml_proc; - if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) - { - LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_; - std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl; - std::cout << "GNSS-SDR program ended.\n"; - exit(1); - } - } - catch (GnssMetadata::ApiException& e) - { - LOG(WARNING) << "API Exception while loading XML metadata file: " << std::to_string(e.Error()); - std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << std::to_string(e.Error()) << std::endl; - std::cout << "GNSS-SDR program ended.\n"; - exit(1); - } - catch (std::exception& e) - { - LOG(WARNING) << "Exception while loading XML metadata file: " << e.what(); - std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << e.what() << std::endl; - std::cout << "GNSS-SDR program ended.\n"; - exit(1); - } -} - -std::vector IONGSMSMetadataHandler::make_stream_sources(const std::vector& stream_ids) const -{ - std::vector sources{}; - for (const auto& file : metadata_.Files()) - { - for (const auto& lane : metadata_.Lanes()) - { - if (lane.Id() == file.Lane().Id()) - { - for (const auto& block : lane.Blocks()) - { - bool block_done = false; - for (const auto& chunk : block.Chunks()) - { - for (const auto& lump : chunk.Lumps()) - { - for (const auto& stream : lump.Streams()) - { - bool found = false; - for (const auto& stream_id : stream_ids) - { - if (stream_id == stream.Id()) - { - found = true; - break; - } - } - if (found) - { - auto source = gnss_make_shared( - metadata_filepath_, - file, - block, - stream_ids); - - sources.push_back(source); - - // This file source will take care of any other matching streams in this block - // We can skip the rest of this block - block_done = true; - break; - } - } - - if (block_done) - { - break; - } - } - if (block_done) - { - break; - } - } - } - break; - } - } - } - - return sources; -} diff --git a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h b/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h deleted file mode 100644 index 6d01567c5..000000000 --- a/src/algorithms/signal_source/libs/ion_gsms_metadata_handler.h +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * \file ion_gsms_metadata_handler.h - * \brief Build instances of IONGSMSFileSource as needed given a list of stream ids - * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#ifndef GNSS_SDR_ION_GSMSS_METADATA_HANDLER_H -#define GNSS_SDR_ION_GSMSS_METADATA_HANDLER_H - -#include "ion_gsms.h" -#include -#include -#include -#include - -/** \addtogroup Signal_Source - * \{ */ -/** \addtogroup Signal_Source_libs - * \{ */ - - -class IONGSMSMetadataHandler -{ -public: - explicit IONGSMSMetadataHandler(const std::string& metadata_filepath); - - std::vector make_stream_sources(const std::vector& stream_ids) const; - const std::string& metadata_filepath() const; - -private: - void load_metadata(); - - // State - std::string metadata_filepath_; - GnssMetadata::Metadata metadata_; -}; - - -/** \} */ -/** \} */ -#endif // GNSS_SDR_ION_GSMSS_METADATA_HANDLER_H From 89d73174a87d243ab88792c49736fbc35120b5ba Mon Sep 17 00:00:00 2001 From: Victor Castillo Date: Mon, 19 Aug 2024 17:44:36 +0200 Subject: [PATCH 361/499] Added valves to properly handle end of samples --- AUTHORS | 2 +- CITATION.cff | 2 +- .../adapters/ion_gsms_signal_source.cc | 16 ++- .../signal_source/gnuradio_blocks/ion_gsms.cc | 108 +++++++++++++----- .../signal_source/gnuradio_blocks/ion_gsms.h | 5 +- 5 files changed, 100 insertions(+), 33 deletions(-) diff --git a/AUTHORS b/AUTHORS index d1251f1fc..7df41ed17 100644 --- a/AUTHORS +++ b/AUTHORS @@ -64,7 +64,7 @@ Marc Sales marcsales92@gmail.com Contributor Piyush Gupta piyush04111999@gmail.com Contributor Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor Stefan van der Linden spvdlinden@gmail.com Contributor -Victor Castillo-Agüero victorcastilloaguero@gmail.com Contributor +Víctor Castillo-Agüero victorcastilloaguero@gmail.com Contributor Will Silberman wsilberm@google.com Contributor Carlos Paniego carpanie@hotmail.com Artwork diff --git a/CITATION.cff b/CITATION.cff index 2be1e1880..4bf27081f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -38,7 +38,7 @@ authors: affiliation: "Instituto Nacional de Técnica Aeroespacial" email: victorcastilloaguero@gmail.com family-names: "Castillo-Agüero" - given-names: Victor + given-names: Víctor - alias: acebrianjuan email: acebrianjuan@gmail.com family-names: "Cebrián-Juan" diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index ba02529b6..b67ec8a3a 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -17,6 +17,7 @@ #include "ion_gsms_signal_source.h" #include "gnss_sdr_flags.h" #include "gnss_sdr_string_literals.h" +#include "gnss_sdr_valve.h" #include #include #include @@ -54,7 +55,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura const std::string& role, unsigned int in_streams, unsigned int out_streams, - Concurrent_Queue* queue __attribute__((unused))) + Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), metadata_filepath_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), @@ -82,6 +83,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura for (std::size_t i = 0; i < source->output_stream_count(); ++i) { copy_blocks_.push_back(gr::blocks::copy::make(source->output_stream_item_size(i))); + valves_.push_back(gnss_sdr_make_valve(source->output_stream_item_size(i), source->output_stream_total_sample_count(i), queue)); } } } @@ -186,6 +188,7 @@ void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) { top_block->connect(source, i, copy_blocks_[cumulative_index], 0); + top_block->connect(copy_blocks_[cumulative_index], 0, valves_[cumulative_index], 0); } } } @@ -193,9 +196,14 @@ void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) { + std::size_t cumulative_index = 0; for (const auto& source : sources_) { - top_block->disconnect(source); + for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + { + top_block->disconnect(source, i, copy_blocks_[cumulative_index], 0); + top_block->disconnect(copy_blocks_[cumulative_index], 0, valves_[cumulative_index], 0); + } } } @@ -219,7 +227,7 @@ gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel) if (RF_channel < 0 || RF_channel >= static_cast(copy_blocks_.size())) { LOG(WARNING) << "'RF_channel' out of bounds while trying to get signal source right block."; - return copy_blocks_[0]; + return valves_[0]; } - return copy_blocks_[RF_channel]; + return valves_[RF_channel]; } diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc index 515bb1cf5..034f43379 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc @@ -19,6 +19,12 @@ #include #include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + using namespace std::string_literals; IONGSMSFileSource::IONGSMSFileSource( @@ -30,13 +36,20 @@ IONGSMSFileSource::IONGSMSFileSource( "ion_gsms_file_source", gr::io_signature::make(0, 0, 0), make_output_signature(block, stream_ids)), - file_stream_(metadata_filepath.parent_path() / file.Url().Value()), + file_stream_(metadata_filepath.parent_path() / file.Url().Value(), std::ios::in | std::ios::binary), io_buffer_offset_(0), maximum_item_rate_(0), chunk_cycle_length_(0) { fs::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); std::size_t block_offset = file.Offset(); + + if (!file_stream_.is_open()) + { + LOG(ERROR) << "ion_gsms_file_source: Unable to open the samples file: " << (data_filepath).c_str(); + } + + // Skip offset and block header file_stream_.seekg(file.Offset() + block_offset + block.SizeHeader()); std::size_t output_stream_offset = 0; @@ -49,42 +62,26 @@ IONGSMSFileSource::IONGSMSFileSource( for (std::size_t i = 0; i < out_count; ++i) { output_stream_item_sizes_.push_back(chunk_data_.back()->output_stream_item_size(i)); + output_stream_item_rates_.push_back(chunk_data_.back()->output_stream_item_rate(i)); maximum_item_rate_ = std::max(chunk_data_.back()->output_stream_item_rate(i), maximum_item_rate_); } } output_stream_count_ = output_stream_offset; -} + output_stream_total_sample_counts_.resize(output_stream_count_); -int IONGSMSFileSource::work( - int noutput_items, - gr_vector_const_void_star& input_items __attribute__((unused)), - gr_vector_void_star& output_items) -{ - const std::size_t max_sample_output = std::floor((noutput_items - 1.0) / maximum_item_rate_); - io_buffer_.resize(max_sample_output * chunk_cycle_length_); - io_buffer_offset_ = 0; - file_stream_.read(io_buffer_.data(), sizeof(decltype(io_buffer_)::value_type) * io_buffer_.size()); - - items_produced_.clear(); - items_produced_.resize(output_items.size()); - - while (io_buffer_offset_ < io_buffer_.size()) + std::size_t cycle_count = block.Cycles(); + if (cycle_count == 0) { - for (auto& c : chunk_data_) - { - auto* chunk = c.get(); - io_buffer_offset_ += chunk->read_from_buffer(reinterpret_cast(io_buffer_.data()), io_buffer_offset_); - chunk->write_to_output(output_items, items_produced_); - } + // Read the whole file + const std::size_t file_size = fs::file_size(data_filepath); + cycle_count = std::floor((file_size - block_offset - block.SizeHeader()) / chunk_cycle_length_); } - for (std::size_t i = 0; i < items_produced_.size(); ++i) + for (std::size_t i = 0; i < output_stream_count_; ++i) { - produce(i, items_produced_[i]); + output_stream_total_sample_counts_[i] = cycle_count * output_stream_item_rates_[i]; } - - return WORK_CALLED_PRODUCE; } @@ -99,6 +96,10 @@ std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) return output_stream_item_sizes_[stream_index]; } +std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const +{ + return output_stream_total_sample_counts_[stream_index]; +} gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) { @@ -140,3 +141,58 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada nstreams, item_sizes); } + +int IONGSMSFileSource::work( + int noutput_items, + gr_vector_const_void_star& input_items __attribute__((unused)), + gr_vector_void_star& output_items) +{ + // Compute the maximum number of samples that will be copied across all output buffer. + // If there are more than one output buffer (multichannel set up), the one with the most samples will be used as the maximum. + // + // Complex samples produce 2 items each (I and Q). In order to account for them, we subtract 1 from `noutput_items` and + // then floor the division. During testing, not doing this caused `max_sample_output` to oscillate between two values, thus + // resizing the `io_buffer_` on each call to `work()`. + const std::size_t max_sample_output = std::floor((noutput_items - 1.0) / maximum_item_rate_); + + // Resize the IO buffer to fit exactly the maximum amount of samples that will be outputted. + io_buffer_.resize(max_sample_output * chunk_cycle_length_); + + // We will be walking the IO buffer with this variable. + io_buffer_offset_ = 0; + + // Read samples from file into IO buffer + const std::size_t bytes_to_read = io_buffer_.size(); + file_stream_.read(io_buffer_.data(), bytes_to_read); + + // Reset `items_produced_` vector. This vector will accumulate the amount of items produced for each output stream. + items_produced_.clear(); + items_produced_.resize(output_items.size()); + + // Walk the IO buffer one chunk cycle at a time. See ION documentation for a definition of chunk and chunk cycle. + while (io_buffer_offset_ < bytes_to_read) + { + // Iterate chunks within a chunk cycle + for (auto& c : chunk_data_) + { + auto* chunk = c.get(); + + // Copy chunk into a separate buffer where the samples will be shifted from. + const std::size_t bytes_copied = chunk->read_from_buffer(reinterpret_cast(io_buffer_.data()), io_buffer_offset_); + + // Advance IO buffer offset + io_buffer_offset_ += bytes_copied; + + // Shift samples into output buffers following the appropriate unpacking strategy for this chunk. + chunk->write_to_output(output_items, items_produced_); + } + } + + // Call `produce(int, int)` with the appropriate item count for each output stream. + for (std::size_t i = 0; i < items_produced_.size(); ++i) + { + produce(i, items_produced_[i]); + } + + return WORK_CALLED_PRODUCE; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h index a4f7e2625..a787344bf 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h @@ -24,10 +24,10 @@ #include #include #include +#include #include #include #include -#include /** \addtogroup Signal_Source * \{ */ @@ -52,6 +52,7 @@ public: std::size_t output_stream_count() const; std::size_t output_stream_item_size(std::size_t stream_index) const; + std::size_t output_stream_total_sample_count(std::size_t stream_index) const; private: static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); @@ -62,6 +63,8 @@ private: std::vector items_produced_; std::size_t output_stream_count_; std::vector output_stream_item_sizes_; + std::vector output_stream_item_rates_; + std::vector output_stream_total_sample_counts_; std::size_t maximum_item_rate_; std::vector> chunk_data_; std::size_t chunk_cycle_length_; From 9bf3f457c361c67175e4a12563d8204d9b0a3146 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Aug 2024 14:54:15 +0200 Subject: [PATCH 362/499] Cleaner exit if the data file is not found --- .../signal_source/gnuradio_blocks/ion_gsms.cc | 12 +++++++++--- .../signal_source/gnuradio_blocks/ion_gsms.h | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc index 034f43379..60a08ba6c 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc @@ -18,6 +18,8 @@ #include "gnuradio/block.h" #include #include +#include +#include #if USE_GLOG_AND_GFLAGS #include @@ -25,8 +27,6 @@ #include #endif -using namespace std::string_literals; - IONGSMSFileSource::IONGSMSFileSource( const fs::path& metadata_filepath, const GnssMetadata::File& file, @@ -46,7 +46,10 @@ IONGSMSFileSource::IONGSMSFileSource( if (!file_stream_.is_open()) { - LOG(ERROR) << "ion_gsms_file_source: Unable to open the samples file: " << (data_filepath).c_str(); + LOG(WARNING) << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str(); + std::cerr << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str() << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); } // Skip offset and block header @@ -96,11 +99,13 @@ std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) return output_stream_item_sizes_[stream_index]; } + std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const { return output_stream_total_sample_counts_[stream_index]; } + gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) { int nstreams = 0; @@ -142,6 +147,7 @@ gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetada item_sizes); } + int IONGSMSFileSource::work( int noutput_items, gr_vector_const_void_star& input_items __attribute__((unused)), diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h index a787344bf..c82726b85 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include From 4929d8775921c59f3f0cddf90481e7a4968e5ecc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Aug 2024 14:58:01 +0200 Subject: [PATCH 363/499] Fix uninitialized warning --- .../signal_source/libs/ion_gsms_chunk_unpacking_ctx.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h index 3c5d7b662..6799f1080 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -34,8 +34,8 @@ struct IONGSMSChunkUnpackingCtx static constexpr uint8_t word_bitsize_ = sizeof(WT) * 8; const GnssMetadata::Chunk::WordShift word_shift_direction_; - WT* iterator_; // Not owned by this class, MUST NOT destroy - WT current_word_; + WT* iterator_ = nullptr; // Not owned by this class, MUST NOT destroy + WT current_word_{}; uint8_t bitshift_ = 0; IONGSMSChunkUnpackingCtx( @@ -51,7 +51,10 @@ struct IONGSMSChunkUnpackingCtx { iterator_ = &data_buffer[data_buffer_word_count]; } - advance_word(); // Initializes current_word_ + if (iterator_) + { + advance_word(); // Initializes current_word_ + } } void advance_word() From ca150572d10ef0dbbf1e354455bdce17ca822703 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Aug 2024 15:12:38 +0200 Subject: [PATCH 364/499] Remove unused configuration parameter. Uniformize guard names --- .../signal_source/adapters/ion_gsms_signal_source.cc | 7 ++++--- .../signal_source/adapters/ion_gsms_signal_source.h | 7 +++---- src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index b67ec8a3a..2def04c75 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -19,9 +19,8 @@ #include "gnss_sdr_string_literals.h" #include "gnss_sdr_valve.h" #include -#include +#include #include -#include #if USE_GLOG_AND_GFLAGS #include @@ -59,7 +58,6 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), metadata_filepath_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), - timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)), in_streams_(in_streams), out_streams_(out_streams) { @@ -88,6 +86,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura } } + void IONGSMSSignalSource::load_metadata() { try @@ -117,6 +116,7 @@ void IONGSMSSignalSource::load_metadata() } } + std::vector IONGSMSSignalSource::make_stream_sources(const std::vector& stream_ids) const { std::vector sources{}; @@ -180,6 +180,7 @@ std::vector IONGSMSSignalSource::make_stream_sources(co return sources; } + void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) { std::size_t cumulative_index = 0; diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index 31d0f7815..fd0a5140c 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -15,8 +15,8 @@ */ -#ifndef GNSS_SDR_ION_METADATA_STANDARD_SIGNAL_SOURCE_H -#define GNSS_SDR_ION_METADATA_STANDARD_SIGNAL_SOURCE_H +#ifndef GNSS_SDR_ION_GSMS_SIGNAL_SOURCE_H +#define GNSS_SDR_ION_GSMS_SIGNAL_SOURCE_H #include "configuration_interface.h" #include "file_source_base.h" @@ -73,7 +73,6 @@ private: gnss_shared_ptr timestamp_block_; std::string timestamp_file_; - double timestamp_clock_offset_ms_; uint32_t in_streams_; uint32_t out_streams_; @@ -82,4 +81,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_ION_METADATA_STANDARD_SIGNAL_SOURCE_H +#endif // GNSS_SDR_ION_GSMS_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h index c82726b85..4a6baa7e9 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h @@ -14,8 +14,8 @@ * ----------------------------------------------------------------------------- */ -#ifndef GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H -#define GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H +#ifndef GNSS_SDR_ION_GSMS_H +#define GNSS_SDR_ION_GSMS_H #include "gnss_block_interface.h" #include "gnss_sdr_filesystem.h" @@ -30,7 +30,7 @@ /** \addtogroup Signal_Source * \{ */ -/** \addtogroup Signal_Source_libs +/** \addtogroup Signal_Source_gnuradio_blocks * \{ */ class IONGSMSFileSource : public gr::sync_block @@ -71,4 +71,4 @@ private: /** \} */ /** \} */ -#endif // GNSS_SDR_ION_GNSS_SDR_METADATA_STANDARD_H +#endif // GNSS_SDR_ION_GSMS_H From 7f5704917f1ba47bebaa0835ca2b683939fb9654 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 20 Aug 2024 15:21:39 +0200 Subject: [PATCH 365/499] Fix for CMake < 3.14 --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 18aa2e276..a0606e348 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1424,6 +1424,7 @@ else() endif() + ################################################################################ # Abseil C++ - https://abseil.io/docs/cpp/ ################################################################################ @@ -3360,6 +3361,9 @@ endif() ################################################################################ # ION GNSS-SDR Metadata Standard https://sdr.ion.org/ (OPTIONAL) ################################################################################ +if(CMAKE_VERSION VERSION_LESS 3.14) + set(ENABLE_ION OFF) # FetchContent_MakeAvailable is available from CMake 3.14 +endif() if(ENABLE_ION) include(FetchContent) set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) From 1ac7e0ca1f134ed8ca832f41f850482df2a292b8 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Wed, 21 Aug 2024 14:48:37 +0200 Subject: [PATCH 366/499] fix configuration options for the FPGA-based AD9361-based boards --- .../adrv9361_z7035_signal_source_fpga.cc | 17 +++++------------ .../adrv9361_z7035_signal_source_fpga.h | 2 -- .../adapters/fmcomms5_signal_source_fpga.cc | 11 +---------- .../adapters/fmcomms5_signal_source_fpga.h | 1 - .../signal_source/libs/ad9361_manager.cc | 2 +- 5 files changed, 7 insertions(+), 26 deletions(-) diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc index cc8f7fe32..75ca38492 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -51,6 +51,7 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_source_(configuration->property(role + ".filter_source", std::string("Off"))), filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), @@ -58,7 +59,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)), tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)), freq0_(configuration->property(role + ".freq", 0)), - freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))), @@ -70,7 +70,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration out_stream_(out_stream), item_size_(sizeof(int8_t)), enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)), - filter_auto_(configuration->property(role + ".filter_auto", false)), quadrature_(configuration->property(role + ".quadrature", true)), rf_dc_(configuration->property(role + ".rf_dc", true)), bb_dc_(configuration->property(role + ".bb_dc", true)), @@ -98,15 +97,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration freq0_ = configuration->property(role + ".freq0", static_cast(GPS_L1_FREQ_HZ)); } - if (filter_auto_) - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); - } - else - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); - } - switch_fpga = std::make_shared(); switch_fpga->set_switch_position(switch_to_real_time_mode); @@ -190,12 +180,15 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration } std::cout << "LO frequency : " << freq0_ << " Hz\n"; + + uint64_t freq1 = 0; // The local oscillator frequency of the ADRV9361-B is not used when using the ADRV9361-Z7035 board. + try { config_ad9361_rx_local(bandwidth_, sample_rate_, freq0_, - freq1_, + freq1, rf_port_select_, rx1_enable_, rx2_enable_, diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h index beffb3c70..acb84d663 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h @@ -107,7 +107,6 @@ private: double tx_attenuation_db_; uint64_t freq0_; // frequency of local oscillator for ADRV9361-A 0 - uint64_t freq1_; // frequency of local oscillator for ADRV9361-B (if present) uint64_t sample_rate_; uint64_t bandwidth_; uint64_t freq_dds_tx_hz_; @@ -122,7 +121,6 @@ private: size_t item_size_; bool enable_dds_lo_; - bool filter_auto_; bool quadrature_; bool rf_dc_; bool bb_dc_; diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc index be2108aa4..f52c67425 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc @@ -51,6 +51,7 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_source_(configuration->property(role + ".filter_source", std::string("Off"))), filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), @@ -63,7 +64,6 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface in_stream_(in_stream), out_stream_(out_stream), item_size_(sizeof(int8_t)), - filter_auto_(configuration->property(role + ".filter_auto", false)), quadrature_(configuration->property(role + ".quadrature", true)), rf_dc_(configuration->property(role + ".rf_dc", true)), bb_dc_(configuration->property(role + ".bb_dc", true)), @@ -86,15 +86,6 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface const uint32_t num_freq_bands = ((enable_rx1_band == true) and (enable_rx2_band == true)) ? 2 : 1; - if (filter_auto_) - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); - } - else - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); - } - switch_fpga = std::make_shared(); switch_fpga->set_switch_position(switch_to_real_time_mode); diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h index 1c5c37c73..665403099 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h @@ -114,7 +114,6 @@ private: size_t item_size_; - bool filter_auto_; bool quadrature_; bool rf_dc_; bool bb_dc_; diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 913488287..d2f82b367 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -349,7 +349,7 @@ bool config_ad9361_rx_local(uint64_t bandwidth_, #ifndef LIBAD9361_VERSION_GREATER_THAN_01 if (filter_source_ == "Design") { - std::cout << "Option filter_source=Design is not available in this version. Set to filter_source=Off\n"; + std::cout << "Option filter_source=Design is not available in this version of libad9361. Set to filter_source=Off\n"; filter_source_ = std::string("Off"); } if (Fpass_ != 0.0 or Fstop_ != 0.0) From 8702f9dfc7e889bef4f5e666a50630c1c0e6850b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 22 Aug 2024 13:26:17 +0200 Subject: [PATCH 367/499] Put the global function into an anonymous namespace Use emplace_back instead of push_back --- .../signal_source/adapters/ion_gsms_signal_source.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 2def04c75..e4fef62a0 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -30,6 +30,8 @@ using namespace std::string_literals; +namespace +{ std::vector parse_comma_list(const std::string& str) { std::vector list{}; @@ -48,6 +50,7 @@ std::vector parse_comma_list(const std::string& str) return list; } +} // anonymous namespace IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configuration, @@ -80,8 +83,8 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura { for (std::size_t i = 0; i < source->output_stream_count(); ++i) { - copy_blocks_.push_back(gr::blocks::copy::make(source->output_stream_item_size(i))); - valves_.push_back(gnss_sdr_make_valve(source->output_stream_item_size(i), source->output_stream_total_sample_count(i), queue)); + copy_blocks_.emplace_back(gr::blocks::copy::make(source->output_stream_item_size(i))); + valves_.emplace_back(gnss_sdr_make_valve(source->output_stream_item_size(i), source->output_stream_total_sample_count(i), queue)); } } } From d7885036b61e5c85854fd31bd3619c51c5a91015 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 22 Aug 2024 14:49:33 +0200 Subject: [PATCH 368/499] Make private member metadata_ a std::shared_pointer --- .../signal_source/adapters/ion_gsms_signal_source.cc | 8 +++++--- .../signal_source/adapters/ion_gsms_signal_source.h | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index e4fef62a0..00f2be229 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -20,6 +20,7 @@ #include "gnss_sdr_valve.h" #include #include +#include #include #if USE_GLOG_AND_GFLAGS @@ -92,10 +93,11 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura void IONGSMSSignalSource::load_metadata() { + metadata_ = std::make_shared(); try { GnssMetadata::XmlProcessor xml_proc; - if (!xml_proc.Load(metadata_filepath_.c_str(), false, metadata_)) + if (!xml_proc.Load(metadata_filepath_.c_str(), false, *metadata_)) { LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_; std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl; @@ -123,9 +125,9 @@ void IONGSMSSignalSource::load_metadata() std::vector IONGSMSSignalSource::make_stream_sources(const std::vector& stream_ids) const { std::vector sources{}; - for (const auto& file : metadata_.Files()) + for (const auto& file : metadata_->Files()) { - for (const auto& lane : metadata_.Lanes()) + for (const auto& lane : metadata_->Lanes()) { if (lane.Id() == file.Lane().Id()) { diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h index fd0a5140c..bcdedbc3d 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -24,6 +24,7 @@ #include "ion_gsms.h" #include #include +#include #include #include @@ -69,7 +70,7 @@ private: std::vector> valves_; std::string metadata_filepath_; - GnssMetadata::Metadata metadata_; + std::shared_ptr metadata_; gnss_shared_ptr timestamp_block_; std::string timestamp_file_; From d5122c4e5a3f11bf64bf206abf4fda4ce466786a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 22 Aug 2024 14:50:40 +0200 Subject: [PATCH 369/499] Simplify code --- src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc index 60a08ba6c..22a25868c 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc @@ -179,10 +179,8 @@ int IONGSMSFileSource::work( while (io_buffer_offset_ < bytes_to_read) { // Iterate chunks within a chunk cycle - for (auto& c : chunk_data_) + for (auto& chunk : chunk_data_) { - auto* chunk = c.get(); - // Copy chunk into a separate buffer where the samples will be shifted from. const std::size_t bytes_copied = chunk->read_from_buffer(reinterpret_cast(io_buffer_.data()), io_buffer_offset_); From 4dee92ddf5119e5ca0fc253662253145b3eb4ed9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 22 Aug 2024 15:44:10 +0200 Subject: [PATCH 370/499] Remove ION source from CI --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7bc294b0f..32dc29f9b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev \ python3-mako liborc-0.4-dev - name: configure - run: cd build && cmake -GNinja -DENABLE_ION=ON .. + run: cd build && cmake -GNinja .. - name: build run: cd build && ninja - name: check @@ -60,7 +60,7 @@ jobs: brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure - run: cd build && cmake -GNinja -DENABLE_ION=ON .. + run: cd build && cmake -GNinja .. - name: build run: cd build && ninja - name: check @@ -92,7 +92,7 @@ jobs: brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure - run: cd build && cmake -GXcode -DENABLE_ION=ON .. + run: cd build && cmake -GXcode .. - name: build run: cd build && xcodebuild -configuration Release - name: check From c4e84ffcfcb512d89c5bb04f10edb2d58f46490a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 23 Aug 2024 07:02:56 +0200 Subject: [PATCH 371/499] Apply clang-tidy fixes --- .../adapters/ad936x_custom_signal_source.cc | 17 +- .../gnuradio_blocks/ad936x_iio_source.cc | 93 +++++--- .../gnuradio_blocks/ad936x_iio_source.h | 42 ++-- .../signal_source/libs/CMakeLists.txt | 1 - .../signal_source/libs/ad9361_manager.cc | 2 +- .../signal_source/libs/ad936x_iio_custom.cc | 211 +++++++++++------- .../signal_source/libs/ad936x_iio_custom.h | 32 +-- .../signal_source/libs/ad936x_iio_samples.cc | 25 --- .../signal_source/libs/ad936x_iio_samples.h | 10 +- src/algorithms/signal_source/libs/ppstcprx.cc | 25 +-- src/algorithms/signal_source/libs/ppstcprx.h | 12 +- 11 files changed, 257 insertions(+), 213 deletions(-) delete mode 100644 src/algorithms/signal_source/libs/ad936x_iio_samples.cc diff --git a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc index b93dc9344..b824a250d 100644 --- a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc @@ -76,8 +76,11 @@ Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* item_size_ = sizeof(gr_complex); // 1. Make the driver instance bool customsamplesize = false; - if (ssize_ != 12 or spattern_ == true) customsamplesize = true; // custom FPGA DMA firmware - if (ssize_ == 12) // default original FPGA DMA firmware + if (ssize_ != 12 || spattern_ == true) + { + customsamplesize = true; // custom FPGA DMA firmware + } + if (ssize_ == 12) // default original FPGA DMA firmware { ssize_ = 16; // set to 16 bits and do not try to change sample size } @@ -153,8 +156,14 @@ Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* for (int n = 0; n < n_channels; n++) { - if (n == 0) inverted_spectrum_vec.push_back(inverted_spectrum_ch0_); - if (n == 1) inverted_spectrum_vec.push_back(inverted_spectrum_ch1_); + if (n == 0) + { + inverted_spectrum_vec.push_back(inverted_spectrum_ch0_); + } + if (n == 1) + { + inverted_spectrum_vec.push_back(inverted_spectrum_ch1_); + } } for (int n = 0; n < n_channels; n++) diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc index 375edf7da..1f0288dc9 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc @@ -33,15 +33,15 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( - std::string pluto_uri_, - std::string board_type_, + const std::string& pluto_uri_, + const std::string& board_type_, long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string& rf_port_select_, + const std::string& rf_filter, + const std::string& gain_mode_rx0_, + const std::string& gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -49,7 +49,7 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( long long freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string& fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -85,7 +85,8 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( tx_lo_channel_)); } -void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out) + +void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples* samples_in, int nchannels, std::vector* files_out) { uint32_t current_byte = 0; int16_t ch = 0; @@ -101,16 +102,17 @@ void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samp } } + ad936x_iio_source::ad936x_iio_source( - std::string pluto_uri_, - std::string board_type_, + const std::string& pluto_uri_, + const std::string& board_type_, long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string& rf_port_select_, + const std::string& rf_filter, + const std::string& gain_mode_rx0_, + const std::string& gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -118,7 +120,7 @@ ad936x_iio_source::ad936x_iio_source( long long freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string& fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -171,54 +173,81 @@ ad936x_iio_source::ad936x_iio_source( case 16: { std::cout << "FPGA sample size set to 16 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=16\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=16\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } case 8: { std::cout << "FPGA sample size set to 8 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=8\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=8\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } case 4: { std::cout << "FPGA sample size set to 4 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=4\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=4\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } case 2: { std::cout << "FPGA sample size set to 2 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=2\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=2\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } default: { std::cout << "WARNING: Unsupported ssize. FPGA sample size set to 16 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=16") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=16") == false) + { + std::cout << "cmd send error!\n"; + } } } if (bshift_ >= 0 and bshift_ <= 14) { std::cout << "FPGA sample bits shift left set to " + std::to_string(bshift_) + " positions.\n"; - if (pps_rx->send_cmd("bshift=" + std::to_string(bshift_) + "\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("bshift=" + std::to_string(bshift_) + "\n") == false) + { + std::cout << "cmd send error!\n"; + } } else { std::cout << "WARNING: Unsupported bshift. FPGA sample bits shift left set to 0.\n"; - if (pps_rx->send_cmd("bshift=0\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("bshift=0\n") == false) + { + std::cout << "cmd send error!\n"; + } } if (spattern_ == true) { std::cout << "FPGA debug sample pattern is active!.\n"; - if (pps_rx->send_cmd("spattern=1\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("spattern=1\n") == false) + { + std::cout << "cmd send error!\n"; + } } else { std::cout << "FPGA debug sample pattern disabled.\n"; - if (pps_rx->send_cmd("spattern=0\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("spattern=0\n") == false) + { + std::cout << "cmd send error!\n"; + } } } else @@ -238,7 +267,7 @@ ad936x_iio_source::ad936x_iio_source( exit(1); } } - catch (std::exception const &ex) + catch (std::exception const& ex) { std::cerr << "STD exception: " << ex.what() << std::endl; exit(1); @@ -267,6 +296,7 @@ ad936x_iio_source::ad936x_iio_source( // } } + ad936x_iio_source::~ad936x_iio_source() { // Terminate PPS thread @@ -284,6 +314,7 @@ bool ad936x_iio_source::start() return ad936x_custom->start_sample_rx(false); } + bool ad936x_iio_source::stop() { std::cout << "stopping ad936x_iio_source...\n"; @@ -291,17 +322,17 @@ bool ad936x_iio_source::stop() return true; } + int ad936x_iio_source::general_work(int noutput_items, - __attribute__((unused)) gr_vector_int &ninput_items, - __attribute__((unused)) gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + __attribute__((unused)) gr_vector_int& ninput_items, + __attribute__((unused)) gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) { std::shared_ptr current_buffer; - ad936x_iio_samples *current_samples; + ad936x_iio_samples* current_samples; ad936x_custom->pop_sample_buffer(current_buffer); current_samples = current_buffer.get(); - // I and Q samples are interleaved in buffer: IQIQIQ... int32_t n_interleaved_iq_samples_per_channel = current_samples->n_bytes / (ad936x_custom->n_channels * 2); if (noutput_items < n_interleaved_iq_samples_per_channel) @@ -312,7 +343,7 @@ int ad936x_iio_source::general_work(int noutput_items, else { // ad9361_channel_demux_and_record(current_samples, ad936x_custom->n_channels, &samplesfile); - auto **out = reinterpret_cast(&output_items[0]); + auto** out = reinterpret_cast(&output_items[0]); uint32_t current_byte = 0; uint32_t current_byte_in_gr = 0; int16_t ch = 0; diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h index 411906a3e..a1a29f6ab 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h @@ -44,15 +44,15 @@ class ad936x_iio_source; using ad936x_iio_source_sptr = gnss_shared_ptr; ad936x_iio_source_sptr ad936x_iio_make_source_sptr( - std::string pluto_uri_, - std::string board_type_, + const std::string &pluto_uri_, + const std::string &board_type_, long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -60,7 +60,7 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( long long freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string &fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -90,15 +90,15 @@ public: private: friend ad936x_iio_source_sptr ad936x_iio_make_source_sptr( - std::string pluto_uri_, - std::string board_type_, + const std::string &pluto_uri_, + const std::string &board_type_, long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -106,7 +106,7 @@ private: long long freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string &fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -116,15 +116,15 @@ private: int tx_lo_channel_); ad936x_iio_source( - std::string pluto_uri_, - std::string board_type_, + const std::string &pluto_uri_, + const std::string &board_type_, long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -132,7 +132,7 @@ private: long long freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string &fe_ip_, int fe_ctlport_, int ssize_, int bshift_, diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index bdbd3aace..9d9732d3c 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -36,7 +36,6 @@ if((ENABLE_FPGA AND ENABLE_AD9361) OR ENABLE_MAX2771) endif() if(ENABLE_PLUTOSDR) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_samples.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_custom.h) diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index d2f82b367..025f97627 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -636,7 +636,7 @@ bool config_ad9361_rx_remote(const std::string &remote_host, { return false; } - if (setup_filter(std::move(filter_source_), bandwidth_, sample_rate_, freq_, rf_port_select_, ad9361_phy, rx_chan0, chn, 0, std::move(filter_filename_), Fpass_, Fstop_) == -1) + if (setup_filter(filter_source_, bandwidth_, sample_rate_, freq_, rf_port_select_, ad9361_phy, rx_chan0, chn, 0, std::move(filter_filename_), Fpass_, Fstop_) == -1) { return false; } diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index ad983aa6b..c41d74b9a 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -31,29 +31,36 @@ #include #endif -ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) +ad936x_iio_custom::ad936x_iio_custom( + int debug_level_, + int log_level_) : n_channels(0), + ctx(nullptr), + phy(nullptr), + stream_dev(nullptr), + dds_dev(nullptr), + receive_samples(false), + fpga_overflow(false), + sample_rate_sps(0), + debug_level(debug_level_), + log_level(log_level_), + PPS_mode(false) { - receive_samples = false; - fpga_overflow = false; - sample_rate_sps = 0; - ctx = NULL; - phy = NULL; - dds_dev = NULL; - stream_dev = NULL; - debug_level = debug_level_; - log_level = log_level_; - PPS_mode = false; - n_channels = 0; } ad936x_iio_custom::~ad936x_iio_custom() { // disable TX - if (phy != NULL) PlutoTxEnable(false); + if (phy != nullptr) + { + PlutoTxEnable(false); + } // Close device - if (ctx != NULL) iio_context_destroy(ctx); + if (ctx != nullptr) + { + iio_context_destroy(ctx); + } } @@ -69,7 +76,7 @@ void ad936x_iio_custom::set_pps_samplestamp_queue(std::shared_ptr ¶ms) { - for (std::vector::const_iterator it = params.begin(); - it != params.end(); ++it) + for (const auto ¶m : params) { - struct iio_channel *chn = NULL; - const char *attr = NULL; + struct iio_channel *chn = nullptr; + const char *attr = nullptr; size_t pos; int ret; - pos = it->find('='); + pos = param.find('='); if (pos == std::string::npos) { - std::cerr << "Malformed line: " << *it << std::endl; + std::cerr << "Malformed line: " << param << std::endl; continue; } - std::string key = it->substr(0, pos); - std::string val = it->substr(pos + 1, std::string::npos); + std::string key = param.substr(0, pos); + std::string val = param.substr(pos + 1, std::string::npos); ret = iio_device_identify_filename(phy, key.c_str(), &chn, &attr); @@ -197,13 +203,19 @@ void ad936x_iio_custom::configure_params(struct iio_device *phy, } if (chn) - ret = iio_channel_attr_write(chn, - attr, val.c_str()); + { + ret = iio_channel_attr_write(chn, + attr, val.c_str()); + } else if (iio_device_find_attr(phy, attr)) - ret = iio_device_attr_write(phy, attr, val.c_str()); + { + ret = iio_device_attr_write(phy, attr, val.c_str()); + } else - ret = iio_device_debug_attr_write(phy, - attr, val.c_str()); + { + ret = iio_device_debug_attr_write(phy, + attr, val.c_str()); + } if (ret < 0) { std::cerr << "Unable to write attribute " << key @@ -217,9 +229,9 @@ void ad936x_iio_custom::set_params_rx(struct iio_device *phy_device, unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, - std::string gain1, double gain1_value, - std::string gain2, double gain2_value, - std::string port_select) + const std::string &gain1, double gain1_value, + const std::string &gain2, double gain2_value, + const std::string &port_select) { std::vector params; @@ -290,7 +302,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0)); params_dds.push_back("out_altvoltage0_TX1_I_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage0_TX1_I_F1_raw=1"); + params_dds.emplace_back("out_altvoltage0_TX1_I_F1_raw=1"); // DDS TX CH1 Q (tone #1) params_dds.push_back("out_altvoltage2_TX1_Q_F1_frequency=" + std::to_string(freq_dds_tx_hz_)); @@ -298,7 +310,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); params_dds.push_back("out_altvoltage2_TX1_Q_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage2_TX1_Q_F1_raw=1"); + params_dds.emplace_back("out_altvoltage2_TX1_Q_F1_raw=1"); configure_params(dds_dev, params_dds); } @@ -319,7 +331,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0)); params_dds.push_back("out_altvoltage4_TX2_I_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage4_TX2_I_F1_raw=1"); + params_dds.emplace_back("out_altvoltage4_TX2_I_F1_raw=1"); // DDS TX CH2 Q (tone #1) params_dds.push_back("out_altvoltage6_TX2_Q_F1_frequency=" + std::to_string(freq_dds_tx_hz_)); @@ -327,7 +339,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); params_dds.push_back("out_altvoltage6_TX2_Q_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage6_TX2_Q_F1_raw=1"); + params_dds.emplace_back("out_altvoltage6_TX2_Q_F1_raw=1"); configure_params(dds_dev, params_dds); } @@ -338,7 +350,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, bool ad936x_iio_custom::check_device() { - if (stream_dev != NULL) + if (stream_dev != nullptr) { return true; } @@ -351,8 +363,8 @@ bool ad936x_iio_custom::check_device() bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, std::string &value) { - struct iio_channel *chn = 0; - const char *attr = 0; + struct iio_channel *chn = nullptr; + const char *attr = nullptr; char valuestr[256]; int ret; ssize_t nchars; @@ -399,9 +411,12 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) { try { - uint32_t temp_mC = boost::lexical_cast(temp_mC_str); + auto temp_mC = boost::lexical_cast(temp_mC_str); temp_c = static_cast(temp_mC) / 1000.0; - if (temp_c > 120) temp_c = -1; + if (temp_c > 120) + { + temp_c = -1; + } return true; } catch (const boost::bad_lexical_cast &e) @@ -420,10 +435,10 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -433,16 +448,19 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, bool high_side_lo_, int tx_lo_channel_) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } bool no_errors = true; std::cout << "Configuring phy device parameters...\n"; int ret; - if (rf_filter.compare("Disabled") == 0) + if (rf_filter == "Disabled") { std::cout << "LNA Filter switch is disabled.\n"; } - else if (rf_filter.compare("Auto") == 0) + else if (rf_filter == "Auto") { std::cout << "Selecting LNA RF filter based on the selected RF frequency... \n"; if (freq_ == 1575420000) @@ -499,9 +517,9 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, params.push_back("out_voltage_rf_bandwidth=" + std::to_string(bandwidth_)); - params.push_back("in_voltage_quadrature_tracking_en=1"); - params.push_back("in_voltage_rf_dc_offset_tracking_en=1"); - params.push_back("in_voltage_bb_dc_offset_tracking_en=1"); + params.emplace_back("in_voltage_quadrature_tracking_en=1"); + params.emplace_back("in_voltage_rf_dc_offset_tracking_en=1"); + params.emplace_back("in_voltage_bb_dc_offset_tracking_en=1"); configure_params(phy, params); @@ -706,7 +724,10 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // Configure RX LO channel (NOTICE that altvoltage0 is the RX LO oscillator!, altvoltage1 is the TX oscillator) struct iio_channel *lo_ch; @@ -729,7 +750,10 @@ bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // Configure RX LO channel (NOTICE that altvoltage0 is the RX LO oscillator!, altvoltage1 is the TX oscillator) struct iio_channel *lo_ch; @@ -750,9 +774,12 @@ bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) } -bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain_dB) +bool ad936x_iio_custom::setRXGain(int ch_num, const std::string &gain_mode, double gain_dB) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } std::vector params; if (ch_num == 0) { @@ -785,7 +812,10 @@ bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain double ad936x_iio_custom::get_rx_gain(int ch_num) { - if (check_device() == false) return -1; + if (check_device() == false) + { + return -1; + } double gain_dB; // gain in dB int ret = 0; if (ch_num == 0) @@ -816,7 +846,10 @@ double ad936x_iio_custom::get_rx_gain(int ch_num) bool ad936x_iio_custom::calibrate([[maybe_unused]] int ch, [[maybe_unused]] double bw_hz) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // todo return true; } @@ -865,12 +898,13 @@ void ad936x_iio_custom::monitor_thread_fn() { ret = iio_device_reg_write(stream_dev, 0x80000088, val); if (ret) - fprintf(stderr, "Failed to clearn DMA status register: %s\n", - strerror(-ret)); + { + fprintf(stderr, "Failed to clearn DMA status register: %s\n", + strerror(-ret)); + } } sleep(1); } - return; } @@ -941,7 +975,7 @@ void ad936x_iio_custom::setPlutoGpo(int p) } -bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) +bool ad936x_iio_custom::select_rf_filter(const std::string &rf_filter) { // adi,gpo-manual-mode-enable Enables GPO manual mode, this will conflict with automatic ENSM slave and eLNA mode // adi,gpo-manual-mode-enable-mask Enable bit mask, setting or clearing bits will change the level of the corresponding output. Bit0 → GPO, Bit1 → GPO1, Bit2 → GPO2, Bit3 → GP03 @@ -961,7 +995,10 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) // 1 Enable // X Enable Mask if Identifier=0xF - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // int plutoGpo = 0; int ret; ret = iio_device_debug_attr_write(phy, "adi,gpo-manual-mode-enable", "1"); @@ -972,7 +1009,7 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return false; } - if (rf_filter.compare("E1") == 0) + if (rf_filter == "E1") { // set gpio0 to switch L1 filter // setPlutoGpo(plutoGpo); @@ -983,7 +1020,7 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return false; } } - else if (rf_filter.compare("E5E6") == 0) + else if (rf_filter == "E5E6") { // set gpio0 to switch L5/L6 filter (GPO0) // plutoGpo = plutoGpo | 0x10; @@ -995,7 +1032,7 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return false; } } - if (rf_filter.compare("none") == 0) + if (rf_filter == "none") { std::cout << "RF external filter not selected\n"; } @@ -1108,18 +1145,18 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) switch (n_channels) { case 1: - channels.push_back("voltage0"); // Channel 0 I - channels.push_back("voltage1"); // Channel 0 Q + channels.emplace_back("voltage0"); // Channel 0 I + channels.emplace_back("voltage1"); // Channel 0 Q break; case 2: - channels.push_back("voltage0"); // Channel 0 I - channels.push_back("voltage1"); // Channel 0 Q - channels.push_back("voltage2"); // Channel 1 I - channels.push_back("voltage3"); // Channel 1 Q + channels.emplace_back("voltage0"); // Channel 0 I + channels.emplace_back("voltage1"); // Channel 0 Q + channels.emplace_back("voltage2"); // Channel 1 I + channels.emplace_back("voltage3"); // Channel 1 Q break; default: - channels.push_back("voltage0"); // Channel 0 I - channels.push_back("voltage1"); // Channel 0 Q + channels.emplace_back("voltage0"); // Channel 0 I + channels.emplace_back("voltage1"); // Channel 0 Q } receive_samples = true; @@ -1151,7 +1188,10 @@ void ad936x_iio_custom::push_sample_buffer(std::shared_ptr & void ad936x_iio_custom::capture(const std::vector &channels) { - if (check_device() == false) return; + if (check_device() == false) + { + return; + } struct iio_buffer *rxbuf; @@ -1179,16 +1219,14 @@ void ad936x_iio_custom::capture(const std::vector &channels) } else { - for (std::vector::const_iterator it = - channels.begin(); - it != channels.end(); ++it) + for (const auto &channel : channels) { struct iio_channel *chn = iio_device_find_channel(stream_dev, - it->c_str(), false); + channel.c_str(), false); if (!chn) { - std::cerr << "Channel " << it->c_str() << " not found\n"; + std::cerr << "Channel " << channel.c_str() << " not found\n"; return; } else @@ -1247,7 +1285,10 @@ void ad936x_iio_custom::capture(const std::vector &channels) items_in_buffer = static_cast(ret) / bytes_to_interleaved_iq_samples; - if (items_in_buffer == 0) return; + if (items_in_buffer == 0) + { + return; + } current_samples->n_channels = n_channels; current_samples->n_interleaved_iq_samples = items_in_buffer; diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.h b/src/algorithms/signal_source/libs/ad936x_iio_custom.h index ab58f36cc..0c6199968 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.h @@ -41,15 +41,15 @@ class ad936x_iio_custom public: ad936x_iio_custom(int debug_level_, int log_level_); virtual ~ad936x_iio_custom(); - bool initialize_device(std::string pluto_device_uri, std::string board_type); + bool initialize_device(const std::string &pluto_device_uri, const std::string &board_type); bool init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -62,7 +62,7 @@ public: bool calibrate(int ch, double bw_hz); double get_rx_gain(int ch_num); - bool setRXGain(int ch_num, std::string gain_mode, double gain_dB); + bool setRXGain(int ch_num, const std::string &gain_mode, double gain_dB); bool set_antenna_port(int ch, int antenna_idx); double get_frequency(int ch); @@ -94,9 +94,9 @@ private: unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, - std::string gain1, double gain1_value, - std::string gain2, double gain2_value, - std::string port_select); + const std::string &gain1, double gain1_value, + const std::string &gain2, double gain2_value, + const std::string &port_select); bool config_ad9361_dds(uint64_t freq_rf_tx_hz_, double tx_attenuation_db_, @@ -108,7 +108,7 @@ private: void get_PPS_timestamp(); void capture(const std::vector &channels); - bool select_rf_filter(std::string rf_filter); + bool select_rf_filter(const std::string &rf_filter); void monitor_thread_fn(); @@ -121,12 +121,6 @@ private: struct iio_device *stream_dev; struct iio_device *dds_dev; - // stream - uint64_t sample_rate_sps; - int debug_level; - int log_level; - bool PPS_mode; - std::mutex mtx; std::condition_variable cv; @@ -140,6 +134,12 @@ private: std::thread capture_samples_thread; std::thread overflow_monitor_thread; std::thread capture_time_thread; + + // stream + uint64_t sample_rate_sps; + int debug_level; + int log_level; + bool PPS_mode; }; /** \} */ diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.cc b/src/algorithms/signal_source/libs/ad936x_iio_samples.cc deleted file mode 100644 index b9b7b505a..000000000 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.cc +++ /dev/null @@ -1,25 +0,0 @@ -/*! - * \file ad936x_iio_samples.cc - * \brief A class that holds a custom sample buffer for Analog Devices AD936x family front-ends. - * \author Javier Arribas, jarribas(at)cttc.es - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "ad936x_iio_samples.h" - -ad936x_iio_samples::ad936x_iio_samples() -{ - n_bytes = 0; - n_interleaved_iq_samples = 0; - step_bytes = 0; - n_channels = 0; -} diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.h b/src/algorithms/signal_source/libs/ad936x_iio_samples.h index 53fff2c9e..9a1d7ce90 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.h @@ -33,11 +33,11 @@ class ad936x_iio_samples { public: - ad936x_iio_samples(); - uint32_t n_bytes; - uint32_t n_interleaved_iq_samples; - uint16_t n_channels; - uint16_t step_bytes; + ad936x_iio_samples() = default; + uint32_t n_bytes{0}; + uint32_t n_interleaved_iq_samples{0}; + uint16_t n_channels{0}; + uint16_t step_bytes{0}; char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; // max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q) }; diff --git a/src/algorithms/signal_source/libs/ppstcprx.cc b/src/algorithms/signal_source/libs/ppstcprx.cc index c23261aff..94dda2052 100644 --- a/src/algorithms/signal_source/libs/ppstcprx.cc +++ b/src/algorithms/signal_source/libs/ppstcprx.cc @@ -20,19 +20,6 @@ #include #include -pps_tcp_rx::pps_tcp_rx() -{ - // TODO Auto-generated constructor stub - is_connected = false; - clientSd = -1; -} - - -pps_tcp_rx::~pps_tcp_rx() -{ - // TODO Auto-generated destructor stub -} - void pps_tcp_rx::set_pps_samplestamp_queue(std::shared_ptr> queue) { @@ -40,7 +27,7 @@ void pps_tcp_rx::set_pps_samplestamp_queue(std::shared_ptr> Pps_queue; - int clientSd; + int clientSd{-1}; public: - volatile bool is_connected; - pps_tcp_rx(); - virtual ~pps_tcp_rx(); + volatile bool is_connected{false}; + pps_tcp_rx() = default; + virtual ~pps_tcp_rx() = default; - void receive_pps(std::string ip_address, int port); - bool send_cmd(std::string cmd); + void receive_pps(const std::string& ip_address, int port); + bool send_cmd(std::string cmd) const; void set_pps_samplestamp_queue(std::shared_ptr> queue); }; From 1384ebef5557978c4d53febe9dbc2823c526bc12 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Mon, 26 Aug 2024 09:03:56 +0200 Subject: [PATCH 372/499] Initialize the receiver local oscillator frequency to GPS_L5_FREQ_HZ by default in the ADRV9361Z7035 FPGA signal source and remove unnecessary include files. --- .../signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc | 2 +- .../signal_source/adapters/adrv9361_z7035_signal_source_fpga.h | 1 - .../signal_source/adapters/fmcomms5_signal_source_fpga.h | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc index 75ca38492..897dd7777 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -58,7 +58,7 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", -3.0)), phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)), tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)), - freq0_(configuration->property(role + ".freq", 0)), + freq0_(configuration->property(role + ".freq", GPS_L5_FREQ_HZ)), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))), diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h index acb84d663..286cde2d5 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h @@ -23,7 +23,6 @@ #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" -#include "fpga_dma-proxy.h" #include "fpga_dynamic_bit_selection.h" #include "fpga_switch.h" #include "gnss_block_interface.h" diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h index 665403099..fbb10bf67 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h @@ -23,7 +23,6 @@ #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" -#include "fpga_dma-proxy.h" #include "fpga_dynamic_bit_selection.h" #include "fpga_switch.h" #include "gnss_block_interface.h" From 3f3321f5a72053c62d0af53fb1bc2af698cdaa5b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 27 Aug 2024 15:14:01 +0200 Subject: [PATCH 373/499] Sort out building flags and improve their reporting --- CMakeLists.txt | 14 +++++----- .../signal_source/adapters/CMakeLists.txt | 8 ++++++ .../gnuradio_blocks/CMakeLists.txt | 8 +----- .../gnuradio_blocks/ad936x_iio_source.cc | 19 +++++++------ .../gnuradio_blocks/ad936x_iio_source.h | 28 +++++++++---------- .../signal_source/libs/CMakeLists.txt | 3 +- .../signal_source/libs/ad936x_iio_samples.h | 2 +- 7 files changed, 42 insertions(+), 40 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0606e348..a978c673f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3715,12 +3715,13 @@ add_subdirectory(src) add_feature_info(ENABLE_UHD ENABLE_UHD "Enables UHD_Signal_Source for using RF front-ends from the USRP family. Requires gr-uhd.") add_feature_info(ENABLE_OSMOSDR ENABLE_OSMOSDR "Enables Osmosdr_Signal_Source and RtlTcp_Signal_Source for using RF front-ends compatible with the OsmoSDR driver. Requires gr-osmosdr.") add_feature_info(ENABLE_LIMESDR ENABLE_LIMESDR "Enables Limesdr_Signal_Source. Requires gr-limesdr.") -add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio and libad9361-dev.") -add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.") -add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio and libad9361-dev.") -add_feature_info(ENABLE_MAX2771 ENABLE_MAX2771 "Enables FPGA_MAX2771_EVKIT_Signal_Source for devices with the MAX2771 chipset. Requires the spidev driver") -add_feature_info(ENABLE_DMA_PROXY ENABLE_DMA_PROXY "Enables DMA Signal_Source. Requires the DMA Proxy driver") -add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Iio_Signal_Source to access AD936X front-ends using libiio. Requires libiio and libad9361-dev.") +add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires libiio, libad9361-dev, and gr-iio.") +add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source and Ad936x_Custom_Signal_Source for using ADALM-PLUTO boards. Requires libiio, libad9361-dev, and gr-iio.") +add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Custom_Signal_Source for using ADALM-PLUTO boards with custom firmware. Requires libiio and libad9361-dev.") +add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks for FPGA offloading.") +add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables ADRV9361_Z7035_Signal_Source_FPGA and the FMCOMMS5_Signal_Source_FPGA for FPGA SoC devices with the AD9361 chipset. Requires libiio, libad9361-dev, and -DENABLE_FPGA=ON.") +add_feature_info(ENABLE_MAX2771 ENABLE_MAX2771 "Enables FPGA_MAX2771_EVKIT_Signal_Source for FPGA SoC devices with the with the MAX2771 chipset. Requires the spidev driver and -DENABLE_FPGA=ON.") +add_feature_info(ENABLE_DMA_PROXY ENABLE_DMA_PROXY "Enables DMA_Signal_Source_FPGA for file post-processing in FPGA SoC devices. Requires the DMA Proxy driver and -DENABLE_FPGA=ON.") add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.") add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.") add_feature_info(ENABLE_ARRAY ENABLE_ARRAY "Enables Raw_Array_Signal_Source and Array_Signal_Conditioner for using CTTC's antenna array. Requires gr-dbfcttc.") @@ -3732,7 +3733,6 @@ add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Runs clang-tidy along with add_feature_info(ENABLE_PROFILING ENABLE_PROFILING "Runs volk_gnsssdr_profile at the end of the building.") add_feature_info(ENABLE_OPENCL ENABLE_OPENCL "Enables GPS_L1_CA_PCPS_OpenCl_Acquisition (experimental). Requires OpenCL.") add_feature_info(ENABLE_CUDA ENABLE_CUDA "Enables GPS_L1_CA_DLL_PLL_Tracking_GPU (experimental). Requires CUDA.") -add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks for FPGA offloading.") add_feature_info(ENABLE_ARMA_NO_DEBUG ENABLE_ARMA_NO_DEBUG "Enables passing the ARMA_NO_DEBUG macro to Armadillo, hence disabling bound checking.") add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.") add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.") diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 5f5d4ce3b..9c0300522 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -25,6 +25,14 @@ if(ENABLE_PLUTOSDR) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_custom_signal_source.h) endif() +if(ENABLE_AD936X_SDR AND NOT ENABLE_PLUTOSDR) + ############################################## + # CUSTOM AD936X IIO SOURCE + ############################################## + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad936x_custom_signal_source.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_custom_signal_source.h) +endif() + if(ENABLE_FMCOMMS2) ############################################### # FMCOMMS2 based SDR Hardware diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index a217648b4..2eca5157a 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -10,13 +10,7 @@ if(ENABLE_RAW_UDP AND PCAP_FOUND) list(APPEND OPT_DRIVER_HEADERS gr_complex_ip_packet_source.h) endif() -if(ENABLE_AD936X_SDR) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gr_complex_ip_packet_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} gr_complex_ip_packet_source.h) -endif() - - -if(ENABLE_PLUTOSDR) +if(ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad936x_iio_source.cc) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_iio_source.h) endif() diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc index 1f0288dc9..c87006bd5 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_source.cc - * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the + * AD936x AD front-end family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * * ----------------------------------------------------------------------------- @@ -35,9 +36,9 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( const std::string& pluto_uri_, const std::string& board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, const std::string& rf_port_select_, const std::string& rf_filter, const std::string& gain_mode_rx0_, @@ -46,7 +47,7 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, const std::string& fe_ip_, @@ -106,9 +107,9 @@ void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples* samp ad936x_iio_source::ad936x_iio_source( const std::string& pluto_uri_, const std::string& board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, const std::string& rf_port_select_, const std::string& rf_filter, const std::string& gain_mode_rx0_, @@ -117,7 +118,7 @@ ad936x_iio_source::ad936x_iio_source( double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, const std::string& fe_ip_, diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h index a1a29f6ab..8f5a34c7c 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_source.h - * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the + * AD936x AD front-end family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * * ----------------------------------------------------------------------------- @@ -46,9 +47,9 @@ using ad936x_iio_source_sptr = gnss_shared_ptr; ad936x_iio_source_sptr ad936x_iio_make_source_sptr( const std::string &pluto_uri_, const std::string &board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, const std::string &rf_port_select_, const std::string &rf_filter, const std::string &gain_mode_rx0_, @@ -57,7 +58,7 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, const std::string &fe_ip_, @@ -92,9 +93,9 @@ private: friend ad936x_iio_source_sptr ad936x_iio_make_source_sptr( const std::string &pluto_uri_, const std::string &board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, const std::string &rf_port_select_, const std::string &rf_filter, const std::string &gain_mode_rx0_, @@ -103,7 +104,7 @@ private: double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, const std::string &fe_ip_, @@ -118,9 +119,9 @@ private: ad936x_iio_source( const std::string &pluto_uri_, const std::string &board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, const std::string &rf_port_select_, const std::string &rf_filter, const std::string &gain_mode_rx0_, @@ -129,7 +130,7 @@ private: double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, const std::string &fe_ip_, @@ -141,7 +142,6 @@ private: bool high_side_lo_, int tx_lo_channel_); - void ad9361_channel_demux_to_buffer(ad936x_iio_samples *samples_in, int nchannels, gr_vector_void_star &output_items); void ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out); diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 9d9732d3c..9c39f7dc7 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -35,7 +35,7 @@ if((ENABLE_FPGA AND ENABLE_AD9361) OR ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) endif() -if(ENABLE_PLUTOSDR) +if(ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_samples.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.cc) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_custom.h) @@ -51,7 +51,6 @@ if(ENABLE_ION) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_unpacking_ctx.h) endif() - set(SIGNAL_SOURCE_LIB_SOURCES rtl_tcp_commands.cc rtl_tcp_dongle_info.cc diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.h b/src/algorithms/signal_source/libs/ad936x_iio_samples.h index 9a1d7ce90..5ff43d065 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.h @@ -21,8 +21,8 @@ #define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768 * 4 #define IIO_INPUTRAMFIFOSIZE 256 +#include #include -#include #include /** \addtogroup Signal_Source From 310685cd20d9426f1f8038a442ff0ed7e208a7ea Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 28 Aug 2024 11:09:56 +0200 Subject: [PATCH 374/499] Allow building Ad936x_Custom_Signal_Source when gnuradio-iio is not available --- src/algorithms/signal_source/adapters/CMakeLists.txt | 2 +- src/algorithms/signal_source/libs/CMakeLists.txt | 2 +- src/core/receiver/CMakeLists.txt | 4 ++++ src/core/receiver/gnss_block_factory.cc | 6 ++++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 9c0300522..48e18e5f3 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -259,7 +259,7 @@ if(LIBIIO_FOUND) ) endif() -if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR) +if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) if(LIBAD9361_VERSION) if(LIBAD9361_VERSION VERSION_GREATER 0.1) target_compile_definitions(signal_source_adapters diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 9c39f7dc7..0df4f3303 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -113,7 +113,7 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR) +if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) target_link_libraries(signal_source_libs PUBLIC Iio::iio diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index 604449390..ba945f69b 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -94,6 +94,10 @@ if(ENABLE_PLUTOSDR) target_compile_definitions(core_receiver PRIVATE -DPLUTOSDR_DRIVER=1) endif() +if(ENABLE_AD936X_SDR) + target_compile_definitions(core_receiver PRIVATE -DAD936X_SDR_DRIVER=1) +endif() + if(ENABLE_FMCOMMS2) target_compile_definitions(core_receiver PRIVATE -DFMCOMMS2_DRIVER=1) endif() diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 222b93cad..fceadefb9 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -163,6 +163,10 @@ #include "plutosdr_signal_source.h" #endif +#if AD936X_SDR_DRIVER +#include "ad936x_custom_signal_source.h" +#endif + #if FMCOMMS2_DRIVER #include "fmcomms2_signal_source.h" #endif @@ -807,6 +811,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams, queue); block = std::move(block_); } +#endif +#if PLUTOSDR_DRIVER || AD936X_SDR_DRIVER else if (implementation == "Ad936x_Custom_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, From 557a7f7265d23733abc7b31be3407f8b3c30b6eb Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 28 Aug 2024 11:13:54 +0200 Subject: [PATCH 375/499] Add work on ISM --- src/core/system_parameters/galileo_ism.cc | 34 ++++++++++++++++++++++- src/core/system_parameters/galileo_ism.h | 19 +++++++------ src/tests/test_main.cc | 3 ++ 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc index 847a4ecd6..24b5b6d82 100644 --- a/src/core/system_parameters/galileo_ism.cc +++ b/src/core/system_parameters/galileo_ism.cc @@ -184,7 +184,7 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) c boost::to_block_range(frame_bits, std::back_inserter(bytes)); std::reverse(bytes.begin(), bytes.end()); - boost::crc_32_type crc32_ism; + boost::crc_optimal<32, 0xC0A0A0D5, 0xFFFFFFFF, 0xFFFFFFFF, true, true> crc32_ism; crc32_ism.process_bytes(bytes.data(), GALILEO_ISM_CRC_DATA_BYTES); const uint32_t crc_computed = crc32_ism.checksum(); if (this->ism_crc == crc_computed) @@ -193,4 +193,36 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) c } return false; +} + + +bool Galileo_ISM::ism_apply_to_sat(uint32_t prn) const +{ + if (prn == 0 || prn > 63) + { + return false; + } + std::bitset<32> bs(this->ism_mask); + if (this->ism_mask_msb == 0) + { + if (prn <= 32) + { + return bs[prn - 1]; + } + else + { + return false; + } + } + else + { + if (prn > 32) + { + return bs[prn - 32]; + } + else + { + return false; + } + } } \ No newline at end of file diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index 12436a606..2066fe0ac 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -57,16 +57,17 @@ public: void set_ism_Tvalidity(uint8_t tvalidity); void set_ism_crc(uint32_t crc); - bool check_ism_crc(const std::bitset& bits) const; + bool check_ism_crc(const std::bitset& bits) const; //!< Requires ism_crc to be already set + bool ism_apply_to_sat(uint32_t prn) const; //!< Returns true if ISM parameters apply to the prn satellite, false otherwise - double get_pconst_value() const; - double get_psat_value() const; - float get_ura_m() const; - float get_ure_m() const; - float get_bnom_m() const; - uint16_t get_WN_ISM() const; - uint16_t get_t0_ISM() const; - uint16_t get_Tvalidity_hours() const; + double get_pconst_value() const; //!< A priori constellation fault probability + double get_psat_value() const; //!< A priori satellite fault probability + float get_ura_m() const; //!< User Range Accuracy, in m, used for integrity + float get_ure_m() const; //!< User Range Error, in m, used for accuracy + float get_bnom_m() const; //!< Maximum nominal bias for a satellite, in m + uint16_t get_WN_ISM() const; //!< ISM Week Number, in weeks + uint16_t get_t0_ISM() const; //!< ISM Time of Week, in seconds + uint16_t get_Tvalidity_hours() const; //!< Validity duration of ISM content, in hours private: // ICD 2.1 Table 97 diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 3769756aa..00f1f9458 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -95,6 +95,9 @@ DECLARE_string(log_dir); #include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" #include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" #include "unit-tests/system-parameters/has_decoding_test.cc" +#include "unit-tests/system-parameters/galileo_ism_test.cc" + + #ifndef EXCLUDE_TESTS_REQUIRING_BINARIES #include "unit-tests/control-plane/control_thread_test.cc" From 89dfadb535d4d5038d86375dea1b0dab9e53bfe1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 29 Aug 2024 08:53:39 +0200 Subject: [PATCH 376/499] Bump local version of Protocol Buffers to v28.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a978c673f..35ccd15a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,7 +358,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.3") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") From 792ec38989a057b75e061b05846f25064a124983 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 29 Aug 2024 20:30:54 +0200 Subject: [PATCH 377/499] Update AArch64 features to Linux 6.10.6 --- .../include/cpu_features_macros.h | 4 +- .../cpu_features/include/cpuinfo_aarch64.h | 43 +++++++++++++++++++ .../src/impl_aarch64__base_implementation.inl | 23 +++++++++- .../cpu_features/test/cpuinfo_aarch64_test.cc | 18 ++++++++ 4 files changed, 85 insertions(+), 3 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index 42b4e55b1..c800d0c32 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -227,11 +227,11 @@ #endif // defined(CPU_FEATURES_ARCH_X86) #if defined(CPU_FEATURES_ARCH_ANY_ARM) -#if defined(__ARM_NEON__) +#if defined(__ARM_NEON) #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 1 #else #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 0 -#endif // defined(__ARM_NEON__) +#endif // defined(__ARM_NEON) #endif // defined(CPU_FEATURES_ARCH_ANY_ARM) #if defined(CPU_FEATURES_ARCH_MIPS) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h index a8cb0d41a..41108b6ec 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h @@ -182,6 +182,31 @@ typedef struct int smef16f16 : 1; // FP16 to FP16 outer product. int mops : 1; // Standardized memory operations. int hbc : 1; // Hinted conditional branches. + int sveb16b16 : 1; // Non-widening BFloat16 to BFloat16 arithmetic for SVE2 + // and SME2. + int lrcpc3 : 1; // Load-Acquire RCpc instructions version 3. + int lse128 : 1; // 128-bit Atomics. + int fpmr : 1; // Floating-point Mode Register. + int lut : 1; // Lookup table instructions with 2-bit and 4-bit indices. + int faminmax : 1; // Maximum and minimum absolute value instructions. + int f8cvt : 1; // FP scaling instructions and FP8 convert instructions. + int f8fma : 1; // FP8 to single-precision and half-precision + // multiply-accumulate instructions. + int f8dp4 : 1; // FP8 to single-precision 4-way dot product FDOT (4-way) + // instructions. + int f8dp2 : 1; // FP8 to half-precision 2-way dot product FDOT (2-way) + // instructions. + int f8e4m3 : 1; // Arm FP8 E4M3 format. + int f8e5m2 : 1; // Arm FP8 E5M2 format. + int smelutv2 : 1; // SME2 lookup table LUTI4 and MOVT instructions. + int smef8f16 : 1; // SME2 F8F16 instructions. + int smef8f32 : 1; // SME2 F8F32 instructions. + int smesf8fma : 1; // SVE2 FP8 to single-precision and half-precision + // multiply-accumulate instructions. + int smesf8dp4 : 1; // SVE2 FP8 to single-precision 4-way dot product FDOT + // (4-way) instructions. + int smesf8dp2 : 1; // SVE2 FP8 to half-precision 2-way dot product FDOT + // (2-way) instructions. // Make sure to update Aarch64FeaturesEnum below if you add a field here. } Aarch64Features; @@ -280,6 +305,24 @@ typedef enum AARCH64_SME_F16F16, AARCH64_MOPS, AARCH64_HBC, + AARCH64_SVE_B16B16, + AARCH64_LRCPC3, + AARCH64_LSE128, + AARCH64_FPMR, + AARCH64_LUT, + AARCH64_FAMINMAX, + AARCH64_F8CVT, + AARCH64_F8FMA, + AARCH64_F8DP4, + AARCH64_F8DP2, + AARCH64_F8E4M3, + AARCH64_F8E5M2, + AARCH64_SME_LUTV2, + AARCH64_SME_F8F16, + AARCH64_SME_F8F32, + AARCH64_SME_SF8FMA, + AARCH64_SME_SF8DP4, + AARCH64_SME_SF8DP2, AARCH64_LAST_, } Aarch64FeaturesEnum; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl index 14be5a726..d0057ee10 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl @@ -103,7 +103,28 @@ LINE(AARCH64_SME_F16F16, smef16f16, "smef16f16", 0, \ AARCH64_HWCAP2_SME_F16F16) \ LINE(AARCH64_MOPS, mops, "mops", 0, AARCH64_HWCAP2_MOPS) \ - LINE(AARCH64_HBC, hbc, "hbc", 0, AARCH64_HWCAP2_HBC) + LINE(AARCH64_HBC, hbc, "hbc", 0, AARCH64_HWCAP2_HBC) \ + LINE(AARCH64_SVE_B16B16, sveb16b16, "sveb16b16", 0, \ + AARCH64_HWCAP2_SVE_B16B16) \ + LINE(AARCH64_LRCPC3, lrcpc3, "lrcpc3", 0, AARCH64_HWCAP2_LRCPC3) \ + LINE(AARCH64_LSE128, lse128, "lse128", 0, AARCH64_HWCAP2_LSE128) \ + LINE(AARCH64_FPMR, fpmr, "fpmr", 0, AARCH64_HWCAP2_FPMR) \ + LINE(AARCH64_LUT, lut, "lut", 0, AARCH64_HWCAP2_LUT) \ + LINE(AARCH64_FAMINMAX, faminmax, "faminmax", 0, AARCH64_HWCAP2_FAMINMAX) \ + LINE(AARCH64_F8CVT, f8cvt, "f8cvt", 0, AARCH64_HWCAP2_F8CVT) \ + LINE(AARCH64_F8FMA, f8fma, "f8fma", 0, AARCH64_HWCAP2_F8FMA) \ + LINE(AARCH64_F8DP4, f8dp4, "f8dp4", 0, AARCH64_HWCAP2_F8DP4) \ + LINE(AARCH64_F8DP2, f8dp2, "f8dp2", 0, AARCH64_HWCAP2_F8DP2) \ + LINE(AARCH64_F8E4M3, f8e4m3, "f8e4m3", 0, AARCH64_HWCAP2_F8E4M3) \ + LINE(AARCH64_F8E5M2, f8e5m2, "f8e5m2", 0, AARCH64_HWCAP2_F8E5M2) \ + LINE(AARCH64_SME_LUTV2, smelutv2, "smelutv1", 0, AARCH64_HWCAP2_SME_LUTV2) \ + LINE(AARCH64_SME_F8F16, smef8f16, "smef8f16", 0, AARCH64_HWCAP2_SME_F8F16) \ + LINE(AARCH64_SME_F8F32, smef8f32, "smef8f32", 0, AARCH64_HWCAP2_SME_F8F32) \ + LINE(AARCH64_SME_SF8FMA, smesf8fma, "smesf8fma", 0, \ + AARCH64_HWCAP2_SME_SF8FMA) \ + LINE(AARCH64_SME_SF8DP4, smesf8dp4, "smesf8dp4", 0, \ + AARCH64_HWCAP2_SME_SF8DP4) \ + LINE(AARCH64_SME_SF8DP2, smesf8dp2, "smesf8dp2", 0, AARCH64_HWCAP2_SME_SF8DP2) #define INTROSPECTION_PREFIX Aarch64 #define INTROSPECTION_ENUM_PREFIX AARCH64 #include "define_introspection_and_hwcaps.inl" \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc index fc8abf8fe..e69c5ef78 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc @@ -326,6 +326,24 @@ CPU revision : 3)"); EXPECT_FALSE(info.features.smef16f16); EXPECT_FALSE(info.features.mops); EXPECT_FALSE(info.features.hbc); + EXPECT_FALSE(info.features.sveb16b16); + EXPECT_FALSE(info.features.lrcpc3); + EXPECT_FALSE(info.features.lse128); + EXPECT_FALSE(info.features.fpmr); + EXPECT_FALSE(info.features.lut); + EXPECT_FALSE(info.features.faminmax); + EXPECT_FALSE(info.features.f8cvt); + EXPECT_FALSE(info.features.f8fma); + EXPECT_FALSE(info.features.f8dp4); + EXPECT_FALSE(info.features.f8dp2); + EXPECT_FALSE(info.features.f8e4m3); + EXPECT_FALSE(info.features.f8e5m2); + EXPECT_FALSE(info.features.smelutv2); + EXPECT_FALSE(info.features.smef8f16); + EXPECT_FALSE(info.features.smef8f32); + EXPECT_FALSE(info.features.smesf8fma); + EXPECT_FALSE(info.features.smesf8dp4); + EXPECT_FALSE(info.features.smesf8dp2); } #elif defined(CPU_FEATURES_OS_MACOS) TEST_F(CpuidAarch64Test, FromDarwinSysctlFromName) From 1088387f75169abd500dff93c3798176c058d5d2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 30 Aug 2024 07:52:37 +0200 Subject: [PATCH 378/499] Update AArch64 features to Linux 6.10.6 --- .../cpu_features/include/internal/hwcaps.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h index 63baa1fff..3f500f606 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h @@ -94,6 +94,24 @@ CPU_FEATURES_START_CPP_NAMESPACE #define AARCH64_HWCAP2_SME_F16F16 (1UL << 42) #define AARCH64_HWCAP2_MOPS (1UL << 43) #define AARCH64_HWCAP2_HBC (1UL << 44) +#define AARCH64_HWCAP2_SVE_B16B16 (1UL << 45) +#define AARCH64_HWCAP2_LRCPC3 (1UL << 46) +#define AARCH64_HWCAP2_LSE128 (1UL << 47) +#define AARCH64_HWCAP2_FPMR (1UL << 48) +#define AARCH64_HWCAP2_LUT (1UL << 49) +#define AARCH64_HWCAP2_FAMINMAX (1UL << 50) +#define AARCH64_HWCAP2_F8CVT (1UL << 51) +#define AARCH64_HWCAP2_F8FMA (1UL << 52) +#define AARCH64_HWCAP2_F8DP4 (1UL << 53) +#define AARCH64_HWCAP2_F8DP2 (1UL << 54) +#define AARCH64_HWCAP2_F8E4M3 (1UL << 55) +#define AARCH64_HWCAP2_F8E5M2 (1UL << 56) +#define AARCH64_HWCAP2_SME_LUTV2 (1UL << 57) +#define AARCH64_HWCAP2_SME_F8F16 (1UL << 58) +#define AARCH64_HWCAP2_SME_F8F32 (1UL << 59) +#define AARCH64_HWCAP2_SME_SF8FMA (1UL << 60) +#define AARCH64_HWCAP2_SME_SF8DP4 (1UL << 61) +#define AARCH64_HWCAP2_SME_SF8DP2 (1UL << 62) // http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h #define ARM_HWCAP_SWP (1UL << 0) From 3ec25f2347fc7db1c39d7f916c624ac61ae3edde Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 31 Aug 2024 10:07:44 +0200 Subject: [PATCH 379/499] Merge from upstream next (#27) * Decouple the FPGA DMA signal source from the AD9361 FPGA signal source. * Add the MAX2771_EVKIT FPGA signal source and the ENABLE_FPGA_MAX2771_EVKIT flag to enable it. * Adjust cross-compilation flags to properly support FPGA signal sources * fix signal source names for consistency * Detect if the spidev driver is installed when the ENABLE_MAX2771 flag is set. Detect if the DMA proxy driver is installed when the ENABLE_DMA_PROXY flag is set. Check if ENABLE_FPGA is set when either ENABLE_MAX2771 or ENABLE_DMA_PROXY is set. * fix FPGA signal source names for consistency * Fix FPGA-related CMakefile flags * make cpplint happy * make cpplint happy * make cmakelint happy * make clang-format happy * Replaced the AD9361 FPGA signal source with the ADRV9361_Z7035 FPGA and the FMCOMMS5 FPGA signal sources. * Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 * Avoid code duplication in CMake modules * Update clang-tidy job * Clang Tidy fixes * Improve efficiency of Concurrent_Map and Concurrent_Queue classes * Fix segmentation fault if the SignalSource implementation is not available * Moved decimation factor count variable to the class * Avoid possible runtime error when PVT.enable_rx_clock_correction=true * Fix formatting * Fix clang-tidy job * Capitalize FPGA in class implementation names * Capitalize acronyms in FPGA-related class names * Instantiate sources only once * Update changelog * Bump version of google benchmark to 1.9.0 * Fix CMakeLists header file list in signal source libs Header file paths were being appended to the source files list. This is not that important since, in general, you don't need to add the header files to the cmake target. * Added ION GNSS SDR Metadata Standard signal source * Only specify outputs for the requested streams * Fixed block iteration withing a file The `File` object only holds a shallow reference to its `Lane` (without the list of blocks). So we must retrieve the full reference manually. * Treat data file paths as relative to the metadata file The data file paths are actually not native paths but URLs, this covers most cases but not all of them. * Fixed decoding errors and refactored each class into its own file * Fixed sample count error & refactored * Bufferef IO & propagate configuration inside ION source * Reset sample value before writing new one Sample values are ORed into the output buffer because they may need a few read/write operations depending on alignment. So, if we don't set the value to 0 before doing this, all samples quickly become 0xFF after a few cycles of the output buffer. * Simpler handling of simpler bit formats If a sample is the same size as a word, it is much easier to read. * Less callback shenanigans * Fix wrong buffer size * Fixed conditional compilation issues And added a comment * Linting fixes * Fixed arithmetic operations on pointers * Fix formatting * Use lock_guard instead of unique_lock * Create a CMake target for the ION dependency for consistency * Improve formatting, add missing include * Fixes for C++ standards older than 20. Avoid C++20-specific lambda templates * Update changelog * Add Victor to the list of authors * Fix CMake error * Fix building error * Fix building * Add -DENABLE_ION=ON to CI jobs * Fix CMake lists * Catch all exceptions * Fix building for -DENABLE_PLUTOSDR=ON * Removed unused member fields and function parameters * Use std::ifstream instead of FILE for reading sample data * Fixed includes and code style * Simplified disconnect() function We can disconnect the sources directly instead of disconnecting each of their outputs. * Implemented range check in `IONGSMSSignalSource::get_right_block(int)` * Moved ION GSMS file source to `gnuradio_blocks/` directory Also fixed some header guards. * Fixed ION GNSS Metadata Standard dependency version * Simplified by removing a very shallow class `ion_gnss_metadata_handler` was only reading the metadata file, which can easily be done in `ion_gsms_signal_source`. * Added valves to properly handle end of samples * Cleaner exit if the data file is not found * Fix uninitialized warning * Remove unused configuration parameter. Uniformize guard names * Fix for CMake < 3.14 * fix configuration options for the FPGA-based AD9361-based boards * Put the global function into an anonymous namespace Use emplace_back instead of push_back * Make private member metadata_ a std::shared_pointer * Simplify code * Remove ION source from CI * Apply clang-tidy fixes * Initialize the receiver local oscillator frequency to GPS_L5_FREQ_HZ by default in the ADRV9361Z7035 FPGA signal source and remove unnecessary include files. * Sort out building flags and improve their reporting * Allow building Ad936x_Custom_Signal_Source when gnuradio-iio is not available * Bump local version of Protocol Buffers to v28.0 * Update AArch64 features to Linux 6.10.6 * Update AArch64 features to Linux 6.10.6 * Fix merging --------- Co-authored-by: Marc Majoral Co-authored-by: cesaaargm Co-authored-by: Xavier Guerrero-Pau Co-authored-by: Victor Castillo --- .gitignore | 1 - AUTHORS | 1 + CITATION.cff | 5 + CMakeLists.txt | 178 +++++++++++- docs/CHANGELOG.md | 5 + .../include/cpu_features_macros.h | 4 +- .../cpu_features/include/cpuinfo_aarch64.h | 43 +++ .../cpu_features/include/internal/hwcaps.h | 18 ++ .../src/impl_aarch64__base_implementation.inl | 23 +- .../cpu_features/test/cpuinfo_aarch64_test.cc | 18 ++ .../signal_source/adapters/CMakeLists.txt | 19 +- .../adapters/ad936x_custom_signal_source.cc | 17 +- .../adrv9361_z7035_signal_source_fpga.cc | 67 ++--- .../adrv9361_z7035_signal_source_fpga.h | 13 +- .../adapters/fmcomms5_signal_source_fpga.cc | 57 ++-- .../adapters/fmcomms5_signal_source_fpga.h | 13 +- .../adapters/ion_gsms_signal_source.cc | 239 +++++++++++++++ .../adapters/ion_gsms_signal_source.h | 85 ++++++ .../max2771_evkit_signal_source_fpga.cc | 21 +- .../max2771_evkit_signal_source_fpga.h | 4 +- .../gnuradio_blocks/CMakeLists.txt | 13 +- .../gnuradio_blocks/ad936x_iio_source.cc | 114 +++++--- .../gnuradio_blocks/ad936x_iio_source.h | 70 ++--- .../signal_source/gnuradio_blocks/ion_gsms.cc | 202 +++++++++++++ .../signal_source/gnuradio_blocks/ion_gsms.h | 74 +++++ .../signal_source/libs/CMakeLists.txt | 28 +- .../signal_source/libs/ad9361_manager.cc | 4 +- .../signal_source/libs/ad936x_iio_custom.cc | 214 ++++++++------ .../signal_source/libs/ad936x_iio_custom.h | 64 ++--- .../signal_source/libs/ad936x_iio_samples.cc | 25 -- .../signal_source/libs/ad936x_iio_samples.h | 24 +- .../signal_source/libs/ion_gsms_chunk_data.cc | 271 ++++++++++++++++++ .../signal_source/libs/ion_gsms_chunk_data.h | 188 ++++++++++++ .../libs/ion_gsms_chunk_unpacking_ctx.h | 184 ++++++++++++ .../libs/ion_gsms_stream_encodings.h | 170 +++++++++++ src/algorithms/signal_source/libs/ppstcprx.cc | 25 +- src/algorithms/signal_source/libs/ppstcprx.h | 12 +- src/core/receiver/CMakeLists.txt | 8 + src/core/receiver/gnss_block_factory.cc | 20 +- 39 files changed, 2153 insertions(+), 388 deletions(-) create mode 100644 src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc create mode 100644 src/algorithms/signal_source/adapters/ion_gsms_signal_source.h create mode 100644 src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc create mode 100644 src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h delete mode 100644 src/algorithms/signal_source/libs/ad936x_iio_samples.cc create mode 100644 src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc create mode 100644 src/algorithms/signal_source/libs/ion_gsms_chunk_data.h create mode 100644 src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h create mode 100644 src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h diff --git a/.gitignore b/.gitignore index 4a50387fa..4afd17279 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,3 @@ HAS_* gnss_sdr_pvt.nmea build-debug/ build-release/ - diff --git a/AUTHORS b/AUTHORS index ad0660662..7df41ed17 100644 --- a/AUTHORS +++ b/AUTHORS @@ -64,6 +64,7 @@ Marc Sales marcsales92@gmail.com Contributor Piyush Gupta piyush04111999@gmail.com Contributor Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor Stefan van der Linden spvdlinden@gmail.com Contributor +Víctor Castillo-Agüero victorcastilloaguero@gmail.com Contributor Will Silberman wsilberm@google.com Contributor Carlos Paniego carpanie@hotmail.com Artwork diff --git a/CITATION.cff b/CITATION.cff index 0f11b55f1..4bf27081f 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -34,6 +34,11 @@ authors: email: mara.branzanti@gmail.com family-names: Branzanti given-names: Mara + - alias: castle055 + affiliation: "Instituto Nacional de Técnica Aeroespacial" + email: victorcastilloaguero@gmail.com + family-names: "Castillo-Agüero" + given-names: Víctor - alias: acebrianjuan email: acebrianjuan@gmail.com family-names: "Cebrián-Juan" diff --git a/CMakeLists.txt b/CMakeLists.txt index c10936ca1..39132e9cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,8 @@ option(ENABLE_ARRAY "Enable the use of CTTC's antenna array front-end as signal option(ENABLE_ZMQ "Enable GNU Radio ZeroMQ Messaging, requires gr-zeromq" ON) +option(ENABLE_ION "Enable ION GNSS-SDR Metadata Standard signal source" OFF) + # Performance analysis tools option(ENABLE_GPERFTOOLS "Enable linking to Gperftools libraries (tcmalloc and profiler)" OFF) @@ -358,12 +360,12 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "27.3") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.8.5") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.0") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) @@ -3252,7 +3254,7 @@ set_package_properties(LIBIIO PROPERTIES PURPOSE "Used for communication with the AD9361 chipset." TYPE OPTIONAL ) -if(ENABLE_AD9361 OR ENABLE_FMCOMMS2) +if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR) if(NOT LIBIIO_FOUND) message(STATUS "libiio not found, its installation is required.") message(STATUS "Please build and install the following projects:") @@ -3270,6 +3272,161 @@ if(ENABLE_AD9361 OR ENABLE_FMCOMMS2) endif() +################################################################################ +# ION GNSS-SDR Metadata Standard https://sdr.ion.org/ (OPTIONAL) +################################################################################ +if(CMAKE_VERSION VERSION_LESS 3.14) + set(ENABLE_ION OFF) # FetchContent_MakeAvailable is available from CMake 3.14 +endif() +if(ENABLE_ION) + include(FetchContent) + set(CMAKE_POLICY_DEFAULT_CMP0063 NEW) + FetchContent_Declare( + gnss_metadata_standard + GIT_REPOSITORY https://github.com/IonMetadataWorkingGroup/GNSS-Metadata-Standard + GIT_TAG 220d116e10db5e403e21b77a1fa25aa35feda198 + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/gnss-metadata-standard + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-metadata-standard + ) + FetchContent_MakeAvailable(gnss_metadata_standard) + + if(NOT TARGET ION::ion) + add_library(ION::ion STATIC IMPORTED) + add_dependencies(ION::ion gnss_metadata_standard) + if(CMAKE_GENERATOR STREQUAL "Xcode") + set_target_properties(ION::ion PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION_DEBUG "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_RELEASE "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Release/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_RELWITHDEBINFO "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION_MINSIZEREL "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc" + ) + set_property(TARGET ION::ion APPEND PROPERTY + INTERFACE_LINK_LIBRARIES + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Release/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Release/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/MinSizeRel/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/RelWithDebInfo/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + "$<$:${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/Debug/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}>" + ) + else() + set_target_properties(ION::ion PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX}" + INTERFACE_INCLUDE_DIRECTORIES "${GNSSSDR_BINARY_DIR}/thirdparty/gnss-metadata-standard/source/api/inc" + INTERFACE_LINK_LIBRARIES "${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/GnssMetadata/${CMAKE_FIND_LIBRARY_PREFIXES}api${CMAKE_STATIC_LIBRARY_SUFFIX};${GNSSSDR_BINARY_DIR}/gnss-metadata-standard/source/api/lib/tinyxml2/${CMAKE_FIND_LIBRARY_PREFIXES}xml${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + endif() + endif() +endif() + + +##################################################################### +# Check signal sources related to FPGA only. +##################################################################### +if(ENABLE_MAX2771 AND NOT ENABLE_FPGA) + message(STATUS "The SPIdev driver is enabled, but the FPGA is not enabled. The FPGA is required when using the SPIdev driver.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "ENABLE_MAX2771 can only be set when ENABLE_FPGA is also set.") + endif() +endif() +if(ENABLE_DMA_PROXY AND NOT ENABLE_FPGA) + message(STATUS "The DMA Proxy driver is enabled, but the FPGA is not enabled. The FPGA is required when using the DMA Proxy driver.") + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "ENABLE_DMA_PROXY can only be set when ENABLE_FPGA is also set.") + endif() +endif() + + + +##################################################################### +# spidev driver - OPTIONAL +# Linux kernel driver that provides user-space access to Serial +# Peripheral Interface) +##################################################################### +if(ENABLE_MAX2771) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + find_program(STRINGS_EXECUTABLE strings) + if(NOT STRINGS_EXECUTABLE) + message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") + message(STATUS " You can try to install it by typing:") + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") + if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") + message(STATUS " sudo yum install binutils") + elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") + message(STATUS " sudo zypper install binutils") + else() + message(STATUS " sudo apt-get install binutils") + endif() + endif() + message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") + endif() + set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") + if(EXISTS "${DTB_FILE}") + message(STATUS "Found DTB file: ${DTB_FILE}") + # Run the strings command and grep for "spidev" + execute_process( + COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} + COMMAND grep "spidev" + OUTPUT_VARIABLE GREP_OUTPUT + RESULT_VARIABLE GREP_RESULT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if(GREP_RESULT EQUAL 0) + message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") + else() + message(STATUS "SPIdev driver not found, its installation is required.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") + endif() + endif() + else() + message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") + endif() +endif() + + + +##################################################################### +# DMA Proxy driver - OPTIONAL +# Simplified and efficient interface for user-space applications +# to leverage DMA capabilities for Xilinx FPGA and SoC systems +##################################################################### +if(ENABLE_DMA_PROXY) + if(DEFINED ENV{SDKTARGETSYSROOT}) + set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) + else() + set(TARGET_ROOTFS_PATH "") + endif() + set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + if(EXISTS "${DMA_PROXY_FILE}") + message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") + else() + if(ENABLE_PACKAGING) + set(ENABLE_DMA_PROXY OFF) + else() + message(FATAL_ERROR "DMA Proxy driver is required for building gnss-sdr with -DENABLE_DMA_PROXY=ON.") + endif() + endif() +endif() + + ##################################################################### # Check signal sources related to FPGA only. @@ -3573,23 +3730,24 @@ add_subdirectory(src) add_feature_info(ENABLE_UHD ENABLE_UHD "Enables UHD_Signal_Source for using RF front-ends from the USRP family. Requires gr-uhd.") add_feature_info(ENABLE_OSMOSDR ENABLE_OSMOSDR "Enables Osmosdr_Signal_Source and RtlTcp_Signal_Source for using RF front-ends compatible with the OsmoSDR driver. Requires gr-osmosdr.") add_feature_info(ENABLE_LIMESDR ENABLE_LIMESDR "Enables Limesdr_Signal_Source. Requires gr-limesdr.") -add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires gr-iio and libad9361-dev.") -add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source for using ADALM-PLUTO boards. Requires gr-iio.") -add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables Ad9361_Fpga_Signal_Source for devices with the AD9361 chipset. Requires libiio and libad9361-dev.") -add_feature_info(ENABLE_MAX2771 ENABLE_MAX2771 "Enables FPGA_MAX2771_EVKIT_Signal_Source for devices with the MAX2771 chipset. Requires the spidev driver") -add_feature_info(ENABLE_DMA_PROXY ENABLE_DMA_PROXY "Enables DMA Signal_Source. Requires the DMA Proxy driver") -add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Iio_Signal_Source to access AD936X front-ends using libiio. Requires libiio and libad9361-dev.") +add_feature_info(ENABLE_FMCOMMS2 ENABLE_FMCOMMS2 "Enables Fmcomms2_Signal_Source for FMCOMMS2/3/4 devices. Requires libiio, libad9361-dev, and gr-iio.") +add_feature_info(ENABLE_PLUTOSDR ENABLE_PLUTOSDR "Enables Plutosdr_Signal_Source and Ad936x_Custom_Signal_Source for using ADALM-PLUTO boards. Requires libiio, libad9361-dev, and gr-iio.") +add_feature_info(ENABLE_AD936X_SDR ENABLE_AD936X_SDR "Enables Ad936x_Custom_Signal_Source for using ADALM-PLUTO boards with custom firmware. Requires libiio and libad9361-dev.") +add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks for FPGA offloading.") +add_feature_info(ENABLE_AD9361 ENABLE_AD9361 "Enables ADRV9361_Z7035_Signal_Source_FPGA and the FMCOMMS5_Signal_Source_FPGA for FPGA SoC devices with the AD9361 chipset. Requires libiio, libad9361-dev, and -DENABLE_FPGA=ON.") +add_feature_info(ENABLE_MAX2771 ENABLE_MAX2771 "Enables FPGA_MAX2771_EVKIT_Signal_Source for FPGA SoC devices with the with the MAX2771 chipset. Requires the spidev driver and -DENABLE_FPGA=ON.") +add_feature_info(ENABLE_DMA_PROXY ENABLE_DMA_PROXY "Enables DMA_Signal_Source_FPGA for file post-processing in FPGA SoC devices. Requires the DMA Proxy driver and -DENABLE_FPGA=ON.") add_feature_info(ENABLE_RAW_UDP ENABLE_RAW_UDP "Enables Custom_UDP_Signal_Source for custom UDP packet sample source. Requires libpcap.") add_feature_info(ENABLE_FLEXIBAND ENABLE_FLEXIBAND "Enables Flexiband_Signal_Source for using Teleorbit's Flexiband RF front-end. Requires gr-teleorbit.") add_feature_info(ENABLE_ARRAY ENABLE_ARRAY "Enables Raw_Array_Signal_Source and Array_Signal_Conditioner for using CTTC's antenna array. Requires gr-dbfcttc.") add_feature_info(ENABLE_ZMQ ENABLE_ZMQ "Enables ZMQ_Signal_Source for GNU Radio ZeroMQ messages. Requires gr-zeromq.") +add_feature_info(ENABLE_ION ENABLE_ION "Enables ION_GSMS_Signal_Source for the ION Metadata Standard.") add_feature_info(ENABLE_GPERFTOOLS ENABLE_GPERFTOOLS "Enables performance analysis. Requires Gperftools.") add_feature_info(ENABLE_GPROF ENABLE_GPROF "Enables performance analysis with 'gprof'.") add_feature_info(ENABLE_CLANG_TIDY ENABLE_CLANG_TIDY "Runs clang-tidy along with the compiler. Requires Clang.") add_feature_info(ENABLE_PROFILING ENABLE_PROFILING "Runs volk_gnsssdr_profile at the end of the building.") add_feature_info(ENABLE_OPENCL ENABLE_OPENCL "Enables GPS_L1_CA_PCPS_OpenCl_Acquisition (experimental). Requires OpenCL.") add_feature_info(ENABLE_CUDA ENABLE_CUDA "Enables GPS_L1_CA_DLL_PLL_Tracking_GPU (experimental). Requires CUDA.") -add_feature_info(ENABLE_FPGA ENABLE_FPGA "Enables building of processing blocks for FPGA offloading.") add_feature_info(ENABLE_ARMA_NO_DEBUG ENABLE_ARMA_NO_DEBUG "Enables passing the ARMA_NO_DEBUG macro to Armadillo, hence disabling bound checking.") add_feature_info(ENABLE_PACKAGING ENABLE_PACKAGING "Enables software packaging.") add_feature_info(ENABLE_OWN_GLOG ENABLE_OWN_GLOG "Forces the downloading and building of Google glog.") diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3963e0b20..327b26a8d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -41,6 +41,11 @@ All notable changes to GNSS-SDR will be documented in this file. - `-DENABLE_DMA_PROXY`: Checks if the DMA proxy driver is installed for controlling the DMA in the FPGA and enables its usage. +- Add the `ION_GSMS_Signal_Source`, which is able to process raw data files + described with the + [ION GNSS Software Defined Receiver Metadata Standard](https://sdr.ion.org/). + It requires the `-DENABLE_ION=ON` building configuration option. + ### Improvements in Portability: - Fix building against google-glog 0.7.x. diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index 42b4e55b1..c800d0c32 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -227,11 +227,11 @@ #endif // defined(CPU_FEATURES_ARCH_X86) #if defined(CPU_FEATURES_ARCH_ANY_ARM) -#if defined(__ARM_NEON__) +#if defined(__ARM_NEON) #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 1 #else #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 0 -#endif // defined(__ARM_NEON__) +#endif // defined(__ARM_NEON) #endif // defined(CPU_FEATURES_ARCH_ANY_ARM) #if defined(CPU_FEATURES_ARCH_MIPS) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h index a8cb0d41a..41108b6ec 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_aarch64.h @@ -182,6 +182,31 @@ typedef struct int smef16f16 : 1; // FP16 to FP16 outer product. int mops : 1; // Standardized memory operations. int hbc : 1; // Hinted conditional branches. + int sveb16b16 : 1; // Non-widening BFloat16 to BFloat16 arithmetic for SVE2 + // and SME2. + int lrcpc3 : 1; // Load-Acquire RCpc instructions version 3. + int lse128 : 1; // 128-bit Atomics. + int fpmr : 1; // Floating-point Mode Register. + int lut : 1; // Lookup table instructions with 2-bit and 4-bit indices. + int faminmax : 1; // Maximum and minimum absolute value instructions. + int f8cvt : 1; // FP scaling instructions and FP8 convert instructions. + int f8fma : 1; // FP8 to single-precision and half-precision + // multiply-accumulate instructions. + int f8dp4 : 1; // FP8 to single-precision 4-way dot product FDOT (4-way) + // instructions. + int f8dp2 : 1; // FP8 to half-precision 2-way dot product FDOT (2-way) + // instructions. + int f8e4m3 : 1; // Arm FP8 E4M3 format. + int f8e5m2 : 1; // Arm FP8 E5M2 format. + int smelutv2 : 1; // SME2 lookup table LUTI4 and MOVT instructions. + int smef8f16 : 1; // SME2 F8F16 instructions. + int smef8f32 : 1; // SME2 F8F32 instructions. + int smesf8fma : 1; // SVE2 FP8 to single-precision and half-precision + // multiply-accumulate instructions. + int smesf8dp4 : 1; // SVE2 FP8 to single-precision 4-way dot product FDOT + // (4-way) instructions. + int smesf8dp2 : 1; // SVE2 FP8 to half-precision 2-way dot product FDOT + // (2-way) instructions. // Make sure to update Aarch64FeaturesEnum below if you add a field here. } Aarch64Features; @@ -280,6 +305,24 @@ typedef enum AARCH64_SME_F16F16, AARCH64_MOPS, AARCH64_HBC, + AARCH64_SVE_B16B16, + AARCH64_LRCPC3, + AARCH64_LSE128, + AARCH64_FPMR, + AARCH64_LUT, + AARCH64_FAMINMAX, + AARCH64_F8CVT, + AARCH64_F8FMA, + AARCH64_F8DP4, + AARCH64_F8DP2, + AARCH64_F8E4M3, + AARCH64_F8E5M2, + AARCH64_SME_LUTV2, + AARCH64_SME_F8F16, + AARCH64_SME_F8F32, + AARCH64_SME_SF8FMA, + AARCH64_SME_SF8DP4, + AARCH64_SME_SF8DP2, AARCH64_LAST_, } Aarch64FeaturesEnum; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h index 63baa1fff..3f500f606 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/internal/hwcaps.h @@ -94,6 +94,24 @@ CPU_FEATURES_START_CPP_NAMESPACE #define AARCH64_HWCAP2_SME_F16F16 (1UL << 42) #define AARCH64_HWCAP2_MOPS (1UL << 43) #define AARCH64_HWCAP2_HBC (1UL << 44) +#define AARCH64_HWCAP2_SVE_B16B16 (1UL << 45) +#define AARCH64_HWCAP2_LRCPC3 (1UL << 46) +#define AARCH64_HWCAP2_LSE128 (1UL << 47) +#define AARCH64_HWCAP2_FPMR (1UL << 48) +#define AARCH64_HWCAP2_LUT (1UL << 49) +#define AARCH64_HWCAP2_FAMINMAX (1UL << 50) +#define AARCH64_HWCAP2_F8CVT (1UL << 51) +#define AARCH64_HWCAP2_F8FMA (1UL << 52) +#define AARCH64_HWCAP2_F8DP4 (1UL << 53) +#define AARCH64_HWCAP2_F8DP2 (1UL << 54) +#define AARCH64_HWCAP2_F8E4M3 (1UL << 55) +#define AARCH64_HWCAP2_F8E5M2 (1UL << 56) +#define AARCH64_HWCAP2_SME_LUTV2 (1UL << 57) +#define AARCH64_HWCAP2_SME_F8F16 (1UL << 58) +#define AARCH64_HWCAP2_SME_F8F32 (1UL << 59) +#define AARCH64_HWCAP2_SME_SF8FMA (1UL << 60) +#define AARCH64_HWCAP2_SME_SF8DP4 (1UL << 61) +#define AARCH64_HWCAP2_SME_SF8DP2 (1UL << 62) // http://elixir.free-electrons.com/linux/latest/source/arch/arm/include/uapi/asm/hwcap.h #define ARM_HWCAP_SWP (1UL << 0) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl index 14be5a726..d0057ee10 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64__base_implementation.inl @@ -103,7 +103,28 @@ LINE(AARCH64_SME_F16F16, smef16f16, "smef16f16", 0, \ AARCH64_HWCAP2_SME_F16F16) \ LINE(AARCH64_MOPS, mops, "mops", 0, AARCH64_HWCAP2_MOPS) \ - LINE(AARCH64_HBC, hbc, "hbc", 0, AARCH64_HWCAP2_HBC) + LINE(AARCH64_HBC, hbc, "hbc", 0, AARCH64_HWCAP2_HBC) \ + LINE(AARCH64_SVE_B16B16, sveb16b16, "sveb16b16", 0, \ + AARCH64_HWCAP2_SVE_B16B16) \ + LINE(AARCH64_LRCPC3, lrcpc3, "lrcpc3", 0, AARCH64_HWCAP2_LRCPC3) \ + LINE(AARCH64_LSE128, lse128, "lse128", 0, AARCH64_HWCAP2_LSE128) \ + LINE(AARCH64_FPMR, fpmr, "fpmr", 0, AARCH64_HWCAP2_FPMR) \ + LINE(AARCH64_LUT, lut, "lut", 0, AARCH64_HWCAP2_LUT) \ + LINE(AARCH64_FAMINMAX, faminmax, "faminmax", 0, AARCH64_HWCAP2_FAMINMAX) \ + LINE(AARCH64_F8CVT, f8cvt, "f8cvt", 0, AARCH64_HWCAP2_F8CVT) \ + LINE(AARCH64_F8FMA, f8fma, "f8fma", 0, AARCH64_HWCAP2_F8FMA) \ + LINE(AARCH64_F8DP4, f8dp4, "f8dp4", 0, AARCH64_HWCAP2_F8DP4) \ + LINE(AARCH64_F8DP2, f8dp2, "f8dp2", 0, AARCH64_HWCAP2_F8DP2) \ + LINE(AARCH64_F8E4M3, f8e4m3, "f8e4m3", 0, AARCH64_HWCAP2_F8E4M3) \ + LINE(AARCH64_F8E5M2, f8e5m2, "f8e5m2", 0, AARCH64_HWCAP2_F8E5M2) \ + LINE(AARCH64_SME_LUTV2, smelutv2, "smelutv1", 0, AARCH64_HWCAP2_SME_LUTV2) \ + LINE(AARCH64_SME_F8F16, smef8f16, "smef8f16", 0, AARCH64_HWCAP2_SME_F8F16) \ + LINE(AARCH64_SME_F8F32, smef8f32, "smef8f32", 0, AARCH64_HWCAP2_SME_F8F32) \ + LINE(AARCH64_SME_SF8FMA, smesf8fma, "smesf8fma", 0, \ + AARCH64_HWCAP2_SME_SF8FMA) \ + LINE(AARCH64_SME_SF8DP4, smesf8dp4, "smesf8dp4", 0, \ + AARCH64_HWCAP2_SME_SF8DP4) \ + LINE(AARCH64_SME_SF8DP2, smesf8dp2, "smesf8dp2", 0, AARCH64_HWCAP2_SME_SF8DP2) #define INTROSPECTION_PREFIX Aarch64 #define INTROSPECTION_ENUM_PREFIX AARCH64 #include "define_introspection_and_hwcaps.inl" \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc index fc8abf8fe..e69c5ef78 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc @@ -326,6 +326,24 @@ CPU revision : 3)"); EXPECT_FALSE(info.features.smef16f16); EXPECT_FALSE(info.features.mops); EXPECT_FALSE(info.features.hbc); + EXPECT_FALSE(info.features.sveb16b16); + EXPECT_FALSE(info.features.lrcpc3); + EXPECT_FALSE(info.features.lse128); + EXPECT_FALSE(info.features.fpmr); + EXPECT_FALSE(info.features.lut); + EXPECT_FALSE(info.features.faminmax); + EXPECT_FALSE(info.features.f8cvt); + EXPECT_FALSE(info.features.f8fma); + EXPECT_FALSE(info.features.f8dp4); + EXPECT_FALSE(info.features.f8dp2); + EXPECT_FALSE(info.features.f8e4m3); + EXPECT_FALSE(info.features.f8e5m2); + EXPECT_FALSE(info.features.smelutv2); + EXPECT_FALSE(info.features.smef8f16); + EXPECT_FALSE(info.features.smef8f32); + EXPECT_FALSE(info.features.smesf8fma); + EXPECT_FALSE(info.features.smesf8dp4); + EXPECT_FALSE(info.features.smesf8dp2); } #elif defined(CPU_FEATURES_OS_MACOS) TEST_F(CpuidAarch64Test, FromDarwinSysctlFromName) diff --git a/src/algorithms/signal_source/adapters/CMakeLists.txt b/src/algorithms/signal_source/adapters/CMakeLists.txt index 0aa745101..48e18e5f3 100644 --- a/src/algorithms/signal_source/adapters/CMakeLists.txt +++ b/src/algorithms/signal_source/adapters/CMakeLists.txt @@ -25,6 +25,14 @@ if(ENABLE_PLUTOSDR) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_custom_signal_source.h) endif() +if(ENABLE_AD936X_SDR AND NOT ENABLE_PLUTOSDR) + ############################################## + # CUSTOM AD936X IIO SOURCE + ############################################## + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad936x_custom_signal_source.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_custom_signal_source.h) +endif() + if(ENABLE_FMCOMMS2) ############################################### # FMCOMMS2 based SDR Hardware @@ -103,6 +111,11 @@ if(ENABLE_ZMQ) list(APPEND OPT_DRIVER_HEADERS zmq_signal_source.h) endif() +if(ENABLE_ION) + list(APPEND OPT_DRIVER_SOURCES ion_gsms_signal_source.cc) + list(APPEND OPT_DRIVER_HEADERS ion_gsms_signal_source.h) +endif() + set(SIGNAL_SOURCE_ADAPTER_SOURCES signal_source_base.cc file_source_base.cc @@ -169,7 +182,7 @@ target_include_directories(signal_source_adapters ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) -if(ENABLE_FPGA OR ENABLE_AD9361) +if(ENABLE_FPGA OR ENABLE_AD9361 OR ENABLE_ION) target_link_libraries(signal_source_adapters PUBLIC signal_source_libs @@ -239,14 +252,14 @@ if(ENABLE_LIMESDR AND GRLIMESDR_FOUND) ) endif() -if(ENABLE_AD9361 AND LIBIIO_FOUND) +if(LIBIIO_FOUND) target_link_libraries(signal_source_adapters PRIVATE Iio::iio ) endif() -if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR) +if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) if(LIBAD9361_VERSION) if(LIBAD9361_VERSION VERSION_GREATER 0.1) target_compile_definitions(signal_source_adapters diff --git a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc index b93dc9344..b824a250d 100644 --- a/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ad936x_custom_signal_source.cc @@ -76,8 +76,11 @@ Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* item_size_ = sizeof(gr_complex); // 1. Make the driver instance bool customsamplesize = false; - if (ssize_ != 12 or spattern_ == true) customsamplesize = true; // custom FPGA DMA firmware - if (ssize_ == 12) // default original FPGA DMA firmware + if (ssize_ != 12 || spattern_ == true) + { + customsamplesize = true; // custom FPGA DMA firmware + } + if (ssize_ == 12) // default original FPGA DMA firmware { ssize_ = 16; // set to 16 bits and do not try to change sample size } @@ -153,8 +156,14 @@ Ad936xCustomSignalSource::Ad936xCustomSignalSource(const ConfigurationInterface* for (int n = 0; n < n_channels; n++) { - if (n == 0) inverted_spectrum_vec.push_back(inverted_spectrum_ch0_); - if (n == 1) inverted_spectrum_vec.push_back(inverted_spectrum_ch1_); + if (n == 0) + { + inverted_spectrum_vec.push_back(inverted_spectrum_ch0_); + } + if (n == 1) + { + inverted_spectrum_vec.push_back(inverted_spectrum_ch1_); + } } for (int n = 0; n < n_channels; n++) diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc index 9d29e2de2..897dd7777 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.cc @@ -1,6 +1,6 @@ /*! * \file adrv9361_z7035_signal_source_fpga.cc - * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * \brief Signal source for the Analog Devices ADRV9361-Z7035 evaluation board * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -51,14 +51,14 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_source_(configuration->property(role + ".filter_source", std::string("Off"))), filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), scale_dds_dbfs_(configuration->property(role + ".scale_dds_dbfs", -3.0)), phase_dds_deg_(configuration->property(role + ".phase_dds_deg", 0.0)), tx_attenuation_db_(configuration->property(role + ".tx_attenuation_db", default_tx_attenuation_db)), - freq0_(configuration->property(role + ".freq", 0)), - freq1_(configuration->property(role + ".freq1", static_cast(GPS_L5_FREQ_HZ))), + freq0_(configuration->property(role + ".freq", GPS_L5_FREQ_HZ)), sample_rate_(configuration->property(role + ".sampling_frequency", default_bandwidth)), bandwidth_(configuration->property(role + ".bandwidth", default_bandwidth)), freq_dds_tx_hz_(configuration->property(role + ".freq_dds_tx_hz", uint64_t(10000))), @@ -70,7 +70,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration out_stream_(out_stream), item_size_(sizeof(int8_t)), enable_dds_lo_(configuration->property(role + ".enable_dds_lo", false)), - filter_auto_(configuration->property(role + ".filter_auto", false)), quadrature_(configuration->property(role + ".quadrature", true)), rf_dc_(configuration->property(role + ".rf_dc", true)), bb_dc_(configuration->property(role + ".bb_dc", true)), @@ -98,15 +97,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration freq0_ = configuration->property(role + ".freq0", static_cast(GPS_L1_FREQ_HZ)); } - if (filter_auto_) - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); - } - else - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); - } - switch_fpga = std::make_shared(); switch_fpga->set_switch_position(switch_to_real_time_mode); @@ -190,12 +180,15 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration } std::cout << "LO frequency : " << freq0_ << " Hz\n"; + + uint64_t freq1 = 0; // The local oscillator frequency of the ADRV9361-B is not used when using the ADRV9361-Z7035 board. + try { config_ad9361_rx_local(bandwidth_, sample_rate_, freq0_, - freq1_, + freq1, rf_port_select_, rx1_enable_, rx2_enable_, @@ -257,7 +250,6 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); - // dynamic bits selection if (enable_dynamic_bit_selection_) { @@ -278,15 +270,23 @@ Adrv9361z7035SignalSourceFPGA::Adrv9361z7035SignalSourceFPGA(const Configuration Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() { - /* cleanup and exit */ - + // cleanup and exit if (rf_shutdown_) { std::cout << "* AD9361 Disabling RX streaming channels\n"; - if (!disable_ad9361_rx_local()) + try { - LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } } + catch (const std::exception &e) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels: " << e.what(); + std::cerr << "Problem shutting down the AD9361 RX channels: " << e.what() << '\n'; + } + if (enable_dds_lo_) { try @@ -301,24 +301,27 @@ Adrv9361z7035SignalSourceFPGA::~Adrv9361z7035SignalSourceFPGA() } // disable buffer overflow checking and buffer monitoring - std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock_buffer_monitor.unlock(); + { + std::lock_guard lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + } if (thread_buffer_monitor.joinable()) { thread_buffer_monitor.join(); } - - std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); - bool bit_selection_enabled = enable_dynamic_bit_selection_; - lock_dyn_bit_sel.unlock(); + bool bit_selection_enabled = false; + { + std::lock_guard lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bit_selection_enabled = enable_dynamic_bit_selection_; + } if (bit_selection_enabled == true) { - std::unique_lock lock(dynamic_bit_selection_mutex); - enable_dynamic_bit_selection_ = false; - lock.unlock(); + { + std::lock_guard lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + } if (thread_dynamic_bit_selection.joinable()) { @@ -337,12 +340,11 @@ void Adrv9361z7035SignalSourceFPGA::run_dynamic_bit_selection_process() // setting the bit selection to the top bits dynamic_bit_selection_fpga->bit_selection(); std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); - std::unique_lock lock(dynamic_bit_selection_mutex); + std::lock_guard lock(dynamic_bit_selection_mutex); if (enable_dynamic_bit_selection_ == false) { dynamic_bit_selection_active = false; } - lock.unlock(); } } @@ -357,12 +359,11 @@ void Adrv9361z7035SignalSourceFPGA::run_buffer_monitor_process() { buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); + std::lock_guard lock(buffer_monitor_mutex); if (enable_ovf_check_buffer_monitor_active_ == false) { enable_ovf_check_buffer_monitor_active = false; } - lock.unlock(); } } diff --git a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h index 5e7e8b7e4..286cde2d5 100644 --- a/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/adrv9361_z7035_signal_source_fpga.h @@ -1,6 +1,6 @@ /*! * \file adrv9361_z7035_signal_source_fpga.h - * \brief signal source for the Analog Devices ADRV9361-Z7035 evaluation board + * \brief Signal source for the Analog Devices ADRV9361-Z7035 evaluation board * directly connected to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -23,7 +23,6 @@ #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" -#include "fpga_dma-proxy.h" #include "fpga_dynamic_bit_selection.h" #include "fpga_switch.h" #include "gnss_block_interface.h" @@ -78,13 +77,14 @@ private: const uint32_t buffer_monitor_period_ms = 1000; // buffer overflow and buffer monitoring initial delay const uint32_t buffer_monitoring_initial_delay_ms = 2000; - // sample block size when running in post-processing mode - const int sample_block_size = 16384; const int32_t switch_to_real_time_mode = 2; void run_dynamic_bit_selection_process(); void run_buffer_monitor_process(); + mutable std::mutex dynamic_bit_selection_mutex; + mutable std::mutex buffer_monitor_mutex; + std::thread thread_dynamic_bit_selection; std::thread thread_buffer_monitor; @@ -92,9 +92,6 @@ private: std::shared_ptr dynamic_bit_selection_fpga; std::shared_ptr buffer_monitor_fpga; - std::mutex dynamic_bit_selection_mutex; - std::mutex buffer_monitor_mutex; - std::string gain_mode_rx1_; std::string gain_mode_rx2_; std::string rf_port_select_; @@ -109,7 +106,6 @@ private: double tx_attenuation_db_; uint64_t freq0_; // frequency of local oscillator for ADRV9361-A 0 - uint64_t freq1_; // frequency of local oscillator for ADRV9361-B (if present) uint64_t sample_rate_; uint64_t bandwidth_; uint64_t freq_dds_tx_hz_; @@ -124,7 +120,6 @@ private: size_t item_size_; bool enable_dds_lo_; - bool filter_auto_; bool quadrature_; bool rf_dc_; bool bb_dc_; diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc index d8c5a65c0..f52c67425 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.cc @@ -1,6 +1,6 @@ /*! * \file fmcomms5_signal_source_fpga.cc - * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * \brief Signal source for the Analog Devices FMCOMMS5 directly connected * to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -51,6 +51,7 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface gain_mode_rx1_(configuration->property(role + ".gain_mode_rx1", default_gain_mode)), gain_mode_rx2_(configuration->property(role + ".gain_mode_rx2", default_gain_mode)), rf_port_select_(configuration->property(role + ".rf_port_select", default_rf_port_select)), + filter_source_(configuration->property(role + ".filter_source", std::string("Off"))), filter_filename_(configuration->property(role + ".filter_filename", filter_file_)), rf_gain_rx1_(configuration->property(role + ".gain_rx1", default_manual_gain_rx1)), rf_gain_rx2_(configuration->property(role + ".gain_rx2", default_manual_gain_rx2)), @@ -63,7 +64,6 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface in_stream_(in_stream), out_stream_(out_stream), item_size_(sizeof(int8_t)), - filter_auto_(configuration->property(role + ".filter_auto", false)), quadrature_(configuration->property(role + ".quadrature", true)), rf_dc_(configuration->property(role + ".rf_dc", true)), bb_dc_(configuration->property(role + ".bb_dc", true)), @@ -86,15 +86,6 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface const uint32_t num_freq_bands = ((enable_rx1_band == true) and (enable_rx2_band == true)) ? 2 : 1; - if (filter_auto_) - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Auto")); - } - else - { - filter_source_ = configuration->property(role + ".filter_source", std::string("Off")); - } - switch_fpga = std::make_shared(); switch_fpga->set_switch_position(switch_to_real_time_mode); @@ -217,7 +208,6 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface buffer_monitor_fpga = std::make_shared(num_freq_bands, dump_, dump_filename); thread_buffer_monitor = std::thread([&] { run_buffer_monitor_process(); }); - // dynamic bits selection if (enable_dynamic_bit_selection_) { @@ -238,36 +228,45 @@ Fmcomms5SignalSourceFPGA::Fmcomms5SignalSourceFPGA(const ConfigurationInterface Fmcomms5SignalSourceFPGA::~Fmcomms5SignalSourceFPGA() { - /* cleanup and exit */ - + // cleanup and exit if (rf_shutdown_) { std::cout << "* Disabling RX streaming channels\n"; - if (!disable_ad9361_rx_local()) + try { - LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + if (!disable_ad9361_rx_local()) + { + LOG(WARNING) << "Problem shutting down the AD9361 RX channels"; + } + } + catch (const std::exception &e) + { + std::cerr << "Problem shutting down the AD9361 RX channels: " << e.what() << '\n'; } } // disable buffer overflow checking and buffer monitoring - std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock_buffer_monitor.unlock(); + { + std::lock_guard lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + } if (thread_buffer_monitor.joinable()) { thread_buffer_monitor.join(); } - - std::unique_lock lock_dyn_bit_sel(dynamic_bit_selection_mutex); - bool bit_selection_enabled = enable_dynamic_bit_selection_; - lock_dyn_bit_sel.unlock(); + bool bit_selection_enabled = false; + { + std::lock_guard lock_dyn_bit_sel(dynamic_bit_selection_mutex); + bit_selection_enabled = enable_dynamic_bit_selection_; + } if (bit_selection_enabled == true) { - std::unique_lock lock(dynamic_bit_selection_mutex); - enable_dynamic_bit_selection_ = false; - lock.unlock(); + { + std::lock_guard lock(dynamic_bit_selection_mutex); + enable_dynamic_bit_selection_ = false; + } if (thread_dynamic_bit_selection.joinable()) { @@ -286,12 +285,11 @@ void Fmcomms5SignalSourceFPGA::run_dynamic_bit_selection_process() // setting the bit selection to the top bits dynamic_bit_selection_fpga->bit_selection(); std::this_thread::sleep_for(std::chrono::milliseconds(Gain_control_period_ms)); - std::unique_lock lock(dynamic_bit_selection_mutex); + std::lock_guard lock(dynamic_bit_selection_mutex); if (enable_dynamic_bit_selection_ == false) { dynamic_bit_selection_active = false; } - lock.unlock(); } } @@ -306,12 +304,11 @@ void Fmcomms5SignalSourceFPGA::run_buffer_monitor_process() { buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); + std::lock_guard lock(buffer_monitor_mutex); if (enable_ovf_check_buffer_monitor_active_ == false) { enable_ovf_check_buffer_monitor_active = false; } - lock.unlock(); } } diff --git a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h index 1bdcf4e6f..fbb10bf67 100644 --- a/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/fmcomms5_signal_source_fpga.h @@ -1,6 +1,6 @@ /*! * \file fmcomms5_signal_source_fpga.h - * \brief signal source for the Analog Devices FMCOMMS5 directly connected + * \brief Signal source for the Analog Devices FMCOMMS5 directly connected * to the FPGA accelerators. * This source implements only the AD9361 control. It is NOT compatible with * conventional SDR acquisition and tracking blocks. @@ -23,7 +23,6 @@ #include "concurrent_queue.h" #include "fpga_buffer_monitor.h" -#include "fpga_dma-proxy.h" #include "fpga_dynamic_bit_selection.h" #include "fpga_switch.h" #include "gnss_block_interface.h" @@ -67,7 +66,6 @@ private: const std::string default_dump_filename = std::string("FPGA_buffer_monitor_dump.dat"); const std::string default_rf_port_select = std::string("A_BALANCED"); const std::string default_gain_mode = std::string("slow_attack"); - const double default_tx_attenuation_db = -10.0; const double default_manual_gain_rx1 = 64.0; const double default_manual_gain_rx2 = 64.0; const uint64_t default_bandwidth = 12500000; @@ -78,13 +76,14 @@ private: const uint32_t buffer_monitor_period_ms = 1000; // buffer overflow and buffer monitoring initial delay const uint32_t buffer_monitoring_initial_delay_ms = 2000; - // sample block size when running in post-processing mode - const int sample_block_size = 16384; const int32_t switch_to_real_time_mode = 2; void run_dynamic_bit_selection_process(); void run_buffer_monitor_process(); + mutable std::mutex dynamic_bit_selection_mutex; + mutable std::mutex buffer_monitor_mutex; + std::thread thread_dynamic_bit_selection; std::thread thread_buffer_monitor; @@ -92,9 +91,6 @@ private: std::shared_ptr dynamic_bit_selection_fpga; std::shared_ptr buffer_monitor_fpga; - std::mutex dynamic_bit_selection_mutex; - std::mutex buffer_monitor_mutex; - std::string gain_mode_rx1_; std::string gain_mode_rx2_; std::string rf_port_select_; @@ -117,7 +113,6 @@ private: size_t item_size_; - bool filter_auto_; bool quadrature_; bool rf_dc_; bool bb_dc_; diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc new file mode 100644 index 000000000..00f2be229 --- /dev/null +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -0,0 +1,239 @@ +/*! + * \file ion_gsms_signal_source.h + * \brief GNSS-SDR Signal Source that reads sample streams following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "ion_gsms_signal_source.h" +#include "gnss_sdr_flags.h" +#include "gnss_sdr_string_literals.h" +#include "gnss_sdr_valve.h" +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +using namespace std::string_literals; + +namespace +{ +std::vector parse_comma_list(const std::string& str) +{ + std::vector list{}; + std::size_t prev_comma_at{0}; + + while (prev_comma_at < str.size()) + { + std::size_t comma_at = str.find_first_of(',', prev_comma_at); + if (comma_at == std::string::npos) + { + comma_at = str.size(); + } + list.emplace_back(str.substr(prev_comma_at, (comma_at - prev_comma_at))); + prev_comma_at = comma_at + 1; + } + + return list; +} +} // anonymous namespace + + +IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configuration, + const std::string& role, + unsigned int in_streams, + unsigned int out_streams, + Concurrent_Queue* queue) + : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), + stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), + metadata_filepath_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), + in_streams_(in_streams), + out_streams_(out_streams) +{ + if (in_streams_ > 0) + { + LOG(ERROR) << "A signal source does not have an input stream"; + } + if (out_streams_ <= 0) + { + LOG(ERROR) << "A signal source does not have an output stream"; + } + + // Parse XML metadata file + load_metadata(); + + // Make source vector + sources_ = make_stream_sources(stream_ids_); + + for (const auto& source : sources_) + { + for (std::size_t i = 0; i < source->output_stream_count(); ++i) + { + copy_blocks_.emplace_back(gr::blocks::copy::make(source->output_stream_item_size(i))); + valves_.emplace_back(gnss_sdr_make_valve(source->output_stream_item_size(i), source->output_stream_total_sample_count(i), queue)); + } + } +} + + +void IONGSMSSignalSource::load_metadata() +{ + metadata_ = std::make_shared(); + try + { + GnssMetadata::XmlProcessor xml_proc; + if (!xml_proc.Load(metadata_filepath_.c_str(), false, *metadata_)) + { + LOG(WARNING) << "Could not load XML metadata file " << metadata_filepath_; + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + } + catch (GnssMetadata::ApiException& e) + { + LOG(WARNING) << "API Exception while loading XML metadata file: " << std::to_string(e.Error()); + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << std::to_string(e.Error()) << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + catch (std::exception& e) + { + LOG(WARNING) << "Exception while loading XML metadata file: " << e.what(); + std::cerr << "Could not load XML metadata file " << metadata_filepath_ << " : " << e.what() << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } +} + + +std::vector IONGSMSSignalSource::make_stream_sources(const std::vector& stream_ids) const +{ + std::vector sources{}; + for (const auto& file : metadata_->Files()) + { + for (const auto& lane : metadata_->Lanes()) + { + if (lane.Id() == file.Lane().Id()) + { + for (const auto& block : lane.Blocks()) + { + bool block_done = false; + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + bool found = false; + for (const auto& stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) + { + auto source = gnss_make_shared( + metadata_filepath_, + file, + block, + stream_ids); + + sources.push_back(source); + + // This file source will take care of any other matching streams in this block + // We can skip the rest of this block + block_done = true; + break; + } + } + + if (block_done) + { + break; + } + } + if (block_done) + { + break; + } + } + } + break; + } + } + } + + return sources; +} + + +void IONGSMSSignalSource::connect(gr::top_block_sptr top_block) +{ + std::size_t cumulative_index = 0; + for (const auto& source : sources_) + { + for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + { + top_block->connect(source, i, copy_blocks_[cumulative_index], 0); + top_block->connect(copy_blocks_[cumulative_index], 0, valves_[cumulative_index], 0); + } + } +} + + +void IONGSMSSignalSource::disconnect(gr::top_block_sptr top_block) +{ + std::size_t cumulative_index = 0; + for (const auto& source : sources_) + { + for (std::size_t i = 0; i < source->output_stream_count(); ++i, ++cumulative_index) + { + top_block->disconnect(source, i, copy_blocks_[cumulative_index], 0); + top_block->disconnect(copy_blocks_[cumulative_index], 0, valves_[cumulative_index], 0); + } + } +} + + +gr::basic_block_sptr IONGSMSSignalSource::get_left_block() +{ + LOG(WARNING) << "Trying to get signal source left block."; + // return gr_basic_block_sptr(); + return IONGSMSFileSource::sptr(); +} + + +gr::basic_block_sptr IONGSMSSignalSource::get_right_block() +{ + return get_right_block(0); +} + + +gr::basic_block_sptr IONGSMSSignalSource::get_right_block(int RF_channel) +{ + if (RF_channel < 0 || RF_channel >= static_cast(copy_blocks_.size())) + { + LOG(WARNING) << "'RF_channel' out of bounds while trying to get signal source right block."; + return valves_[0]; + } + return valves_[RF_channel]; +} diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h new file mode 100644 index 000000000..bcdedbc3d --- /dev/null +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.h @@ -0,0 +1,85 @@ +/*! + * \file ion_gsms_signal_source.h + * \brief GNSS-SDR Signal Source that reads sample streams following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#ifndef GNSS_SDR_ION_GSMS_SIGNAL_SOURCE_H +#define GNSS_SDR_ION_GSMS_SIGNAL_SOURCE_H + +#include "configuration_interface.h" +#include "file_source_base.h" +#include "gnss_sdr_timestamp.h" +#include "ion_gsms.h" +#include +#include +#include +#include +#include + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_adapters + * \{ */ + +/*! + * \brief Class that reads signals samples from a file + * and adapts it to a SignalSourceInterface + */ +class IONGSMSSignalSource : public SignalSourceBase +{ +public: + IONGSMSSignalSource(const ConfigurationInterface* configuration, const std::string& role, + unsigned int in_streams, unsigned int out_streams, + Concurrent_Queue* queue); + + ~IONGSMSSignalSource() override = default; + +protected: + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + gr::basic_block_sptr get_right_block(int RF_channel) override; + + inline size_t item_size() override + { + return (*sources_.begin())->output_stream_item_size(0); + } + +private: + std::vector make_stream_sources(const std::vector& stream_ids) const; + + void load_metadata(); + + std::vector stream_ids_; + std::vector sources_; + std::vector> copy_blocks_; + std::vector> valves_; + + std::string metadata_filepath_; + std::shared_ptr metadata_; + + gnss_shared_ptr timestamp_block_; + std::string timestamp_file_; + + uint32_t in_streams_; + uint32_t out_streams_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_ION_GSMS_SIGNAL_SOURCE_H diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc index 788b50e77..80b310034 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.cc @@ -140,13 +140,11 @@ MAX2771EVKITSignalSourceFPGA::MAX2771EVKITSignalSourceFPGA(const ConfigurationIn } } + std::vector MAX2771EVKITSignalSourceFPGA::setup_regs(void) { - std::vector register_values = std::vector(MAX2771_NUM_REGS); - - + auto register_values = std::vector(MAX2771_NUM_REGS); uint32_t LNA_mode = (LNA_active_) ? 0x0 : 0x2; - uint32_t Filter_Bandwidth; switch (bandwidth_) @@ -376,10 +374,10 @@ bool MAX2771EVKITSignalSourceFPGA::configure(std::vector register_valu return 0; } + MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() { - /* cleanup and exit */ - + // cleanup and exit if (rf_shutdown_) { chipen_ = false; @@ -392,7 +390,6 @@ MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() return; } - if (configure(register_values)) { std::cerr << "Error disabling the MAX2771 device " << '\n'; @@ -405,9 +402,10 @@ MAX2771EVKITSignalSourceFPGA::~MAX2771EVKITSignalSourceFPGA() } // disable buffer overflow checking and buffer monitoring - std::unique_lock lock_buffer_monitor(buffer_monitor_mutex); - enable_ovf_check_buffer_monitor_active_ = false; - lock_buffer_monitor.unlock(); + { + std::lock_guard lock_buffer_monitor(buffer_monitor_mutex); + enable_ovf_check_buffer_monitor_active_ = false; + } if (thread_buffer_monitor.joinable()) { @@ -426,12 +424,11 @@ void MAX2771EVKITSignalSourceFPGA::run_buffer_monitor_process() { buffer_monitor_fpga->check_buffer_overflow_and_monitor_buffer_status(); std::this_thread::sleep_for(std::chrono::milliseconds(buffer_monitor_period_ms)); - std::unique_lock lock(buffer_monitor_mutex); + std::lock_guard lock(buffer_monitor_mutex); if (enable_ovf_check_buffer_monitor_active_ == false) { enable_ovf_check_buffer_monitor_active = false; } - lock.unlock(); } } diff --git a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h index 3008aa384..5ba036ca3 100644 --- a/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h +++ b/src/algorithms/signal_source/adapters/max2771_evkit_signal_source_fpga.h @@ -53,7 +53,6 @@ public: std::vector setup_regs(void); - inline size_t item_size() override { return item_size_; @@ -130,14 +129,13 @@ private: bool configure(std::vector register_values); void run_buffer_monitor_process(); + mutable std::mutex buffer_monitor_mutex; std::thread thread_buffer_monitor; std::shared_ptr buffer_monitor_fpga; std::shared_ptr spidev_fpga; - std::mutex buffer_monitor_mutex; - uint64_t freq_; // frequency of local oscillator uint64_t sample_rate_; diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 24f067be6..2eca5157a 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -10,17 +10,16 @@ if(ENABLE_RAW_UDP AND PCAP_FOUND) list(APPEND OPT_DRIVER_HEADERS gr_complex_ip_packet_source.h) endif() -if(ENABLE_AD936X_SDR) - set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} gr_complex_ip_packet_source.cc) - set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} gr_complex_ip_packet_source.h) -endif() - - -if(ENABLE_PLUTOSDR) +if(ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ad936x_iio_source.cc) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ad936x_iio_source.h) endif() +if(ENABLE_ION) + set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} ion_gsms.cc) + set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} ion_gsms.h) +endif() + set(SIGNAL_SOURCE_GR_BLOCKS_SOURCES fifo_reader.cc unpack_byte_2bit_samples.cc diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc index 0cf885fe2..c87006bd5 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_source.cc - * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the + * AD936x AD front-end family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * * ----------------------------------------------------------------------------- @@ -33,23 +34,23 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( - std::string pluto_uri_, - std::string board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string& pluto_uri_, + const std::string& board_type_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, + const std::string& rf_port_select_, + const std::string& rf_filter, + const std::string& gain_mode_rx0_, + const std::string& gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string& fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -85,9 +86,10 @@ ad936x_iio_source_sptr ad936x_iio_make_source_sptr( tx_lo_channel_)); } -void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out) + +void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples* samples_in, int nchannels, std::vector* files_out) { - int32_t current_byte = 0; + uint32_t current_byte = 0; int16_t ch = 0; // std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n"; while (current_byte < samples_in->n_bytes) @@ -101,24 +103,25 @@ void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samp } } + ad936x_iio_source::ad936x_iio_source( - std::string pluto_uri_, - std::string board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string& pluto_uri_, + const std::string& board_type_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, + const std::string& rf_port_select_, + const std::string& rf_filter, + const std::string& gain_mode_rx0_, + const std::string& gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string& fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -171,54 +174,81 @@ ad936x_iio_source::ad936x_iio_source( case 16: { std::cout << "FPGA sample size set to 16 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=16\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=16\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } case 8: { std::cout << "FPGA sample size set to 8 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=8\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=8\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } case 4: { std::cout << "FPGA sample size set to 4 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=4\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=4\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } case 2: { std::cout << "FPGA sample size set to 2 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=2\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=2\n") == false) + { + std::cout << "cmd send error!\n"; + } break; } default: { std::cout << "WARNING: Unsupported ssize. FPGA sample size set to 16 bits per sample.\n"; - if (pps_rx->send_cmd("ssize=16") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("ssize=16") == false) + { + std::cout << "cmd send error!\n"; + } } } if (bshift_ >= 0 and bshift_ <= 14) { std::cout << "FPGA sample bits shift left set to " + std::to_string(bshift_) + " positions.\n"; - if (pps_rx->send_cmd("bshift=" + std::to_string(bshift_) + "\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("bshift=" + std::to_string(bshift_) + "\n") == false) + { + std::cout << "cmd send error!\n"; + } } else { std::cout << "WARNING: Unsupported bshift. FPGA sample bits shift left set to 0.\n"; - if (pps_rx->send_cmd("bshift=0\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("bshift=0\n") == false) + { + std::cout << "cmd send error!\n"; + } } if (spattern_ == true) { std::cout << "FPGA debug sample pattern is active!.\n"; - if (pps_rx->send_cmd("spattern=1\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("spattern=1\n") == false) + { + std::cout << "cmd send error!\n"; + } } else { std::cout << "FPGA debug sample pattern disabled.\n"; - if (pps_rx->send_cmd("spattern=0\n") == false) std::cout << "cmd send error!\n"; + if (pps_rx->send_cmd("spattern=0\n") == false) + { + std::cout << "cmd send error!\n"; + } } } else @@ -238,7 +268,7 @@ ad936x_iio_source::ad936x_iio_source( exit(1); } } - catch (std::exception const &ex) + catch (std::exception const& ex) { std::cerr << "STD exception: " << ex.what() << std::endl; exit(1); @@ -267,6 +297,7 @@ ad936x_iio_source::ad936x_iio_source( // } } + ad936x_iio_source::~ad936x_iio_source() { // Terminate PPS thread @@ -284,6 +315,7 @@ bool ad936x_iio_source::start() return ad936x_custom->start_sample_rx(false); } + bool ad936x_iio_source::stop() { std::cout << "stopping ad936x_iio_source...\n"; @@ -291,17 +323,17 @@ bool ad936x_iio_source::stop() return true; } + int ad936x_iio_source::general_work(int noutput_items, - __attribute__((unused)) gr_vector_int &ninput_items, - __attribute__((unused)) gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + __attribute__((unused)) gr_vector_int& ninput_items, + __attribute__((unused)) gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) { std::shared_ptr current_buffer; - ad936x_iio_samples *current_samples; + ad936x_iio_samples* current_samples; ad936x_custom->pop_sample_buffer(current_buffer); current_samples = current_buffer.get(); - // I and Q samples are interleaved in buffer: IQIQIQ... int32_t n_interleaved_iq_samples_per_channel = current_samples->n_bytes / (ad936x_custom->n_channels * 2); if (noutput_items < n_interleaved_iq_samples_per_channel) @@ -312,7 +344,7 @@ int ad936x_iio_source::general_work(int noutput_items, else { // ad9361_channel_demux_and_record(current_samples, ad936x_custom->n_channels, &samplesfile); - auto **out = reinterpret_cast(&output_items[0]); + auto** out = reinterpret_cast(&output_items[0]); uint32_t current_byte = 0; uint32_t current_byte_in_gr = 0; int16_t ch = 0; diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h index 411906a3e..8f5a34c7c 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.h @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_source.h - * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end gnss-sdr signal gnuradio block for the + * AD936x AD front-end family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * * ----------------------------------------------------------------------------- @@ -44,23 +45,23 @@ class ad936x_iio_source; using ad936x_iio_source_sptr = gnss_shared_ptr; ad936x_iio_source_sptr ad936x_iio_make_source_sptr( - std::string pluto_uri_, - std::string board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &pluto_uri_, + const std::string &board_type_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string &fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -90,23 +91,23 @@ public: private: friend ad936x_iio_source_sptr ad936x_iio_make_source_sptr( - std::string pluto_uri_, - std::string board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &pluto_uri_, + const std::string &board_type_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string &fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -116,23 +117,23 @@ private: int tx_lo_channel_); ad936x_iio_source( - std::string pluto_uri_, - std::string board_type_, - long long bandwidth_, - long long sample_rate_, - long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &pluto_uri_, + const std::string &board_type_, + int64_t bandwidth_, + int64_t sample_rate_, + int64_t freq_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, bool enable_ch1, - long long freq_2ch, + int64_t freq_2ch, bool ppsmode_, bool customsamplesize_, - std::string fe_ip_, + const std::string &fe_ip_, int fe_ctlport_, int ssize_, int bshift_, @@ -141,7 +142,6 @@ private: bool high_side_lo_, int tx_lo_channel_); - void ad9361_channel_demux_to_buffer(ad936x_iio_samples *samples_in, int nchannels, gr_vector_void_star &output_items); void ad9361_channel_demux_and_record(ad936x_iio_samples *samples_in, int nchannels, std::vector *files_out); diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc new file mode 100644 index 000000000..22a25868c --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.cc @@ -0,0 +1,202 @@ +/*! + * \file ion_gsms.cc + * \brief GNU Radio block that reads a Block from a file following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "ion_gsms.h" +#include "gnuradio/block.h" +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + +IONGSMSFileSource::IONGSMSFileSource( + const fs::path& metadata_filepath, + const GnssMetadata::File& file, + const GnssMetadata::Block& block, + const std::vector& stream_ids) + : gr::sync_block( + "ion_gsms_file_source", + gr::io_signature::make(0, 0, 0), + make_output_signature(block, stream_ids)), + file_stream_(metadata_filepath.parent_path() / file.Url().Value(), std::ios::in | std::ios::binary), + io_buffer_offset_(0), + maximum_item_rate_(0), + chunk_cycle_length_(0) +{ + fs::path data_filepath = metadata_filepath.parent_path() / file.Url().Value(); + std::size_t block_offset = file.Offset(); + + if (!file_stream_.is_open()) + { + LOG(WARNING) << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str(); + std::cerr << "ION_GSMS_Signal_Source - Unable to open the samples file: " << (data_filepath).c_str() << std::endl; + std::cout << "GNSS-SDR program ended.\n"; + exit(1); + } + + // Skip offset and block header + file_stream_.seekg(file.Offset() + block_offset + block.SizeHeader()); + + std::size_t output_stream_offset = 0; + for (const auto& chunk : block.Chunks()) + { + chunk_data_.emplace_back(std::make_shared(chunk, stream_ids, output_stream_offset)); + chunk_cycle_length_ += chunk.CountWords() * chunk.SizeWord(); + const std::size_t out_count = chunk_data_.back()->output_stream_count(); + output_stream_offset += out_count; + for (std::size_t i = 0; i < out_count; ++i) + { + output_stream_item_sizes_.push_back(chunk_data_.back()->output_stream_item_size(i)); + output_stream_item_rates_.push_back(chunk_data_.back()->output_stream_item_rate(i)); + maximum_item_rate_ = std::max(chunk_data_.back()->output_stream_item_rate(i), maximum_item_rate_); + } + } + output_stream_count_ = output_stream_offset; + + output_stream_total_sample_counts_.resize(output_stream_count_); + + std::size_t cycle_count = block.Cycles(); + if (cycle_count == 0) + { + // Read the whole file + const std::size_t file_size = fs::file_size(data_filepath); + cycle_count = std::floor((file_size - block_offset - block.SizeHeader()) / chunk_cycle_length_); + } + + for (std::size_t i = 0; i < output_stream_count_; ++i) + { + output_stream_total_sample_counts_[i] = cycle_count * output_stream_item_rates_[i]; + } +} + + +std::size_t IONGSMSFileSource::output_stream_count() const +{ + return output_stream_count_; +} + + +std::size_t IONGSMSFileSource::output_stream_item_size(std::size_t stream_index) const +{ + return output_stream_item_sizes_[stream_index]; +} + + +std::size_t IONGSMSFileSource::output_stream_total_sample_count(std::size_t stream_index) const +{ + return output_stream_total_sample_counts_[stream_index]; +} + + +gr::io_signature::sptr IONGSMSFileSource::make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids) +{ + int nstreams = 0; + std::vector item_sizes{}; + + for (const auto& chunk : block.Chunks()) + { + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + bool found = false; + for (const auto& stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) + { + ++nstreams; + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + } + item_sizes.push_back(bits_to_item_size(sample_bitsize)); + } + } + } + } + + return gr::io_signature::makev( + nstreams, + nstreams, + item_sizes); +} + + +int IONGSMSFileSource::work( + int noutput_items, + gr_vector_const_void_star& input_items __attribute__((unused)), + gr_vector_void_star& output_items) +{ + // Compute the maximum number of samples that will be copied across all output buffer. + // If there are more than one output buffer (multichannel set up), the one with the most samples will be used as the maximum. + // + // Complex samples produce 2 items each (I and Q). In order to account for them, we subtract 1 from `noutput_items` and + // then floor the division. During testing, not doing this caused `max_sample_output` to oscillate between two values, thus + // resizing the `io_buffer_` on each call to `work()`. + const std::size_t max_sample_output = std::floor((noutput_items - 1.0) / maximum_item_rate_); + + // Resize the IO buffer to fit exactly the maximum amount of samples that will be outputted. + io_buffer_.resize(max_sample_output * chunk_cycle_length_); + + // We will be walking the IO buffer with this variable. + io_buffer_offset_ = 0; + + // Read samples from file into IO buffer + const std::size_t bytes_to_read = io_buffer_.size(); + file_stream_.read(io_buffer_.data(), bytes_to_read); + + // Reset `items_produced_` vector. This vector will accumulate the amount of items produced for each output stream. + items_produced_.clear(); + items_produced_.resize(output_items.size()); + + // Walk the IO buffer one chunk cycle at a time. See ION documentation for a definition of chunk and chunk cycle. + while (io_buffer_offset_ < bytes_to_read) + { + // Iterate chunks within a chunk cycle + for (auto& chunk : chunk_data_) + { + // Copy chunk into a separate buffer where the samples will be shifted from. + const std::size_t bytes_copied = chunk->read_from_buffer(reinterpret_cast(io_buffer_.data()), io_buffer_offset_); + + // Advance IO buffer offset + io_buffer_offset_ += bytes_copied; + + // Shift samples into output buffers following the appropriate unpacking strategy for this chunk. + chunk->write_to_output(output_items, items_produced_); + } + } + + // Call `produce(int, int)` with the appropriate item count for each output stream. + for (std::size_t i = 0; i < items_produced_.size(); ++i) + { + produce(i, items_produced_[i]); + } + + return WORK_CALLED_PRODUCE; +} diff --git a/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h new file mode 100644 index 000000000..4a6baa7e9 --- /dev/null +++ b/src/algorithms/signal_source/gnuradio_blocks/ion_gsms.h @@ -0,0 +1,74 @@ +/*! + * \file ion_gsms.h + * \brief GNU Radio block that reads a Block from a file following ION's GNSS-SDR metadata standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ION_GSMS_H +#define GNSS_SDR_ION_GSMS_H + +#include "gnss_block_interface.h" +#include "gnss_sdr_filesystem.h" +#include "ion_gsms_chunk_data.h" +#include +#include +#include +#include +#include +#include +#include + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_gnuradio_blocks + * \{ */ + +class IONGSMSFileSource : public gr::sync_block +{ +public: + using sptr = gnss_shared_ptr; + + IONGSMSFileSource( + const fs::path& metadata_filepath, + const GnssMetadata::File& file, + const GnssMetadata::Block& block, + const std::vector& stream_ids); + + int work( + int noutput_items, + gr_vector_const_void_star& input_items, + gr_vector_void_star& output_items) override; + + std::size_t output_stream_count() const; + std::size_t output_stream_item_size(std::size_t stream_index) const; + std::size_t output_stream_total_sample_count(std::size_t stream_index) const; + +private: + static gr::io_signature::sptr make_output_signature(const GnssMetadata::Block& block, const std::vector& stream_ids); + + std::ifstream file_stream_; + std::vector io_buffer_; + std::size_t io_buffer_offset_; + std::vector items_produced_; + std::size_t output_stream_count_; + std::vector output_stream_item_sizes_; + std::vector output_stream_item_rates_; + std::vector output_stream_total_sample_counts_; + std::size_t maximum_item_rate_; + std::vector> chunk_data_; + std::size_t chunk_cycle_length_; +}; + +/** \} */ +/** \} */ +#endif // GNSS_SDR_ION_GSMS_H diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 3506dc4f7..0df4f3303 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -7,14 +7,15 @@ set(OPT_SIGNAL_SOURCE_LIB_SOURCES "") set(OPT_SIGNAL_SOURCE_LIB_HEADERS "") + if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad9361_manager.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad9361_manager.h) endif() if(ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} fpga_spidev.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_spidev.h) endif() if(ENABLE_FPGA) @@ -34,16 +35,21 @@ if((ENABLE_FPGA AND ENABLE_AD9361) OR ENABLE_MAX2771) set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} fpga_buffer_monitor.h) endif() -if(ENABLE_PLUTOSDR) - set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_samples.h) +if(ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_samples.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ad936x_iio_custom.h) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} pps_samplestamp.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ad936x_iio_custom.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} pps_samplestamp.h) set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ppstcprx.cc) - set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ppstcprx.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ppstcprx.h) endif() +if(ENABLE_ION) + set(OPT_SIGNAL_SOURCE_LIB_SOURCES ${OPT_SIGNAL_SOURCE_LIB_SOURCES} ion_gsms_chunk_data.cc) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_data.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_stream_encodings.h) + set(OPT_SIGNAL_SOURCE_LIB_HEADERS ${OPT_SIGNAL_SOURCE_LIB_HEADERS} ion_gsms_chunk_unpacking_ctx.h) +endif() set(SIGNAL_SOURCE_LIB_SOURCES rtl_tcp_commands.cc @@ -107,7 +113,7 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR) +if(ENABLE_FMCOMMS2 OR ENABLE_AD9361 OR ENABLE_PLUTOSDR OR ENABLE_AD936X_SDR) target_link_libraries(signal_source_libs PUBLIC Iio::iio @@ -130,6 +136,10 @@ if(ENABLE_FPGA OR ENABLE_AD9361) ) endif() +if(ENABLE_ION) + target_link_libraries(signal_source_libs PUBLIC ION::ion algorithms_libs) +endif() + if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(signal_source_libs diff --git a/src/algorithms/signal_source/libs/ad9361_manager.cc b/src/algorithms/signal_source/libs/ad9361_manager.cc index 913488287..025f97627 100644 --- a/src/algorithms/signal_source/libs/ad9361_manager.cc +++ b/src/algorithms/signal_source/libs/ad9361_manager.cc @@ -349,7 +349,7 @@ bool config_ad9361_rx_local(uint64_t bandwidth_, #ifndef LIBAD9361_VERSION_GREATER_THAN_01 if (filter_source_ == "Design") { - std::cout << "Option filter_source=Design is not available in this version. Set to filter_source=Off\n"; + std::cout << "Option filter_source=Design is not available in this version of libad9361. Set to filter_source=Off\n"; filter_source_ = std::string("Off"); } if (Fpass_ != 0.0 or Fstop_ != 0.0) @@ -636,7 +636,7 @@ bool config_ad9361_rx_remote(const std::string &remote_host, { return false; } - if (setup_filter(std::move(filter_source_), bandwidth_, sample_rate_, freq_, rf_port_select_, ad9361_phy, rx_chan0, chn, 0, std::move(filter_filename_), Fpass_, Fstop_) == -1) + if (setup_filter(filter_source_, bandwidth_, sample_rate_, freq_, rf_port_select_, ad9361_phy, rx_chan0, chn, 0, std::move(filter_filename_), Fpass_, Fstop_) == -1) { return false; } diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index 72461bafd..c41d74b9a 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_custom.cc - * \brief A direct IIO custom front-end driver for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end driver for the AD936x AD front-end + * family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * ----------------------------------------------------------------------------- * @@ -30,29 +31,36 @@ #include #endif -ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) +ad936x_iio_custom::ad936x_iio_custom( + int debug_level_, + int log_level_) : n_channels(0), + ctx(nullptr), + phy(nullptr), + stream_dev(nullptr), + dds_dev(nullptr), + receive_samples(false), + fpga_overflow(false), + sample_rate_sps(0), + debug_level(debug_level_), + log_level(log_level_), + PPS_mode(false) { - receive_samples = false; - fpga_overflow = false; - sample_rate_sps = 0; - ctx = NULL; - phy = NULL; - dds_dev = NULL; - stream_dev = NULL; - debug_level = debug_level_; - log_level = log_level_; - PPS_mode = false; - n_channels = 0; } ad936x_iio_custom::~ad936x_iio_custom() { // disable TX - if (phy != NULL) PlutoTxEnable(false); + if (phy != nullptr) + { + PlutoTxEnable(false); + } // Close device - if (ctx != NULL) iio_context_destroy(ctx); + if (ctx != nullptr) + { + iio_context_destroy(ctx); + } } @@ -68,7 +76,7 @@ void ad936x_iio_custom::set_pps_samplestamp_queue(std::shared_ptr ¶ms) { - for (std::vector::const_iterator it = params.begin(); - it != params.end(); ++it) + for (const auto ¶m : params) { - struct iio_channel *chn = NULL; - const char *attr = NULL; + struct iio_channel *chn = nullptr; + const char *attr = nullptr; size_t pos; int ret; - pos = it->find('='); + pos = param.find('='); if (pos == std::string::npos) { - std::cerr << "Malformed line: " << *it << std::endl; + std::cerr << "Malformed line: " << param << std::endl; continue; } - std::string key = it->substr(0, pos); - std::string val = it->substr(pos + 1, std::string::npos); + std::string key = param.substr(0, pos); + std::string val = param.substr(pos + 1, std::string::npos); ret = iio_device_identify_filename(phy, key.c_str(), &chn, &attr); @@ -196,13 +203,19 @@ void ad936x_iio_custom::configure_params(struct iio_device *phy, } if (chn) - ret = iio_channel_attr_write(chn, - attr, val.c_str()); + { + ret = iio_channel_attr_write(chn, + attr, val.c_str()); + } else if (iio_device_find_attr(phy, attr)) - ret = iio_device_attr_write(phy, attr, val.c_str()); + { + ret = iio_device_attr_write(phy, attr, val.c_str()); + } else - ret = iio_device_debug_attr_write(phy, - attr, val.c_str()); + { + ret = iio_device_debug_attr_write(phy, + attr, val.c_str()); + } if (ret < 0) { std::cerr << "Unable to write attribute " << key @@ -216,9 +229,9 @@ void ad936x_iio_custom::set_params_rx(struct iio_device *phy_device, unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, - std::string gain1, double gain1_value, - std::string gain2, double gain2_value, - std::string port_select) + const std::string &gain1, double gain1_value, + const std::string &gain2, double gain2_value, + const std::string &port_select) { std::vector params; @@ -289,7 +302,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0)); params_dds.push_back("out_altvoltage0_TX1_I_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage0_TX1_I_F1_raw=1"); + params_dds.emplace_back("out_altvoltage0_TX1_I_F1_raw=1"); // DDS TX CH1 Q (tone #1) params_dds.push_back("out_altvoltage2_TX1_Q_F1_frequency=" + std::to_string(freq_dds_tx_hz_)); @@ -297,7 +310,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); params_dds.push_back("out_altvoltage2_TX1_Q_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage2_TX1_Q_F1_raw=1"); + params_dds.emplace_back("out_altvoltage2_TX1_Q_F1_raw=1"); configure_params(dds_dev, params_dds); } @@ -318,7 +331,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0)); params_dds.push_back("out_altvoltage4_TX2_I_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage4_TX2_I_F1_raw=1"); + params_dds.emplace_back("out_altvoltage4_TX2_I_F1_raw=1"); // DDS TX CH2 Q (tone #1) params_dds.push_back("out_altvoltage6_TX2_Q_F1_frequency=" + std::to_string(freq_dds_tx_hz_)); @@ -326,7 +339,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, std::to_string(phase_dds_deg_ * 1000.0 + 270000.0)); params_dds.push_back("out_altvoltage6_TX2_Q_F1_scale=" + std::to_string(scale_dds_)); - params_dds.push_back("out_altvoltage6_TX2_Q_F1_raw=1"); + params_dds.emplace_back("out_altvoltage6_TX2_Q_F1_raw=1"); configure_params(dds_dev, params_dds); } @@ -337,7 +350,7 @@ bool ad936x_iio_custom::config_ad9361_dds(uint64_t freq_rf_tx_hz_, bool ad936x_iio_custom::check_device() { - if (stream_dev != NULL) + if (stream_dev != nullptr) { return true; } @@ -350,8 +363,8 @@ bool ad936x_iio_custom::check_device() bool ad936x_iio_custom::get_iio_param(iio_device *dev, const std::string ¶m, std::string &value) { - struct iio_channel *chn = 0; - const char *attr = 0; + struct iio_channel *chn = nullptr; + const char *attr = nullptr; char valuestr[256]; int ret; ssize_t nchars; @@ -398,9 +411,12 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) { try { - uint32_t temp_mC = boost::lexical_cast(temp_mC_str); + auto temp_mC = boost::lexical_cast(temp_mC_str); temp_c = static_cast(temp_mC) / 1000.0; - if (temp_c > 120) temp_c = -1; + if (temp_c > 120) + { + temp_c = -1; + } return true; } catch (const boost::bad_lexical_cast &e) @@ -419,10 +435,10 @@ bool ad936x_iio_custom::read_die_temp(double &temp_c) bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -432,16 +448,19 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, bool high_side_lo_, int tx_lo_channel_) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } bool no_errors = true; std::cout << "Configuring phy device parameters...\n"; int ret; - if (rf_filter.compare("Disabled") == 0) + if (rf_filter == "Disabled") { std::cout << "LNA Filter switch is disabled.\n"; } - else if (rf_filter.compare("Auto") == 0) + else if (rf_filter == "Auto") { std::cout << "Selecting LNA RF filter based on the selected RF frequency... \n"; if (freq_ == 1575420000) @@ -498,9 +517,9 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, params.push_back("out_voltage_rf_bandwidth=" + std::to_string(bandwidth_)); - params.push_back("in_voltage_quadrature_tracking_en=1"); - params.push_back("in_voltage_rf_dc_offset_tracking_en=1"); - params.push_back("in_voltage_bb_dc_offset_tracking_en=1"); + params.emplace_back("in_voltage_quadrature_tracking_en=1"); + params.emplace_back("in_voltage_rf_dc_offset_tracking_en=1"); + params.emplace_back("in_voltage_bb_dc_offset_tracking_en=1"); configure_params(phy, params); @@ -705,7 +724,10 @@ bool ad936x_iio_custom::init_config_ad9361_rx(long long bandwidth_, bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // Configure RX LO channel (NOTICE that altvoltage0 is the RX LO oscillator!, altvoltage1 is the TX oscillator) struct iio_channel *lo_ch; @@ -728,7 +750,10 @@ bool ad936x_iio_custom::set_rx_frequency(long long freq_hz) bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // Configure RX LO channel (NOTICE that altvoltage0 is the RX LO oscillator!, altvoltage1 is the TX oscillator) struct iio_channel *lo_ch; @@ -749,9 +774,12 @@ bool ad936x_iio_custom::get_rx_frequency(long long &freq_hz) } -bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain_dB) +bool ad936x_iio_custom::setRXGain(int ch_num, const std::string &gain_mode, double gain_dB) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } std::vector params; if (ch_num == 0) { @@ -784,7 +812,10 @@ bool ad936x_iio_custom::setRXGain(int ch_num, std::string gain_mode, double gain double ad936x_iio_custom::get_rx_gain(int ch_num) { - if (check_device() == false) return -1; + if (check_device() == false) + { + return -1; + } double gain_dB; // gain in dB int ret = 0; if (ch_num == 0) @@ -815,7 +846,10 @@ double ad936x_iio_custom::get_rx_gain(int ch_num) bool ad936x_iio_custom::calibrate([[maybe_unused]] int ch, [[maybe_unused]] double bw_hz) { - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // todo return true; } @@ -864,12 +898,13 @@ void ad936x_iio_custom::monitor_thread_fn() { ret = iio_device_reg_write(stream_dev, 0x80000088, val); if (ret) - fprintf(stderr, "Failed to clearn DMA status register: %s\n", - strerror(-ret)); + { + fprintf(stderr, "Failed to clearn DMA status register: %s\n", + strerror(-ret)); + } } sleep(1); } - return; } @@ -940,7 +975,7 @@ void ad936x_iio_custom::setPlutoGpo(int p) } -bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) +bool ad936x_iio_custom::select_rf_filter(const std::string &rf_filter) { // adi,gpo-manual-mode-enable Enables GPO manual mode, this will conflict with automatic ENSM slave and eLNA mode // adi,gpo-manual-mode-enable-mask Enable bit mask, setting or clearing bits will change the level of the corresponding output. Bit0 → GPO, Bit1 → GPO1, Bit2 → GPO2, Bit3 → GP03 @@ -960,7 +995,10 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) // 1 Enable // X Enable Mask if Identifier=0xF - if (check_device() == false) return false; + if (check_device() == false) + { + return false; + } // int plutoGpo = 0; int ret; ret = iio_device_debug_attr_write(phy, "adi,gpo-manual-mode-enable", "1"); @@ -971,7 +1009,7 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return false; } - if (rf_filter.compare("E1") == 0) + if (rf_filter == "E1") { // set gpio0 to switch L1 filter // setPlutoGpo(plutoGpo); @@ -982,7 +1020,7 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return false; } } - else if (rf_filter.compare("E5E6") == 0) + else if (rf_filter == "E5E6") { // set gpio0 to switch L5/L6 filter (GPO0) // plutoGpo = plutoGpo | 0x10; @@ -994,7 +1032,7 @@ bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) return false; } } - if (rf_filter.compare("none") == 0) + if (rf_filter == "none") { std::cout << "RF external filter not selected\n"; } @@ -1107,18 +1145,18 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) switch (n_channels) { case 1: - channels.push_back("voltage0"); // Channel 0 I - channels.push_back("voltage1"); // Channel 0 Q + channels.emplace_back("voltage0"); // Channel 0 I + channels.emplace_back("voltage1"); // Channel 0 Q break; case 2: - channels.push_back("voltage0"); // Channel 0 I - channels.push_back("voltage1"); // Channel 0 Q - channels.push_back("voltage2"); // Channel 1 I - channels.push_back("voltage3"); // Channel 1 Q + channels.emplace_back("voltage0"); // Channel 0 I + channels.emplace_back("voltage1"); // Channel 0 Q + channels.emplace_back("voltage2"); // Channel 1 I + channels.emplace_back("voltage3"); // Channel 1 Q break; default: - channels.push_back("voltage0"); // Channel 0 I - channels.push_back("voltage1"); // Channel 0 Q + channels.emplace_back("voltage0"); // Channel 0 I + channels.emplace_back("voltage1"); // Channel 0 Q } receive_samples = true; @@ -1150,7 +1188,10 @@ void ad936x_iio_custom::push_sample_buffer(std::shared_ptr & void ad936x_iio_custom::capture(const std::vector &channels) { - if (check_device() == false) return; + if (check_device() == false) + { + return; + } struct iio_buffer *rxbuf; @@ -1178,16 +1219,14 @@ void ad936x_iio_custom::capture(const std::vector &channels) } else { - for (std::vector::const_iterator it = - channels.begin(); - it != channels.end(); ++it) + for (const auto &channel : channels) { struct iio_channel *chn = iio_device_find_channel(stream_dev, - it->c_str(), false); + channel.c_str(), false); if (!chn) { - std::cerr << "Channel " << it->c_str() << " not found\n"; + std::cerr << "Channel " << channel.c_str() << " not found\n"; return; } else @@ -1246,7 +1285,10 @@ void ad936x_iio_custom::capture(const std::vector &channels) items_in_buffer = static_cast(ret) / bytes_to_interleaved_iq_samples; - if (items_in_buffer == 0) return; + if (items_in_buffer == 0) + { + return; + } current_samples->n_channels = n_channels; current_samples->n_interleaved_iq_samples = items_in_buffer; diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.h b/src/algorithms/signal_source/libs/ad936x_iio_custom.h index 83a61282a..0c6199968 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.h @@ -1,6 +1,7 @@ /*! * \file ad936x_iio_custom.h - * \brief A direct IIO custom front-end driver for the AD936x AD front-end family with special FPGA custom functionalities. + * \brief A direct IIO custom front-end driver for the AD936x AD front-end + * family with special FPGA custom functionalities. * \author Javier Arribas, jarribas(at)cttc.es * ----------------------------------------------------------------------------- * @@ -14,41 +15,41 @@ */ -#ifndef SRC_LIBS_ad936x_iio_custom_H_ -#define SRC_LIBS_ad936x_iio_custom_H_ +#ifndef GNSS_SDR_AD936X_IIO_CUSTOM_H +#define GNSS_SDR_AD936X_IIO_CUSTOM_H +#include "ad936x_iio_samples.h" #include "concurrent_queue.h" #include "gnss_time.h" #include "pps_samplestamp.h" #include +#include +#include // multichip sync and high level functions #include #include - -#ifdef __APPLE__ -#include -#else -#include -#endif - -#include "ad936x_iio_samples.h" -#include // multichip sync and high level functions #include #include +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + + class ad936x_iio_custom { public: ad936x_iio_custom(int debug_level_, int log_level_); virtual ~ad936x_iio_custom(); - bool initialize_device(std::string pluto_device_uri, std::string board_type); + bool initialize_device(const std::string &pluto_device_uri, const std::string &board_type); bool init_config_ad9361_rx(long long bandwidth_, long long sample_rate_, long long freq_, - std::string rf_port_select_, - std::string rf_filter, - std::string gain_mode_rx0_, - std::string gain_mode_rx1_, + const std::string &rf_port_select_, + const std::string &rf_filter, + const std::string &gain_mode_rx0_, + const std::string &gain_mode_rx1_, double rf_gain_rx0_, double rf_gain_rx1_, bool enable_ch0, @@ -61,7 +62,7 @@ public: bool calibrate(int ch, double bw_hz); double get_rx_gain(int ch_num); - bool setRXGain(int ch_num, std::string gain_mode, double gain_dB); + bool setRXGain(int ch_num, const std::string &gain_mode, double gain_dB); bool set_antenna_port(int ch, int antenna_idx); double get_frequency(int ch); @@ -93,9 +94,9 @@ private: unsigned long long frequency, unsigned long samplerate, unsigned long bandwidth, bool quadrature, bool rfdc, bool bbdc, - std::string gain1, double gain1_value, - std::string gain2, double gain2_value, - std::string port_select); + const std::string &gain1, double gain1_value, + const std::string &gain2, double gain2_value, + const std::string &port_select); bool config_ad9361_dds(uint64_t freq_rf_tx_hz_, double tx_attenuation_db_, @@ -107,7 +108,7 @@ private: void get_PPS_timestamp(); void capture(const std::vector &channels); - bool select_rf_filter(std::string rf_filter); + bool select_rf_filter(const std::string &rf_filter); void monitor_thread_fn(); @@ -120,15 +121,6 @@ private: struct iio_device *stream_dev; struct iio_device *dds_dev; - // stream - - uint64_t sample_rate_sps; - - - int debug_level; - int log_level; - bool PPS_mode; - std::mutex mtx; std::condition_variable cv; @@ -142,6 +134,14 @@ private: std::thread capture_samples_thread; std::thread overflow_monitor_thread; std::thread capture_time_thread; + + // stream + uint64_t sample_rate_sps; + int debug_level; + int log_level; + bool PPS_mode; }; -#endif /* SRC_LIBS_ad936x_iio_custom_H_ */ +/** \} */ +/** \} */ +#endif // GNSS_SDR_AD936X_IIO_CUSTOM_H diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.cc b/src/algorithms/signal_source/libs/ad936x_iio_samples.cc deleted file mode 100644 index b9b7b505a..000000000 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.cc +++ /dev/null @@ -1,25 +0,0 @@ -/*! - * \file ad936x_iio_samples.cc - * \brief A class that holds a custom sample buffer for Analog Devices AD936x family front-ends. - * \author Javier Arribas, jarribas(at)cttc.es - * - * ----------------------------------------------------------------------------- - * - * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. - * This file is part of GNSS-SDR. - * - * Copyright (C) 2010-2022 (see AUTHORS file for a list of contributors) - * SPDX-License-Identifier: GPL-3.0-or-later - * - * ----------------------------------------------------------------------------- - */ - -#include "ad936x_iio_samples.h" - -ad936x_iio_samples::ad936x_iio_samples() -{ - n_bytes = 0; - n_interleaved_iq_samples = 0; - step_bytes = 0; - n_channels = 0; -} diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.h b/src/algorithms/signal_source/libs/ad936x_iio_samples.h index 63d30545b..5ff43d065 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.h @@ -15,26 +15,32 @@ */ -#ifndef SRC_LIBS_ad936x_iio_samples_H_ -#define SRC_LIBS_ad936x_iio_samples_H_ +#ifndef GNSS_SDR_AD936X_IIO_SAMPLES_H +#define GNSS_SDR_AD936X_IIO_SAMPLES_H #define IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES 32768 * 4 - #define IIO_INPUTRAMFIFOSIZE 256 +#include #include -#include #include +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + class ad936x_iio_samples { public: - ad936x_iio_samples(); - uint32_t n_bytes; - uint32_t n_interleaved_iq_samples; - uint16_t n_channels; - uint16_t step_bytes; + ad936x_iio_samples() = default; + uint32_t n_bytes{0}; + uint32_t n_interleaved_iq_samples{0}; + uint16_t n_channels{0}; + uint16_t step_bytes{0}; char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; // max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q) }; +/** \} */ +/** \} */ #endif diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc new file mode 100644 index 000000000..5a8cd823c --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -0,0 +1,271 @@ +/*! + * \file ion_gsms_chunk_data.cc + * \brief Holds logic for reading and decoding samples from a chunk + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "ion_gsms_chunk_data.h" +#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + + +IONGSMSChunkData::IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset) + : chunk_(chunk), + sizeword_(chunk_.SizeWord()), + countwords_(chunk_.CountWords()) +{ + // Instantiate the Allocator functor + Allocator allocator(countwords_, buffer_); + // Call with_word_type with the Allocator functor + with_word_type(sizeword_, allocator); + + const std::size_t total_bitsize = sizeword_ * countwords_ * 8; + std::size_t used_bitsize = 0; + std::size_t output_streams = 0; + for (const auto& lump : chunk.Lumps()) + { + for (const auto& stream : lump.Streams()) + { + used_bitsize += stream.Packedbits(); + + bool found = false; + for (const auto& stream_id : stream_ids) + { + if (stream_id == stream.Id()) + { + found = true; + break; + } + } + if (found) + { + streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()), output_streams + output_stream_offset); + ++output_streams; + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_rate = stream.RateFactor(); + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + sample_rate *= 2; + } + output_stream_item_size_.push_back(bits_to_item_size(sample_bitsize)); + output_stream_item_rate_.push_back(sample_rate); + } + else + { + streams_.emplace_back(lump, stream, GnssMetadata::encoding_from_string(stream.Encoding()), -1); + } + } + } + + output_stream_count_ = output_streams; + padding_bitsize_ = total_bitsize - used_bitsize; +} + + +IONGSMSChunkData::~IONGSMSChunkData() +{ + Deleter deleter(static_cast(buffer_)); + with_word_type(sizeword_, deleter); +} + + +std::size_t IONGSMSChunkData::read_from_buffer(uint8_t* buffer, std::size_t offset) +{ + memset(buffer_, 0, sizeword_ * countwords_); + memcpy(buffer_, &buffer[offset], sizeword_ * countwords_); + return sizeword_ * countwords_; +} + + +void IONGSMSChunkData::write_to_output(gr_vector_void_star& outputs, std::vector& output_items) +{ + switch (sizeword_) + { + case 1: + unpack_words(outputs, output_items); + break; + case 2: + unpack_words(outputs, output_items); + break; + case 4: + unpack_words(outputs, output_items); + break; + case 8: + unpack_words(outputs, output_items); + break; + default: + LOG(ERROR) << "Unknown word size (" << std::to_string(sizeword_) << "), unpacking nothing."; + break; + } +} + + +std::size_t IONGSMSChunkData::output_stream_count() const +{ + return output_stream_count_; +} + + +std::size_t IONGSMSChunkData::output_stream_item_size(std::size_t stream_index) const +{ + return output_stream_item_size_[stream_index]; +} + + +std::size_t IONGSMSChunkData::output_stream_item_rate(std::size_t stream_index) const +{ + return output_stream_item_rate_[stream_index]; +} + + +template +void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector& output_items) +{ + WT* data = static_cast(buffer_); + // TODO - Swap endiannes if needed + + IONGSMSChunkUnpackingCtx ctx{ + chunk_.Shift(), + data, + countwords_, + }; + + // Head padding + if (padding_bitsize_ > 0 && chunk_.Padding() == GnssMetadata::Chunk::Head) + { + ctx.shift_padding(padding_bitsize_); + } + + // Samples + for (const auto& [lump, stream, encoding, output_index] : streams_) + { + if (output_index == -1) + { + // skip stream + ctx.shift_padding(stream.Packedbits()); + } + else + { + output_items[output_index] += write_stream_samples(ctx, lump, stream, encoding, &outputs[output_index]); + } + } +} + + +template +std::size_t IONGSMSChunkData::write_stream_samples( + IONGSMSChunkUnpackingCtx& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream, + const GnssMetadata::StreamEncoding stream_encoding, + void** out) +{ + std::size_t sample_bitsize = stream.Packedbits() / stream.RateFactor(); + std::size_t sample_count = stream.RateFactor(); + + if (stream.Packedbits() >= 2 * stream.RateFactor() * stream.Quantization()) + { + // Samples have 'Complex' format + sample_bitsize /= 2; + sample_count *= 2; + } + + if (sample_bitsize <= 8) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); + } + else if (sample_bitsize <= 16) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); + } + else if (sample_bitsize <= 32) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); + } + else if (sample_bitsize <= 64) + { + write_n_samples(ctx, lump.Shift(), sample_bitsize, sample_count, stream_encoding, reinterpret_cast(out)); + } + + return sample_count; +} + + +template +void IONGSMSChunkData::write_n_samples( + IONGSMSChunkUnpackingCtx& ctx, + GnssMetadata::Lump::LumpShift lump_shift, + uint8_t sample_bitsize, + std::size_t sample_count, + GnssMetadata::StreamEncoding stream_encoding, + OT** out) +{ + if (lump_shift == GnssMetadata::Lump::shiftRight) + { + auto* sample = static_cast(*out); + sample += sample_count; + for (std::size_t i = 0; i < sample_count; ++i) + { + *sample = 0; + ctx.shift_sample(sample_bitsize, sample); + decode_sample(sample_bitsize, sample, stream_encoding); + --sample; + } + } + else // if (lump_shift == GnssMetadata::Lump::shiftLeft || lump_shift == GnssMetadata::Lump::shiftUndefined) + { + auto* sample = static_cast(*out); + for (std::size_t i = 0; i < sample_count; ++i) + { + *sample = 0; + ctx.shift_sample(sample_bitsize, sample); + decode_sample(sample_bitsize, sample, stream_encoding); + ++sample; + } + } + + (*out) += sample_count; +} + + +// Static utilities +template +void IONGSMSChunkData::decode_sample(const uint8_t sample_bitsize, Sample* sample, const GnssMetadata::StreamEncoding encoding) +{ + // using SampleType = std::remove_pointer_t; + switch (sample_bitsize) + { + case 2: + *sample = GnssMetadata::two_bit_look_up[encoding][*sample]; + break; + case 3: + *sample = GnssMetadata::three_bit_look_up[encoding][*sample]; + break; + case 4: + *sample = GnssMetadata::four_bit_look_up[encoding][*sample]; + break; + case 5: + *sample = GnssMetadata::five_bit_look_up[encoding][*sample]; + break; + default: + // TODO - Is this an error that can happen? + // for now we'll just do nothing, if the sample is this wide it may need no decoding + break; + } +} diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h new file mode 100644 index 000000000..5170af848 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.h @@ -0,0 +1,188 @@ +/*! + * \file ion_gsms_chunk_data.h + * \brief Holds logic for reading and decoding samples from a chunk + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ION_GSMS_CHUNK_DATA_H +#define GNSS_SDR_ION_GSMS_CHUNK_DATA_H + +#include "ion_gsms_chunk_unpacking_ctx.h" +#include "ion_gsms_stream_encodings.h" +#include +#include +#include +#include +#include +#include +#include + + +inline std::size_t bits_to_item_size(std::size_t bit_count) +{ + if (bit_count <= 8) + { + return 1; + } + if (bit_count <= 16) + { + return 2; + } + if (bit_count <= 32) + { + return 4; + } + if (bit_count <= 64) + { + return 8; + } + + // You are asking too much of this humble processor + std::cerr << "Item size too large (" << std::to_string(bit_count) << "), returning nonsense.\n"; + return 1; +} + + +// Define a functor that has a templated operator() +struct Allocator +{ + size_t countwords_; + void*& buffer_; // Using void* to hold any type of pointer + + Allocator(size_t countwords, void*& buffer) + : countwords_(countwords), buffer_(buffer) {} + + template + void operator()() const + { + buffer_ = new WordType[countwords_]; + } +}; + + +// Define a functor to delete the allocated memory +struct Deleter +{ + void* buffer_; + + explicit Deleter(void* buffer) + : buffer_(buffer) {} + + template + void operator()() const + { + delete[] static_cast(buffer_); + } +}; + + +template +void with_word_type(uint8_t word_size, Callback callback) +{ + switch (word_size) + { + case 1: + callback.template operator()(); + break; + case 2: + callback.template operator()(); + break; + case 4: + callback.template operator()(); + break; + case 8: + callback.template operator()(); + break; + default: + std::cerr << "Unknown word size (" << std::to_string(word_size) << "), returning nonsense.\n"; + break; + } +} + +class IONGSMSChunkData +{ +public: + IONGSMSChunkData(const GnssMetadata::Chunk& chunk, const std::vector& stream_ids, std::size_t output_stream_offset); + + ~IONGSMSChunkData(); + + IONGSMSChunkData(const IONGSMSChunkData& rhl) = delete; + IONGSMSChunkData& operator=(const IONGSMSChunkData& rhl) = delete; + + IONGSMSChunkData(IONGSMSChunkData&& rhl) = delete; + IONGSMSChunkData& operator=(IONGSMSChunkData&& rhl) = delete; + + std::size_t read_from_buffer(uint8_t* buffer, std::size_t offset); + + void write_to_output(gr_vector_void_star& outputs, std::vector& output_items); + + std::size_t output_stream_count() const; + std::size_t output_stream_item_size(std::size_t stream_index) const; + std::size_t output_stream_item_rate(std::size_t stream_index) const; + +private: + template + void unpack_words(gr_vector_void_star& outputs, std::vector& output_items); + + template + std::size_t write_stream_samples( + IONGSMSChunkUnpackingCtx& ctx, + const GnssMetadata::Lump& lump, + const GnssMetadata::IonStream& stream, + GnssMetadata::StreamEncoding stream_encoding, + void** out); + + template + void write_n_samples( + IONGSMSChunkUnpackingCtx& ctx, + GnssMetadata::Lump::LumpShift lump_shift, + uint8_t sample_bitsize, + std::size_t sample_count, + GnssMetadata::StreamEncoding stream_encoding, + OT** out); + + template + static void decode_sample(uint8_t sample_bitsize, Sample* sample, GnssMetadata::StreamEncoding encoding); + + const GnssMetadata::Chunk& chunk_; + uint8_t sizeword_; + uint8_t countwords_; + uint8_t padding_bitsize_; + std::size_t output_stream_count_; + std::vector output_stream_item_size_; + std::vector output_stream_item_rate_; + + struct stream_metadata_t + { + const GnssMetadata::Lump& lump; + const GnssMetadata::IonStream& stream; + GnssMetadata::StreamEncoding stream_encoding; + int output_index = -1; + + stream_metadata_t( + const GnssMetadata::Lump& lump_, + const GnssMetadata::IonStream& stream_, + GnssMetadata::StreamEncoding stream_encoding_, + int output_index_ = -1) : lump(lump_), + stream(stream_), + stream_encoding(stream_encoding_), + output_index(output_index_) + { + } + }; + std::vector streams_; + + void* buffer_; +}; + +#endif // GNSS_SDR_ION_GSMS_CHUNK_DATA_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h new file mode 100644 index 000000000..6799f1080 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_unpacking_ctx.h @@ -0,0 +1,184 @@ +/*! + * \file ion_gsms_chunk_unpacking_ctx.h + * \brief Holds state and provides utilities for unpacking samples from a chunk + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * This is a template class, and thus, its member functions must be defined in the header file. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ION_GSMS_CHUNK_UNPACKING_CTX_H +#define GNSS_SDR_ION_GSMS_CHUNK_UNPACKING_CTX_H + +#include +#include +#include + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + +template +struct IONGSMSChunkUnpackingCtx +{ + static constexpr uint8_t word_bitsize_ = sizeof(WT) * 8; + + const GnssMetadata::Chunk::WordShift word_shift_direction_; + WT* iterator_ = nullptr; // Not owned by this class, MUST NOT destroy + WT current_word_{}; + uint8_t bitshift_ = 0; + + IONGSMSChunkUnpackingCtx( + const GnssMetadata::Chunk::WordShift word_shift, + WT* data_buffer, + uint8_t data_buffer_word_count) : word_shift_direction_(word_shift) + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + iterator_ = data_buffer; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + iterator_ = &data_buffer[data_buffer_word_count]; + } + if (iterator_) + { + advance_word(); // Initializes current_word_ + } + } + + void advance_word() + { + WT word = *iterator_; + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + ++iterator_; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + --iterator_; + } + + current_word_ = word; + } + + void shift_current_word(uint8_t n) + { + if ((n % word_bitsize_) == 0) + { + for (uint8_t i = 0; i < (n / word_bitsize_); ++i) + { + advance_word(); + } + return; + } + + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + current_word_ <<= n; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + current_word_ >>= n; + } + + bitshift_ += n; + if (bitshift_ >= word_bitsize_) + { + advance_word(); + bitshift_ -= word_bitsize_; + } + } + + void shift_padding(uint8_t n_bits) + { + if (n_bits == 0) + { + return; + } + + if ((n_bits + (bitshift_ % word_bitsize_)) >= word_bitsize_) + { + const uint8_t bits_shifted = word_bitsize_ - (bitshift_ % word_bitsize_); + + shift_current_word(bits_shifted); + shift_padding(n_bits - bits_shifted); + } + else + { + shift_current_word(n_bits); + } + } + + template + void shift_sample(uint8_t sample_bitsize, OT* output, uint8_t output_bit_offset = 0) + { + if (sample_bitsize % word_bitsize_ == 0) + { + const uint8_t words_per_sample = sample_bitsize / word_bitsize_; + for (uint8_t i = 0; i < words_per_sample; ++i) + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + *output |= (current_word_ << ((words_per_sample - 1 - i) * word_bitsize_)); + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + *output |= (current_word_ << (i * word_bitsize_)); + // TODO - reverse bit order of sample? maybe? + } + advance_word(); + } + } + else if ((sample_bitsize + (bitshift_ % word_bitsize_)) > word_bitsize_) + { + const uint8_t bits_shifted = word_bitsize_ - (bitshift_ % word_bitsize_); + + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize_ - bits_shifted)) - 1); + *output |= ((current_word_ & mask) >> output_bit_offset); + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (bits_shifted)) - 1); + *output |= (current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + } + + shift_current_word(bits_shifted); + shift_sample(sample_bitsize - bits_shifted, output, bits_shifted); + } + else + { + if (word_shift_direction_ == GnssMetadata::Chunk::Left) + { + WT mask = ~((1 << (word_bitsize_ - sample_bitsize)) - 1); + OT sample = (current_word_ & mask) >> (word_bitsize_ - sample_bitsize); + *output |= (sample) >> output_bit_offset; + } + else if (word_shift_direction_ == GnssMetadata::Chunk::Right) + { + WT mask = ((1 << (sample_bitsize)) - 1); + *output |= (current_word_ & mask) << output_bit_offset; + // TODO - reverse bit order of sample? maybe? + } + + shift_current_word(sample_bitsize); + } + } +}; + +/** \} */ +/** \} */ +#endif // GNSS_SDR_ION_GSMS_CHUNK_UNPACKING_CTX_H diff --git a/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h new file mode 100644 index 000000000..5b39e6497 --- /dev/null +++ b/src/algorithms/signal_source/libs/ion_gsms_stream_encodings.h @@ -0,0 +1,170 @@ +/*! + * \file ion_gsms_stream_encodings.h + * \brief Implements look up tables for all encodings in the standard + * \author Víctor Castillo Agüero, 2024. victorcastilloaguero(at)gmail.com + * + * These tables are taken from the stardard's official document. + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_ION_GSMS_STREAM_ENCODINGS_H +#define GNSS_SDR_ION_GSMS_STREAM_ENCODINGS_H + +#include + +/** \addtogroup Signal_Source + * \{ */ +/** \addtogroup Signal_Source_libs + * \{ */ + +namespace GnssMetadata +{ + +using StreamEncoding = unsigned char; + +namespace StreamEncodings +{ + +constexpr unsigned char SIGN = 0; +constexpr unsigned char OB = 1; +constexpr unsigned char SM = 2; +constexpr unsigned char MS = 3; +constexpr unsigned char TC = 4; +constexpr unsigned char OG = 5; +constexpr unsigned char OBA = 6; +constexpr unsigned char SMA = 7; +constexpr unsigned char MSA = 8; +constexpr unsigned char TCA = 9; +constexpr unsigned char OGA = 10; +constexpr unsigned char FP = 11; + +} // namespace StreamEncodings + +inline StreamEncoding encoding_from_string(const std::string& str) +{ + if (str == "SIGN") + { + return StreamEncodings::SIGN; + } + if (str == "OB") + { + return StreamEncodings::OB; + } + if (str == "SM") + { + return StreamEncodings::SM; + } + if (str == "MS") + { + return StreamEncodings::MS; + } + if (str == "TC") + { + return StreamEncodings::TC; + } + if (str == "OG") + { + return StreamEncodings::OG; + } + if (str == "OBA") + { + return StreamEncodings::OBA; + } + if (str == "SMA") + { + return StreamEncodings::SMA; + } + if (str == "MSA") + { + return StreamEncodings::MSA; + } + if (str == "TCA") + { + return StreamEncodings::TCA; + } + if (str == "OGA") + { + return StreamEncodings::OGA; + } + if (str == "FP") + { + return StreamEncodings::FP; + } + return 0; +} + +template +inline T two_bit_look_up[11][4]{ + {}, // [0] + {-2, -1, 0, 1}, // [1 /*OB*/] + {0, 1, 0, -1}, // [2 /*SM*/] + {0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, -2, -1}, // [4 /*TC*/] + {-2, -1, 1, 0}, // [5 /*OG*/] + {-3, -1, 1, 3}, // [6 /*OBA*/] + {1, 3, -1, -3}, // [7 /*SMA*/] + {1, -1, 3, -3}, // [8 /*MSA*/] + {1, 3, -3, -1}, // [9 /*TCA*/] + {-3, -1, 3, 1}, // [10 /*OGA*/] +}; + +template +inline T three_bit_look_up[11][8]{ + {}, // [0] + {-4, -3, -2, -1, 0, 1, 2, 3}, // [1 /*OB*/] + {0, 1, 2, 3, 0, -1, -2, -3}, // [2 /*SM*/] + {0, 0, 1, -1, 0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, 2, 3, -4, -3, -2, -1}, // [4 /*TC*/] + {-4, -3, -1, -2, 3, 2, 0, 1}, // [5 /*OG*/] + {-7, -5, -3, -1, 1, 3, 5, 7}, // [6 /*OBA*/] + {1, 3, 5, 7, -1, -3, -5, -7}, // [7 /*SMA*/] + {1, -1, 3, -3, 5, -5, 7, -7}, // [8 /*MSA*/] + {1, 3, 5, 7, -7, -5, -3, -1}, // [9 /*TCA*/] + {-7, -5, -1, -3, 7, 5, 1, 3}, // [10 /*OGA*/] +}; + +template +inline T four_bit_look_up[11][16]{ + {}, // [0] + {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, // [1 /*OB*/] + {0, 1, 2, 3, 4, 5, 6, 7, 0, -1, -2, -3, -4, -5, -6, -7}, // [2 /*SM*/] + {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, 2, 3, 4, 5, 6, 7, -8, -7, -6, -5, -4, -3, -2, -1}, // [4 /*TC*/] + {-8, -7, -5, -6, -1, -2, -4, -3, 7, 6, 4, 5, 0, 1, 3, 2}, // [5 /*OG*/] + {-15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15}, // [6 /*OBA*/] + {1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15}, // [7 /*SMA*/] + {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15}, // [8 /*MSA*/] + {1, 3, 5, 7, 9, 11, 13, 15, -15, -13, -11, -9, -7, -5, -3, -1}, // [9 /*TCA*/] + {-15, -13, -9, -11, -1, -3, -7, -5, 15, 13, 9, 11, 1, 3, 7, 5}, // [10 /*OGA*/] +}; + +template +inline T five_bit_look_up[11][32]{ + {}, // [0] + {-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, // [1 /*OB*/] + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, -1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -13, -14, -15}, // [2 /*SM*/] + {0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1, 0, 0, 1, -1}, // [3 /*MS*/] + {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1}, // [4 /*TC*/] + {-16, -15, -13, -14, -9, -10, -12, -11, -1, -2, -4, -3, -8, -7, -5, -6, 15, 14, 12, 13, 8, 9, 11, 10, 0, 1, 3, 2, 7, 6, 4, 5}, // [5 /*OG*/] + {-31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31}, // [6 /*OBA*/] + {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -1, -3, -5, -7, -9, -11, -13, -15, -17, -19, -21, -23, -25, -27, -29, -31}, // [7 /*SMA*/] + {1, -1, 3, -3, 5, -5, 7, -7, 9, -9, 11, -11, 13, -13, 15, -15, 17, -17, 19, -19, 21, -21, 23, -23, 25, -25, 27, -27, 29, -29, 31, -31}, // [8 /*MSA*/] + {1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, -31, -29, -27, -25, -23, -21, -19, -17, -15, -13, -11, -9, -7, -5, -3, -1}, // [9 /*TCA*/] + {-31, -29, -25, -27, -17, -19, -23, -21, -1, -3, -7, -5, -15, -13, -9, -11, 31, 29, 25, 27, 17, 19, 23, 21, 1, 3, 7, 5, 15, 13, 9, 11}, // [10 /*OGA*/] +}; + +} // namespace GnssMetadata + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_ION_GSMS_STREAM_ENCODINGS_H diff --git a/src/algorithms/signal_source/libs/ppstcprx.cc b/src/algorithms/signal_source/libs/ppstcprx.cc index c23261aff..94dda2052 100644 --- a/src/algorithms/signal_source/libs/ppstcprx.cc +++ b/src/algorithms/signal_source/libs/ppstcprx.cc @@ -20,19 +20,6 @@ #include #include -pps_tcp_rx::pps_tcp_rx() -{ - // TODO Auto-generated constructor stub - is_connected = false; - clientSd = -1; -} - - -pps_tcp_rx::~pps_tcp_rx() -{ - // TODO Auto-generated destructor stub -} - void pps_tcp_rx::set_pps_samplestamp_queue(std::shared_ptr> queue) { @@ -40,7 +27,7 @@ void pps_tcp_rx::set_pps_samplestamp_queue(std::shared_ptr> Pps_queue; - int clientSd; + int clientSd{-1}; public: - volatile bool is_connected; - pps_tcp_rx(); - virtual ~pps_tcp_rx(); + volatile bool is_connected{false}; + pps_tcp_rx() = default; + virtual ~pps_tcp_rx() = default; - void receive_pps(std::string ip_address, int port); - bool send_cmd(std::string cmd); + void receive_pps(const std::string& ip_address, int port); + bool send_cmd(std::string cmd) const; void set_pps_samplestamp_queue(std::shared_ptr> queue); }; diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index cacef7f6f..ba945f69b 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -70,6 +70,10 @@ if(ENABLE_FPGA) target_compile_definitions(core_receiver PUBLIC -DENABLE_FPGA=1) endif() +if(ENABLE_ION) + target_compile_definitions(core_receiver PRIVATE -DENABLE_ION_SOURCE=1) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(core_receiver PUBLIC -DGNURADIO_USES_STD_POINTERS=1) endif() @@ -90,6 +94,10 @@ if(ENABLE_PLUTOSDR) target_compile_definitions(core_receiver PRIVATE -DPLUTOSDR_DRIVER=1) endif() +if(ENABLE_AD936X_SDR) + target_compile_definitions(core_receiver PRIVATE -DAD936X_SDR_DRIVER=1) +endif() + if(ENABLE_FMCOMMS2) target_compile_definitions(core_receiver PRIVATE -DFMCOMMS2_DRIVER=1) endif() diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index ce77442ee..fceadefb9 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -163,6 +163,10 @@ #include "plutosdr_signal_source.h" #endif +#if AD936X_SDR_DRIVER +#include "ad936x_custom_signal_source.h" +#endif + #if FMCOMMS2_DRIVER #include "fmcomms2_signal_source.h" #endif @@ -196,6 +200,11 @@ #include "gps_l1_ca_dll_pll_tracking_gpu.h" #endif +#if ENABLE_ION_SOURCE +#undef Owner +#include "ion_gsms_signal_source.h" +#endif + using namespace std::string_literals; namespace @@ -759,7 +768,14 @@ std::unique_ptr GNSSBlockFactory::GetBlock( block = std::move(block_); } #endif - +#if ENABLE_ION_SOURCE + else if (implementation == "ION_GSMS_Signal_Source") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams, queue); + block = std::move(block_); + } +#endif #if RAW_ARRAY_DRIVER else if (implementation == "Raw_Array_Signal_Source") { @@ -795,6 +811,8 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams, queue); block = std::move(block_); } +#endif +#if PLUTOSDR_DRIVER || AD936X_SDR_DRIVER else if (implementation == "Ad936x_Custom_Signal_Source") { std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, From 951520f581bd7c1cd15264efda570489d24a3387 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 5 Sep 2024 16:38:04 +0200 Subject: [PATCH 380/499] Fix: Windows does not define __ARM_NEON --- .../cpu_features/include/cpu_features_macros.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index c800d0c32..b595a22f2 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -226,13 +226,14 @@ #endif // defined(CPU_FEATURES_ARCH_X86) -#if defined(CPU_FEATURES_ARCH_ANY_ARM) -#if defined(__ARM_NEON) +// Note: MSVC targeting ARM does not define `__ARM_NEON` but Windows on ARM +// requires it. In that case we force NEON detection. +#if defined(__ARM_NEON) || \ + (defined(CPU_FEATURES_COMPILER_MSC) && defined(CPU_FEATURES_ARCH_ANY_ARM)) #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 1 #else #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 0 -#endif // defined(__ARM_NEON) -#endif // defined(CPU_FEATURES_ARCH_ANY_ARM) +#endif #if defined(CPU_FEATURES_ARCH_MIPS) #if defined(__mips_msa) From 85f935afe9cb3b8990c9e4352122449550fc44c0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 6 Sep 2024 15:46:23 +0200 Subject: [PATCH 381/499] Improve detection of the dma_proxy module and the spidev driver --- CMakeLists.txt | 60 ++++++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 35ccd15a5..b93750b3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3444,46 +3444,23 @@ if(ENABLE_MAX2771) if(DEFINED ENV{SDKTARGETSYSROOT}) set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) else() - set(TARGET_ROOTFS_PATH "") - endif() - find_program(STRINGS_EXECUTABLE strings) - if(NOT STRINGS_EXECUTABLE) - message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") - message(STATUS " You can try to install it by typing:") - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(STATUS " sudo yum install binutils") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(STATUS " sudo zypper install binutils") - else() - message(STATUS " sudo apt-get install binutils") - endif() - endif() - message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") - endif() - set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") - if(EXISTS "${DTB_FILE}") - message(STATUS "Found DTB file: ${DTB_FILE}") - # Run the strings command and grep for "spidev" - execute_process( - COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} - COMMAND grep "spidev" - OUTPUT_VARIABLE GREP_OUTPUT - RESULT_VARIABLE GREP_RESULT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(GREP_RESULT EQUAL 0) - message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") + string(REGEX MATCH "(.*/tmp-glibc)" MATCHED_PATH "${GNURADIO_RUNTIME_INCLUDE_DIRS}") + if(MATCHED_PATH) + set(TARGET_ROOTFS_PATH "${MATCHED_PATH}/sysroots-components") else() - message(STATUS "SPIdev driver not found, its installation is required.") - if(ENABLE_PACKAGING) - set(ENABLE_MAX2771 OFF) - else() - message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") - endif() + set(TARGET_ROOTFS_PATH "") endif() + endif() + file(GLOB_RECURSE SPIDEV_FILE "${TARGET_ROOTFS_PATH}/*/spidev.h") + if(EXISTS "${SPIDEV_FILE}") + message(STATUS "SPIdev driver found: ${SPIDEV_FILE}") else() - message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") + message(STATUS "SPIdev driver not found, its installation is required.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") + endif() endif() endif() @@ -3498,9 +3475,14 @@ if(ENABLE_DMA_PROXY) if(DEFINED ENV{SDKTARGETSYSROOT}) set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) else() - set(TARGET_ROOTFS_PATH "") + string(REGEX MATCH "(.*/tmp-glibc)" MATCHED_PATH "${GNURADIO_RUNTIME_INCLUDE_DIRS}") + if(MATCHED_PATH) + set(TARGET_ROOTFS_PATH "${MATCHED_PATH}/sysroots-components") + else() + set(TARGET_ROOTFS_PATH "") + endif() endif() - set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + file(GLOB_RECURSE DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/*/dma-proxy.ko") if(EXISTS "${DMA_PROXY_FILE}") message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") else() From b981f8065e486a288f60769d28898b8a08165d20 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 8 Sep 2024 09:41:36 +0200 Subject: [PATCH 382/499] Add missing include (fixes building with modern GCC) --- src/algorithms/signal_source/libs/fpga_spidev.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/signal_source/libs/fpga_spidev.h b/src/algorithms/signal_source/libs/fpga_spidev.h index 5fbe2f41c..ccef015d2 100644 --- a/src/algorithms/signal_source/libs/fpga_spidev.h +++ b/src/algorithms/signal_source/libs/fpga_spidev.h @@ -16,6 +16,7 @@ #ifndef GNSS_SDR_FPGA_SPIDEV_H #define GNSS_SDR_FPGA_SPIDEV_H +#include #include class Fpga_spidev From 94ab8a7006c7114c4823d710c897168503f630f4 Mon Sep 17 00:00:00 2001 From: Xavier Guerrero-Pau Date: Thu, 29 Aug 2024 16:30:13 +0200 Subject: [PATCH 383/499] Adapted udp_port to multiple ports --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 2 +- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 7 ++++- .../PVT/libs/monitor_pvt_udp_sink.cc | 11 +++++-- .../PVT/libs/monitor_pvt_udp_sink.h | 5 +++- src/algorithms/PVT/libs/pvt_conf.h | 2 +- src/core/monitor/gnss_synchro_monitor.cc | 17 +++++------ src/core/monitor/gnss_synchro_monitor.h | 6 ++-- src/core/monitor/gnss_synchro_udp_sink.cc | 15 +++++++--- src/core/monitor/gnss_synchro_udp_sink.h | 2 +- src/core/receiver/gnss_flowgraph.cc | 30 +++++++++++++++---- 10 files changed, 67 insertions(+), 30 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index bdd1f97c6..bfdf6c4b8 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -887,7 +887,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Read PVT MONITOR Configuration pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false); pvt_output_parameters.udp_addresses = configuration->property(role + ".monitor_client_addresses", std::string("127.0.0.1")); - pvt_output_parameters.udp_port = configuration->property(role + ".monitor_udp_port", 1234); + pvt_output_parameters.udp_ports = configuration->property(role + ".monitor_udp_port", std::string("1234")); pvt_output_parameters.protobuf_enabled = configuration->property(role + ".enable_protobuf", true); if (configuration->property("Monitor.enable_protobuf", false) == true) { diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 5f33ecaed..bae417cbb 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -467,7 +467,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); - d_udp_sink_ptr = std::make_unique(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled); + std::string port_string = conf_.udp_ports; + std::vector udp_port_vec = split_string(port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + + d_udp_sink_ptr = std::make_unique(udp_addr_vec, udp_port_vec, conf_.protobuf_enabled); } else { diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 9caef6f4d..e284bf4b2 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -17,19 +17,24 @@ #include "monitor_pvt_udp_sink.h" #include +#include #include #include -Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addresses, - const uint16_t& port, +Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, bool protobuf_enabled) : socket{io_context}, use_protobuf(protobuf_enabled) { for (const auto& address : addresses) { - boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), boost::lexical_cast (port)); endpoints.push_back(endpoint); + } } if (use_protobuf) diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index 1fbe3219d..bfe1c00e5 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -40,7 +40,10 @@ 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); + Monitor_Pvt_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, + bool protobuf_enabled); bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt); private: diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index 37d9b5aac..b38cfe788 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -48,6 +48,7 @@ public: std::string rtcm_output_file_path = std::string("."); std::string has_output_file_path = std::string("."); std::string udp_addresses; + std::string udp_ports; std::string udp_eph_addresses; std::string log_source_timetag_file; @@ -64,7 +65,6 @@ public: int32_t rinexobs_rate_ms = 0; int32_t an_rate_ms = 20; int32_t max_obs_block_rx_clock_offset_ms = 40; - int udp_port = 0; int udp_eph_port = 0; int rtk_trace_level = 0; diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 98526fe60..0b74b7b8c 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -26,29 +26,28 @@ gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf) { return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels, decimation_factor, - udp_port, + udp_ports, udp_addresses, enable_protobuf)); } - gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf) : gr::block("gnss_synchro_monitor", - gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), - gr::io_signature::make(0, 0, 0)), - count(0), - d_nchannels(n_channels), - d_decimation_factor(decimation_factor) + gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), + gr::io_signature::make(0, 0, 0)), + count(0), + d_nchannels(n_channels), + d_decimation_factor(decimation_factor) { udp_sink_ptr = std::make_unique(udp_addresses, udp_port, enable_protobuf); } diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index 64749a001..4edd012e1 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -41,7 +41,7 @@ using gnss_synchro_monitor_sptr = gnss_shared_ptr; gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); @@ -61,13 +61,13 @@ public: private: friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); gnss_synchro_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index 336f834cb..67f76a431 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -18,11 +18,13 @@ #include "gnss_synchro_udp_sink.h" #include #include +#include #include #include -Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector& addresses, - const uint16_t& port, +Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, bool enable_protobuf) : socket{io_context}, use_protobuf(enable_protobuf) @@ -33,8 +35,13 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector& add } for (const auto& address : addresses) { - boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); - endpoints.push_back(endpoint); + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint( + boost::asio::ip::address::from_string(address, error), + boost::lexical_cast (port)); + endpoints.push_back(endpoint); + } } } diff --git a/src/core/monitor/gnss_synchro_udp_sink.h b/src/core/monitor/gnss_synchro_udp_sink.h index cf777cc12..699a6043f 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.h +++ b/src/core/monitor/gnss_synchro_udp_sink.h @@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service; class Gnss_Synchro_Udp_Sink { public: - Gnss_Synchro_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool enable_protobuf); + Gnss_Synchro_Udp_Sink(const std::vector& addresses, const std::vector& ports, bool enable_protobuf); bool write_gnss_synchro(const std::vector& stocks); private: diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index c7cbb9f07..599dadab3 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -217,11 +217,17 @@ void GNSSFlowgraph::init() std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); + std::string udp_port_string = configuration_->property("Monitor.udp_port", std::string("1234")); + std::vector udp_port_vec = split_string(udp_port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + // Instantiate monitor object GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("Monitor.decimation_factor", 1), - configuration_->property("Monitor.udp_port", 1234), - udp_addr_vec, enable_protobuf); + udp_port_vec, + udp_addr_vec, + enable_protobuf); } /* @@ -241,10 +247,16 @@ void GNSSFlowgraph::init() std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); + std::string udp_port_string = configuration_->property("AcquisitionMonitor.udp_port", std::string("1235")); + std::vector udp_port_vec = split_string(udp_port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + GnssSynchroAcquisitionMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("AcquisitionMonitor.decimation_factor", 1), - configuration_->property("AcquisitionMonitor.udp_port", 1235), - udp_addr_vec, enable_protobuf); + udp_port_vec, + udp_addr_vec, + enable_protobuf); } /* @@ -264,10 +276,16 @@ void GNSSFlowgraph::init() std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); + std::string udp_port_string = configuration_->property("TrackingMonitor.udp_port", std::string("1236")); + std::vector udp_port_vec = split_string(udp_port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + GnssSynchroTrackingMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("TrackingMonitor.decimation_factor", 1), - configuration_->property("TrackingMonitor.udp_port", 1236), - udp_addr_vec, enable_protobuf); + udp_port_vec, + udp_addr_vec, + enable_protobuf); } /* From fdc4e4078e440f36611532eeb16e721b66aad88a Mon Sep 17 00:00:00 2001 From: Xavier Guerrero-Pau Date: Thu, 29 Aug 2024 17:39:23 +0200 Subject: [PATCH 384/499] Fixed typo --- src/core/monitor/gnss_synchro_monitor.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 0b74b7b8c..d670d342a 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -49,7 +49,7 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, d_nchannels(n_channels), d_decimation_factor(decimation_factor) { - udp_sink_ptr = std::make_unique(udp_addresses, udp_port, enable_protobuf); + udp_sink_ptr = std::make_unique(udp_addresses, udp_ports, enable_protobuf); } From c9277539ff64666f3c0f53167a305e824d0aebdb Mon Sep 17 00:00:00 2001 From: Xavier Guerrero-Pau Date: Mon, 9 Sep 2024 15:43:24 +0200 Subject: [PATCH 385/499] Fixed clang format --- src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc | 12 ++++++------ src/algorithms/PVT/libs/monitor_pvt_udp_sink.h | 4 ++-- src/core/monitor/gnss_synchro_monitor.cc | 10 +++++----- src/core/monitor/gnss_synchro_udp_sink.cc | 16 ++++++++-------- src/core/receiver/gnss_flowgraph.cc | 6 +++--- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index e284bf4b2..f9a60e0ac 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -24,17 +24,17 @@ Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink( const std::vector& addresses, - const std::vector& ports, + const std::vector& ports, bool protobuf_enabled) : socket{io_context}, use_protobuf(protobuf_enabled) { for (const auto& address : addresses) { - for (const auto& port : ports) - { - boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), boost::lexical_cast (port)); - endpoints.push_back(endpoint); - } + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), boost::lexical_cast(port)); + endpoints.push_back(endpoint); + } } if (use_protobuf) diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index bfe1c00e5..393e4e5e2 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -41,8 +41,8 @@ class Monitor_Pvt_Udp_Sink { public: Monitor_Pvt_Udp_Sink( - const std::vector& addresses, - const std::vector& ports, + const std::vector& addresses, + const std::vector& ports, bool protobuf_enabled); bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt); diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index d670d342a..f63811a73 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -43,11 +43,11 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, const std::vector& udp_addresses, bool enable_protobuf) : gr::block("gnss_synchro_monitor", - gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), - gr::io_signature::make(0, 0, 0)), - count(0), - d_nchannels(n_channels), - d_decimation_factor(decimation_factor) + gr::io_signature::make(n_channels, n_channels, sizeof(Gnss_Synchro)), + gr::io_signature::make(0, 0, 0)), + count(0), + d_nchannels(n_channels), + d_decimation_factor(decimation_factor) { udp_sink_ptr = std::make_unique(udp_addresses, udp_ports, enable_protobuf); } diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index 67f76a431..45a6e441e 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -17,8 +17,8 @@ #include "gnss_synchro_udp_sink.h" #include -#include #include +#include #include #include @@ -35,13 +35,13 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink( } for (const auto& address : addresses) { - for (const auto& port : ports) - { - boost::asio::ip::udp::endpoint endpoint( - boost::asio::ip::address::from_string(address, error), - boost::lexical_cast (port)); - endpoints.push_back(endpoint); - } + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint( + boost::asio::ip::address::from_string(address, error), + boost::lexical_cast(port)); + endpoints.push_back(endpoint); + } } } diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 599dadab3..2963b03a5 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -226,7 +226,7 @@ void GNSSFlowgraph::init() GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("Monitor.decimation_factor", 1), udp_port_vec, - udp_addr_vec, + udp_addr_vec, enable_protobuf); } @@ -255,7 +255,7 @@ void GNSSFlowgraph::init() GnssSynchroAcquisitionMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("AcquisitionMonitor.decimation_factor", 1), udp_port_vec, - udp_addr_vec, + udp_addr_vec, enable_protobuf); } @@ -284,7 +284,7 @@ void GNSSFlowgraph::init() GnssSynchroTrackingMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("TrackingMonitor.decimation_factor", 1), udp_port_vec, - udp_addr_vec, + udp_addr_vec, enable_protobuf); } From d449465a25c333e7878ae27b1d9619dea46a8333 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 9 Sep 2024 17:10:24 +0200 Subject: [PATCH 386/499] Update changelog --- docs/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index abdc04427..70108de49 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -45,6 +45,7 @@ All notable changes to GNSS-SDR will be documented in this file. described with the [ION GNSS Software Defined Receiver Metadata Standard](https://sdr.ion.org/). It requires the `-DENABLE_ION=ON` building configuration option. +- The `Monitor` block is now able to send data to multiple ports. ### Improvements in Portability: From 3bd38a1ca0715e49d9c4e281e6e5d87d115f7f7f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 9 Sep 2024 17:12:27 +0200 Subject: [PATCH 387/499] Add Xavier Guerrero to the authors list --- AUTHORS | 1 + CITATION.cff | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/AUTHORS b/AUTHORS index 7df41ed17..9f305c3a3 100644 --- a/AUTHORS +++ b/AUTHORS @@ -37,6 +37,7 @@ Carles Fernández-Prades carles.fernandez@cttc.cat Project manager Javier Arribas javier.arribas@cttc.es Developer Luis Esteve Elfau luis@epsilon-formacion.com Developer Marc Majoral marc.majoral@cttc.cat Developer +Xavier Guerrero xavier.guerrero@cttc.es Developer Jordi Vilà-Valls jordi.vila-valls@isae-supaero.fr Consultant Pau Closas pau.closas@northeastern.edu Consultant Álvaro Cebrián Juan acebrianjuan@gmail.com Contributor diff --git a/CITATION.cff b/CITATION.cff index 4bf27081f..4851a8b1b 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -20,6 +20,11 @@ authors: family-names: Majoral given-names: Marc orcid: "https://orcid.org/0000-0001-6161-6747" + - affiliation: "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)" + alias: xguerreropau + email: xavier.guerrero@cttc.es + family-names: Guerrero + given-names: Xavier - alias: Gastd email: gabriel.araujo.5000@gmail.com family-names: Araujo From fe58ba563c02f11eb6e96d20cf3d1dbbd54e49e8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 12 Sep 2024 21:22:54 +0200 Subject: [PATCH 388/499] Update changelog --- docs/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 70108de49..1f067e6d6 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -45,7 +45,8 @@ All notable changes to GNSS-SDR will be documented in this file. described with the [ION GNSS Software Defined Receiver Metadata Standard](https://sdr.ion.org/). It requires the `-DENABLE_ION=ON` building configuration option. -- The `Monitor` block is now able to send data to multiple ports. +- The `Monitor` and `PVT` blocks are now able to send data to multiple UDP + ports. ### Improvements in Portability: From c61d69b6272dda7f4978d76e20b4424709eb732e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 12 Sep 2024 21:24:01 +0200 Subject: [PATCH 389/499] Bump local version of Protocol Buffers to 28.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b93750b3e..aa4c671b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -358,7 +358,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") From d40e3427d423324f96d6f394698d62f3e63a08af Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 16 Sep 2024 18:13:12 +0200 Subject: [PATCH 390/499] Add install and uninstall targets to nav_msg_listener --- docs/CHANGELOG.md | 1 + src/utils/nav-listener/CMakeLists.txt | 16 +++++++++ src/utils/nav-listener/README.md | 12 +++++++ .../cmake/cmake_uninstall.cmake.in | 35 +++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 src/utils/nav-listener/cmake/cmake_uninstall.cmake.in diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1f067e6d6..aa7bef842 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -85,6 +85,7 @@ All notable changes to GNSS-SDR will be documented in this file. ### Improvements in Usability: - Tidy up the `conf/` folder. +- Add `install` and `uninstall` targets to the `nav_msg_listener` utility. See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ diff --git a/src/utils/nav-listener/CMakeLists.txt b/src/utils/nav-listener/CMakeLists.txt index cc86a7bf4..ea9c5d36e 100644 --- a/src/utils/nav-listener/CMakeLists.txt +++ b/src/utils/nav-listener/CMakeLists.txt @@ -39,3 +39,19 @@ target_include_directories(navmsg_lib add_executable(nav_msg_listener ${NAVLISTENER_SOURCE_DIR}/main.cc) target_link_libraries(nav_msg_listener PUBLIC navmsg_lib) + +install(TARGETS nav_msg_listener + RUNTIME DESTINATION bin + COMPONENT "nav_msg_listener" +) + +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY + ) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake + ) +endif() diff --git a/src/utils/nav-listener/README.md b/src/utils/nav-listener/README.md index 76b2aedaf..4bd90658e 100644 --- a/src/utils/nav-listener/README.md +++ b/src/utils/nav-listener/README.md @@ -27,6 +27,18 @@ $ cmake .. $ make ``` +Optionally, you can install it: + +``` +$ sudo make install +``` + +and uninstall it later with: + +``` +$ sudo make uninstall +``` + ## Usage In order to tell GNSS-SDR to generate those messages, you need to include the diff --git a/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in b/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..fc57491c4 --- /dev/null +++ b/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,35 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif() + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + if(CMAKE_VERSION VERSION_LESS 3.17) + execute_process( + COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval + ) + else() + execute_process( + COMMAND @CMAKE_COMMAND@ -E rm "$ENV{DESTDIR}${file}" + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval + ) + endif() + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif() + else() + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif() +endforeach() From 583ae6df0d5255e033d087fbfbdfe746d3d4472b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 20 Sep 2024 14:50:31 +0200 Subject: [PATCH 391/499] Fix CRC computation in ISM --- src/core/system_parameters/galileo_ism.cc | 40 ++---------- src/core/system_parameters/galileo_ism.h | 28 +++++---- src/tests/test_main.cc | 62 ++++++++++++++++--- .../system-parameters/galileo_ism_test.cc | 43 +++++++++++++ 4 files changed, 119 insertions(+), 54 deletions(-) create mode 100644 src/tests/unit-tests/system-parameters/galileo_ism_test.cc diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc index 24b5b6d82..a601176a0 100644 --- a/src/core/system_parameters/galileo_ism.cc +++ b/src/core/system_parameters/galileo_ism.cc @@ -15,7 +15,6 @@ */ #include "galileo_ism.h" -#include #include #include #include @@ -176,15 +175,12 @@ uint16_t Galileo_ISM::get_Tvalidity_hours() const } -bool Galileo_ISM::check_ism_crc(const std::bitset& bits) const +bool Galileo_ISM::check_ism_crc(const std::bitset& bits) { boost::dynamic_bitset frame_bits(bits.to_string().substr(0, GALILEO_ISM_CRC_DATA_BITS)); - std::vector bytes; boost::to_block_range(frame_bits, std::back_inserter(bytes)); std::reverse(bytes.begin(), bytes.end()); - - boost::crc_optimal<32, 0xC0A0A0D5, 0xFFFFFFFF, 0xFFFFFFFF, true, true> crc32_ism; crc32_ism.process_bytes(bytes.data(), GALILEO_ISM_CRC_DATA_BYTES); const uint32_t crc_computed = crc32_ism.checksum(); if (this->ism_crc == crc_computed) @@ -196,33 +192,9 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) c } -bool Galileo_ISM::ism_apply_to_sat(uint32_t prn) const +uint32_t Galileo_ISM::compute_crc(const std::vector& data) { - if (prn == 0 || prn > 63) - { - return false; - } - std::bitset<32> bs(this->ism_mask); - if (this->ism_mask_msb == 0) - { - if (prn <= 32) - { - return bs[prn - 1]; - } - else - { - return false; - } - } - else - { - if (prn > 32) - { - return bs[prn - 32]; - } - else - { - return false; - } - } -} \ No newline at end of file + crc32_ism.process_bytes(data.data(), data.size()); + uint32_t result = crc32_ism.checksum(); + return result; +} diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index 2066fe0ac..39a26f116 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -19,9 +19,11 @@ #define GNSS_SDR_GALILEO_ISM_H #include "Galileo_INAV.h" +#include #include #include #include +#include /** \addtogroup Core * \{ */ @@ -41,7 +43,7 @@ public: /*! * Default constructor */ - Galileo_ISM() = default; + Galileo_ISM() : crc32_ism(0x814141AB, 0, 0, false, false) {}; void set_ism_constellation_id(uint8_t const_id); void set_ism_service_level_id(uint8_t sl_id); @@ -57,19 +59,21 @@ public: void set_ism_Tvalidity(uint8_t tvalidity); void set_ism_crc(uint32_t crc); - bool check_ism_crc(const std::bitset& bits) const; //!< Requires ism_crc to be already set - bool ism_apply_to_sat(uint32_t prn) const; //!< Returns true if ISM parameters apply to the prn satellite, false otherwise + bool check_ism_crc(const std::bitset& bits); - double get_pconst_value() const; //!< A priori constellation fault probability - double get_psat_value() const; //!< A priori satellite fault probability - float get_ura_m() const; //!< User Range Accuracy, in m, used for integrity - float get_ure_m() const; //!< User Range Error, in m, used for accuracy - float get_bnom_m() const; //!< Maximum nominal bias for a satellite, in m - uint16_t get_WN_ISM() const; //!< ISM Week Number, in weeks - uint16_t get_t0_ISM() const; //!< ISM Time of Week, in seconds - uint16_t get_Tvalidity_hours() const; //!< Validity duration of ISM content, in hours + double get_pconst_value() const; + double get_psat_value() const; + float get_ura_m() const; + float get_ure_m() const; + float get_bnom_m() const; + uint16_t get_WN_ISM() const; + uint16_t get_t0_ISM() const; + uint16_t get_Tvalidity_hours() const; + uint32_t compute_crc(const std::vector& data); private: + boost::crc_basic<32> crc32_ism; + // ICD 2.1 Table 97 std::unordered_map ISM_PCONST_MAP = { {0, 1.0e-8}, @@ -146,7 +150,6 @@ private: {14, 3.75}, {15, 4.00}}; - // ICD 2.1 Table 101 std::unordered_map ISM_BNOM_MAP = { {0, 0.0}, @@ -166,7 +169,6 @@ private: {14, 2.0}, {15, 2.4}}; - // ICD 2.1 Table 102 std::unordered_map ISM_TVALIDITY_MAP = { {0, 1}, diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 00f1f9458..bdc565e0d 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -18,19 +18,59 @@ #include "concurrent_map.h" #include "concurrent_queue.h" #include "gps_acq_assist.h" +#include +#include +#include +#include +#include + +#if USE_GLOG_AND_GFLAGS #include #include -#include -#include - #if GFLAGS_OLD_NAMESPACE namespace gflags { using namespace google; } +DECLARE_string(log_dir); +#endif +#else +#include "gnss_sdr_flags.h" +#include +#include +#include +#include +#include +#include +#include +#include + +class TestingLogSink : public absl::LogSink +{ +public: + TestingLogSink() + { + if (!absl::GetFlag(FLAGS_log_dir).empty()) + { + filename = std::string(absl::GetFlag(FLAGS_log_dir) + "/run_tests.log"); + } + else + { + filename = std::string(GetTempDir() + "/run_tests.log"); + } + logfile.open(filename); + } + void Send(const absl::LogEntry &entry) override + { + logfile << entry.text_message_with_prefix_and_newline() << std::flush; + } + +private: + std::ofstream logfile; + std::string filename; +}; #endif -DECLARE_string(log_dir); #if UNIT_TESTING_MINIMAL #include "unit-tests/arithmetic/matio_test.cc" @@ -95,9 +135,6 @@ DECLARE_string(log_dir); #include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" #include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" #include "unit-tests/system-parameters/has_decoding_test.cc" -#include "unit-tests/system-parameters/galileo_ism_test.cc" - - #ifndef EXCLUDE_TESTS_REQUIRING_BINARIES #include "unit-tests/control-plane/control_thread_test.cc" @@ -177,8 +214,15 @@ int main(int argc, char **argv) catch (...) { } // catch the "testing::internal::::ClassUniqueToAlwaysTrue" from gtest +#if USE_GLOG_AND_GFLAGS gflags::ParseCommandLineFlags(&argc, &argv, true); google::InitGoogleLogging(argv[0]); +#else + absl::ParseCommandLine(argc, argv); + absl::LogSink *testLogSink = new TestingLogSink; + absl::AddLogSink(testLogSink); + absl::InitializeLog(); +#endif try { res = RUN_ALL_TESTS(); @@ -187,6 +231,10 @@ int main(int argc, char **argv) { LOG(WARNING) << "Unexpected catch"; } +#if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); +#else + absl::FlushLogSinks(); +#endif return res; } diff --git a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc new file mode 100644 index 000000000..07573603b --- /dev/null +++ b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc @@ -0,0 +1,43 @@ +/*! + * \file galileo_ism_test.cc + * \brief Tests for Galileo Integrity Support Message + * \author Carles Fernandez-Prades, 2024. cfernandez(at)cttc.es + * + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "galileo_ism.h" +#include +#include +#include +#include + +TEST(GalileoISMTest, CRC) +{ + Galileo_ISM gal_ism{}; + uint32_t expected_crc = 3002390191; + std::bitset<96> input{"010110000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"}; + std::vector data_bytes; + for (size_t i = 0; i < input.size(); i += 8) + { + std::bitset<8> byte; + for (size_t j = 0; j < 8; j++) + { + byte[j] = input[i + j]; + } + data_bytes.push_back(static_cast(byte.to_ulong())); + } + + std::reverse(data_bytes.begin(), data_bytes.end()); + auto computed_crc = gal_ism.compute_crc(data_bytes); + EXPECT_TRUE(computed_crc == expected_crc); +} \ No newline at end of file From de6f9918110408b0b3710d499fdf7574b05789ad Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 20 Sep 2024 18:54:18 +0200 Subject: [PATCH 392/499] Improve CRC computation of ISM --- src/core/system_parameters/galileo_ism.cc | 29 ++++++++++++++----- src/core/system_parameters/galileo_ism.h | 2 +- src/tests/test_main.cc | 2 +- .../system-parameters/galileo_ism_test.cc | 23 ++++----------- 4 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc index a601176a0..a8847abfe 100644 --- a/src/core/system_parameters/galileo_ism.cc +++ b/src/core/system_parameters/galileo_ism.cc @@ -15,9 +15,7 @@ */ #include "galileo_ism.h" -#include #include -#include void Galileo_ISM::set_ism_constellation_id(uint8_t const_id) { @@ -177,12 +175,27 @@ uint16_t Galileo_ISM::get_Tvalidity_hours() const bool Galileo_ISM::check_ism_crc(const std::bitset& bits) { - boost::dynamic_bitset frame_bits(bits.to_string().substr(0, GALILEO_ISM_CRC_DATA_BITS)); - std::vector bytes; - boost::to_block_range(frame_bits, std::back_inserter(bytes)); - std::reverse(bytes.begin(), bytes.end()); - crc32_ism.process_bytes(bytes.data(), GALILEO_ISM_CRC_DATA_BYTES); - const uint32_t crc_computed = crc32_ism.checksum(); + std::bitset<96> extracted; + for (int32_t i = 0; i < GALILEO_ISM_CRC_DATA_BITS; ++i) + { + extracted[i] = bits[i + 32]; + } + + std::vector data_bytes((extracted.size() + 7) / 8); + + for (size_t i = 0; i < extracted.size(); i += 8) + { + uint8_t byte = 0; + for (size_t j = 0; j < 8 && i + j < extracted.size(); ++j) + { + byte |= (extracted[i + j] << j); + } + data_bytes[i / 8] = byte; + } + + std::reverse(data_bytes.begin(), data_bytes.end()); + const uint32_t crc_computed = this->compute_crc(data_bytes); + if (this->ism_crc == crc_computed) { return true; diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index 39a26f116..37a564de3 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -69,10 +69,10 @@ public: uint16_t get_WN_ISM() const; uint16_t get_t0_ISM() const; uint16_t get_Tvalidity_hours() const; - uint32_t compute_crc(const std::vector& data); private: boost::crc_basic<32> crc32_ism; + uint32_t compute_crc(const std::vector& data); // ICD 2.1 Table 97 std::unordered_map ISM_PCONST_MAP = { diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index bdc565e0d..3a0970f9a 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -131,7 +131,7 @@ private: #include "unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc" #include "unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc" #include "unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc" -#include "unit-tests/system-parameters/glonass_gnav_crc_test.cc" +#include "unit-tests/system-parameters/galileo_ism_test.cc" #include "unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc" #include "unit-tests/system-parameters/glonass_gnav_nav_message_test.cc" #include "unit-tests/system-parameters/has_decoding_test.cc" diff --git a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc index 07573603b..b2b36166e 100644 --- a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc +++ b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc @@ -17,27 +17,14 @@ #include "galileo_ism.h" #include -#include -#include -#include TEST(GalileoISMTest, CRC) { + // Example from ANNEX G Galileo ICD Galileo_ISM gal_ism{}; uint32_t expected_crc = 3002390191; - std::bitset<96> input{"010110000010101010101010101010101010101010101010101010101010101010101010101010101010101010101010"}; - std::vector data_bytes; - for (size_t i = 0; i < input.size(); i += 8) - { - std::bitset<8> byte; - for (size_t j = 0; j < 8; j++) - { - byte[j] = input[i + j]; - } - data_bytes.push_back(static_cast(byte.to_ulong())); - } - - std::reverse(data_bytes.begin(), data_bytes.end()); - auto computed_crc = gal_ism.compute_crc(data_bytes); - EXPECT_TRUE(computed_crc == expected_crc); + gal_ism.set_ism_crc(expected_crc); + std::bitset<128> input{"01011000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010111101001101011010101111"}; + bool result = gal_ism.check_ism_crc(input); + EXPECT_TRUE(result); } \ No newline at end of file From f6f58fd45e5c53adf65e58fedab4ddccf42fbc45 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Sep 2024 07:39:24 +0200 Subject: [PATCH 393/499] Log ISM data --- .../system_parameters/galileo_inav_message.cc | 13 ++++++++++++- src/core/system_parameters/galileo_ism.cc | 17 ++++++++++++++--- src/core/system_parameters/galileo_ism.h | 4 +++- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 182e15027..1a609c396 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1332,7 +1332,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) gal_ism.set_ism_service_level_id(ism_service_level_id); if (ism_constellation_id == 0) { - DLOG(INFO) << "I/NAV ARAIM Integrity Support Message in Test"; + LOG(INFO) << "I/NAV ARAIM Integrity Support Message in Test"; } if (ism_constellation_id == 1) { @@ -1348,6 +1348,17 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) gal_ism.set_ism_ure(read_octet_unsigned(data_jk_bits, ISM_URE_BIT)); gal_ism.set_ism_bnom(read_octet_unsigned(data_jk_bits, ISM_BNOM_BIT)); gal_ism.set_ism_Tvalidity(read_octet_unsigned(data_jk_bits, ISM_TVALIDITY_BIT)); + LOG(INFO) << "I/NAV ARAIM Integrity Support Message: " + << "WN_ISM=" << static_cast(gal_ism.get_WN_ISM()) << ", " + << "t0_ISM=" << static_cast(gal_ism.get_t0_ISM()) << ", " + << "Mask_MSB_ISM=" << static_cast(gal_ism.get_ism_mask_msb()) << ", " + << "Mask_ISM=" << gal_ism.get_mask_ISM() << ", " + << "Pconst=" << gal_ism.get_pconst_value() << ", " + << "Psat=" << gal_ism.get_psat_value() << ", " + << "URA=" << gal_ism.get_ura_m() << " [m], " + << "URE=" << gal_ism.get_ure_m() << " [m], " + << "Bnom=" << gal_ism.get_bnom_m() << " [m], " + << "Tvalidity=" << static_cast(gal_ism.get_Tvalidity_hours()) << " [h]"; } } } diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc index a8847abfe..a2c308bb3 100644 --- a/src/core/system_parameters/galileo_ism.cc +++ b/src/core/system_parameters/galileo_ism.cc @@ -129,6 +129,12 @@ double Galileo_ISM::get_psat_value() const } +bool Galileo_ISM::get_ism_mask_msb() const +{ + return ism_mask_msb; +} + + float Galileo_ISM::get_ura_m() const { auto it = ISM_URA_MAP.find(this->ism_ura); @@ -151,6 +157,12 @@ float Galileo_ISM::get_ure_m() const } +uint32_t Galileo_ISM::get_mask_ISM() const +{ + return ism_mask; +} + + float Galileo_ISM::get_bnom_m() const { auto it = ISM_BNOM_MAP.find(this->ism_bnom); @@ -175,7 +187,7 @@ uint16_t Galileo_ISM::get_Tvalidity_hours() const bool Galileo_ISM::check_ism_crc(const std::bitset& bits) { - std::bitset<96> extracted; + std::bitset extracted; for (int32_t i = 0; i < GALILEO_ISM_CRC_DATA_BITS; ++i) { extracted[i] = bits[i + 32]; @@ -208,6 +220,5 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) uint32_t Galileo_ISM::compute_crc(const std::vector& data) { crc32_ism.process_bytes(data.data(), data.size()); - uint32_t result = crc32_ism.checksum(); - return result; + return crc32_ism.checksum(); } diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index 37a564de3..aa613f7b2 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -66,13 +66,15 @@ public: float get_ura_m() const; float get_ure_m() const; float get_bnom_m() const; + uint32_t get_mask_ISM() const; uint16_t get_WN_ISM() const; uint16_t get_t0_ISM() const; uint16_t get_Tvalidity_hours() const; + bool get_ism_mask_msb() const; private: - boost::crc_basic<32> crc32_ism; uint32_t compute_crc(const std::vector& data); + boost::crc_basic<32> crc32_ism; // ICD 2.1 Table 97 std::unordered_map ISM_PCONST_MAP = { From e23d171b22bf39d42e0eb7a8767b8c9362ee9a2c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Sep 2024 08:42:59 +0200 Subject: [PATCH 394/499] Fix formatting --- .../system_parameters/galileo_inav_message.cc | 20 +++++++++---------- src/core/system_parameters/galileo_ism.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 1a609c396..5f3ac3514 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1349,16 +1349,16 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) gal_ism.set_ism_bnom(read_octet_unsigned(data_jk_bits, ISM_BNOM_BIT)); gal_ism.set_ism_Tvalidity(read_octet_unsigned(data_jk_bits, ISM_TVALIDITY_BIT)); LOG(INFO) << "I/NAV ARAIM Integrity Support Message: " - << "WN_ISM=" << static_cast(gal_ism.get_WN_ISM()) << ", " - << "t0_ISM=" << static_cast(gal_ism.get_t0_ISM()) << ", " - << "Mask_MSB_ISM=" << static_cast(gal_ism.get_ism_mask_msb()) << ", " - << "Mask_ISM=" << gal_ism.get_mask_ISM() << ", " - << "Pconst=" << gal_ism.get_pconst_value() << ", " - << "Psat=" << gal_ism.get_psat_value() << ", " - << "URA=" << gal_ism.get_ura_m() << " [m], " - << "URE=" << gal_ism.get_ure_m() << " [m], " - << "Bnom=" << gal_ism.get_bnom_m() << " [m], " - << "Tvalidity=" << static_cast(gal_ism.get_Tvalidity_hours()) << " [h]"; + << "WN_ISM=" << static_cast(gal_ism.get_WN_ISM()) << ", " + << "t0_ISM=" << static_cast(gal_ism.get_t0_ISM()) << ", " + << "Mask_MSB_ISM=" << static_cast(gal_ism.get_ism_mask_msb()) << ", " + << "Mask_ISM=" << gal_ism.get_mask_ISM() << ", " + << "Pconst=" << gal_ism.get_pconst_value() << ", " + << "Psat=" << gal_ism.get_psat_value() << ", " + << "URA=" << gal_ism.get_ura_m() << " [m], " + << "URE=" << gal_ism.get_ure_m() << " [m], " + << "Bnom=" << gal_ism.get_bnom_m() << " [m], " + << "Tvalidity=" << static_cast(gal_ism.get_Tvalidity_hours()) << " [h]"; } } } diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index aa613f7b2..fb48fee35 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -43,7 +43,7 @@ public: /*! * Default constructor */ - Galileo_ISM() : crc32_ism(0x814141AB, 0, 0, false, false) {}; + Galileo_ISM() : crc32_ism(0x814141AB, 0, 0, false, false){}; void set_ism_constellation_id(uint8_t const_id); void set_ism_service_level_id(uint8_t sl_id); From bc800dea281d430cc5251105b04d53f51b9207a7 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Sep 2024 10:22:32 +0200 Subject: [PATCH 395/499] Improve CRC computation of ISM --- .../system_parameters/galileo_inav_message.cc | 2 -- src/core/system_parameters/galileo_ism.cc | 23 ++++++++++++------- src/core/system_parameters/galileo_ism.h | 4 ++-- .../system-parameters/galileo_ism_test.cc | 12 +++++++--- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 5f3ac3514..b33737de9 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -1323,8 +1323,6 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) DLOG(INFO) << "Word type 22 arrived"; ism_constellation_id = read_octet_unsigned(data_jk_bits, ISM_CONSTELLATION_ID_BIT); ism_service_level_id = read_octet_unsigned(data_jk_bits, ISM_SERVICE_LEVEL_ID_BIT); - ism_crc = static_cast(read_navigation_unsigned(data_jk_bits, ISM_CRC_BIT)); - gal_ism.set_ism_crc(ism_crc); if (gal_ism.check_ism_crc(data_jk_bits)) { DLOG(INFO) << "I/NAV ARAIM Integrity Support Message CRC OK"; diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc index a2c308bb3..1c8097e64 100644 --- a/src/core/system_parameters/galileo_ism.cc +++ b/src/core/system_parameters/galileo_ism.cc @@ -187,20 +187,25 @@ uint16_t Galileo_ISM::get_Tvalidity_hours() const bool Galileo_ISM::check_ism_crc(const std::bitset& bits) { - std::bitset extracted; + std::bitset data_bits; for (int32_t i = 0; i < GALILEO_ISM_CRC_DATA_BITS; ++i) { - extracted[i] = bits[i + 32]; + data_bits[i] = bits[i + 32]; } + std::bitset<32> crc_bits; + for (int32_t i = 0; i < 32; ++i) + { + crc_bits[i] = bits[i]; + } + ism_crc = crc_bits.to_ulong(); - std::vector data_bytes((extracted.size() + 7) / 8); - - for (size_t i = 0; i < extracted.size(); i += 8) + std::vector data_bytes((data_bits.size() + 7) / 8); + for (size_t i = 0; i < data_bits.size(); i += 8) { uint8_t byte = 0; - for (size_t j = 0; j < 8 && i + j < extracted.size(); ++j) + for (size_t j = 0; j < 8 && i + j < data_bits.size(); ++j) { - byte |= (extracted[i + j] << j); + byte |= (data_bits[i + j] << j); } data_bytes[i / 8] = byte; } @@ -220,5 +225,7 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) uint32_t Galileo_ISM::compute_crc(const std::vector& data) { crc32_ism.process_bytes(data.data(), data.size()); - return crc32_ism.checksum(); + const uint32_t crc = crc32_ism.checksum(); + crc32_ism.reset(); + return crc; } diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index fb48fee35..dab782e27 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -43,7 +43,7 @@ public: /*! * Default constructor */ - Galileo_ISM() : crc32_ism(0x814141AB, 0, 0, false, false){}; + Galileo_ISM() = default; void set_ism_constellation_id(uint8_t const_id); void set_ism_service_level_id(uint8_t sl_id); @@ -74,7 +74,7 @@ public: private: uint32_t compute_crc(const std::vector& data); - boost::crc_basic<32> crc32_ism; + boost::crc_optimal<32, 0x814141AB, 0, 0, false, false> crc32_ism; // ICD 2.1 Table 97 std::unordered_map ISM_PCONST_MAP = { diff --git a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc index b2b36166e..4c5fa941d 100644 --- a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc +++ b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc @@ -9,7 +9,7 @@ * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. * This file is part of GNSS-SDR. * - * Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors) + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) * SPDX-License-Identifier: GPL-3.0-or-later * * ----------------------------------------------------------------------------- @@ -22,9 +22,15 @@ TEST(GalileoISMTest, CRC) { // Example from ANNEX G Galileo ICD Galileo_ISM gal_ism{}; - uint32_t expected_crc = 3002390191; - gal_ism.set_ism_crc(expected_crc); std::bitset<128> input{"01011000001010101010101010101010101010101010101010101010101010101010101010101010101010101010101010110010111101001101011010101111"}; bool result = gal_ism.check_ism_crc(input); EXPECT_TRUE(result); + // Check if it can be used twice + std::bitset<128> input2 = input; + bool result2 = gal_ism.check_ism_crc(input2); + EXPECT_TRUE(result2); + // Check if it fails + input2.set(127); + bool result3 = gal_ism.check_ism_crc(input2); + EXPECT_TRUE(!result3); } \ No newline at end of file From abc07e414b85bd37771a0a8231e12ea0bea56f9a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Sep 2024 11:40:17 +0200 Subject: [PATCH 396/499] Merging next, solving conflicts (#28) * Decouple the FPGA DMA signal source from the AD9361 FPGA signal source. * Add the MAX2771_EVKIT FPGA signal source and the ENABLE_FPGA_MAX2771_EVKIT flag to enable it. * Adjust cross-compilation flags to properly support FPGA signal sources * fix signal source names for consistency * Detect if the spidev driver is installed when the ENABLE_MAX2771 flag is set. Detect if the DMA proxy driver is installed when the ENABLE_DMA_PROXY flag is set. Check if ENABLE_FPGA is set when either ENABLE_MAX2771 or ENABLE_DMA_PROXY is set. * fix FPGA signal source names for consistency * Fix FPGA-related CMakefile flags * make cpplint happy * make cpplint happy * make cmakelint happy * make clang-format happy * Replaced the AD9361 FPGA signal source with the ADRV9361_Z7035 FPGA and the FMCOMMS5 FPGA signal sources. * Bump local version of GoogleTest to 1.15.2 and Protocol Buffers to 27.3 * Avoid code duplication in CMake modules * Update clang-tidy job * Clang Tidy fixes * Improve efficiency of Concurrent_Map and Concurrent_Queue classes * Fix segmentation fault if the SignalSource implementation is not available * Moved decimation factor count variable to the class * Avoid possible runtime error when PVT.enable_rx_clock_correction=true * Fix formatting * Fix clang-tidy job * Capitalize FPGA in class implementation names * Capitalize acronyms in FPGA-related class names * Instantiate sources only once * Update changelog * Bump version of google benchmark to 1.9.0 * Fix CMakeLists header file list in signal source libs Header file paths were being appended to the source files list. This is not that important since, in general, you don't need to add the header files to the cmake target. * Added ION GNSS SDR Metadata Standard signal source * Only specify outputs for the requested streams * Fixed block iteration withing a file The `File` object only holds a shallow reference to its `Lane` (without the list of blocks). So we must retrieve the full reference manually. * Treat data file paths as relative to the metadata file The data file paths are actually not native paths but URLs, this covers most cases but not all of them. * Fixed decoding errors and refactored each class into its own file * Fixed sample count error & refactored * Bufferef IO & propagate configuration inside ION source * Reset sample value before writing new one Sample values are ORed into the output buffer because they may need a few read/write operations depending on alignment. So, if we don't set the value to 0 before doing this, all samples quickly become 0xFF after a few cycles of the output buffer. * Simpler handling of simpler bit formats If a sample is the same size as a word, it is much easier to read. * Less callback shenanigans * Fix wrong buffer size * Fixed conditional compilation issues And added a comment * Linting fixes * Fixed arithmetic operations on pointers * Fix formatting * Use lock_guard instead of unique_lock * Create a CMake target for the ION dependency for consistency * Improve formatting, add missing include * Fixes for C++ standards older than 20. Avoid C++20-specific lambda templates * Update changelog * Add Victor to the list of authors * Fix CMake error * Fix building error * Fix building * Add -DENABLE_ION=ON to CI jobs * Fix CMake lists * Catch all exceptions * Fix building for -DENABLE_PLUTOSDR=ON * Removed unused member fields and function parameters * Use std::ifstream instead of FILE for reading sample data * Fixed includes and code style * Simplified disconnect() function We can disconnect the sources directly instead of disconnecting each of their outputs. * Implemented range check in `IONGSMSSignalSource::get_right_block(int)` * Moved ION GSMS file source to `gnuradio_blocks/` directory Also fixed some header guards. * Fixed ION GNSS Metadata Standard dependency version * Simplified by removing a very shallow class `ion_gnss_metadata_handler` was only reading the metadata file, which can easily be done in `ion_gsms_signal_source`. * Added valves to properly handle end of samples * Cleaner exit if the data file is not found * Fix uninitialized warning * Remove unused configuration parameter. Uniformize guard names * Fix for CMake < 3.14 * fix configuration options for the FPGA-based AD9361-based boards * Put the global function into an anonymous namespace Use emplace_back instead of push_back * Make private member metadata_ a std::shared_pointer * Simplify code * Remove ION source from CI * Apply clang-tidy fixes * Initialize the receiver local oscillator frequency to GPS_L5_FREQ_HZ by default in the ADRV9361Z7035 FPGA signal source and remove unnecessary include files. * Sort out building flags and improve their reporting * Allow building Ad936x_Custom_Signal_Source when gnuradio-iio is not available * Bump local version of Protocol Buffers to v28.0 * Update AArch64 features to Linux 6.10.6 * Update AArch64 features to Linux 6.10.6 * Fix: Windows does not define __ARM_NEON * Improve detection of the dma_proxy module and the spidev driver * Add missing include (fixes building with modern GCC) * Adapted udp_port to multiple ports * Fixed typo * Fixed clang format * Update changelog * Add Xavier Guerrero to the authors list * Update changelog * Bump local version of Protocol Buffers to 28.1 * Add install and uninstall targets to nav_msg_listener * Add Cesare to the authors list * Add OSNMA to changelog * Leave OSNMA files in the same folder for consistency * Fix conflict --------- Co-authored-by: Marc Majoral Co-authored-by: cesaaargm Co-authored-by: Xavier Guerrero-Pau Co-authored-by: Victor Castillo --- .gitignore | 1 + AUTHORS | 70 +++++++++--------- CITATION.cff | 10 +++ CMakeLists.txt | 71 ++++++++----------- docs/CHANGELOG.md | 13 ++++ src/algorithms/PVT/adapters/rtklib_pvt.cc | 2 +- .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 7 +- .../PVT/libs/monitor_pvt_udp_sink.cc | 13 ++-- .../PVT/libs/monitor_pvt_udp_sink.h | 5 +- src/algorithms/PVT/libs/pvt_conf.h | 2 +- .../include/cpu_features_macros.h | 9 +-- .../signal_source/libs/fpga_spidev.h | 1 + src/core/monitor/gnss_synchro_monitor.cc | 9 ++- src/core/monitor/gnss_synchro_monitor.h | 6 +- src/core/monitor/gnss_synchro_udp_sink.cc | 15 ++-- src/core/monitor/gnss_synchro_udp_sink.h | 2 +- src/core/receiver/gnss_flowgraph.cc | 30 ++++++-- src/core/system_parameters/Galileo_OSNMA.h | 8 +-- src/utils/nav-listener/CMakeLists.txt | 16 +++++ src/utils/nav-listener/README.md | 12 ++++ .../cmake/cmake_uninstall.cmake.in | 35 +++++++++ 21 files changed, 226 insertions(+), 111 deletions(-) create mode 100644 src/utils/nav-listener/cmake/cmake_uninstall.cmake.in diff --git a/.gitignore b/.gitignore index 4afd17279..1d7a03d59 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,7 @@ cmake-build-release/ .vscode/ .vs/ Testing/ + GSDR* PVT_* HAS_* diff --git a/AUTHORS b/AUTHORS index 7df41ed17..eda9cc06f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -33,40 +33,42 @@ Contact Information List of authors -------------------------------------------------------------------------------- -Carles Fernández-Prades carles.fernandez@cttc.cat Project manager -Javier Arribas javier.arribas@cttc.es Developer -Luis Esteve Elfau luis@epsilon-formacion.com Developer -Marc Majoral marc.majoral@cttc.cat Developer -Jordi Vilà-Valls jordi.vila-valls@isae-supaero.fr Consultant -Pau Closas pau.closas@northeastern.edu Consultant -Álvaro Cebrián Juan acebrianjuan@gmail.com Contributor -Andres Cecilia Luque a.cecilia.luque@gmail.com Contributor -Anthony Arnold anthony.arnold@uqconnect.edu.au Contributor -Antonio Ramos antonio.ramosdet@gmail.com Contributor -Carlos Avilés carlos.avilesr@googlemail.com Contributor -Cillian O'Driscoll cillian.odriscoll@gmail.com Contributor -Damian Miralles dmiralles2009@gmail.com Contributor -Daniel Fehr daniel.co@bluewin.ch Contributor -David Pubill david.pubill@cttc.cat Contributor -En Shin seanstone5923@gmail.com Contributor -Fran Fabra fabra@ice.csic.es Contributor -Gabriel Araujo gabriel.araujo.5000@gmail.com Contributor -Gerald LaMountain gerald@gece.neu.edu Contributor -Into Pääkkönen into.paakkonen@aalto.fi Contributor -Irene Pérez Riega iperrie@inta.es Contributor -Jim Melton jim.melton@sncorp.com Contributor -Josh Schindehette jschindehette@geontech.com Contributor -Leonardo Tonetto tonetto.dev@gmail.com Contributor -Malte Lenhart malte.lenhart@mailbox.org Contributor -Mara Branzanti mara.branzanti@gmail.com Contributor -Marc Molina marc.molina.pena@gmail.com Contributor -Marc Sales marcsales92@gmail.com Contributor -Piyush Gupta piyush04111999@gmail.com Contributor -Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor -Stefan van der Linden spvdlinden@gmail.com Contributor -Víctor Castillo-Agüero victorcastilloaguero@gmail.com Contributor -Will Silberman wsilberm@google.com Contributor -Carlos Paniego carpanie@hotmail.com Artwork +Carles Fernández-Prades carles.fernandez@cttc.cat Project manager +Javier Arribas javier.arribas@cttc.es Developer +Luis Esteve Elfau luis@epsilon-formacion.com Developer +Marc Majoral marc.majoral@cttc.cat Developer +Xavier Guerrero xavier.guerrero@cttc.es Developer +Jordi Vilà-Valls jordi.vila-valls@isae-supaero.fr Consultant +Pau Closas pau.closas@northeastern.edu Consultant +Álvaro Cebrián Juan acebrianjuan@gmail.com Contributor +Andres Cecilia Luque a.cecilia.luque@gmail.com Contributor +Anthony Arnold anthony.arnold@uqconnect.edu.au Contributor +Antonio Ramos antonio.ramosdet@gmail.com Contributor +Carlos Avilés carlos.avilesr@googlemail.com Contributor +Cesare Ghionoiu Martinez c.ghionoiu-martinez@tu-braunschweig.de Contributor +Cillian O'Driscoll cillian.odriscoll@gmail.com Contributor +Damian Miralles dmiralles2009@gmail.com Contributor +Daniel Fehr daniel.co@bluewin.ch Contributor +David Pubill david.pubill@cttc.cat Contributor +En Shin seanstone5923@gmail.com Contributor +Fran Fabra fabra@ice.csic.es Contributor +Gabriel Araujo gabriel.araujo.5000@gmail.com Contributor +Gerald LaMountain gerald@gece.neu.edu Contributor +Into Pääkkönen into.paakkonen@aalto.fi Contributor +Irene Pérez Riega iperrie@inta.es Contributor +Jim Melton jim.melton@sncorp.com Contributor +Josh Schindehette jschindehette@geontech.com Contributor +Leonardo Tonetto tonetto.dev@gmail.com Contributor +Malte Lenhart malte.lenhart@mailbox.org Contributor +Mara Branzanti mara.branzanti@gmail.com Contributor +Marc Molina marc.molina.pena@gmail.com Contributor +Marc Sales marcsales92@gmail.com Contributor +Piyush Gupta piyush04111999@gmail.com Contributor +Rodrigo Muñoz rodrigo.munoz@proteinlab.cl Contributor +Stefan van der Linden spvdlinden@gmail.com Contributor +Víctor Castillo-Agüero victorcastilloaguero@gmail.com Contributor +Will Silberman wsilberm@google.com Contributor +Carlos Paniego carpanie@hotmail.com Artwork # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades diff --git a/CITATION.cff b/CITATION.cff index 4bf27081f..337e4d42a 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -20,6 +20,11 @@ authors: family-names: Majoral given-names: Marc orcid: "https://orcid.org/0000-0001-6161-6747" + - affiliation: "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)" + alias: xguerreropau + email: xavier.guerrero@cttc.es + family-names: Guerrero + given-names: Xavier - alias: Gastd email: gabriel.araujo.5000@gmail.com family-names: Araujo @@ -56,6 +61,11 @@ authors: - email: daniel.co@bluewin.ch family-names: Fehr given-names: Daniel + - alias: cesaaargm + affiliation: "Technische Universität Braunschweig" + email: c.ghionoiu-martinez@tu-braunschweig.de + family-names: "Ghionoiu Martinez" + given-names: Cesare - alias: piyush0411 email: piyush04111999@gmail.com family-names: Gupta diff --git a/CMakeLists.txt b/CMakeLists.txt index 39132e9cf..adad30676 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,7 +360,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") @@ -3358,46 +3358,23 @@ if(ENABLE_MAX2771) if(DEFINED ENV{SDKTARGETSYSROOT}) set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) else() - set(TARGET_ROOTFS_PATH "") - endif() - find_program(STRINGS_EXECUTABLE strings) - if(NOT STRINGS_EXECUTABLE) - message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") - message(STATUS " You can try to install it by typing:") - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(STATUS " sudo yum install binutils") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(STATUS " sudo zypper install binutils") - else() - message(STATUS " sudo apt-get install binutils") - endif() - endif() - message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") - endif() - set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") - if(EXISTS "${DTB_FILE}") - message(STATUS "Found DTB file: ${DTB_FILE}") - # Run the strings command and grep for "spidev" - execute_process( - COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} - COMMAND grep "spidev" - OUTPUT_VARIABLE GREP_OUTPUT - RESULT_VARIABLE GREP_RESULT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(GREP_RESULT EQUAL 0) - message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") + string(REGEX MATCH "(.*/tmp-glibc)" MATCHED_PATH "${GNURADIO_RUNTIME_INCLUDE_DIRS}") + if(MATCHED_PATH) + set(TARGET_ROOTFS_PATH "${MATCHED_PATH}/sysroots-components") else() - message(STATUS "SPIdev driver not found, its installation is required.") - if(ENABLE_PACKAGING) - set(ENABLE_MAX2771 OFF) - else() - message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") - endif() + set(TARGET_ROOTFS_PATH "") endif() + endif() + file(GLOB_RECURSE SPIDEV_FILE "${TARGET_ROOTFS_PATH}/*/spidev.h") + if(EXISTS "${SPIDEV_FILE}") + message(STATUS "SPIdev driver found: ${SPIDEV_FILE}") else() - message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") + message(STATUS "SPIdev driver not found, its installation is required.") + if(ENABLE_PACKAGING) + set(ENABLE_MAX2771 OFF) + else() + message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") + endif() endif() endif() @@ -3412,9 +3389,14 @@ if(ENABLE_DMA_PROXY) if(DEFINED ENV{SDKTARGETSYSROOT}) set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) else() - set(TARGET_ROOTFS_PATH "") + string(REGEX MATCH "(.*/tmp-glibc)" MATCHED_PATH "${GNURADIO_RUNTIME_INCLUDE_DIRS}") + if(MATCHED_PATH) + set(TARGET_ROOTFS_PATH "${MATCHED_PATH}/sysroots-components") + else() + set(TARGET_ROOTFS_PATH "") + endif() endif() - set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + file(GLOB_RECURSE DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/*/dma-proxy.ko") if(EXISTS "${DMA_PROXY_FILE}") message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") else() @@ -3513,9 +3495,14 @@ if(ENABLE_DMA_PROXY) if(DEFINED ENV{SDKTARGETSYSROOT}) set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) else() - set(TARGET_ROOTFS_PATH "") + string(REGEX MATCH "(.*/tmp-glibc)" MATCHED_PATH "${GNURADIO_RUNTIME_INCLUDE_DIRS}") + if(MATCHED_PATH) + set(TARGET_ROOTFS_PATH "${MATCHED_PATH}/sysroots-components") + else() + set(TARGET_ROOTFS_PATH "") + endif() endif() - set(DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/lib/modules/5.10.0-xilinx-v2021.2/extra/dma-proxy.ko") + file(GLOB_RECURSE DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/*/dma-proxy.ko") if(EXISTS "${DMA_PROXY_FILE}") message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") else() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 327b26a8d..d18c58ffe 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -45,6 +45,8 @@ All notable changes to GNSS-SDR will be documented in this file. described with the [ION GNSS Software Defined Receiver Metadata Standard](https://sdr.ion.org/). It requires the `-DENABLE_ION=ON` building configuration option. +- The `Monitor` and `PVT` blocks are now able to send data to multiple UDP + ports. ### Improvements in Portability: @@ -89,9 +91,20 @@ All notable changes to GNSS-SDR will be documented in this file. Accordingly, the GNSS-SDR building system now looks for OpenSSL in the first place and, if not found, then it looks for GnuTLS as a fallback. +### Reliability + +- Implementation of the Galileo Open Service Navigation Message Authentication + (OSNMA), a data authentication function for the Galileo Open Service worldwide + users, freely accessible to all. OSNMA provides receivers with the assurance + that the received Galileo navigation message is coming from the system itself + and has not been modified. OSNMA is enabled by default if the receiver + configuration defines Galileo E1 OS channels. More details can be found in + [Introducing GNSS Navigation Message Authentication](https://gnss-sdr.org/osnma). + ### Improvements in Usability: - Tidy up the `conf/` folder. +- Add `install` and `uninstall` targets to the `nav_msg_listener` utility. See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index e964cf5a6..529c330f3 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -887,7 +887,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Read PVT MONITOR Configuration pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false); pvt_output_parameters.udp_addresses = configuration->property(role + ".monitor_client_addresses", std::string("127.0.0.1")); - pvt_output_parameters.udp_port = configuration->property(role + ".monitor_udp_port", 1234); + pvt_output_parameters.udp_ports = configuration->property(role + ".monitor_udp_port", std::string("1234")); pvt_output_parameters.protobuf_enabled = configuration->property(role + ".enable_protobuf", true); if (configuration->property("Monitor.enable_protobuf", false) == true) { diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 23fd9605d..33db19222 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -482,7 +482,12 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); - d_udp_sink_ptr = std::make_unique(udp_addr_vec, conf_.udp_port, conf_.protobuf_enabled); + std::string port_string = conf_.udp_ports; + std::vector udp_port_vec = split_string(port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + + d_udp_sink_ptr = std::make_unique(udp_addr_vec, udp_port_vec, conf_.protobuf_enabled); } else { diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc index 9caef6f4d..f9a60e0ac 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.cc @@ -17,19 +17,24 @@ #include "monitor_pvt_udp_sink.h" #include +#include #include #include -Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink(const std::vector& addresses, - const uint16_t& port, +Monitor_Pvt_Udp_Sink::Monitor_Pvt_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, bool protobuf_enabled) : socket{io_context}, use_protobuf(protobuf_enabled) { for (const auto& address : addresses) { - boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); - endpoints.push_back(endpoint); + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), boost::lexical_cast(port)); + endpoints.push_back(endpoint); + } } if (use_protobuf) diff --git a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h index 1fbe3219d..393e4e5e2 100644 --- a/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h +++ b/src/algorithms/PVT/libs/monitor_pvt_udp_sink.h @@ -40,7 +40,10 @@ 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); + Monitor_Pvt_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, + bool protobuf_enabled); bool write_monitor_pvt(const Monitor_Pvt* const monitor_pvt); private: diff --git a/src/algorithms/PVT/libs/pvt_conf.h b/src/algorithms/PVT/libs/pvt_conf.h index 19d0a2e8d..f014325ba 100644 --- a/src/algorithms/PVT/libs/pvt_conf.h +++ b/src/algorithms/PVT/libs/pvt_conf.h @@ -48,6 +48,7 @@ public: std::string rtcm_output_file_path = std::string("."); std::string has_output_file_path = std::string("."); std::string udp_addresses; + std::string udp_ports; std::string udp_eph_addresses; std::string log_source_timetag_file; @@ -64,7 +65,6 @@ public: int32_t rinexobs_rate_ms = 0; int32_t an_rate_ms = 20; int32_t max_obs_block_rx_clock_offset_ms = 40; - int udp_port = 0; int udp_eph_port = 0; int rtk_trace_level = 0; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index c800d0c32..b595a22f2 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -226,13 +226,14 @@ #endif // defined(CPU_FEATURES_ARCH_X86) -#if defined(CPU_FEATURES_ARCH_ANY_ARM) -#if defined(__ARM_NEON) +// Note: MSVC targeting ARM does not define `__ARM_NEON` but Windows on ARM +// requires it. In that case we force NEON detection. +#if defined(__ARM_NEON) || \ + (defined(CPU_FEATURES_COMPILER_MSC) && defined(CPU_FEATURES_ARCH_ANY_ARM)) #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 1 #else #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 0 -#endif // defined(__ARM_NEON) -#endif // defined(CPU_FEATURES_ARCH_ANY_ARM) +#endif #if defined(CPU_FEATURES_ARCH_MIPS) #if defined(__mips_msa) diff --git a/src/algorithms/signal_source/libs/fpga_spidev.h b/src/algorithms/signal_source/libs/fpga_spidev.h index 5fbe2f41c..ccef015d2 100644 --- a/src/algorithms/signal_source/libs/fpga_spidev.h +++ b/src/algorithms/signal_source/libs/fpga_spidev.h @@ -16,6 +16,7 @@ #ifndef GNSS_SDR_FPGA_SPIDEV_H #define GNSS_SDR_FPGA_SPIDEV_H +#include #include class Fpga_spidev diff --git a/src/core/monitor/gnss_synchro_monitor.cc b/src/core/monitor/gnss_synchro_monitor.cc index 98526fe60..f63811a73 100644 --- a/src/core/monitor/gnss_synchro_monitor.cc +++ b/src/core/monitor/gnss_synchro_monitor.cc @@ -26,21 +26,20 @@ gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf) { return gnss_synchro_monitor_sptr(new gnss_synchro_monitor(n_channels, decimation_factor, - udp_port, + udp_ports, udp_addresses, enable_protobuf)); } - gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf) : gr::block("gnss_synchro_monitor", @@ -50,7 +49,7 @@ gnss_synchro_monitor::gnss_synchro_monitor(int n_channels, d_nchannels(n_channels), d_decimation_factor(decimation_factor) { - udp_sink_ptr = std::make_unique(udp_addresses, udp_port, enable_protobuf); + udp_sink_ptr = std::make_unique(udp_addresses, udp_ports, enable_protobuf); } diff --git a/src/core/monitor/gnss_synchro_monitor.h b/src/core/monitor/gnss_synchro_monitor.h index 64749a001..4edd012e1 100644 --- a/src/core/monitor/gnss_synchro_monitor.h +++ b/src/core/monitor/gnss_synchro_monitor.h @@ -41,7 +41,7 @@ using gnss_synchro_monitor_sptr = gnss_shared_ptr; gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); @@ -61,13 +61,13 @@ public: private: friend gnss_synchro_monitor_sptr gnss_synchro_make_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); gnss_synchro_monitor(int n_channels, int decimation_factor, - int udp_port, + const std::vector& udp_ports, const std::vector& udp_addresses, bool enable_protobuf); diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index 336f834cb..45a6e441e 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -17,12 +17,14 @@ #include "gnss_synchro_udp_sink.h" #include +#include #include #include #include -Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector& addresses, - const uint16_t& port, +Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink( + const std::vector& addresses, + const std::vector& ports, bool enable_protobuf) : socket{io_context}, use_protobuf(enable_protobuf) @@ -33,8 +35,13 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink(const std::vector& add } for (const auto& address : addresses) { - boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); - endpoints.push_back(endpoint); + for (const auto& port : ports) + { + boost::asio::ip::udp::endpoint endpoint( + boost::asio::ip::address::from_string(address, error), + boost::lexical_cast(port)); + endpoints.push_back(endpoint); + } } } diff --git a/src/core/monitor/gnss_synchro_udp_sink.h b/src/core/monitor/gnss_synchro_udp_sink.h index cf777cc12..699a6043f 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.h +++ b/src/core/monitor/gnss_synchro_udp_sink.h @@ -45,7 +45,7 @@ using b_io_context = boost::asio::io_service; class Gnss_Synchro_Udp_Sink { public: - Gnss_Synchro_Udp_Sink(const std::vector& addresses, const uint16_t& port, bool enable_protobuf); + Gnss_Synchro_Udp_Sink(const std::vector& addresses, const std::vector& ports, bool enable_protobuf); bool write_gnss_synchro(const std::vector& stocks); private: diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 593c9912c..785672670 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -237,11 +237,17 @@ void GNSSFlowgraph::init() std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); + std::string udp_port_string = configuration_->property("Monitor.udp_port", std::string("1234")); + std::vector udp_port_vec = split_string(udp_port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + // Instantiate monitor object GnssSynchroMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("Monitor.decimation_factor", 1), - configuration_->property("Monitor.udp_port", 1234), - udp_addr_vec, enable_protobuf); + udp_port_vec, + udp_addr_vec, + enable_protobuf); } /* @@ -261,10 +267,16 @@ void GNSSFlowgraph::init() std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); + std::string udp_port_string = configuration_->property("AcquisitionMonitor.udp_port", std::string("1235")); + std::vector udp_port_vec = split_string(udp_port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + GnssSynchroAcquisitionMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("AcquisitionMonitor.decimation_factor", 1), - configuration_->property("AcquisitionMonitor.udp_port", 1235), - udp_addr_vec, enable_protobuf); + udp_port_vec, + udp_addr_vec, + enable_protobuf); } /* @@ -284,10 +296,16 @@ void GNSSFlowgraph::init() std::sort(udp_addr_vec.begin(), udp_addr_vec.end()); udp_addr_vec.erase(std::unique(udp_addr_vec.begin(), udp_addr_vec.end()), udp_addr_vec.end()); + std::string udp_port_string = configuration_->property("TrackingMonitor.udp_port", std::string("1236")); + std::vector udp_port_vec = split_string(udp_port_string, '_'); + std::sort(udp_port_vec.begin(), udp_port_vec.end()); + udp_port_vec.erase(std::unique(udp_port_vec.begin(), udp_port_vec.end()), udp_port_vec.end()); + GnssSynchroTrackingMonitor_ = gnss_synchro_make_monitor(channels_count_, configuration_->property("TrackingMonitor.decimation_factor", 1), - configuration_->property("TrackingMonitor.udp_port", 1236), - udp_addr_vec, enable_protobuf); + udp_port_vec, + udp_addr_vec, + enable_protobuf); } /* diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 68c374a8b..b394781cd 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -158,10 +158,10 @@ const std::unordered_map OSNMA_TABLE_15 = { {std::string("ECDSA P-256"), 512}, {std::string("ECDSA P-521"), 1056}}; // key: ECDSA Curve and hash function, value: {l_ds_bits} -const std::string PEMFILE_DEFAULT("./data/OSNMA_PublicKey.pem"); -const std::string CRTFILE_DEFAULT("./data/OSNMA_PublicKey_20240115100000_newPKID_1.crt"); -const std::string MERKLEFILE_DEFAULT("./data/OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); -const std::string KROOTFILE_DEFAULT("./data/OSNMA_DSM_KROOT_NMAHeader.bin"); +const std::string PEMFILE_DEFAULT("./OSNMA_PublicKey.pem"); +const std::string CRTFILE_DEFAULT("./OSNMA_PublicKey_20240115100000_newPKID_1.crt"); +const std::string MERKLEFILE_DEFAULT("./OSNMA_MerkleTree_20240115100000_newPKID_1.xml"); +const std::string KROOTFILE_DEFAULT("./OSNMA_DSM_KROOT_NMAHeader.bin"); class Mack_lookup { diff --git a/src/utils/nav-listener/CMakeLists.txt b/src/utils/nav-listener/CMakeLists.txt index cc86a7bf4..ea9c5d36e 100644 --- a/src/utils/nav-listener/CMakeLists.txt +++ b/src/utils/nav-listener/CMakeLists.txt @@ -39,3 +39,19 @@ target_include_directories(navmsg_lib add_executable(nav_msg_listener ${NAVLISTENER_SOURCE_DIR}/main.cc) target_link_libraries(nav_msg_listener PUBLIC navmsg_lib) + +install(TARGETS nav_msg_listener + RUNTIME DESTINATION bin + COMPONENT "nav_msg_listener" +) + +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY + ) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake + ) +endif() diff --git a/src/utils/nav-listener/README.md b/src/utils/nav-listener/README.md index 76b2aedaf..4bd90658e 100644 --- a/src/utils/nav-listener/README.md +++ b/src/utils/nav-listener/README.md @@ -27,6 +27,18 @@ $ cmake .. $ make ``` +Optionally, you can install it: + +``` +$ sudo make install +``` + +and uninstall it later with: + +``` +$ sudo make uninstall +``` + ## Usage In order to tell GNSS-SDR to generate those messages, you need to include the diff --git a/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in b/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..fc57491c4 --- /dev/null +++ b/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in @@ -0,0 +1,35 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +endif() + +file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + if(CMAKE_VERSION VERSION_LESS 3.17) + execute_process( + COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval + ) + else() + execute_process( + COMMAND @CMAKE_COMMAND@ -E rm "$ENV{DESTDIR}${file}" + OUTPUT_VARIABLE rm_out + RESULT_VARIABLE rm_retval + ) + endif() + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif() + else() + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif() +endforeach() From 311b0ea6f2b6fd49a57c31bef4d87f9727bed0e1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Sep 2024 13:12:48 +0200 Subject: [PATCH 397/499] Improve ISM handling and add PRN applicability check --- .../system_parameters/galileo_inav_message.cc | 14 ++- .../system_parameters/galileo_inav_message.h | 10 +- src/core/system_parameters/galileo_ism.cc | 100 +++++++++++------- src/core/system_parameters/galileo_ism.h | 42 ++++---- 4 files changed, 104 insertions(+), 62 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index b33737de9..712dead0f 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -44,7 +44,7 @@ Galileo_Inav_Message::Galileo_Inav_Message() } -// here the compiler knows how to destrcut rs +// here the compiler knows how to destroy rs Galileo_Inav_Message::~Galileo_Inav_Message() = default; @@ -388,6 +388,17 @@ bool Galileo_Inav_Message::have_new_reduced_ced() } +bool Galileo_Inav_Message::have_new_ism() +{ + if (have_ISM) + { + have_ISM = false; + return true; + } + return false; +} + + Galileo_Ephemeris Galileo_Inav_Message::get_ephemeris() const { Galileo_Ephemeris ephemeris; @@ -1359,6 +1370,7 @@ int32_t Galileo_Inav_Message::page_jk_decoder(const char* data_jk) << "Tvalidity=" << static_cast(gal_ism.get_Tvalidity_hours()) << " [h]"; } } + have_ISM = true; } break; diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 3acacecdd..8b35f1a6d 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -90,6 +90,11 @@ public: */ bool have_new_reduced_ced(); + /* + * \brief Returns true if new ISM data have arrived. The flag is set to false when the function is executed + */ + bool have_new_ism(); + /* * \brief Returns a Galileo_Ephemeris object filled with the latest navigation data received */ @@ -115,6 +120,9 @@ public: */ Galileo_Ephemeris get_reduced_ced() const; + /* + * \brief Returns a Galileo_ISM object filled with the latest ISM data received + */ Galileo_ISM get_galileo_ism() const; inline bool get_flag_CRC_test() const @@ -403,7 +411,6 @@ private: uint8_t IODnav_LSB19{}; uint8_t IODnav_LSB20{}; - uint32_t ism_crc{}; uint8_t ism_constellation_id{}; uint8_t ism_service_level_id{}; @@ -434,6 +441,7 @@ private: bool flag_CED{}; bool enable_rs{}; + bool have_ISM{}; }; diff --git a/src/core/system_parameters/galileo_ism.cc b/src/core/system_parameters/galileo_ism.cc index 1c8097e64..2cad8b410 100644 --- a/src/core/system_parameters/galileo_ism.cc +++ b/src/core/system_parameters/galileo_ism.cc @@ -19,98 +19,92 @@ void Galileo_ISM::set_ism_constellation_id(uint8_t const_id) { - this->ism_constellation_id = const_id; + this->d_ism_constellation_id = const_id; } void Galileo_ISM::set_ism_service_level_id(uint8_t sl_id) { - this->ism_service_level_id = sl_id; + this->d_ism_service_level_id = sl_id; } void Galileo_ISM::set_ism_wn(uint16_t wn_ism) { - this->ism_wn = wn_ism; + this->d_ism_wn = wn_ism; } void Galileo_ISM::set_ism_t0(uint16_t t0) { - this->ism_t0 = t0; + this->d_ism_t0 = t0; } void Galileo_ISM::set_ism_mask_msb(bool mask_msb) { - this->ism_mask_msb = mask_msb; + this->d_ism_mask_msb = mask_msb; } void Galileo_ISM::set_ism_mask(uint32_t mask) { - this->ism_mask = mask; + this->d_ism_mask = mask; } void Galileo_ISM::set_ism_pconst(uint8_t pconst) { - this->ism_pconst = pconst; + this->d_ism_pconst = pconst; } void Galileo_ISM::set_ism_psat(uint8_t psat) { - this->ism_psat = psat; + this->d_ism_psat = psat; } void Galileo_ISM::set_ism_ura(uint8_t ura) { - this->ism_ura = ura; + this->d_ism_ura = ura; } void Galileo_ISM::set_ism_ure(uint8_t ure) { - this->ism_ure = ure; + this->d_ism_ure = ure; } void Galileo_ISM::set_ism_bnom(uint8_t bnom) { - this->ism_bnom = bnom; + this->d_ism_bnom = bnom; } void Galileo_ISM::set_ism_Tvalidity(uint8_t tvalidity) { - this->ism_Tvalidity = tvalidity; -} - - -void Galileo_ISM::set_ism_crc(uint32_t crc) -{ - this->ism_crc = crc; + this->d_ism_Tvalidity = tvalidity; } uint16_t Galileo_ISM::get_WN_ISM() const { - return this->ism_wn; + return this->d_ism_wn; } uint16_t Galileo_ISM::get_t0_ISM() const { - return (this->ism_t0 * 1800); + return (this->d_ism_t0 * 1800); } double Galileo_ISM::get_pconst_value() const { - auto it = ISM_PCONST_MAP.find(this->ism_pconst); - if (it == ISM_PCONST_MAP.end()) + auto it = d_ISM_PCONST_MAP.find(this->d_ism_pconst); + if (it == d_ISM_PCONST_MAP.end()) { return 0.0; } @@ -120,8 +114,8 @@ double Galileo_ISM::get_pconst_value() const double Galileo_ISM::get_psat_value() const { - auto it = ISM_PSAT_MAP.find(this->ism_psat); - if (it == ISM_PSAT_MAP.end()) + auto it = d_ISM_PSAT_MAP.find(this->d_ism_psat); + if (it == d_ISM_PSAT_MAP.end()) { return 0.0; } @@ -131,14 +125,14 @@ double Galileo_ISM::get_psat_value() const bool Galileo_ISM::get_ism_mask_msb() const { - return ism_mask_msb; + return d_ism_mask_msb; } float Galileo_ISM::get_ura_m() const { - auto it = ISM_URA_MAP.find(this->ism_ura); - if (it == ISM_URA_MAP.end()) + auto it = d_ISM_URA_MAP.find(this->d_ism_ura); + if (it == d_ISM_URA_MAP.end()) { return 0.0; } @@ -148,8 +142,8 @@ float Galileo_ISM::get_ura_m() const float Galileo_ISM::get_ure_m() const { - auto it = ISM_URE_MAP.find(this->ism_ure); - if (it == ISM_URE_MAP.end()) + auto it = d_ISM_URE_MAP.find(this->d_ism_ure); + if (it == d_ISM_URE_MAP.end()) { return 0.0; } @@ -159,14 +153,14 @@ float Galileo_ISM::get_ure_m() const uint32_t Galileo_ISM::get_mask_ISM() const { - return ism_mask; + return d_ism_mask; } float Galileo_ISM::get_bnom_m() const { - auto it = ISM_BNOM_MAP.find(this->ism_bnom); - if (it == ISM_BNOM_MAP.end()) + auto it = d_ISM_BNOM_MAP.find(this->d_ism_bnom); + if (it == d_ISM_BNOM_MAP.end()) { return 5.0; // } @@ -176,8 +170,8 @@ float Galileo_ISM::get_bnom_m() const uint16_t Galileo_ISM::get_Tvalidity_hours() const { - auto it = ISM_TVALIDITY_MAP.find(this->ism_Tvalidity); - if (it == ISM_TVALIDITY_MAP.end()) + auto it = d_ISM_TVALIDITY_MAP.find(this->d_ism_Tvalidity); + if (it == d_ISM_TVALIDITY_MAP.end()) { return 0.0; } @@ -197,7 +191,7 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) { crc_bits[i] = bits[i]; } - ism_crc = crc_bits.to_ulong(); + this->d_ism_crc = crc_bits.to_ulong(); std::vector data_bytes((data_bits.size() + 7) / 8); for (size_t i = 0; i < data_bits.size(); i += 8) @@ -213,7 +207,7 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) std::reverse(data_bytes.begin(), data_bytes.end()); const uint32_t crc_computed = this->compute_crc(data_bytes); - if (this->ism_crc == crc_computed) + if (this->d_ism_crc == crc_computed) { return true; } @@ -224,8 +218,36 @@ bool Galileo_ISM::check_ism_crc(const std::bitset& bits) uint32_t Galileo_ISM::compute_crc(const std::vector& data) { - crc32_ism.process_bytes(data.data(), data.size()); - const uint32_t crc = crc32_ism.checksum(); - crc32_ism.reset(); + d_crc32_ism.process_bytes(data.data(), data.size()); + const uint32_t crc = d_crc32_ism.checksum(); + d_crc32_ism.reset(); return crc; } + + +bool Galileo_ISM::ism_parameters_apply(uint32_t prn) const +{ + // ICD 2.1 Table 96 + if (prn == 0 || prn > 63 || d_ism_service_level_id != 2 || d_ism_constellation_id != 1) + { + return false; + } + std::bitset<32> b(d_ism_mask); + if (d_ism_mask_msb == false) + { + // For numbering in the ICD, the most significant bit/byte is numbered as bit/byte 0 + if (prn > 32) + { + return false; + } + return b.test(32 - prn); + } + else + { + if (prn <= 32) + { + return false; + } + return b.test(64 - prn); + } +} diff --git a/src/core/system_parameters/galileo_ism.h b/src/core/system_parameters/galileo_ism.h index dab782e27..359754176 100644 --- a/src/core/system_parameters/galileo_ism.h +++ b/src/core/system_parameters/galileo_ism.h @@ -57,7 +57,6 @@ public: void set_ism_ure(uint8_t ure); void set_ism_bnom(uint8_t bnom); void set_ism_Tvalidity(uint8_t tvalidity); - void set_ism_crc(uint32_t crc); bool check_ism_crc(const std::bitset& bits); @@ -71,13 +70,14 @@ public: uint16_t get_t0_ISM() const; uint16_t get_Tvalidity_hours() const; bool get_ism_mask_msb() const; + bool ism_parameters_apply(uint32_t prn) const; private: uint32_t compute_crc(const std::vector& data); - boost::crc_optimal<32, 0x814141AB, 0, 0, false, false> crc32_ism; + boost::crc_optimal<32, 0x814141AB, 0, 0, false, false> d_crc32_ism; // ICD 2.1 Table 97 - std::unordered_map ISM_PCONST_MAP = { + std::unordered_map d_ISM_PCONST_MAP = { {0, 1.0e-8}, {1, 1.0e-7}, {2, 1.0e-6}, @@ -96,7 +96,7 @@ private: {15, 2.0e-4}}; // ICD 2.1 Table 98 - std::unordered_map ISM_PSAT_MAP = { + std::unordered_map d_ISM_PSAT_MAP = { {0, 1.0e-7}, {1, 3.0e-7}, {2, 6.0e-7}, @@ -115,7 +115,7 @@ private: {15, 3.0e-5}}; // ICD 2.1 Table 99 - std::unordered_map ISM_URA_MAP = { + std::unordered_map d_ISM_URA_MAP = { {0, 0.75}, {1, 1.0}, {2, 1.5}, @@ -134,7 +134,7 @@ private: {15, 6.0}}; // ICD 2.1 Table 100 - std::unordered_map ISM_URE_MAP = { + std::unordered_map d_ISM_URE_MAP = { {0, 0.25}, {1, 0.50}, {2, 0.75}, @@ -153,7 +153,7 @@ private: {15, 4.00}}; // ICD 2.1 Table 101 - std::unordered_map ISM_BNOM_MAP = { + std::unordered_map d_ISM_BNOM_MAP = { {0, 0.0}, {1, 0.10}, {2, 0.20}, @@ -172,7 +172,7 @@ private: {15, 2.4}}; // ICD 2.1 Table 102 - std::unordered_map ISM_TVALIDITY_MAP = { + std::unordered_map d_ISM_TVALIDITY_MAP = { {0, 1}, {1, 2}, {2, 3}, @@ -190,19 +190,19 @@ private: {14, 720}, {15, 1440}}; - uint32_t ism_crc{}; - uint32_t ism_mask{}; - uint16_t ism_wn{}; - uint16_t ism_t0{}; - uint8_t ism_constellation_id{}; - uint8_t ism_service_level_id{}; - uint8_t ism_pconst{}; - uint8_t ism_psat{}; - uint8_t ism_ura{}; - uint8_t ism_ure{}; - uint8_t ism_bnom{}; - uint8_t ism_Tvalidity{}; - bool ism_mask_msb{}; + uint32_t d_ism_crc{}; + uint32_t d_ism_mask{}; + uint16_t d_ism_wn{}; + uint16_t d_ism_t0{}; + uint8_t d_ism_constellation_id{}; + uint8_t d_ism_service_level_id{}; + uint8_t d_ism_pconst{}; + uint8_t d_ism_psat{}; + uint8_t d_ism_ura{}; + uint8_t d_ism_ure{}; + uint8_t d_ism_bnom{}; + uint8_t d_ism_Tvalidity{}; + bool d_ism_mask_msb{}; }; /** \} */ From 84b86107a79a3d75be9fb18f38a419e85baf2d23 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Sep 2024 13:26:27 +0200 Subject: [PATCH 398/499] Improve GalileoISMTest --- src/tests/unit-tests/system-parameters/galileo_ism_test.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc index 4c5fa941d..131022720 100644 --- a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc +++ b/src/tests/unit-tests/system-parameters/galileo_ism_test.cc @@ -26,11 +26,10 @@ TEST(GalileoISMTest, CRC) bool result = gal_ism.check_ism_crc(input); EXPECT_TRUE(result); // Check if it can be used twice - std::bitset<128> input2 = input; - bool result2 = gal_ism.check_ism_crc(input2); + bool result2 = gal_ism.check_ism_crc(input); EXPECT_TRUE(result2); // Check if it fails - input2.set(127); - bool result3 = gal_ism.check_ism_crc(input2); + input.set(127); + bool result3 = gal_ism.check_ism_crc(input); EXPECT_TRUE(!result3); } \ No newline at end of file From 2e1a96a7c4e5b738d42cbd469a3f8c7bbfadbe3a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 Sep 2024 18:29:21 +0200 Subject: [PATCH 399/499] Fix merge conflict --- CMakeLists.txt | 106 ------------------------------------------------- 1 file changed, 106 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adad30676..e5c406f96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3410,112 +3410,6 @@ endif() -##################################################################### -# Check signal sources related to FPGA only. -##################################################################### -if(ENABLE_MAX2771 AND NOT ENABLE_FPGA) - message(STATUS "The SPIdev driver is enabled, but the FPGA is not enabled. The FPGA is required when using the SPIdev driver.") - if(ENABLE_PACKAGING) - set(ENABLE_MAX2771 OFF) - else() - message(FATAL_ERROR "ENABLE_MAX2771 can only be set when ENABLE_FPGA is also set.") - endif() -endif() -if(ENABLE_DMA_PROXY AND NOT ENABLE_FPGA) - message(STATUS "The DMA Proxy driver is enabled, but the FPGA is not enabled. The FPGA is required when using the DMA Proxy driver.") - if(ENABLE_PACKAGING) - set(ENABLE_DMA_PROXY OFF) - else() - message(FATAL_ERROR "ENABLE_DMA_PROXY can only be set when ENABLE_FPGA is also set.") - endif() -endif() - - - -##################################################################### -# spidev driver - OPTIONAL -# Linux kernel driver that provides user-space access to Serial -# Peripheral Interface) -##################################################################### -if(ENABLE_MAX2771) - if(DEFINED ENV{SDKTARGETSYSROOT}) - set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) - else() - set(TARGET_ROOTFS_PATH "") - endif() - find_program(STRINGS_EXECUTABLE strings) - if(NOT STRINGS_EXECUTABLE) - message(STATUS "The 'strings' command could not be found. See https://www.gnu.org/software/binutils/") - message(STATUS " You can try to install it by typing:") - if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|kFreeBSD|GNU") - if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") - message(STATUS " sudo yum install binutils") - elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") - message(STATUS " sudo zypper install binutils") - else() - message(STATUS " sudo apt-get install binutils") - endif() - endif() - message(FATAL_ERROR "Binutils are required to build GNSS-SDR for SoC FPGA devices using the MAX2771 option.") - endif() - set(DTB_FILE "${TARGET_ROOTFS_PATH}/boot/devicetree/system-top.dtb") - if(EXISTS "${DTB_FILE}") - message(STATUS "Found DTB file: ${DTB_FILE}") - # Run the strings command and grep for "spidev" - execute_process( - COMMAND ${STRINGS_EXECUTABLE} ${DTB_FILE} - COMMAND grep "spidev" - OUTPUT_VARIABLE GREP_OUTPUT - RESULT_VARIABLE GREP_RESULT - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(GREP_RESULT EQUAL 0) - message(STATUS "Found spidev-compatible peripheral in ${DTB_FILE}.") - else() - message(STATUS "SPIdev driver not found, its installation is required.") - if(ENABLE_PACKAGING) - set(ENABLE_MAX2771 OFF) - else() - message(FATAL_ERROR "SPIdev driver is required for building gnss-sdr with -DENABLE_MAX2271=ON.") - endif() - endif() - else() - message(FATAL_ERROR "The device tree (DTB) file ${DTB_FILE} cannot be found.") - endif() -endif() - - - -##################################################################### -# DMA Proxy driver - OPTIONAL -# Simplified and efficient interface for user-space applications -# to leverage DMA capabilities for Xilinx FPGA and SoC systems -##################################################################### -if(ENABLE_DMA_PROXY) - if(DEFINED ENV{SDKTARGETSYSROOT}) - set(TARGET_ROOTFS_PATH $ENV{SDKTARGETSYSROOT}) - else() - string(REGEX MATCH "(.*/tmp-glibc)" MATCHED_PATH "${GNURADIO_RUNTIME_INCLUDE_DIRS}") - if(MATCHED_PATH) - set(TARGET_ROOTFS_PATH "${MATCHED_PATH}/sysroots-components") - else() - set(TARGET_ROOTFS_PATH "") - endif() - endif() - file(GLOB_RECURSE DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/*/dma-proxy.ko") - if(EXISTS "${DMA_PROXY_FILE}") - message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") - else() - if(ENABLE_PACKAGING) - set(ENABLE_DMA_PROXY OFF) - else() - message(FATAL_ERROR "DMA Proxy driver is required for building gnss-sdr with -DENABLE_DMA_PROXY=ON.") - endif() - endif() -endif() - - - ############################################## # TELEORBIT FLEXIBAND FRONTEND - OPTIONAL ############################################## From d0a6264754a2f7c98fa16bc44321e0b8c62d44db Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 Sep 2024 20:08:02 +0200 Subject: [PATCH 400/499] Make clang-tidy CI job happy --- .../gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc | 4 ++-- src/core/system_parameters/galileo_has_data.cc | 2 +- src/tests/unit-tests/arithmetic/matio_test.cc | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc index 303adbf2b..e88b9cb2c 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc @@ -202,8 +202,8 @@ bool sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::get_bits(const st const int32_t nbits_requested = symbols.size() / D_SYMBOLS_PER_BIT; int32_t nbits_decoded; // fill two vectors with the two possible symbol alignments - std::vector symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector - std::vector symbols_vd2; // shifted symbol vector -> add past sample in front of input vector + const std::vector symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector + std::vector symbols_vd2; // shifted symbol vector -> add past sample in front of input vector symbols_vd2.push_back(d_past_symbol); for (auto symbol_it = symbols.cbegin(); symbol_it != symbols.cend() - 1; ++symbol_it) { diff --git a/src/core/system_parameters/galileo_has_data.cc b/src/core/system_parameters/galileo_has_data.cc index cf52b9a99..0cdc3456b 100644 --- a/src/core/system_parameters/galileo_has_data.cc +++ b/src/core/system_parameters/galileo_has_data.cc @@ -392,7 +392,7 @@ std::vector Galileo_HAS_data::get_delta_clock_subset_correction_m(uint8_t } auto subset_corr_matrix = this->get_delta_clock_subset_correction_m(); - std::vector delta_clock_subset_correction_m_v = subset_corr_matrix[nsys_sub_index]; + const std::vector delta_clock_subset_correction_m_v = subset_corr_matrix[nsys_sub_index]; std::vector delta_clock_subset_correction_m_aux; std::vector num_satellites_subset = this->get_num_subset_satellites(); uint8_t num_sats_in_this_system_subset = num_satellites_subset[nsys_sub_index]; diff --git a/src/tests/unit-tests/arithmetic/matio_test.cc b/src/tests/unit-tests/arithmetic/matio_test.cc index 1b1bb3a22..4ff9290dd 100644 --- a/src/tests/unit-tests/arithmetic/matio_test.cc +++ b/src/tests/unit-tests/arithmetic/matio_test.cc @@ -131,6 +131,7 @@ TEST(MatioTest, WriteAndReadGrComplex) auto *x_read_real = reinterpret_cast(x_read_st->Re); auto *x_read_imag = reinterpret_cast(x_read_st->Im); std::vector x_v_read; + x_v_read.reserve(size); for (unsigned int k = 0; k < size; k++) { x_v_read.emplace_back(x_read_real[k], x_read_imag[k]); From f81bd57961d1b81474678d52b2dd4946765264bd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 Sep 2024 20:22:37 +0200 Subject: [PATCH 401/499] Update changelog --- docs/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d18c58ffe..2a4db385b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -47,6 +47,9 @@ All notable changes to GNSS-SDR will be documented in this file. It requires the `-DENABLE_ION=ON` building configuration option. - The `Monitor` and `PVT` blocks are now able to send data to multiple UDP ports. +- Add experimental decoding of Galileo's I/NAV ARAIM Integrity Support Message + (ISM) as defined in the OS SIS ICD v2.1. Values, if received, are only logged + but not used. ### Improvements in Portability: From 12a095920f497ed427addc7b68deef69b77ec1ed Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 Sep 2024 20:34:26 +0200 Subject: [PATCH 402/499] Fix merge conflict --- src/core/system_parameters/galileo_inav_message.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 47c31aba9..94a994805 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -97,15 +97,14 @@ public: bool have_new_reduced_ced(); /* -<<<<<<< HEAD * \brief Returns true if new ISM data have arrived. The flag is set to false when the function is executed */ bool have_new_ism(); -======= + + /* * \brief Returns true if new NMA data have arrived. The flag is set to false when the function is executed */ bool have_new_nma(); ->>>>>>> d0a6264754a2f7c98fa16bc44321e0b8c62d44db /* * \brief Returns a Galileo_Ephemeris object filled with the latest navigation data received From f91f37261d67ef19131216f7e3555dfa4acaca71 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 Sep 2024 20:49:44 +0200 Subject: [PATCH 403/499] Fix merging conflict --- src/core/system_parameters/galileo_inav_message.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/system_parameters/galileo_inav_message.h b/src/core/system_parameters/galileo_inav_message.h index 94a994805..f60c884d5 100644 --- a/src/core/system_parameters/galileo_inav_message.h +++ b/src/core/system_parameters/galileo_inav_message.h @@ -131,6 +131,11 @@ public: */ Galileo_Ephemeris get_reduced_ced() const; + /* + * \brief Returns a Galileo_ISMs object filled with the latest ISM data received + */ + Galileo_ISM get_galileo_ism() const; + /* * \brief Returns an OSNMA_msg object filled with the latest NMA message received. Resets msg buffer. */ From d74bceee6e4d4a8c3729acb41d15c174dd944570 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 25 Sep 2024 21:17:45 +0200 Subject: [PATCH 404/499] Make clang-tidy job happy --- .../gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc | 4 ++-- src/core/system_parameters/galileo_has_data.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc index e88b9cb2c..3da46865f 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/sbas_l1_telemetry_decoder_gs.cc @@ -202,8 +202,8 @@ bool sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::get_bits(const st const int32_t nbits_requested = symbols.size() / D_SYMBOLS_PER_BIT; int32_t nbits_decoded; // fill two vectors with the two possible symbol alignments - const std::vector symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector - std::vector symbols_vd2; // shifted symbol vector -> add past sample in front of input vector + const std::vector &symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector + std::vector symbols_vd2; // shifted symbol vector -> add past sample in front of input vector symbols_vd2.push_back(d_past_symbol); for (auto symbol_it = symbols.cbegin(); symbol_it != symbols.cend() - 1; ++symbol_it) { diff --git a/src/core/system_parameters/galileo_has_data.cc b/src/core/system_parameters/galileo_has_data.cc index 0cdc3456b..566f59757 100644 --- a/src/core/system_parameters/galileo_has_data.cc +++ b/src/core/system_parameters/galileo_has_data.cc @@ -392,7 +392,7 @@ std::vector Galileo_HAS_data::get_delta_clock_subset_correction_m(uint8_t } auto subset_corr_matrix = this->get_delta_clock_subset_correction_m(); - const std::vector delta_clock_subset_correction_m_v = subset_corr_matrix[nsys_sub_index]; + const std::vector& delta_clock_subset_correction_m_v = subset_corr_matrix[nsys_sub_index]; std::vector delta_clock_subset_correction_m_aux; std::vector num_satellites_subset = this->get_num_subset_satellites(); uint8_t num_sats_in_this_system_subset = num_satellites_subset[nsys_sub_index]; From cdcbc4d03d0a481e0f982aa2668d2c4de0a4640b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 26 Sep 2024 07:32:56 +0200 Subject: [PATCH 405/499] Bump local version of Protocol Buffers to 28.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5c406f96..c986cfc12 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,7 +360,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.1") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.2") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") From 98ee81f3acbba5f073c5babc507d3a7d4f9ca7ac Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 30 Sep 2024 15:34:50 +0200 Subject: [PATCH 406/499] Add Cshort_To_Gr_Complex Data Type Adapter implementation --- docs/CHANGELOG.md | 3 + .../data_type_adapter/adapters/CMakeLists.txt | 2 + .../adapters/cshort_to_grcomplex.cc | 92 +++++++++++++++++++ .../adapters/cshort_to_grcomplex.h | 83 +++++++++++++++++ .../gnuradio_blocks/CMakeLists.txt | 3 + .../gnuradio_blocks/cshort_to_gr_complex.cc | 50 ++++++++++ .../gnuradio_blocks/cshort_to_gr_complex.h | 55 +++++++++++ src/core/receiver/gnss_block_factory.cc | 7 ++ 8 files changed, 295 insertions(+) create mode 100644 src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc create mode 100644 src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h create mode 100644 src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.cc create mode 100644 src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.h diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 2a4db385b..290c0e976 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -50,6 +50,9 @@ All notable changes to GNSS-SDR will be documented in this file. - Add experimental decoding of Galileo's I/NAV ARAIM Integrity Support Message (ISM) as defined in the OS SIS ICD v2.1. Values, if received, are only logged but not used. +- Added new + [`Cshort_To_Gr_Complex`](https://gnss-sdr.org/docs/sp-blocks/data-type-adapter/#implementation-cshort_to_gr_complex) + Data Type Adapter implementation. ### Improvements in Portability: diff --git a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt index 253624190..9b5935e5b 100644 --- a/src/algorithms/data_type_adapter/adapters/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/adapters/CMakeLists.txt @@ -7,6 +7,7 @@ set(DATATYPE_ADAPTER_SOURCES byte_to_short.cc + cshort_to_grcomplex.cc ibyte_to_cbyte.cc ibyte_to_complex.cc ibyte_to_cshort.cc @@ -16,6 +17,7 @@ set(DATATYPE_ADAPTER_SOURCES set(DATATYPE_ADAPTER_HEADERS byte_to_short.h + cshort_to_grcomplex.h ibyte_to_cbyte.h ibyte_to_complex.h ibyte_to_cshort.h diff --git a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc new file mode 100644 index 000000000..7eb94a519 --- /dev/null +++ b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc @@ -0,0 +1,92 @@ +/*! + * \file cshort_to_grcomplex.cc + * \brief Adapts an 16-bits complex sample stream to a float complex stream + * \author Carles Fernandez Prades, 2014 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#include "cshort_to_grcomplex.h" +#include "configuration_interface.h" +#include +#if USE_GLOG_AND_GFLAGS +#include +#else +#include +#endif + + +CshortToGrComplex::CshortToGrComplex(const ConfigurationInterface* configuration, + std::string role, + unsigned int in_streams, + unsigned int out_streams) : role_(std::move(role)), + in_streams_(in_streams), + out_streams_(out_streams), + dump_(configuration->property(role_ + ".dump", false)) +{ + const std::string default_dump_filename("../data/data_type_adapter.dat"); + + DLOG(INFO) << "role " << role_; + + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + cshort_to_gr_complex_ = make_cshort_to_gr_complex(); + + DLOG(INFO) << "data_type_adapter_(" << cshort_to_gr_complex_->unique_id() << ")"; + + if (dump_) + { + DLOG(INFO) << "Dumping output into file " << dump_filename_; + const size_t item_size = sizeof(gr_complex); + file_sink_ = gr::blocks::file_sink::make(item_size, dump_filename_.c_str()); + } + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one output stream"; + } +} + + +void CshortToGrComplex::connect(gr::top_block_sptr top_block) +{ + if (dump_) + { + top_block->connect(cshort_to_gr_complex_, 0, file_sink_, 0); + } + else + { + DLOG(INFO) << "Nothing to connect internally"; + } +} + + +void CshortToGrComplex::disconnect(gr::top_block_sptr top_block) +{ + if (dump_) + { + top_block->disconnect(cshort_to_gr_complex_, 0, file_sink_, 0); + } +} + + +gr::basic_block_sptr CshortToGrComplex::get_left_block() +{ + return cshort_to_gr_complex_; +} + + +gr::basic_block_sptr CshortToGrComplex::get_right_block() +{ + return cshort_to_gr_complex_; +} diff --git a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h new file mode 100644 index 000000000..324211f7d --- /dev/null +++ b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h @@ -0,0 +1,83 @@ +/*! + * \file cshort_to_grcomplex.h + * \brief Adapts an 16-bits complex sample stream to a float complex stream + * \author Carles Fernandez Prades, 2014 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_CSHORT_TO_GRCOMPLEX_H +#define GNSS_SDR_CSHORT_TO_GRCOMPLEX_H + +#include "cshort_to_gr_complex.h" +#include "gnss_block_interface.h" +#include +#include +#include + +/** \addtogroup Data_Type Data Type Adapters + * Classes for data type conversion + * \{ */ +/** \addtogroup Data_type_adapters data_type_adapters + * Wrap GNU Radio data tyope adapter blocks with a GNSSBlockInterface + * \{ */ + + +class ConfigurationInterface; + +/*! + * \brief Adapts an 16-bits complex sample stream to a float complex stream + * + */ +class CshortToGrComplex : public GNSSBlockInterface +{ +public: + CshortToGrComplex(const ConfigurationInterface* configuration, + std::string role, unsigned int in_streams, + unsigned int out_streams); + + ~CshortToGrComplex() = default; + + inline std::string role() override + { + return role_; + } + + //! Returns "Cshort_To_Gr_Complex" + inline std::string implementation() override + { + return "Cshort_To_Gr_Complex"; + } + + inline size_t item_size() override + { + return 2 * sizeof(float); + } + + void connect(gr::top_block_sptr top_block) override; + void disconnect(gr::top_block_sptr top_block) override; + gr::basic_block_sptr get_left_block() override; + gr::basic_block_sptr get_right_block() override; + +private: + cshort_to_gr_complex_sptr cshort_to_gr_complex_; + gr::blocks::file_sink::sptr file_sink_; + std::string dump_filename_; + std::string role_; + unsigned int in_streams_; + unsigned int out_streams_; + bool dump_; +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_CSHORT_TO_GRCOMPLEX_H diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt index 5a05385c2..79330488e 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt @@ -6,12 +6,14 @@ set(DATA_TYPE_GR_BLOCKS_SOURCES + cshort_to_gr_complex.cc interleaved_byte_to_complex_byte.cc interleaved_short_to_complex_short.cc interleaved_byte_to_complex_short.cc ) set(DATA_TYPE_GR_BLOCKS_HEADERS + cshort_to_gr_complex.h interleaved_byte_to_complex_byte.h interleaved_short_to_complex_short.h interleaved_byte_to_complex_short.h @@ -42,6 +44,7 @@ target_link_libraries(data_type_gr_blocks Boost::headers PRIVATE Volk::volk + Volkgnsssdr::volkgnsssdr ) target_include_directories(data_type_gr_blocks diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.cc b/src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.cc new file mode 100644 index 000000000..b547d943f --- /dev/null +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.cc @@ -0,0 +1,50 @@ +/*! + * \file cshort_to_gr_complex.cc + * \brief Adapts a complex short (16 + 16 bits) sample stream into a + * std::complex stream (32 + 32 bits) + * \author Carles Fernandez Prades, 2014 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + + +#include "cshort_to_gr_complex.h" +#include +#include +#include +#include // for max + + +cshort_to_gr_complex_sptr make_cshort_to_gr_complex() +{ + return cshort_to_gr_complex_sptr(new cshort_to_gr_complex()); +} + + +cshort_to_gr_complex::cshort_to_gr_complex() + : sync_block("cshort_to_gr_complex", + gr::io_signature::make(1, 1, sizeof(lv_16sc_t)), + gr::io_signature::make(1, 1, sizeof(gr_complex))) +{ + const auto alignment_multiple = static_cast(volk_get_alignment() / sizeof(lv_16sc_t)); + set_alignment(std::max(1, alignment_multiple)); +} + + +int cshort_to_gr_complex::work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) +{ + const auto *in = reinterpret_cast(input_items[0]); + auto *out = reinterpret_cast(output_items[0]); + volk_gnsssdr_16ic_convert_32fc(out, in, noutput_items); + return noutput_items; +} diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.h b/src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.h new file mode 100644 index 000000000..6605597d3 --- /dev/null +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/cshort_to_gr_complex.h @@ -0,0 +1,55 @@ +/*! + * \file cshort_to_gr_complex.h + * \brief Adapts a complex short (16 + 16 bits) sample stream into a + * std::complex stream (32 + 32 bits) + * \author Carles Fernandez Prades, 2014 cfernandez(at)cttc.es + * + * ----------------------------------------------------------------------------- + * + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * Copyright (C) 2010-2024 (see AUTHORS file for a list of contributors) + * SPDX-License-Identifier: GPL-3.0-or-later + * + * ----------------------------------------------------------------------------- + */ + +#ifndef GNSS_SDR_CSHORT_TO_GR_COMPLEX_H +#define GNSS_SDR_CSHORT_TO_GR_COMPLEX_H + +#include "gnss_block_interface.h" +#include + +/** \addtogroup Data_Type + * \{ */ +/** \addtogroup data_type_gnuradio_blocks + * \{ */ + + +class cshort_to_gr_complex; + +using cshort_to_gr_complex_sptr = gnss_shared_ptr; + +cshort_to_gr_complex_sptr make_cshort_to_gr_complex(); + +/*! + * \brief This class adapts a short (16-bits) interleaved sample stream + * into a std::complex stream + */ +class cshort_to_gr_complex : public gr::sync_block +{ +public: + int work(int noutput_items, + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items); + +private: + friend cshort_to_gr_complex_sptr make_cshort_to_gr_complex(); + cshort_to_gr_complex(); +}; + + +/** \} */ +/** \} */ +#endif // GNSS_SDR_CSHORT_TO_GR_COMPLEX_H \ No newline at end of file diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index fceadefb9..1635aa5f5 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -36,6 +36,7 @@ #include "byte_to_short.h" #include "channel.h" #include "configuration_interface.h" +#include "cshort_to_grcomplex.h" #include "direct_resampler_conditioner.h" #include "fifo_signal_source.h" #include "file_signal_source.h" @@ -919,6 +920,12 @@ std::unique_ptr GNSSBlockFactory::GetBlock( out_streams); block = std::move(block_); } + else if (implementation == "Cshort_To_Gr_Complex") + { + std::unique_ptr block_ = std::make_unique(configuration, role, in_streams, + out_streams); + block = std::move(block_); + } // INPUT FILTER ------------------------------------------------------------ else if (implementation == "Fir_Filter") From 5be2971c9b66574fa5f086c51dccec7fea03663b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 1 Oct 2024 10:09:24 +0200 Subject: [PATCH 407/499] Do not write empty files if downloading fails while running CMake --- src/tests/CMakeLists.txt | 54 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index deca361e3..770dff763 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -486,7 +486,12 @@ if(NOT (ENABLE_PACKAGING OR ENABLE_UNIT_TESTING_MINIMAL)) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=d57a02d3c7361bba2e137329b66458ef + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat) message(STATUS "Downloading file: GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat") @@ -494,7 +499,12 @@ if(NOT (ENABLE_PACKAGING OR ENABLE_UNIT_TESTING_MINIMAL)) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=f12ada80a2ad1bab061262e010643529 + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat) message(STATUS "Downloading file: GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat") @@ -502,7 +512,12 @@ if(NOT (ENABLE_PACKAGING OR ENABLE_UNIT_TESTING_MINIMAL)) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=b98d6d82885354f168f279817de284b5 + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin) message(STATUS "Downloading file: NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin") @@ -510,7 +525,12 @@ if(NOT (ENABLE_PACKAGING OR ENABLE_UNIT_TESTING_MINIMAL)) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin SHOW_PROGRESS EXPECTED_HASH MD5=0e2dc212309141d236897bc0af187074 + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin) + endif() endif() message(STATUS "Done.") endif() @@ -524,7 +544,12 @@ if(ENABLE_UNIT_TESTING_EXTRA) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat SHOW_PROGRESS EXPECTED_HASH MD5=a6fcbefe155137945d3c33c5ef7bd0f9 + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/gps_l2c_m_prn7_5msps.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat) message(STATUS "Downloading file: Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat") @@ -532,7 +557,12 @@ if(ENABLE_UNIT_TESTING_EXTRA) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=ffb72fc63c116be58d5e5ccb1daaed3a + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Glonass_L1_CA_SIM_Fs_62Msps_4ms.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat) message(STATUS "Downloading file: BdsB1IStr01_fs25e6_if0_4ms.dat") @@ -540,7 +570,12 @@ if(ENABLE_UNIT_TESTING_EXTRA) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=5a4336dad9d80f3313a16dec4fff9233 + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat) message(STATUS "Downloading file: BdsB3IStr01_fs50e6_if0_4ms.dat") @@ -548,7 +583,12 @@ if(ENABLE_UNIT_TESTING_EXTRA) ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat SHOW_PROGRESS EXPECTED_HASH MD5=066d0d8434a8bc81e161778b7c34cc07 + STATUS status_download ) + list(GET status_download 0 result_download) + if(NOT (${result_download} EQUAL 0)) + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat) + endif() endif() if(NOT EXISTS ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip) message(STATUS "Downloading file: Test_vectors.zip") @@ -556,11 +596,17 @@ if(ENABLE_UNIT_TESTING_EXTRA) ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip SHOW_PROGRESS EXPECTED_HASH MD5=8158aebee735652c9398e5bb6d944364 + STATUS status_download ) - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xzf ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip - WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/ - ) + list(GET status_download 0 result_download) + if(${result_download} EQUAL 0) + execute_process( + COMMAND ${CMAKE_COMMAND} -E tar xzf ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip + WORKING_DIRECTORY ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/ + ) + else() + file(REMOVE ${GNSSSDR_BINARY_DIR}/thirdparty/osnma_tests/Test_vectors.zip) + endif() endif() message(STATUS "Done.") if(ENABLE_INSTALL_TESTS) From 825037592a8a6541c896a2c36655b49ec118bd43 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 4 Oct 2024 11:55:09 +0200 Subject: [PATCH 408/499] Remove build and data folders, move tests and utils to the base of the source tree --- .github/workflows/main.yml | 72 ++++++------ .github/workflows/volk_gnsssdr_android.yml | 1 + .gitignore | 45 +++---- CMakeLists.txt | 4 + README.md | 110 +++++++----------- build/.gitignore | 6 - data/.gitignore | 6 - docs/CHANGELOG.md | 10 ++ docs/doxygen/other/main_page.dox | 19 ++- docs/xml-schemas/README.md | 2 +- src/CMakeLists.txt | 4 - .../volk_gnsssdr/.gitignore | 16 +-- {src/tests => tests}/CMakeLists.txt | 28 ++--- .../tests => tests}/benchmarks/CMakeLists.txt | 0 {src/tests => tests}/benchmarks/README.md | 0 .../benchmarks/benchmark_atan2.cc | 0 .../benchmarks/benchmark_copy.cc | 0 .../benchmarks/benchmark_crypto.cc | 0 .../benchmarks/benchmark_detector.cc | 0 .../benchmarks/benchmark_osnma.cc | 0 .../benchmarks/benchmark_preamble.cc | 0 .../benchmarks/benchmark_reed_solomon.cc | 0 {src/tests => tests}/common-files/gnuplot_i.h | 0 .../common-files/observable_tests_flags.h | 0 .../common-files/signal_generator_flags.h | 0 .../tests => tests}/common-files/test_flags.h | 0 .../common-files/tracking_tests_flags.h | 0 .../data/config_file_sample.txt | 0 {src/tests => tests}/data/gnsstk_gcc13.patch | 0 .../data/gnsstk_static13.patch | 0 .../data/gnsstk_static14.patch | 0 .../data/rtklib_test/eph_GPS_L1CA_test1.xml | 0 .../data/rtklib_test/obs_test1.xml | 0 {src/tests => tests}/single_test_main.cc | 0 .../system-tests/libs/CMakeLists.txt | 0 .../system-tests/libs/position_test_flags.h | 0 .../libs/rtklib_solver_dump_reader.cc | 0 .../libs/rtklib_solver_dump_reader.h | 0 .../libs/spirent_motion_csv_dump_reader.cc | 0 .../libs/spirent_motion_csv_dump_reader.h | 0 .../system-tests/position_test.cc | 0 {src/tests => tests}/system-tests/ttff.cc | 0 {src/tests => tests}/test_main.cc | 0 .../arithmetic/code_generation_test.cc | 0 .../arithmetic/complex_carrier_test.cc | 0 .../unit-tests/arithmetic/conjugate_test.cc | 0 .../unit-tests/arithmetic/fft_length_test.cc | 0 .../unit-tests/arithmetic/fft_speed_test.cc | 0 .../arithmetic/magnitude_squared_test.cc | 0 .../unit-tests/arithmetic/matio_test.cc | 0 .../unit-tests/arithmetic/multiply_test.cc | 0 .../arithmetic/preamble_correlator_test.cc | 0 .../control-plane/control_thread_test.cc | 0 .../control-plane/file_configuration_test.cc | 0 .../control-plane/gnss_block_factory_test.cc | 0 .../control-plane/gnss_flowgraph_test.cc | 0 .../in_memory_configuration_test.cc | 0 .../unit-tests/control-plane/protobuf_test.cc | 0 .../control-plane/string_converter_test.cc | 0 .../acquisition/acq_performance_test.cc | 0 .../beidou_b1i_pcps_acquisition_test.cc | 0 .../beidou_b3i_pcps_acquisition_test.cc | 0 ...8ms_ambiguous_acquisition_gsoc2013_test.cc | 0 ...cps_ambiguous_acquisition_gsoc2013_test.cc | 0 ...e1_pcps_ambiguous_acquisition_gsoc_test.cc | 0 ...ileo_e1_pcps_ambiguous_acquisition_test.cc | 0 ...e1_pcps_ambiguous_acquisition_test_fpga.cc | 0 ...wsr_ambiguous_acquisition_gsoc2013_test.cc | 0 ...ync_ambiguous_acquisition_gsoc2014_test.cc | 0 ...ong_ambiguous_acquisition_gsoc2013_test.cc | 0 ...cps_acquisition_gsoc2014_gensource_test.cc | 0 .../galileo_e5b_pcps_acquisition_test.cc | 0 .../galileo_e6_pcps_acquisition_test.cc | 0 ...ss_l1_ca_pcps_acquisition_gsoc2017_test.cc | 0 .../glonass_l1_ca_pcps_acquisition_test.cc | 0 .../glonass_l2_ca_pcps_acquisition_test.cc | 0 ...ps_l1_ca_pcps_acquisition_gsoc2013_test.cc | 0 .../gps_l1_ca_pcps_acquisition_test.cc | 0 .../gps_l1_ca_pcps_acquisition_test_fpga.cc | 0 ...a_pcps_opencl_acquisition_gsoc2013_test.cc | 0 ...cps_quicksync_acquisition_gsoc2014_test.cc | 0 ..._ca_pcps_tong_acquisition_gsoc2013_test.cc | 0 .../gps_l2_m_pcps_acquisition_test.cc | 0 .../adapter/adapter_test.cc | 0 .../adapter/pass_through_test.cc | 0 .../filter/fir_filter_test.cc | 0 .../filter/notch_filter_lite_test.cc | 0 .../filter/notch_filter_test.cc | 0 .../filter/pulse_blanking_filter_test.cc | 0 .../libs/CMakeLists.txt | 2 +- .../libs/acquisition_dump_reader.cc | 0 .../libs/acquisition_dump_reader.h | 0 .../libs/acquisition_msg_rx.cc | 0 .../libs/acquisition_msg_rx.h | 0 .../libs/item_type_helpers_test.cc | 0 .../libs/observables_dump_reader.cc | 0 .../libs/observables_dump_reader.h | 0 .../libs/tlm_dump_reader.cc | 0 .../libs/tlm_dump_reader.h | 0 .../libs/tracking_dump_reader.cc | 0 .../libs/tracking_dump_reader.h | 0 .../libs/tracking_true_obs_reader.cc | 0 .../libs/tracking_true_obs_reader.h | 0 .../libs/true_observables_reader.cc | 0 .../libs/true_observables_reader.h | 0 .../observables/hybrid_observables_test.cc | 0 .../hybrid_observables_test_fpga.cc | 0 .../osnma/gnss_crypto_test.cc | 0 .../osnma/osnma_msg_receiver_test.cc | 0 .../osnma/osnma_test_vectors.cc | 0 .../pvt/geohash_test.cc | 0 .../pvt/nmea_printer_test.cc | 0 .../pvt/rinex_printer_test.cc | 0 .../pvt/rtcm_printer_test.cc | 0 .../signal-processing-blocks/pvt/rtcm_test.cc | 0 .../pvt/rtklib_solver_test.cc | 0 .../pvt/serdes_monitor_pvt_test.cc | 0 .../direct_resampler_conditioner_cc_test.cc | 0 .../resampler/mmse_resampler_test.cc | 0 .../sources/file_signal_source_test.cc | 0 .../sources/gnss_sdr_valve_test.cc | 0 .../sources/unpack_2bit_samples_test.cc | 0 .../galileo_fnav_inav_decoder_test.cc | 0 .../gps_l1_ca_telemetry_decoder_test.cc | 0 .../tracking/bayesian_estimation_test.cc | 0 .../cpu_multicorrelator_real_codes_test.cc | 0 .../tracking/cpu_multicorrelator_test.cc | 0 .../tracking/cubature_filter_test.cc | 0 .../tracking/discriminator_test.cc | 0 .../galileo_e1_dll_pll_veml_tracking_test.cc | 0 .../tracking/galileo_e5a_tracking_test.cc | 0 .../galileo_e5b_dll_pll_tracking_test.cc | 0 ...onass_l1_ca_dll_pll_c_aid_tracking_test.cc | 0 .../glonass_l1_ca_dll_pll_tracking_test.cc | 0 .../gps_l1_ca_dll_pll_tracking_test.cc | 0 .../gps_l1_ca_dll_pll_tracking_test_fpga.cc | 0 .../gps_l1_ca_gaussian_tracking_test.cc | 0 .../gps_l2_m_dll_pll_tracking_test.cc | 0 .../tracking/gpu_multicorrelator_test.cc | 0 .../tracking/tracking_loop_filter_test.cc | 0 .../tracking/tracking_pull-in_test.cc | 0 .../tracking/tracking_pull-in_test_fpga.cc | 0 .../tracking/unscented_filter_test.cc | 0 .../galileo_e1b_reed_solomon_test.cc | 0 .../galileo_e6b_reed_solomon_test.cc | 0 .../system-parameters/galileo_ism_test.cc | 0 .../glonass_gnav_crc_test.cc | 0 .../glonass_gnav_ephemeris_test.cc | 0 .../glonass_gnav_nav_message_test.cc | 0 .../system-parameters/has_decoding_test.cc | 0 {src/utils => utils}/CMakeLists.txt | 0 .../front-end-cal/CMakeLists.txt | 0 .../front-end-cal/front_end_cal.cc | 0 .../front-end-cal/front_end_cal.h | 0 {src/utils => utils}/front-end-cal/main.cc | 0 .../matlab/dll_pll_veml_plot_sample.m | 0 .../matlab/gps_l1_ca_kf_plot_sample.m | 0 .../gps_l1_ca_pvt_plot_sample_agilent_cap2.m | 0 .../matlab/gps_l1_ca_pvt_raw_plot_sample.m | 0 .../matlab/gps_l1_ca_telemetry_plot_sample.m | 0 {src/utils => utils}/matlab/help_script1.m | 0 {src/utils => utils}/matlab/help_script2.m | 0 .../matlab/hybrid_observables_plot_sample.m | 0 .../libs/dll_pll_veml_read_tracking_dump.m | 0 .../matlab/libs/geoFunctions/cart2geo.m | 0 .../matlab/libs/geoFunctions/cart2utm.m | 0 .../matlab/libs/geoFunctions/check_t.m | 0 .../matlab/libs/geoFunctions/clksin.m | 0 .../matlab/libs/geoFunctions/clsin.m | 0 .../matlab/libs/geoFunctions/deg2dms.m | 0 .../matlab/libs/geoFunctions/dms2deg.m | 0 .../matlab/libs/geoFunctions/dms2mat.m | 0 .../matlab/libs/geoFunctions/e_r_corr.m | 0 .../matlab/libs/geoFunctions/findUtmZone.m | 0 .../matlab/libs/geoFunctions/geo2cart.m | 0 .../matlab/libs/geoFunctions/leastSquarePos.m | 0 .../matlab/libs/geoFunctions/mat2dms.m | 0 .../matlab/libs/geoFunctions/roundn.m | 0 .../matlab/libs/geoFunctions/satpos.m | 0 .../matlab/libs/geoFunctions/togeod.m | 0 .../matlab/libs/geoFunctions/topocent.m | 0 .../matlab/libs/geoFunctions/tropo.m | 0 .../gps_l1_ca_dll_pll_read_tracking_dump.m | 0 .../libs/gps_l1_ca_kf_read_tracking_dump.m | 0 .../matlab/libs/gps_l1_ca_pvt_read_pvt_dump.m | 0 .../matlab/libs/gps_l1_ca_read_pvt_raw_dump.m | 0 .../libs/gps_l1_ca_read_telemetry_dump.m | 0 {src/utils => utils}/matlab/libs/plotKalman.m | 0 .../matlab/libs/plotNavigation.m | 0 .../matlab/libs/plotTracking.m | 0 .../matlab/libs/plotVEMLTracking.m | 0 .../matlab/libs/quantize_signal.m | 0 .../matlab/libs/read_complex_binary.m | 0 .../matlab/libs/read_complex_char_binary.m | 0 .../matlab/libs/read_complex_short_binary.m | 0 .../libs/read_hybrid_observables_dump.m | 0 .../libs/read_true_sim_observables_dump.m | 0 {src/utils => utils}/matlab/plotTrackingE5a.m | 0 {src/utils => utils}/matlab/plot_acq_grid.m | 0 .../matlab/plot_acq_grid_gsoc.m | 0 .../matlab/plot_acq_grid_gsoc_e5.m | 0 .../matlab/plot_acq_grid_gsoc_glonass.m | 0 .../matlab/plot_tracking_quality_indicators.m | 0 .../nav-listener/CMakeLists.txt | 0 {src/utils => utils}/nav-listener/README.md | 0 .../cmake/cmake_uninstall.cmake.in | 0 {src/utils => utils}/nav-listener/main.cc | 0 .../nav-listener/nav_message.proto | 0 .../nav-listener/nav_msg_udp_listener.cc | 0 .../nav-listener/nav_msg_udp_listener.h | 0 .../python/dll_pll_veml_plot_sample.py | 0 .../python/gps_l1_ca_kf_plot_sample.py | 0 .../python/gps_l1_ca_pvt_raw_plot_sample.py | 0 .../python/gps_l1_ca_telemetry_plot_sample.py | 0 .../python/hybrid_observables_plot_sample.py | 0 .../lib/dll_pll_veml_read_tracking_dump.py | 0 .../lib/gps_l1_ca_kf_read_tracking_dump.py | 0 .../python/lib/gps_l1_ca_read_pvt_dump.py | 0 .../lib/gps_l1_ca_read_telemetry_dump.py | 0 {src/utils => utils}/python/lib/plotKalman.py | 0 .../python/lib/plotNavigation.py | 0 .../python/lib/plotPosition.py | 0 .../python/lib/plotTracking.py | 0 .../python/lib/plotVEMLTracking.py | 0 .../lib/read_hybrid_observables_dump.py | 0 {src/utils => utils}/python/plot_acq_grid.py | 0 .../plot_tracking_quality_indicators.py | 0 .../ieee-access18/L2-access18.conf | 0 .../reproducibility/ieee-access18/README.md | 6 +- .../reproducibility/ieee-access18/plot_dump.m | 0 .../rinex-tools/CMakeLists.txt | 2 +- {src/utils => utils}/rinex-tools/README.md | 0 {src/utils => utils}/rinex-tools/obsdiff.cc | 0 .../rinex-tools/obsdiff_flags.h | 0 .../rinex2assist/CMakeLists.txt | 0 {src/utils => utils}/rinex2assist/README.md | 0 {src/utils => utils}/rinex2assist/main.cc | 0 .../scripts/download-galileo-almanac.sh | 0 .../scripts/gnss-sdr-harness.sh | 0 ...ss_sdr_tcp_connector_parallel_tracking.txt | 0 ...dr_tcp_connector_parallel_tracking_start.m | 0 .../gnss_sdr_tcp_connector_tracking_lib.mdl | 0 ...sdr_tcp_connector_tracking_lib.mdl.license | 0 ..._sdr_galileo_e1_tcp_connector_tracking.txt | 0 ...README_gnss_sdr_tcp_connector_tracking.txt | 0 ..._galileo_e1_tcp_connector_tracking_lib.mdl | 0 ..._e1_tcp_connector_tracking_lib.mdl.license | 0 ..._galileo_e1_tcp_connector_tracking_start.m | 0 .../gnss_sdr_tcp_connector_tracking_lib.mdl | 0 ...sdr_tcp_connector_tracking_lib.mdl.license | 0 .../gnss_sdr_tcp_connector_tracking_start.m | 0 251 files changed, 154 insertions(+), 179 deletions(-) delete mode 100644 build/.gitignore delete mode 100644 data/.gitignore rename {src/tests => tests}/CMakeLists.txt (98%) rename {src/tests => tests}/benchmarks/CMakeLists.txt (100%) rename {src/tests => tests}/benchmarks/README.md (100%) rename {src/tests => tests}/benchmarks/benchmark_atan2.cc (100%) rename {src/tests => tests}/benchmarks/benchmark_copy.cc (100%) rename {src/tests => tests}/benchmarks/benchmark_crypto.cc (100%) rename {src/tests => tests}/benchmarks/benchmark_detector.cc (100%) rename {src/tests => tests}/benchmarks/benchmark_osnma.cc (100%) rename {src/tests => tests}/benchmarks/benchmark_preamble.cc (100%) rename {src/tests => tests}/benchmarks/benchmark_reed_solomon.cc (100%) rename {src/tests => tests}/common-files/gnuplot_i.h (100%) rename {src/tests => tests}/common-files/observable_tests_flags.h (100%) rename {src/tests => tests}/common-files/signal_generator_flags.h (100%) rename {src/tests => tests}/common-files/test_flags.h (100%) rename {src/tests => tests}/common-files/tracking_tests_flags.h (100%) rename {src/tests => tests}/data/config_file_sample.txt (100%) rename {src/tests => tests}/data/gnsstk_gcc13.patch (100%) rename {src/tests => tests}/data/gnsstk_static13.patch (100%) rename {src/tests => tests}/data/gnsstk_static14.patch (100%) rename {src/tests => tests}/data/rtklib_test/eph_GPS_L1CA_test1.xml (100%) rename {src/tests => tests}/data/rtklib_test/obs_test1.xml (100%) rename {src/tests => tests}/single_test_main.cc (100%) rename {src/tests => tests}/system-tests/libs/CMakeLists.txt (100%) rename {src/tests => tests}/system-tests/libs/position_test_flags.h (100%) rename {src/tests => tests}/system-tests/libs/rtklib_solver_dump_reader.cc (100%) rename {src/tests => tests}/system-tests/libs/rtklib_solver_dump_reader.h (100%) rename {src/tests => tests}/system-tests/libs/spirent_motion_csv_dump_reader.cc (100%) rename {src/tests => tests}/system-tests/libs/spirent_motion_csv_dump_reader.h (100%) rename {src/tests => tests}/system-tests/position_test.cc (100%) rename {src/tests => tests}/system-tests/ttff.cc (100%) rename {src/tests => tests}/test_main.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/code_generation_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/complex_carrier_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/conjugate_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/fft_length_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/fft_speed_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/magnitude_squared_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/matio_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/multiply_test.cc (100%) rename {src/tests => tests}/unit-tests/arithmetic/preamble_correlator_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/control_thread_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/file_configuration_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/gnss_block_factory_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/gnss_flowgraph_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/in_memory_configuration_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/protobuf_test.cc (100%) rename {src/tests => tests}/unit-tests/control-plane/string_converter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/adapter/adapter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/CMakeLists.txt (98%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/libs/true_observables_reader.h (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/geohash_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/discriminator_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc (100%) rename {src/tests => tests}/unit-tests/signal-processing-blocks/tracking/unscented_filter_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/galileo_ism_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/glonass_gnav_crc_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc (100%) rename {src/tests => tests}/unit-tests/system-parameters/has_decoding_test.cc (100%) rename {src/utils => utils}/CMakeLists.txt (100%) rename {src/utils => utils}/front-end-cal/CMakeLists.txt (100%) rename {src/utils => utils}/front-end-cal/front_end_cal.cc (100%) rename {src/utils => utils}/front-end-cal/front_end_cal.h (100%) rename {src/utils => utils}/front-end-cal/main.cc (100%) rename {src/utils => utils}/matlab/dll_pll_veml_plot_sample.m (100%) rename {src/utils => utils}/matlab/gps_l1_ca_kf_plot_sample.m (100%) rename {src/utils => utils}/matlab/gps_l1_ca_pvt_plot_sample_agilent_cap2.m (100%) rename {src/utils => utils}/matlab/gps_l1_ca_pvt_raw_plot_sample.m (100%) rename {src/utils => utils}/matlab/gps_l1_ca_telemetry_plot_sample.m (100%) rename {src/utils => utils}/matlab/help_script1.m (100%) rename {src/utils => utils}/matlab/help_script2.m (100%) rename {src/utils => utils}/matlab/hybrid_observables_plot_sample.m (100%) rename {src/utils => utils}/matlab/libs/dll_pll_veml_read_tracking_dump.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/cart2geo.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/cart2utm.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/check_t.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/clksin.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/clsin.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/deg2dms.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/dms2deg.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/dms2mat.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/e_r_corr.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/findUtmZone.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/geo2cart.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/leastSquarePos.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/mat2dms.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/roundn.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/satpos.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/togeod.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/topocent.m (100%) rename {src/utils => utils}/matlab/libs/geoFunctions/tropo.m (100%) rename {src/utils => utils}/matlab/libs/gps_l1_ca_dll_pll_read_tracking_dump.m (100%) rename {src/utils => utils}/matlab/libs/gps_l1_ca_kf_read_tracking_dump.m (100%) rename {src/utils => utils}/matlab/libs/gps_l1_ca_pvt_read_pvt_dump.m (100%) rename {src/utils => utils}/matlab/libs/gps_l1_ca_read_pvt_raw_dump.m (100%) rename {src/utils => utils}/matlab/libs/gps_l1_ca_read_telemetry_dump.m (100%) rename {src/utils => utils}/matlab/libs/plotKalman.m (100%) rename {src/utils => utils}/matlab/libs/plotNavigation.m (100%) rename {src/utils => utils}/matlab/libs/plotTracking.m (100%) rename {src/utils => utils}/matlab/libs/plotVEMLTracking.m (100%) rename {src/utils => utils}/matlab/libs/quantize_signal.m (100%) rename {src/utils => utils}/matlab/libs/read_complex_binary.m (100%) rename {src/utils => utils}/matlab/libs/read_complex_char_binary.m (100%) rename {src/utils => utils}/matlab/libs/read_complex_short_binary.m (100%) rename {src/utils => utils}/matlab/libs/read_hybrid_observables_dump.m (100%) rename {src/utils => utils}/matlab/libs/read_true_sim_observables_dump.m (100%) rename {src/utils => utils}/matlab/plotTrackingE5a.m (100%) rename {src/utils => utils}/matlab/plot_acq_grid.m (100%) rename {src/utils => utils}/matlab/plot_acq_grid_gsoc.m (100%) rename {src/utils => utils}/matlab/plot_acq_grid_gsoc_e5.m (100%) rename {src/utils => utils}/matlab/plot_acq_grid_gsoc_glonass.m (100%) rename {src/utils => utils}/matlab/plot_tracking_quality_indicators.m (100%) rename {src/utils => utils}/nav-listener/CMakeLists.txt (100%) rename {src/utils => utils}/nav-listener/README.md (100%) rename {src/utils => utils}/nav-listener/cmake/cmake_uninstall.cmake.in (100%) rename {src/utils => utils}/nav-listener/main.cc (100%) rename {src/utils => utils}/nav-listener/nav_message.proto (100%) rename {src/utils => utils}/nav-listener/nav_msg_udp_listener.cc (100%) rename {src/utils => utils}/nav-listener/nav_msg_udp_listener.h (100%) rename {src/utils => utils}/python/dll_pll_veml_plot_sample.py (100%) rename {src/utils => utils}/python/gps_l1_ca_kf_plot_sample.py (100%) rename {src/utils => utils}/python/gps_l1_ca_pvt_raw_plot_sample.py (100%) rename {src/utils => utils}/python/gps_l1_ca_telemetry_plot_sample.py (100%) rename {src/utils => utils}/python/hybrid_observables_plot_sample.py (100%) rename {src/utils => utils}/python/lib/dll_pll_veml_read_tracking_dump.py (100%) rename {src/utils => utils}/python/lib/gps_l1_ca_kf_read_tracking_dump.py (100%) rename {src/utils => utils}/python/lib/gps_l1_ca_read_pvt_dump.py (100%) rename {src/utils => utils}/python/lib/gps_l1_ca_read_telemetry_dump.py (100%) rename {src/utils => utils}/python/lib/plotKalman.py (100%) rename {src/utils => utils}/python/lib/plotNavigation.py (100%) rename {src/utils => utils}/python/lib/plotPosition.py (100%) rename {src/utils => utils}/python/lib/plotTracking.py (100%) rename {src/utils => utils}/python/lib/plotVEMLTracking.py (100%) rename {src/utils => utils}/python/lib/read_hybrid_observables_dump.py (100%) rename {src/utils => utils}/python/plot_acq_grid.py (100%) rename {src/utils => utils}/python/plot_tracking_quality_indicators.py (100%) rename {src/utils => utils}/reproducibility/ieee-access18/L2-access18.conf (100%) rename {src/utils => utils}/reproducibility/ieee-access18/README.md (93%) rename {src/utils => utils}/reproducibility/ieee-access18/plot_dump.m (100%) rename {src/utils => utils}/rinex-tools/CMakeLists.txt (99%) rename {src/utils => utils}/rinex-tools/README.md (100%) rename {src/utils => utils}/rinex-tools/obsdiff.cc (100%) rename {src/utils => utils}/rinex-tools/obsdiff_flags.h (100%) rename {src/utils => utils}/rinex2assist/CMakeLists.txt (100%) rename {src/utils => utils}/rinex2assist/README.md (100%) rename {src/utils => utils}/rinex2assist/main.cc (100%) rename {src/utils => utils}/scripts/download-galileo-almanac.sh (100%) rename {src/utils => utils}/scripts/gnss-sdr-harness.sh (100%) rename {src/utils => utils}/simulink/MultiThread/README_gnss_sdr_tcp_connector_parallel_tracking.txt (100%) rename {src/utils => utils}/simulink/MultiThread/gnss_sdr_tcp_connector_parallel_tracking_start.m (100%) rename {src/utils => utils}/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl (100%) rename {src/utils => utils}/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license (100%) rename {src/utils => utils}/simulink/SingleThread/README_gnss_sdr_galileo_e1_tcp_connector_tracking.txt (100%) rename {src/utils => utils}/simulink/SingleThread/README_gnss_sdr_tcp_connector_tracking.txt (100%) rename {src/utils => utils}/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl (100%) rename {src/utils => utils}/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl.license (100%) rename {src/utils => utils}/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_start.m (100%) rename {src/utils => utils}/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl (100%) rename {src/utils => utils}/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license (100%) rename {src/utils => utils}/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_start.m (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 54a478cba..ddb7cbc68 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,15 +28,15 @@ jobs: libgnutls-openssl-dev libmatio-dev googletest protobuf-compiler libprotobuf-dev \ python3-mako liborc-0.4-dev - name: configure - run: cd build && cmake -GNinja .. + run: cmake -S . -B build -GNinja - name: build - run: cd build && ninja + run: cmake --build build - name: check - run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests + run: cmake --build build --target check && ./install/volk_gnsssdr_profile && ./install/run_tests - name: default position_test run: | - cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF .. && \ - ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* + cmake -S . -B build -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF && \ + cmake --build build && ./install/position_test && ./install/run_tests --gtest_filter=Osnma* build-macos: runs-on: macos-latest @@ -62,15 +62,15 @@ jobs: brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure - run: cd build && cmake -GNinja .. + run: cmake -S . -B build -GNinja - name: build - run: cd build && ninja + run: cmake --build build - name: check - run: cd build && ninja check && ../install/volk_gnsssdr_profile && ../install/run_tests + run: cmake --build build --target check && ./install/volk_gnsssdr_profile && ./install/run_tests - name: default position_test run: | - cd build && cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF .. && \ - ninja && ../install/position_test && ../install/run_tests --gtest_filter=Osnma* + cmake -S . -B build -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF && \ + cmake --build build && ./install/position_test && ./install/run_tests --gtest_filter=Osnma* build-macos-xcode: runs-on: macos-latest @@ -96,22 +96,20 @@ jobs: brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf pip3 install mako - name: configure - run: cd build && cmake -GXcode .. + run: cmake -S . -B build -GXcode - name: build - run: cd build && xcodebuild -configuration Release + run: cmake --build build --config Release - name: check run: | - cd build - xcodebuild -configuration Release -target check - ../install/volk_gnsssdr_profile - ../install/run_tests + cmake --build build --config Release --target check + ./install/volk_gnsssdr_profile + ./install/run_tests - name: default position_test run: | - cd build - cmake -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF .. - xcodebuild -configuration Release -target position_test - ../install/position_test - ../install/run_tests --gtest_filter=Osnma* + cmake -S . -B build -DENABLE_SYSTEM_TESTING_EXTRA=ON -DENABLE_UNIT_TESTING_EXTRA=OFF + cmake --build build --config Release --target position_test + ./install/position_test + ./install/run_tests --gtest_filter=Osnma* clang-format: runs-on: ubuntu-latest @@ -151,7 +149,7 @@ jobs: ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run - run: cd build && cmake .. && make volk_gnsssdr_module gtest-1.15.2 core_monitor core_libs pvt_libs + run: cmake -S . -B build && cmake --build build --target volk_gnsssdr_module gtest-1.15.2 core_monitor core_libs pvt_libs - name: run clang-tidy run: cd build && /opt/homebrew/opt/llvm/bin/run-clang-tidy -fix - name: check @@ -168,7 +166,7 @@ jobs: - name: install dependencies run: sudo apt-get install python3-pip && sudo pip3 install cpplint - name: run checks - run: "find ./src/ -iname *.h -o -iname *.cc | xargs cpplint + run: "find ./src/ ./utils ./tests -iname *.h -o -iname *.cc | xargs cpplint --filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,\ +build/include_what_you_use,+build/printf_format,+build/storage_class,\ +readability/constructors,+readability/namespace,+readability/newline,\ @@ -180,7 +178,7 @@ jobs: +whitespace/end-of-line,+whitespace/ending-newline,+whitespace/semicolon,\ +whitespace/tab --exclude=./src/core/interfaces/gnss_block_interface.h --exclude=./src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/hwcaps_for_testing.* - --exclude=./src/utils/nav-listener/build/nav_message.pb.h" + --exclude=./utils/nav-listener/build/nav_message.pb.h" prettier-markdown: runs-on: ubuntu-latest @@ -215,12 +213,12 @@ jobs: pip install mako - name: configure shell: powershell - run: cd build; cmake -G "Visual Studio 17 2022" ..\src\algorithms\libs\volk_gnsssdr_module\volk_gnsssdr + run: cmake -S src\algorithms\libs\volk_gnsssdr_module\volk_gnsssdr -B build -G "Visual Studio 17 2022" - name: build run: cmake --build build --config Release - name: test shell: powershell - run: cd build; ctest -C Release + run: ctest -C Release --test-dir build - name: install run: cmake --install build - name: run profile @@ -233,11 +231,11 @@ jobs: - name: install dependencies run: sudo apt install python3-mako liborc-dev - name: configure - run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + run: cmake -S src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr -B build - name: build - run: cd build && make -j2 + run: cmake --build build - name: install - run: cd build && sudo make install && sudo ldconfig + run: sudo cmake --install build && sudo ldconfig - name: test run: volk_gnsssdr_profile @@ -253,11 +251,11 @@ jobs: python -m pip install --upgrade pip pip install mako - name: configure - run: cd build && cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + run: cmake -S src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr -B build - name: build - run: cd build && make -j2 && sudo make install + run: cmake --build build && sudo cmake --install build - name: test - run: cd build && ctest -C Release --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc + run: ctest -C Release --test-dir build --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc volk-gnsssdr-macos-xcode: runs-on: macos-latest @@ -271,13 +269,13 @@ jobs: python -m pip install --upgrade pip pip install mako - name: configure - run: cd build && cmake -GXcode ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + run: cmake -S src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr -B build -GXcode - name: build - run: cd build && xcodebuild -configuration Release + run: cmake --build build --config Release - name: install - run: cd build && sudo xcodebuild -configuration Release -target install + run: sudo cmake --install build - name: test - run: cd build && ctest -C Release --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc + run: ctest -C Release --test-dir build --exclude-regex --exclude-regex volk_gnsssdr_32fc_32f_rotator_dotprodxnpuppet_32fc shellcheck: runs-on: ubuntu-latest @@ -286,7 +284,7 @@ jobs: - name: install dependencies run: sudo apt install shellcheck - name: check scripts - run: shellcheck src/utils/scripts/* + run: shellcheck utils/scripts/* REUSE-compliance: runs-on: ubuntu-latest diff --git a/.github/workflows/volk_gnsssdr_android.yml b/.github/workflows/volk_gnsssdr_android.yml index 04a33c3d4..b10f894dd 100644 --- a/.github/workflows/volk_gnsssdr_android.yml +++ b/.github/workflows/volk_gnsssdr_android.yml @@ -50,6 +50,7 @@ jobs: shell: bash run: | cd $GITHUB_WORKSPACE/ + mkdir build cd build cmake -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-sdk-linux/ndk/24.0.8215888/build/cmake/android.toolchain.cmake \ -DANDROID_ABI=${{ matrix.arch.name }} \ diff --git a/.gitignore b/.gitignore index a876bf1c1..2155a88bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,29 +1,30 @@ # SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2011 Carles Fernandez-Prades +# SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades *~ .*.swp -docs/doxygen/Doxyfile -docs/html -docs/latex -docs/GNSS-SDR_manual.pdf -src/tests/data/output.dat -thirdparty/ -src/utils/nav-listener/build -.settings -.project -.cproject -.idea -cmake-build-debug/ +/build/ +/build*/ +/cmake-build-debug/ +/data/ +/docs/doxygen/Doxyfile +/docs/html/ +/docs/latex/ +/docs/GNSS-SDR_manual.pdf +/gnss_sdr_pvt.nmea +/GSDR* +/HAS_* +/PVT_* +/Testing/ +/tests/data/output.dat +/thirdparty/ +/utils/nav-listener/build/ +/utils/nav-listener/build*/ /install +.cproject .DS_Store +.idea +.project .pydevproject -.vscode/ +.settings .vs/ -Testing/ - -GSDR* -PVT_* -HAS_* -gnss_sdr_pvt.nmea -build-debug/ -build-release/ \ No newline at end of file +.vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt index c986cfc12..0c933e908 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3602,6 +3602,10 @@ add_custom_target(uninstall # Add subdirectories ################################################################################ add_subdirectory(src) +if(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING) + add_subdirectory(tests) +endif() +add_subdirectory(utils) diff --git a/README.md b/README.md index d5cbacc94..8997686d1 100644 --- a/README.md +++ b/README.md @@ -535,18 +535,16 @@ gnss-sdr with the following structure: ``` |-gnss-sdr - |---build <- where gnss-sdr is built. |---cmake <- CMake-related files. |---conf <- Configuration files. Each file defines one particular receiver. - |---data <- Populate this folder with your captured data. |---docs <- Contains documentation-related files. |---install <- Executables will be placed here. |---src <- Source code folder. |-----algorithms <- Signal processing blocks. |-----core <- Control plane, interfaces, systems' parameters. |-----main <- Main function of the C++ program. - |-----tests <- QA code. - |-----utils <- some utilities (e.g. Matlab scripts). + |---tests <- QA code. + |---utils <- some utilities (e.g. Matlab scripts). ``` By default, you will be in the 'main' branch of the Git repository, which @@ -567,14 +565,14 @@ readings can be found at our Go to GNSS-SDR's build directory: ``` -$ cd gnss-sdr/build +$ cd gnss-sdr ``` Configure and build the application: ``` -$ cmake .. -$ make +$ cmake -S . -B build +$ cmake --build build ``` By default, CMake will build the Release version, meaning that the compiler will @@ -585,8 +583,8 @@ information about the internals of the receiver, as well as more fine-grained logging. This can be done by building the Debug version, by doing: ``` -$ cmake -DCMAKE_BUILD_TYPE=Debug .. -$ make +$ cmake -S . -B build-debug -DCMAKE_BUILD_TYPE=Debug +$ cmake --build build-debug ``` This will create four executables at gnss-sdr/install, namely `gnss-sdr`, @@ -595,7 +593,7 @@ that folder, but if you prefer to install `gnss-sdr` on your system and have it available anywhere else, do: ``` -$ sudo make install +$ sudo cmake --install build ``` This will also make a copy of the conf/ folder into @@ -607,21 +605,21 @@ You could be interested in creating the documentation (requires: `sudo apt-get install doxygen-latex` in Ubuntu/Debian) by doing: ``` -$ make doc +$ cmake --build build --target doc ``` -from the gnss-sdr/build folder. This will generate HTML documentation that can -be retrieved pointing your browser of preference to build/docs/html/index.html. -If a LaTeX installation is detected in your system, +This will generate HTML documentation that can be retrieved pointing your +browser of preference to `build/docs/html/index.html`. If a LaTeX installation +is detected in your system, ``` -$ make pdfmanual +$ cmake --build build --target pdfmanual ``` will create a PDF manual at build/docs/GNSS-SDR_manual.pdf. Finally, ``` -$ make doc-clean +$ cmake --build build --target doc-clean ``` will remove the content of previously generated documentation. @@ -639,30 +637,6 @@ the function to execute. It mimics GNU Radio's [VOLK](https://www.libvolk.org/) library, so if you still have not run `volk_profile`, this is a good moment to do so. -If you are using [Eclipse](https://www.eclipse.org/ide/) as your development -environment, CMake can create the project for you. However, if the build -directory is a subdirectory of the source directory (as is the case of the -`gnss-sdr/build` folder), this is not supported well by Eclipse. It is strongly -recommended to use a build directory which is a sibling of the source directory. -Hence, type from the `gnss-sdr` root folder: - -``` -$ cd .. -$ mkdir eclipse && cd eclipse -$ cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=TRUE -DCMAKE_ECLIPSE_VERSION=4.5 ../gnss-sdr -``` - -and then import the created project into Eclipse: - -1. Import project using Menu File -> Import. -2. Select General -> Existing projects into workspace. -3. Select your root directory: Browse and select your newly created `eclipse/` - directory. Keep "Copy projects into workspace" unchecked. -4. Click on "Finish" and you will get a fully functional Eclipse project. - -After building the project, you will find the generated binaries at -`eclipse/install`. - #### Build OSMOSDR support (OPTIONAL) Install the [OsmoSDR](https://osmocom.org/projects/sdr "OsmoSDR's Homepage") @@ -691,9 +665,9 @@ $ sudo ldconfig Then, configure GNSS-SDR to build the `Osmosdr_Signal_Source` by: ``` -$ cmake -DENABLE_OSMOSDR=ON .. -$ make -$ sudo make install +$ cmake -S . -B build -DENABLE_OSMOSDR=ON +$ cmake --build build +$ sudo cmake --install build ``` (in order to disable the `Osmosdr_Signal_Source` compilation, you can pass @@ -734,18 +708,18 @@ $ cd ../.. Then configure GNSS-SDR to build the `Fmcomms2_Signal_Source` implementation: ``` -$ cd gnss-sdr/build -$ cmake -DENABLE_FMCOMMS2=ON .. -$ make -$ sudo make install +$ cd gnss-sdr +$ cmake -S . -B build -DENABLE_FMCOMMS2=ON +$ cmake --build build +$ sudo cmake --install build ``` or configure it to build `Plutosdr_Signal_Source`: ``` -$ cmake -DENABLE_PLUTOSDR=ON .. -$ make -$ sudo make install +$ cmake -S . -B build -DENABLE_PLUTOSDR=ON +$ cmake --build build +$ sudo cmake --install build ``` With `Fmcomms2_Signal_Source` you can use any SDR hardware based on @@ -760,9 +734,9 @@ devices. In order to enable the building of blocks that use OpenCL, type: ``` -$ cmake -DENABLE_OPENCL=ON .. -$ make -$ sudo make install +$ cmake -S . -B build -DENABLE_OPENCL=ON +$ cmake --build build +$ sudo cmake --install build ``` #### Build CUDA support (OPTIONAL) @@ -774,9 +748,9 @@ data-parallel computations, first you need to install the CUDA Toolkit from Make sure that the SDK samples build well. Then, build GNSS-SDR by doing: ``` -$ cmake -DENABLE_CUDA=ON .. -$ make -$ sudo make install +$ cmake -S . -B build -DENABLE_CUDA=ON +$ cmake --build build +$ sudo cmake --install build ``` Of course, you will also need a GPU that @@ -879,13 +853,13 @@ non-standard location. If that is the case, you need to inform GNSS-SDR's configuration system by defining the `PYTHON_EXECUTABLE` variable as: ``` -$ cmake -DPYTHON_EXECUTABLE=/path/to/bin/python3 .. +$ cmake -S . -B build -DPYTHON_EXECUTABLE=/path/to/bin/python3 ``` In case you have installed Macports in a non-standard location, you can use: ``` -$ cmake -DCMAKE_PREFIX_PATH=/opt/local -DUSE_MACPORTS_PYTHON=/opt/local/bin/python .. +$ cmake -S . -B build -DCMAKE_PREFIX_PATH=/opt/local -DUSE_MACPORTS_PYTHON=/opt/local/bin/python ``` changing `/opt/local` by the base directory in which your software is installed. @@ -901,17 +875,23 @@ software: ``` $ git clone https://github.com/gnss-sdr/gnss-sdr -$ cd gnss-sdr/build -$ cmake .. -$ make +$ cd gnss-sdr +$ cmake -S . -B build +$ cmake --build build ``` -This will create three executables at gnss-sdr/install, namely `gnss-sdr`, +This will create three executables at `gnss-sdr/install`, namely `gnss-sdr`, `run_tests` and `volk_gnsssdr_profile`. You can install the software receiver on your system by doing: ``` -$ sudo make install +$ sudo cmake --install build +``` + +and uninstall it with: + +``` +$ sudo cmake --build build --target uninstall ``` Note, it is advisable not to run the install step in a homebrew environment. @@ -919,7 +899,7 @@ Note, it is advisable not to run the install step in a homebrew environment. The documentation can be built by: ``` -$ make doc +$ cmake --build build --target doc ``` and can be viewed doing: @@ -994,7 +974,7 @@ $ git pull upstream next ``` Before rebuilding the source code, it is safe (and recommended) to remove the -remainders of old compilations: +remainders of old compilations, _e.g._: ``` $ rm -rf gnss-sdr/build/* diff --git a/build/.gitignore b/build/.gitignore deleted file mode 100644 index 08e486f4d..000000000 --- a/build/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades -# Ignore everything in this directory -* -# Except this file -!.gitignore diff --git a/data/.gitignore b/data/.gitignore deleted file mode 100644 index 08e486f4d..000000000 --- a/data/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2011-2020 Carles Fernandez-Prades -# Ignore everything in this directory -* -# Except this file -!.gitignore diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 290c0e976..c0932fd6f 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -111,6 +111,16 @@ All notable changes to GNSS-SDR will be documented in this file. - Tidy up the `conf/` folder. - Add `install` and `uninstall` targets to the `nav_msg_listener` utility. +- **Potential Breaking Change**: The source tree has been refactored to follow a + more conventional folder structure. This may disrupt user pipelines that + relied on the previous structure and could break development branches that + were branched off from `next` before this change. The key changes are: + + - The `tests` and `utils` directories have been moved from the `src` folder to + the root of the source tree. + - The empty `build` and `data` folders have been removed. Users can create a + building folder using `mkdir build` or by having CMake handle it: + `cmake -S . -B build`. See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index 5545c2bae..ab2f2606b 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -101,10 +101,8 @@ $ git clone https://github.com/gnss-sdr/gnss-sdr This will create a folder named gnss-sdr with the following structure: \verbatim |-gnss-sdr - |---build <- where gnss-sdr is built |---cmake <- CMake-related files |---conf <- Configuration files. Each file represents one receiver. - |---data <- Populate this folder with your captured data. |---docs <- Contains documentation-related files |---install <- Executables |---src <- Source code folder @@ -127,13 +125,13 @@ This will create a folder named gnss-sdr with the following structure: |-------receiver |-------system_parameters |-----main - |-----tests - |-----utils <- some utilities (e.g. Matlab scripts) + |---tests + |---utils <- some utilities (e.g. Matlab scripts) \endverbatim You are now ready to build GNSS-SDR by using CMake as building tool: \verbatim -$ cd gnss-sdr/build +$ cd gnss-sdr && mkdir build && cd build $ cmake .. $ make \endverbatim @@ -153,10 +151,10 @@ You can create the documentation by doing: $ make doc \endverbatim -from the gnss-sdr/build folder. In both cases, Doxygen will generate HTML documentation that can be +from the building folder. In both cases, Doxygen will generate HTML documentation that can be retrieved pointing your browser of preference to gnss-sdr/docs/html/index.html. -There are two more extra targets available. From the gnss-sdr/build folder: +There are two more extra targets available. In the buiding folder: \verbatim $ make doc-clean \endverbatim @@ -177,10 +175,9 @@ By default, CMake will build the Release version, meaning that the compiler will a RF front-end and you need to attain real time. If working with a file (and thus without real-time constraints), you may want to obtain more information about the internals of the receiver, as well as more fine-grained logging. This can be done by building the Debug version, by doing: \verbatim -$ cd gnss-sdr/build +$ cd gnss-sdr && mkdir build-debug && cd build-debug $ cmake -DCMAKE_BUILD_TYPE=Debug .. $ make -$ sudo make install \endverbatim \subsection updating_gnss-sdr Updating GNSS-SDR @@ -191,8 +188,8 @@ $ git pull https://github.com/gnss-sdr/gnss-sdr next \endverbatim Before rebuiling the source code, it is safe (and recommended) to remove the remainders of old builds: \verbatim -$ cd gnss-sdr/build -$ sudo make uninstall +$ cd +$ sudo make uninstall ; if you installed it before $ rm -rf * \endverbatim diff --git a/docs/xml-schemas/README.md b/docs/xml-schemas/README.md index eae9b1a70..1966290f6 100644 --- a/docs/xml-schemas/README.md +++ b/docs/xml-schemas/README.md @@ -51,6 +51,6 @@ Please check https://gnss-sdr.org/docs/sp-blocks/global-parameters/ for more information about the usage of XML files in GNSS-SDR. You could find useful the utility program -[rinex2assist](https://github.com/gnss-sdr/gnss-sdr/tree/next/src/utils/rinex2assist) +[rinex2assist](https://github.com/gnss-sdr/gnss-sdr/tree/next/utils/rinex2assist) for the generation of compatible XML files from recent, publicly available RINEX navigation data files. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ab56014db..7b3c36c7b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -8,7 +8,3 @@ add_subdirectory(algorithms) add_subdirectory(core) add_subdirectory(main) -if(ENABLE_UNIT_TESTING OR ENABLE_SYSTEM_TESTING) - add_subdirectory(tests) -endif() -add_subdirectory(utils) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/.gitignore b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/.gitignore index a3bcb1ddf..e0043b895 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/.gitignore +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/.gitignore @@ -3,16 +3,16 @@ *~ *.pyc *.pyo -html/ -build/ -cmake_build/ -cmake-build-*/ -out/ +*.swp +/*build*/ +/archives/ +/.DS_Store +/gen/volk_gnsssdr_arch_defs.py +/html/ +/out/ .project .cproject .vagrant/ .vscode/ .vs/ -*.swp -/.DS_Store -/gen/volk_gnsssdr_arch_defs.py + diff --git a/src/tests/CMakeLists.txt b/tests/CMakeLists.txt similarity index 98% rename from src/tests/CMakeLists.txt rename to tests/CMakeLists.txt index 770dff763..78171ae9d 100644 --- a/src/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -366,14 +366,14 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) if(CMAKE_VERSION VERSION_GREATER 3.17.0) set(GNSSTK_PATCH_COMMAND cd ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} && - ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${GNSSSDR_SOURCE_DIR}/src/tests/data/gnsstk_static14.patch && - ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/core/lib/GNSSCore/ObsID.hpp < ${GNSSSDR_SOURCE_DIR}/src/tests/data/gnsstk_gcc13.patch + ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${GNSSSDR_SOURCE_DIR}/tests/data/gnsstk_static14.patch && + ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/core/lib/GNSSCore/ObsID.hpp < ${GNSSSDR_SOURCE_DIR}/tests/data/gnsstk_gcc13.patch ) else() set(GNSSTK_PATCH_COMMAND cd ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION} && - ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${GNSSSDR_SOURCE_DIR}/src/tests/data/gnsstk_static13.patch && - ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/core/lib/GNSSCore/ObsID.hpp < ${GNSSSDR_SOURCE_DIR}/src/tests/data/gnsstk_gcc13.patch + ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/CMakeLists.txt < ${GNSSSDR_SOURCE_DIR}/tests/data/gnsstk_static13.patch && + ${Patch_EXECUTABLE} ${GNSSSDR_BINARY_DIR}/thirdparty/gnsstk-${GNSSSDR_GNSSTK_LOCAL_VERSION}/core/lib/GNSSCore/ObsID.hpp < ${GNSSSDR_SOURCE_DIR}/tests/data/gnsstk_gcc13.patch ) endif() # Patch only once @@ -623,12 +623,12 @@ if(NOT ENABLE_PACKAGING) install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat DESTINATION share/gnss-sdr/signal_samples) install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/GPS_L1_CA_ID_1_Fs_4Msps_2ms.dat DESTINATION share/gnss-sdr/signal_samples) install(FILES ${GNSSSDR_BINARY_DIR}/thirdparty/signal_samples/NT1065_GLONASS_L1_20160831_fs6625e6_if0e3_4ms.bin DESTINATION share/gnss-sdr/signal_samples) - install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/obs_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) - install(FILES ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) + install(FILES ${GNSSSDR_SOURCE_DIR}/tests/data/rtklib_test/obs_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) + install(FILES ${GNSSSDR_SOURCE_DIR}/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION share/gnss-sdr/data/rtklib_test) add_definitions(-DTEST_PATH="${CMAKE_INSTALL_PREFIX}/share/gnss-sdr/") else() - file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/obs_test1.xml DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/data/rtklib_test) - file(COPY ${GNSSSDR_SOURCE_DIR}/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/data/rtklib_test) + file(COPY ${GNSSSDR_SOURCE_DIR}/tests/data/rtklib_test/obs_test1.xml DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/data/rtklib_test) + file(COPY ${GNSSSDR_SOURCE_DIR}/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml DESTINATION ${GNSSSDR_BINARY_DIR}/thirdparty/data/rtklib_test) add_definitions(-DTEST_PATH="${GNSSSDR_BINARY_DIR}/thirdparty/") endif() endif() @@ -687,7 +687,7 @@ if(ENABLE_UNIT_TESTING) endif() target_include_directories(run_tests INTERFACE - ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/tests/common-files ) if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(run_tests @@ -838,7 +838,7 @@ if(ENABLE_FPGA) target_link_libraries(gps_l1_ca_dll_pll_tracking_test_fpga INTERFACE "$") endif() target_include_directories(gps_l1_ca_dll_pll_tracking_test_fpga - INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + INTERFACE ${GNSSSDR_SOURCE_DIR}/tests/common-files ) xcode_remove_warning_duplicates(gps_l1_ca_dll_pll_tracking_test_fpga) install(TARGETS gps_l1_ca_dll_pll_tracking_test_fpga @@ -873,7 +873,7 @@ function(add_system_test executable) endif() target_include_directories(${executable} PRIVATE ${OPT_INCLUDES_} - INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + INTERFACE ${GNSSSDR_SOURCE_DIR}/tests/common-files ) target_link_libraries(${executable} PRIVATE ${OPT_LIBS_} algorithms_libs) if(NOT ENABLE_GLOG_AND_GFLAGS) @@ -1098,7 +1098,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) target_include_directories(gnss_block_test PRIVATE ${GNSSSDR_SOURCE_DIR}/src/algorithms/libs - INTERFACE ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + INTERFACE ${GNSSSDR_SOURCE_DIR}/tests/common-files ) if(ENABLE_FPGA) @@ -1188,7 +1188,7 @@ endif() target_include_directories(matio_test INTERFACE - ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/tests/common-files ) xcode_remove_warning_duplicates(matio_test) @@ -1238,7 +1238,7 @@ if(NOT ENABLE_PACKAGING AND NOT ENABLE_FPGA) endif() target_include_directories(acq_test INTERFACE - ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/tests/common-files ) if(PMT_USES_BOOST_ANY) target_compile_definitions(acq_test diff --git a/src/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt similarity index 100% rename from src/tests/benchmarks/CMakeLists.txt rename to tests/benchmarks/CMakeLists.txt diff --git a/src/tests/benchmarks/README.md b/tests/benchmarks/README.md similarity index 100% rename from src/tests/benchmarks/README.md rename to tests/benchmarks/README.md diff --git a/src/tests/benchmarks/benchmark_atan2.cc b/tests/benchmarks/benchmark_atan2.cc similarity index 100% rename from src/tests/benchmarks/benchmark_atan2.cc rename to tests/benchmarks/benchmark_atan2.cc diff --git a/src/tests/benchmarks/benchmark_copy.cc b/tests/benchmarks/benchmark_copy.cc similarity index 100% rename from src/tests/benchmarks/benchmark_copy.cc rename to tests/benchmarks/benchmark_copy.cc diff --git a/src/tests/benchmarks/benchmark_crypto.cc b/tests/benchmarks/benchmark_crypto.cc similarity index 100% rename from src/tests/benchmarks/benchmark_crypto.cc rename to tests/benchmarks/benchmark_crypto.cc diff --git a/src/tests/benchmarks/benchmark_detector.cc b/tests/benchmarks/benchmark_detector.cc similarity index 100% rename from src/tests/benchmarks/benchmark_detector.cc rename to tests/benchmarks/benchmark_detector.cc diff --git a/src/tests/benchmarks/benchmark_osnma.cc b/tests/benchmarks/benchmark_osnma.cc similarity index 100% rename from src/tests/benchmarks/benchmark_osnma.cc rename to tests/benchmarks/benchmark_osnma.cc diff --git a/src/tests/benchmarks/benchmark_preamble.cc b/tests/benchmarks/benchmark_preamble.cc similarity index 100% rename from src/tests/benchmarks/benchmark_preamble.cc rename to tests/benchmarks/benchmark_preamble.cc diff --git a/src/tests/benchmarks/benchmark_reed_solomon.cc b/tests/benchmarks/benchmark_reed_solomon.cc similarity index 100% rename from src/tests/benchmarks/benchmark_reed_solomon.cc rename to tests/benchmarks/benchmark_reed_solomon.cc diff --git a/src/tests/common-files/gnuplot_i.h b/tests/common-files/gnuplot_i.h similarity index 100% rename from src/tests/common-files/gnuplot_i.h rename to tests/common-files/gnuplot_i.h diff --git a/src/tests/common-files/observable_tests_flags.h b/tests/common-files/observable_tests_flags.h similarity index 100% rename from src/tests/common-files/observable_tests_flags.h rename to tests/common-files/observable_tests_flags.h diff --git a/src/tests/common-files/signal_generator_flags.h b/tests/common-files/signal_generator_flags.h similarity index 100% rename from src/tests/common-files/signal_generator_flags.h rename to tests/common-files/signal_generator_flags.h diff --git a/src/tests/common-files/test_flags.h b/tests/common-files/test_flags.h similarity index 100% rename from src/tests/common-files/test_flags.h rename to tests/common-files/test_flags.h diff --git a/src/tests/common-files/tracking_tests_flags.h b/tests/common-files/tracking_tests_flags.h similarity index 100% rename from src/tests/common-files/tracking_tests_flags.h rename to tests/common-files/tracking_tests_flags.h diff --git a/src/tests/data/config_file_sample.txt b/tests/data/config_file_sample.txt similarity index 100% rename from src/tests/data/config_file_sample.txt rename to tests/data/config_file_sample.txt diff --git a/src/tests/data/gnsstk_gcc13.patch b/tests/data/gnsstk_gcc13.patch similarity index 100% rename from src/tests/data/gnsstk_gcc13.patch rename to tests/data/gnsstk_gcc13.patch diff --git a/src/tests/data/gnsstk_static13.patch b/tests/data/gnsstk_static13.patch similarity index 100% rename from src/tests/data/gnsstk_static13.patch rename to tests/data/gnsstk_static13.patch diff --git a/src/tests/data/gnsstk_static14.patch b/tests/data/gnsstk_static14.patch similarity index 100% rename from src/tests/data/gnsstk_static14.patch rename to tests/data/gnsstk_static14.patch diff --git a/src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml b/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml similarity index 100% rename from src/tests/data/rtklib_test/eph_GPS_L1CA_test1.xml rename to tests/data/rtklib_test/eph_GPS_L1CA_test1.xml diff --git a/src/tests/data/rtklib_test/obs_test1.xml b/tests/data/rtklib_test/obs_test1.xml similarity index 100% rename from src/tests/data/rtklib_test/obs_test1.xml rename to tests/data/rtklib_test/obs_test1.xml diff --git a/src/tests/single_test_main.cc b/tests/single_test_main.cc similarity index 100% rename from src/tests/single_test_main.cc rename to tests/single_test_main.cc diff --git a/src/tests/system-tests/libs/CMakeLists.txt b/tests/system-tests/libs/CMakeLists.txt similarity index 100% rename from src/tests/system-tests/libs/CMakeLists.txt rename to tests/system-tests/libs/CMakeLists.txt diff --git a/src/tests/system-tests/libs/position_test_flags.h b/tests/system-tests/libs/position_test_flags.h similarity index 100% rename from src/tests/system-tests/libs/position_test_flags.h rename to tests/system-tests/libs/position_test_flags.h diff --git a/src/tests/system-tests/libs/rtklib_solver_dump_reader.cc b/tests/system-tests/libs/rtklib_solver_dump_reader.cc similarity index 100% rename from src/tests/system-tests/libs/rtklib_solver_dump_reader.cc rename to tests/system-tests/libs/rtklib_solver_dump_reader.cc diff --git a/src/tests/system-tests/libs/rtklib_solver_dump_reader.h b/tests/system-tests/libs/rtklib_solver_dump_reader.h similarity index 100% rename from src/tests/system-tests/libs/rtklib_solver_dump_reader.h rename to tests/system-tests/libs/rtklib_solver_dump_reader.h diff --git a/src/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc b/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc similarity index 100% rename from src/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc rename to tests/system-tests/libs/spirent_motion_csv_dump_reader.cc diff --git a/src/tests/system-tests/libs/spirent_motion_csv_dump_reader.h b/tests/system-tests/libs/spirent_motion_csv_dump_reader.h similarity index 100% rename from src/tests/system-tests/libs/spirent_motion_csv_dump_reader.h rename to tests/system-tests/libs/spirent_motion_csv_dump_reader.h diff --git a/src/tests/system-tests/position_test.cc b/tests/system-tests/position_test.cc similarity index 100% rename from src/tests/system-tests/position_test.cc rename to tests/system-tests/position_test.cc diff --git a/src/tests/system-tests/ttff.cc b/tests/system-tests/ttff.cc similarity index 100% rename from src/tests/system-tests/ttff.cc rename to tests/system-tests/ttff.cc diff --git a/src/tests/test_main.cc b/tests/test_main.cc similarity index 100% rename from src/tests/test_main.cc rename to tests/test_main.cc diff --git a/src/tests/unit-tests/arithmetic/code_generation_test.cc b/tests/unit-tests/arithmetic/code_generation_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/code_generation_test.cc rename to tests/unit-tests/arithmetic/code_generation_test.cc diff --git a/src/tests/unit-tests/arithmetic/complex_carrier_test.cc b/tests/unit-tests/arithmetic/complex_carrier_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/complex_carrier_test.cc rename to tests/unit-tests/arithmetic/complex_carrier_test.cc diff --git a/src/tests/unit-tests/arithmetic/conjugate_test.cc b/tests/unit-tests/arithmetic/conjugate_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/conjugate_test.cc rename to tests/unit-tests/arithmetic/conjugate_test.cc diff --git a/src/tests/unit-tests/arithmetic/fft_length_test.cc b/tests/unit-tests/arithmetic/fft_length_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/fft_length_test.cc rename to tests/unit-tests/arithmetic/fft_length_test.cc diff --git a/src/tests/unit-tests/arithmetic/fft_speed_test.cc b/tests/unit-tests/arithmetic/fft_speed_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/fft_speed_test.cc rename to tests/unit-tests/arithmetic/fft_speed_test.cc diff --git a/src/tests/unit-tests/arithmetic/magnitude_squared_test.cc b/tests/unit-tests/arithmetic/magnitude_squared_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/magnitude_squared_test.cc rename to tests/unit-tests/arithmetic/magnitude_squared_test.cc diff --git a/src/tests/unit-tests/arithmetic/matio_test.cc b/tests/unit-tests/arithmetic/matio_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/matio_test.cc rename to tests/unit-tests/arithmetic/matio_test.cc diff --git a/src/tests/unit-tests/arithmetic/multiply_test.cc b/tests/unit-tests/arithmetic/multiply_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/multiply_test.cc rename to tests/unit-tests/arithmetic/multiply_test.cc diff --git a/src/tests/unit-tests/arithmetic/preamble_correlator_test.cc b/tests/unit-tests/arithmetic/preamble_correlator_test.cc similarity index 100% rename from src/tests/unit-tests/arithmetic/preamble_correlator_test.cc rename to tests/unit-tests/arithmetic/preamble_correlator_test.cc diff --git a/src/tests/unit-tests/control-plane/control_thread_test.cc b/tests/unit-tests/control-plane/control_thread_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/control_thread_test.cc rename to tests/unit-tests/control-plane/control_thread_test.cc diff --git a/src/tests/unit-tests/control-plane/file_configuration_test.cc b/tests/unit-tests/control-plane/file_configuration_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/file_configuration_test.cc rename to tests/unit-tests/control-plane/file_configuration_test.cc diff --git a/src/tests/unit-tests/control-plane/gnss_block_factory_test.cc b/tests/unit-tests/control-plane/gnss_block_factory_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/gnss_block_factory_test.cc rename to tests/unit-tests/control-plane/gnss_block_factory_test.cc diff --git a/src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc b/tests/unit-tests/control-plane/gnss_flowgraph_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/gnss_flowgraph_test.cc rename to tests/unit-tests/control-plane/gnss_flowgraph_test.cc diff --git a/src/tests/unit-tests/control-plane/in_memory_configuration_test.cc b/tests/unit-tests/control-plane/in_memory_configuration_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/in_memory_configuration_test.cc rename to tests/unit-tests/control-plane/in_memory_configuration_test.cc diff --git a/src/tests/unit-tests/control-plane/protobuf_test.cc b/tests/unit-tests/control-plane/protobuf_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/protobuf_test.cc rename to tests/unit-tests/control-plane/protobuf_test.cc diff --git a/src/tests/unit-tests/control-plane/string_converter_test.cc b/tests/unit-tests/control-plane/string_converter_test.cc similarity index 100% rename from src/tests/unit-tests/control-plane/string_converter_test.cc rename to tests/unit-tests/control-plane/string_converter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test_fpga.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test_fpga.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc rename to tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc b/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc rename to tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc b/tests/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc rename to tests/unit-tests/signal-processing-blocks/adapter/pass_through_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc b/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc rename to tests/unit-tests/signal-processing-blocks/filter/fir_filter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc b/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc rename to tests/unit-tests/signal-processing-blocks/filter/notch_filter_lite_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc b/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc rename to tests/unit-tests/signal-processing-blocks/filter/notch_filter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc b/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc rename to tests/unit-tests/signal-processing-blocks/filter/pulse_blanking_filter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt similarity index 98% rename from src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt rename to tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 32a81ee01..54d27bcc3 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -55,7 +55,7 @@ target_include_directories(signal_processing_testing_lib PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces INTERFACE - ${GNSSSDR_SOURCE_DIR}/src/tests/common-files + ${GNSSSDR_SOURCE_DIR}/tests/common-files ) if(USE_GENERIC_LAMBDAS) diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc b/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc rename to tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h b/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h rename to tests/unit-tests/signal-processing-blocks/libs/acquisition_dump_reader.h diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc b/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc rename to tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h b/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h rename to tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc b/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc rename to tests/unit-tests/signal-processing-blocks/libs/item_type_helpers_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc b/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc rename to tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h b/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h rename to tests/unit-tests/signal-processing-blocks/libs/observables_dump_reader.h diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc b/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc rename to tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h b/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h rename to tests/unit-tests/signal-processing-blocks/libs/tlm_dump_reader.h diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc b/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc rename to tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h b/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h rename to tests/unit-tests/signal-processing-blocks/libs/tracking_dump_reader.h diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc b/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc rename to tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h b/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h rename to tests/unit-tests/signal-processing-blocks/libs/tracking_true_obs_reader.h diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc b/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc rename to tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.h b/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.h similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.h rename to tests/unit-tests/signal-processing-blocks/libs/true_observables_reader.h diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc rename to tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc rename to tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc b/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc rename to tests/unit-tests/signal-processing-blocks/osnma/gnss_crypto_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc rename to tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc b/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc rename to tests/unit-tests/signal-processing-blocks/osnma/osnma_test_vectors.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/geohash_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/geohash_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/geohash_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/geohash_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/nmea_printer_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/rinex_printer_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/rtcm_printer_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/rtcm_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc rename to tests/unit-tests/signal-processing-blocks/pvt/serdes_monitor_pvt_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc b/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc rename to tests/unit-tests/signal-processing-blocks/resampler/direct_resampler_conditioner_cc_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc b/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc rename to tests/unit-tests/signal-processing-blocks/resampler/mmse_resampler_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc b/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc rename to tests/unit-tests/signal-processing-blocks/sources/file_signal_source_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc b/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc rename to tests/unit-tests/signal-processing-blocks/sources/gnss_sdr_valve_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc b/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc rename to tests/unit-tests/signal-processing-blocks/sources/unpack_2bit_samples_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc b/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc rename to tests/unit-tests/signal-processing-blocks/telemetry_decoder/galileo_fnav_inav_decoder_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc rename to tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/bayesian_estimation_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/discriminator_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/discriminator_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/discriminator_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/discriminator_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc rename to tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc rename to tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc diff --git a/src/tests/unit-tests/signal-processing-blocks/tracking/unscented_filter_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/unscented_filter_test.cc similarity index 100% rename from src/tests/unit-tests/signal-processing-blocks/tracking/unscented_filter_test.cc rename to tests/unit-tests/signal-processing-blocks/tracking/unscented_filter_test.cc diff --git a/src/tests/unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc b/tests/unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc rename to tests/unit-tests/system-parameters/galileo_e1b_reed_solomon_test.cc diff --git a/src/tests/unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc b/tests/unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc rename to tests/unit-tests/system-parameters/galileo_e6b_reed_solomon_test.cc diff --git a/src/tests/unit-tests/system-parameters/galileo_ism_test.cc b/tests/unit-tests/system-parameters/galileo_ism_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/galileo_ism_test.cc rename to tests/unit-tests/system-parameters/galileo_ism_test.cc diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc b/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc rename to tests/unit-tests/system-parameters/glonass_gnav_crc_test.cc diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc b/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc rename to tests/unit-tests/system-parameters/glonass_gnav_ephemeris_test.cc diff --git a/src/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc b/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc rename to tests/unit-tests/system-parameters/glonass_gnav_nav_message_test.cc diff --git a/src/tests/unit-tests/system-parameters/has_decoding_test.cc b/tests/unit-tests/system-parameters/has_decoding_test.cc similarity index 100% rename from src/tests/unit-tests/system-parameters/has_decoding_test.cc rename to tests/unit-tests/system-parameters/has_decoding_test.cc diff --git a/src/utils/CMakeLists.txt b/utils/CMakeLists.txt similarity index 100% rename from src/utils/CMakeLists.txt rename to utils/CMakeLists.txt diff --git a/src/utils/front-end-cal/CMakeLists.txt b/utils/front-end-cal/CMakeLists.txt similarity index 100% rename from src/utils/front-end-cal/CMakeLists.txt rename to utils/front-end-cal/CMakeLists.txt diff --git a/src/utils/front-end-cal/front_end_cal.cc b/utils/front-end-cal/front_end_cal.cc similarity index 100% rename from src/utils/front-end-cal/front_end_cal.cc rename to utils/front-end-cal/front_end_cal.cc diff --git a/src/utils/front-end-cal/front_end_cal.h b/utils/front-end-cal/front_end_cal.h similarity index 100% rename from src/utils/front-end-cal/front_end_cal.h rename to utils/front-end-cal/front_end_cal.h diff --git a/src/utils/front-end-cal/main.cc b/utils/front-end-cal/main.cc similarity index 100% rename from src/utils/front-end-cal/main.cc rename to utils/front-end-cal/main.cc diff --git a/src/utils/matlab/dll_pll_veml_plot_sample.m b/utils/matlab/dll_pll_veml_plot_sample.m similarity index 100% rename from src/utils/matlab/dll_pll_veml_plot_sample.m rename to utils/matlab/dll_pll_veml_plot_sample.m diff --git a/src/utils/matlab/gps_l1_ca_kf_plot_sample.m b/utils/matlab/gps_l1_ca_kf_plot_sample.m similarity index 100% rename from src/utils/matlab/gps_l1_ca_kf_plot_sample.m rename to utils/matlab/gps_l1_ca_kf_plot_sample.m diff --git a/src/utils/matlab/gps_l1_ca_pvt_plot_sample_agilent_cap2.m b/utils/matlab/gps_l1_ca_pvt_plot_sample_agilent_cap2.m similarity index 100% rename from src/utils/matlab/gps_l1_ca_pvt_plot_sample_agilent_cap2.m rename to utils/matlab/gps_l1_ca_pvt_plot_sample_agilent_cap2.m diff --git a/src/utils/matlab/gps_l1_ca_pvt_raw_plot_sample.m b/utils/matlab/gps_l1_ca_pvt_raw_plot_sample.m similarity index 100% rename from src/utils/matlab/gps_l1_ca_pvt_raw_plot_sample.m rename to utils/matlab/gps_l1_ca_pvt_raw_plot_sample.m diff --git a/src/utils/matlab/gps_l1_ca_telemetry_plot_sample.m b/utils/matlab/gps_l1_ca_telemetry_plot_sample.m similarity index 100% rename from src/utils/matlab/gps_l1_ca_telemetry_plot_sample.m rename to utils/matlab/gps_l1_ca_telemetry_plot_sample.m diff --git a/src/utils/matlab/help_script1.m b/utils/matlab/help_script1.m similarity index 100% rename from src/utils/matlab/help_script1.m rename to utils/matlab/help_script1.m diff --git a/src/utils/matlab/help_script2.m b/utils/matlab/help_script2.m similarity index 100% rename from src/utils/matlab/help_script2.m rename to utils/matlab/help_script2.m diff --git a/src/utils/matlab/hybrid_observables_plot_sample.m b/utils/matlab/hybrid_observables_plot_sample.m similarity index 100% rename from src/utils/matlab/hybrid_observables_plot_sample.m rename to utils/matlab/hybrid_observables_plot_sample.m diff --git a/src/utils/matlab/libs/dll_pll_veml_read_tracking_dump.m b/utils/matlab/libs/dll_pll_veml_read_tracking_dump.m similarity index 100% rename from src/utils/matlab/libs/dll_pll_veml_read_tracking_dump.m rename to utils/matlab/libs/dll_pll_veml_read_tracking_dump.m diff --git a/src/utils/matlab/libs/geoFunctions/cart2geo.m b/utils/matlab/libs/geoFunctions/cart2geo.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/cart2geo.m rename to utils/matlab/libs/geoFunctions/cart2geo.m diff --git a/src/utils/matlab/libs/geoFunctions/cart2utm.m b/utils/matlab/libs/geoFunctions/cart2utm.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/cart2utm.m rename to utils/matlab/libs/geoFunctions/cart2utm.m diff --git a/src/utils/matlab/libs/geoFunctions/check_t.m b/utils/matlab/libs/geoFunctions/check_t.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/check_t.m rename to utils/matlab/libs/geoFunctions/check_t.m diff --git a/src/utils/matlab/libs/geoFunctions/clksin.m b/utils/matlab/libs/geoFunctions/clksin.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/clksin.m rename to utils/matlab/libs/geoFunctions/clksin.m diff --git a/src/utils/matlab/libs/geoFunctions/clsin.m b/utils/matlab/libs/geoFunctions/clsin.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/clsin.m rename to utils/matlab/libs/geoFunctions/clsin.m diff --git a/src/utils/matlab/libs/geoFunctions/deg2dms.m b/utils/matlab/libs/geoFunctions/deg2dms.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/deg2dms.m rename to utils/matlab/libs/geoFunctions/deg2dms.m diff --git a/src/utils/matlab/libs/geoFunctions/dms2deg.m b/utils/matlab/libs/geoFunctions/dms2deg.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/dms2deg.m rename to utils/matlab/libs/geoFunctions/dms2deg.m diff --git a/src/utils/matlab/libs/geoFunctions/dms2mat.m b/utils/matlab/libs/geoFunctions/dms2mat.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/dms2mat.m rename to utils/matlab/libs/geoFunctions/dms2mat.m diff --git a/src/utils/matlab/libs/geoFunctions/e_r_corr.m b/utils/matlab/libs/geoFunctions/e_r_corr.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/e_r_corr.m rename to utils/matlab/libs/geoFunctions/e_r_corr.m diff --git a/src/utils/matlab/libs/geoFunctions/findUtmZone.m b/utils/matlab/libs/geoFunctions/findUtmZone.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/findUtmZone.m rename to utils/matlab/libs/geoFunctions/findUtmZone.m diff --git a/src/utils/matlab/libs/geoFunctions/geo2cart.m b/utils/matlab/libs/geoFunctions/geo2cart.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/geo2cart.m rename to utils/matlab/libs/geoFunctions/geo2cart.m diff --git a/src/utils/matlab/libs/geoFunctions/leastSquarePos.m b/utils/matlab/libs/geoFunctions/leastSquarePos.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/leastSquarePos.m rename to utils/matlab/libs/geoFunctions/leastSquarePos.m diff --git a/src/utils/matlab/libs/geoFunctions/mat2dms.m b/utils/matlab/libs/geoFunctions/mat2dms.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/mat2dms.m rename to utils/matlab/libs/geoFunctions/mat2dms.m diff --git a/src/utils/matlab/libs/geoFunctions/roundn.m b/utils/matlab/libs/geoFunctions/roundn.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/roundn.m rename to utils/matlab/libs/geoFunctions/roundn.m diff --git a/src/utils/matlab/libs/geoFunctions/satpos.m b/utils/matlab/libs/geoFunctions/satpos.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/satpos.m rename to utils/matlab/libs/geoFunctions/satpos.m diff --git a/src/utils/matlab/libs/geoFunctions/togeod.m b/utils/matlab/libs/geoFunctions/togeod.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/togeod.m rename to utils/matlab/libs/geoFunctions/togeod.m diff --git a/src/utils/matlab/libs/geoFunctions/topocent.m b/utils/matlab/libs/geoFunctions/topocent.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/topocent.m rename to utils/matlab/libs/geoFunctions/topocent.m diff --git a/src/utils/matlab/libs/geoFunctions/tropo.m b/utils/matlab/libs/geoFunctions/tropo.m similarity index 100% rename from src/utils/matlab/libs/geoFunctions/tropo.m rename to utils/matlab/libs/geoFunctions/tropo.m diff --git a/src/utils/matlab/libs/gps_l1_ca_dll_pll_read_tracking_dump.m b/utils/matlab/libs/gps_l1_ca_dll_pll_read_tracking_dump.m similarity index 100% rename from src/utils/matlab/libs/gps_l1_ca_dll_pll_read_tracking_dump.m rename to utils/matlab/libs/gps_l1_ca_dll_pll_read_tracking_dump.m diff --git a/src/utils/matlab/libs/gps_l1_ca_kf_read_tracking_dump.m b/utils/matlab/libs/gps_l1_ca_kf_read_tracking_dump.m similarity index 100% rename from src/utils/matlab/libs/gps_l1_ca_kf_read_tracking_dump.m rename to utils/matlab/libs/gps_l1_ca_kf_read_tracking_dump.m diff --git a/src/utils/matlab/libs/gps_l1_ca_pvt_read_pvt_dump.m b/utils/matlab/libs/gps_l1_ca_pvt_read_pvt_dump.m similarity index 100% rename from src/utils/matlab/libs/gps_l1_ca_pvt_read_pvt_dump.m rename to utils/matlab/libs/gps_l1_ca_pvt_read_pvt_dump.m diff --git a/src/utils/matlab/libs/gps_l1_ca_read_pvt_raw_dump.m b/utils/matlab/libs/gps_l1_ca_read_pvt_raw_dump.m similarity index 100% rename from src/utils/matlab/libs/gps_l1_ca_read_pvt_raw_dump.m rename to utils/matlab/libs/gps_l1_ca_read_pvt_raw_dump.m diff --git a/src/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m b/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m similarity index 100% rename from src/utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m rename to utils/matlab/libs/gps_l1_ca_read_telemetry_dump.m diff --git a/src/utils/matlab/libs/plotKalman.m b/utils/matlab/libs/plotKalman.m similarity index 100% rename from src/utils/matlab/libs/plotKalman.m rename to utils/matlab/libs/plotKalman.m diff --git a/src/utils/matlab/libs/plotNavigation.m b/utils/matlab/libs/plotNavigation.m similarity index 100% rename from src/utils/matlab/libs/plotNavigation.m rename to utils/matlab/libs/plotNavigation.m diff --git a/src/utils/matlab/libs/plotTracking.m b/utils/matlab/libs/plotTracking.m similarity index 100% rename from src/utils/matlab/libs/plotTracking.m rename to utils/matlab/libs/plotTracking.m diff --git a/src/utils/matlab/libs/plotVEMLTracking.m b/utils/matlab/libs/plotVEMLTracking.m similarity index 100% rename from src/utils/matlab/libs/plotVEMLTracking.m rename to utils/matlab/libs/plotVEMLTracking.m diff --git a/src/utils/matlab/libs/quantize_signal.m b/utils/matlab/libs/quantize_signal.m similarity index 100% rename from src/utils/matlab/libs/quantize_signal.m rename to utils/matlab/libs/quantize_signal.m diff --git a/src/utils/matlab/libs/read_complex_binary.m b/utils/matlab/libs/read_complex_binary.m similarity index 100% rename from src/utils/matlab/libs/read_complex_binary.m rename to utils/matlab/libs/read_complex_binary.m diff --git a/src/utils/matlab/libs/read_complex_char_binary.m b/utils/matlab/libs/read_complex_char_binary.m similarity index 100% rename from src/utils/matlab/libs/read_complex_char_binary.m rename to utils/matlab/libs/read_complex_char_binary.m diff --git a/src/utils/matlab/libs/read_complex_short_binary.m b/utils/matlab/libs/read_complex_short_binary.m similarity index 100% rename from src/utils/matlab/libs/read_complex_short_binary.m rename to utils/matlab/libs/read_complex_short_binary.m diff --git a/src/utils/matlab/libs/read_hybrid_observables_dump.m b/utils/matlab/libs/read_hybrid_observables_dump.m similarity index 100% rename from src/utils/matlab/libs/read_hybrid_observables_dump.m rename to utils/matlab/libs/read_hybrid_observables_dump.m diff --git a/src/utils/matlab/libs/read_true_sim_observables_dump.m b/utils/matlab/libs/read_true_sim_observables_dump.m similarity index 100% rename from src/utils/matlab/libs/read_true_sim_observables_dump.m rename to utils/matlab/libs/read_true_sim_observables_dump.m diff --git a/src/utils/matlab/plotTrackingE5a.m b/utils/matlab/plotTrackingE5a.m similarity index 100% rename from src/utils/matlab/plotTrackingE5a.m rename to utils/matlab/plotTrackingE5a.m diff --git a/src/utils/matlab/plot_acq_grid.m b/utils/matlab/plot_acq_grid.m similarity index 100% rename from src/utils/matlab/plot_acq_grid.m rename to utils/matlab/plot_acq_grid.m diff --git a/src/utils/matlab/plot_acq_grid_gsoc.m b/utils/matlab/plot_acq_grid_gsoc.m similarity index 100% rename from src/utils/matlab/plot_acq_grid_gsoc.m rename to utils/matlab/plot_acq_grid_gsoc.m diff --git a/src/utils/matlab/plot_acq_grid_gsoc_e5.m b/utils/matlab/plot_acq_grid_gsoc_e5.m similarity index 100% rename from src/utils/matlab/plot_acq_grid_gsoc_e5.m rename to utils/matlab/plot_acq_grid_gsoc_e5.m diff --git a/src/utils/matlab/plot_acq_grid_gsoc_glonass.m b/utils/matlab/plot_acq_grid_gsoc_glonass.m similarity index 100% rename from src/utils/matlab/plot_acq_grid_gsoc_glonass.m rename to utils/matlab/plot_acq_grid_gsoc_glonass.m diff --git a/src/utils/matlab/plot_tracking_quality_indicators.m b/utils/matlab/plot_tracking_quality_indicators.m similarity index 100% rename from src/utils/matlab/plot_tracking_quality_indicators.m rename to utils/matlab/plot_tracking_quality_indicators.m diff --git a/src/utils/nav-listener/CMakeLists.txt b/utils/nav-listener/CMakeLists.txt similarity index 100% rename from src/utils/nav-listener/CMakeLists.txt rename to utils/nav-listener/CMakeLists.txt diff --git a/src/utils/nav-listener/README.md b/utils/nav-listener/README.md similarity index 100% rename from src/utils/nav-listener/README.md rename to utils/nav-listener/README.md diff --git a/src/utils/nav-listener/cmake/cmake_uninstall.cmake.in b/utils/nav-listener/cmake/cmake_uninstall.cmake.in similarity index 100% rename from src/utils/nav-listener/cmake/cmake_uninstall.cmake.in rename to utils/nav-listener/cmake/cmake_uninstall.cmake.in diff --git a/src/utils/nav-listener/main.cc b/utils/nav-listener/main.cc similarity index 100% rename from src/utils/nav-listener/main.cc rename to utils/nav-listener/main.cc diff --git a/src/utils/nav-listener/nav_message.proto b/utils/nav-listener/nav_message.proto similarity index 100% rename from src/utils/nav-listener/nav_message.proto rename to utils/nav-listener/nav_message.proto diff --git a/src/utils/nav-listener/nav_msg_udp_listener.cc b/utils/nav-listener/nav_msg_udp_listener.cc similarity index 100% rename from src/utils/nav-listener/nav_msg_udp_listener.cc rename to utils/nav-listener/nav_msg_udp_listener.cc diff --git a/src/utils/nav-listener/nav_msg_udp_listener.h b/utils/nav-listener/nav_msg_udp_listener.h similarity index 100% rename from src/utils/nav-listener/nav_msg_udp_listener.h rename to utils/nav-listener/nav_msg_udp_listener.h diff --git a/src/utils/python/dll_pll_veml_plot_sample.py b/utils/python/dll_pll_veml_plot_sample.py similarity index 100% rename from src/utils/python/dll_pll_veml_plot_sample.py rename to utils/python/dll_pll_veml_plot_sample.py diff --git a/src/utils/python/gps_l1_ca_kf_plot_sample.py b/utils/python/gps_l1_ca_kf_plot_sample.py similarity index 100% rename from src/utils/python/gps_l1_ca_kf_plot_sample.py rename to utils/python/gps_l1_ca_kf_plot_sample.py diff --git a/src/utils/python/gps_l1_ca_pvt_raw_plot_sample.py b/utils/python/gps_l1_ca_pvt_raw_plot_sample.py similarity index 100% rename from src/utils/python/gps_l1_ca_pvt_raw_plot_sample.py rename to utils/python/gps_l1_ca_pvt_raw_plot_sample.py diff --git a/src/utils/python/gps_l1_ca_telemetry_plot_sample.py b/utils/python/gps_l1_ca_telemetry_plot_sample.py similarity index 100% rename from src/utils/python/gps_l1_ca_telemetry_plot_sample.py rename to utils/python/gps_l1_ca_telemetry_plot_sample.py diff --git a/src/utils/python/hybrid_observables_plot_sample.py b/utils/python/hybrid_observables_plot_sample.py similarity index 100% rename from src/utils/python/hybrid_observables_plot_sample.py rename to utils/python/hybrid_observables_plot_sample.py diff --git a/src/utils/python/lib/dll_pll_veml_read_tracking_dump.py b/utils/python/lib/dll_pll_veml_read_tracking_dump.py similarity index 100% rename from src/utils/python/lib/dll_pll_veml_read_tracking_dump.py rename to utils/python/lib/dll_pll_veml_read_tracking_dump.py diff --git a/src/utils/python/lib/gps_l1_ca_kf_read_tracking_dump.py b/utils/python/lib/gps_l1_ca_kf_read_tracking_dump.py similarity index 100% rename from src/utils/python/lib/gps_l1_ca_kf_read_tracking_dump.py rename to utils/python/lib/gps_l1_ca_kf_read_tracking_dump.py diff --git a/src/utils/python/lib/gps_l1_ca_read_pvt_dump.py b/utils/python/lib/gps_l1_ca_read_pvt_dump.py similarity index 100% rename from src/utils/python/lib/gps_l1_ca_read_pvt_dump.py rename to utils/python/lib/gps_l1_ca_read_pvt_dump.py diff --git a/src/utils/python/lib/gps_l1_ca_read_telemetry_dump.py b/utils/python/lib/gps_l1_ca_read_telemetry_dump.py similarity index 100% rename from src/utils/python/lib/gps_l1_ca_read_telemetry_dump.py rename to utils/python/lib/gps_l1_ca_read_telemetry_dump.py diff --git a/src/utils/python/lib/plotKalman.py b/utils/python/lib/plotKalman.py similarity index 100% rename from src/utils/python/lib/plotKalman.py rename to utils/python/lib/plotKalman.py diff --git a/src/utils/python/lib/plotNavigation.py b/utils/python/lib/plotNavigation.py similarity index 100% rename from src/utils/python/lib/plotNavigation.py rename to utils/python/lib/plotNavigation.py diff --git a/src/utils/python/lib/plotPosition.py b/utils/python/lib/plotPosition.py similarity index 100% rename from src/utils/python/lib/plotPosition.py rename to utils/python/lib/plotPosition.py diff --git a/src/utils/python/lib/plotTracking.py b/utils/python/lib/plotTracking.py similarity index 100% rename from src/utils/python/lib/plotTracking.py rename to utils/python/lib/plotTracking.py diff --git a/src/utils/python/lib/plotVEMLTracking.py b/utils/python/lib/plotVEMLTracking.py similarity index 100% rename from src/utils/python/lib/plotVEMLTracking.py rename to utils/python/lib/plotVEMLTracking.py diff --git a/src/utils/python/lib/read_hybrid_observables_dump.py b/utils/python/lib/read_hybrid_observables_dump.py similarity index 100% rename from src/utils/python/lib/read_hybrid_observables_dump.py rename to utils/python/lib/read_hybrid_observables_dump.py diff --git a/src/utils/python/plot_acq_grid.py b/utils/python/plot_acq_grid.py similarity index 100% rename from src/utils/python/plot_acq_grid.py rename to utils/python/plot_acq_grid.py diff --git a/src/utils/python/plot_tracking_quality_indicators.py b/utils/python/plot_tracking_quality_indicators.py similarity index 100% rename from src/utils/python/plot_tracking_quality_indicators.py rename to utils/python/plot_tracking_quality_indicators.py diff --git a/src/utils/reproducibility/ieee-access18/L2-access18.conf b/utils/reproducibility/ieee-access18/L2-access18.conf similarity index 100% rename from src/utils/reproducibility/ieee-access18/L2-access18.conf rename to utils/reproducibility/ieee-access18/L2-access18.conf diff --git a/src/utils/reproducibility/ieee-access18/README.md b/utils/reproducibility/ieee-access18/README.md similarity index 93% rename from src/utils/reproducibility/ieee-access18/README.md rename to utils/reproducibility/ieee-access18/README.md index 67f59ad6d..82fa59103 100644 --- a/src/utils/reproducibility/ieee-access18/README.md +++ b/utils/reproducibility/ieee-access18/README.md @@ -58,9 +58,9 @@ $ tar xvfJ L2_signal_samples.tar.xz $ echo "3a04c1eeb970776bb77f5e3b7eaff2df L2_signal_samples.tar.xz" > data.md5 $ md5sum -c data.md5 $ cd .. -$ cp ../src/utils/reproducibility/ieee-access18/L2-access18.conf . -$ cp ../src/utils/reproducibility/ieee-access18/plot_dump.m . -$ cp -r ../src/utils/matlab/libs/geoFunctions . +$ cp ../utils/reproducibility/ieee-access18/L2-access18.conf . +$ cp ../utils/reproducibility/ieee-access18/plot_dump.m . +$ cp -r ../utils/matlab/libs/geoFunctions . $ gnss-sdr --c=L2-access18.conf $ octave --no-gui plot_dump.m $ epspdf Figure2.eps Figure2.pdf diff --git a/src/utils/reproducibility/ieee-access18/plot_dump.m b/utils/reproducibility/ieee-access18/plot_dump.m similarity index 100% rename from src/utils/reproducibility/ieee-access18/plot_dump.m rename to utils/reproducibility/ieee-access18/plot_dump.m diff --git a/src/utils/rinex-tools/CMakeLists.txt b/utils/rinex-tools/CMakeLists.txt similarity index 99% rename from src/utils/rinex-tools/CMakeLists.txt rename to utils/rinex-tools/CMakeLists.txt index 695c369ee..84d361d40 100644 --- a/src/utils/rinex-tools/CMakeLists.txt +++ b/utils/rinex-tools/CMakeLists.txt @@ -33,7 +33,7 @@ if("${ARMADILLO_VERSION_STRING}" VERSION_GREATER "9.800" OR (NOT ARMADILLO_FOUND add_executable(obsdiff ${CMAKE_CURRENT_SOURCE_DIR}/obsdiff.cc obsdiff_flags.h) endif() - target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/src/tests/common-files) + target_include_directories(obsdiff PUBLIC ${GNSSSDR_SOURCE_DIR}/tests/common-files) if(GNSSTK_VERSION AND "${GNSSTK_VERSION}" VERSION_LESS 3.0.1) set_property(TARGET obsdiff PROPERTY CXX_STANDARD 14) # Required by GPSTk v3.0.0 endif() diff --git a/src/utils/rinex-tools/README.md b/utils/rinex-tools/README.md similarity index 100% rename from src/utils/rinex-tools/README.md rename to utils/rinex-tools/README.md diff --git a/src/utils/rinex-tools/obsdiff.cc b/utils/rinex-tools/obsdiff.cc similarity index 100% rename from src/utils/rinex-tools/obsdiff.cc rename to utils/rinex-tools/obsdiff.cc diff --git a/src/utils/rinex-tools/obsdiff_flags.h b/utils/rinex-tools/obsdiff_flags.h similarity index 100% rename from src/utils/rinex-tools/obsdiff_flags.h rename to utils/rinex-tools/obsdiff_flags.h diff --git a/src/utils/rinex2assist/CMakeLists.txt b/utils/rinex2assist/CMakeLists.txt similarity index 100% rename from src/utils/rinex2assist/CMakeLists.txt rename to utils/rinex2assist/CMakeLists.txt diff --git a/src/utils/rinex2assist/README.md b/utils/rinex2assist/README.md similarity index 100% rename from src/utils/rinex2assist/README.md rename to utils/rinex2assist/README.md diff --git a/src/utils/rinex2assist/main.cc b/utils/rinex2assist/main.cc similarity index 100% rename from src/utils/rinex2assist/main.cc rename to utils/rinex2assist/main.cc diff --git a/src/utils/scripts/download-galileo-almanac.sh b/utils/scripts/download-galileo-almanac.sh similarity index 100% rename from src/utils/scripts/download-galileo-almanac.sh rename to utils/scripts/download-galileo-almanac.sh diff --git a/src/utils/scripts/gnss-sdr-harness.sh b/utils/scripts/gnss-sdr-harness.sh similarity index 100% rename from src/utils/scripts/gnss-sdr-harness.sh rename to utils/scripts/gnss-sdr-harness.sh diff --git a/src/utils/simulink/MultiThread/README_gnss_sdr_tcp_connector_parallel_tracking.txt b/utils/simulink/MultiThread/README_gnss_sdr_tcp_connector_parallel_tracking.txt similarity index 100% rename from src/utils/simulink/MultiThread/README_gnss_sdr_tcp_connector_parallel_tracking.txt rename to utils/simulink/MultiThread/README_gnss_sdr_tcp_connector_parallel_tracking.txt diff --git a/src/utils/simulink/MultiThread/gnss_sdr_tcp_connector_parallel_tracking_start.m b/utils/simulink/MultiThread/gnss_sdr_tcp_connector_parallel_tracking_start.m similarity index 100% rename from src/utils/simulink/MultiThread/gnss_sdr_tcp_connector_parallel_tracking_start.m rename to utils/simulink/MultiThread/gnss_sdr_tcp_connector_parallel_tracking_start.m diff --git a/src/utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl b/utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl similarity index 100% rename from src/utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl rename to utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl diff --git a/src/utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license b/utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license similarity index 100% rename from src/utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license rename to utils/simulink/MultiThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license diff --git a/src/utils/simulink/SingleThread/README_gnss_sdr_galileo_e1_tcp_connector_tracking.txt b/utils/simulink/SingleThread/README_gnss_sdr_galileo_e1_tcp_connector_tracking.txt similarity index 100% rename from src/utils/simulink/SingleThread/README_gnss_sdr_galileo_e1_tcp_connector_tracking.txt rename to utils/simulink/SingleThread/README_gnss_sdr_galileo_e1_tcp_connector_tracking.txt diff --git a/src/utils/simulink/SingleThread/README_gnss_sdr_tcp_connector_tracking.txt b/utils/simulink/SingleThread/README_gnss_sdr_tcp_connector_tracking.txt similarity index 100% rename from src/utils/simulink/SingleThread/README_gnss_sdr_tcp_connector_tracking.txt rename to utils/simulink/SingleThread/README_gnss_sdr_tcp_connector_tracking.txt diff --git a/src/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl b/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl similarity index 100% rename from src/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl rename to utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl diff --git a/src/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl.license b/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl.license similarity index 100% rename from src/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl.license rename to utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_lib.mdl.license diff --git a/src/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_start.m b/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_start.m similarity index 100% rename from src/utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_start.m rename to utils/simulink/SingleThread/gnss_sdr_galileo_e1_tcp_connector_tracking_start.m diff --git a/src/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl b/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl similarity index 100% rename from src/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl rename to utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl diff --git a/src/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license b/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license similarity index 100% rename from src/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license rename to utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_lib.mdl.license diff --git a/src/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_start.m b/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_start.m similarity index 100% rename from src/utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_start.m rename to utils/simulink/SingleThread/gnss_sdr_tcp_connector_tracking_start.m From 58ded939ada0a467d591e85b7ab06f76a42fa5cd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 4 Oct 2024 11:55:42 +0200 Subject: [PATCH 409/499] Fix end of line format --- .../Beidou/gnss-sdr_BDS_B1I_byte.conf | 254 +++--- .../gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf | 424 +++++----- .../Beidou/gnss-sdr_BDS_B3I_byte.conf | 246 +++--- .../Beidou/gnss-sdr_BDS_B3I_ibyte.conf | 264 +++--- .../Beidou/gnss-sdr_BDS_B3I_short.conf | 162 ++-- conf/File_input/GPS/gnss-sdr-L1-gaussian.conf | 134 +-- .../GPS/gnss-sdr_GPS_L1_CA_ibyte.conf | 188 ++--- conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf | 274 +++---- .../GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf | 216 ++--- .../GPS/gnss-sdr_GPS_L1_gr_complex.conf | 196 ++--- .../GPS/gnss-sdr_GPS_L1_ishort.conf | 204 ++--- ...nnel_GPS_L1_Flexiband_bin_file_III_1a.conf | 368 ++++----- ...nnel_GPS_L1_Flexiband_realtime_III_1a.conf | 378 ++++----- ...nnel_GPS_L1_Flexiband_realtime_III_1b.conf | 376 ++++----- ...annel_GPS_L1_Flexiband_realtime_II_3b.conf | 390 ++++----- ...hannel_GPS_L1_Flexiband_realtime_I_1b.conf | 366 ++++----- ...l_GPS_L1_L2_Flexiband_realtime_III_1b.conf | 610 +++++++------- ...Galileo_E1B_Flexiband_bin_file_III_1b.conf | 556 ++++++------- ...el_GPS_L2_M_Flexiband_bin_file_III_1b.conf | 726 ++++++++--------- ...S_L2_M_Flexiband_bin_file_III_1b_real.conf | 516 ++++++------ .../Galileo/gnss-sdr_Galileo_E1_ishort.conf | 218 ++--- .../Galileo/gnss-sdr_Galileo_E1_nsr.conf | 254 +++--- .../Galileo/gnss-sdr_Galileo_E5a.conf | 242 +++--- .../gnss-sdr_Galileo_E5a_IFEN_CTTC.conf | 314 +++---- ...r_galileo_E1_extended_correlator_byte.conf | 282 +++---- ...galileo_E1_extended_correlator_labsat.conf | 338 ++++---- ...nss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf | 284 +++---- .../gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf | 286 +++---- .../Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf | 164 ++-- .../gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf | 172 ++-- .../Glonass/gnss-sdr_GLONASS_L1_ibyte.conf | 202 ++--- ...nss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf | 286 +++---- .../gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf | 288 +++---- .../Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf | 152 ++-- .../gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf | 172 ++-- .../MultiCons/gnss-sdr_Hybrid_byte.conf | 320 ++++---- .../MultiCons/gnss-sdr_Hybrid_byte_sim.conf | 290 +++---- .../MultiCons/gnss-sdr_Hybrid_gr_complex.conf | 262 +++--- .../MultiCons/gnss-sdr_Hybrid_ishort.conf | 322 ++++---- .../MultiCons/gnss-sdr_labsat_kf.conf | 370 ++++----- ..._all_in_one_Flexiband_bin_file_III_1b.conf | 770 +++++++++--------- .../gnss-sdr_multisource_Hybrid_ishort.conf | 338 ++++---- .../gnss-sdr_multisource_Hybrid_nsr.conf | 462 +++++------ conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf | 328 ++++---- conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf | 414 +++++----- conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf | 352 ++++---- conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf | 206 ++--- conf/Other/gnss-sdr_GPS_L1_FPGA.conf | 144 ++-- conf/Other/gnss-sdr_GPS_L1_fifo.conf | 112 +-- .../Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf | 170 ++-- conf/Other/gnss-sdr_GPS_L1_monitor.conf | 178 ++-- .../gnss-sdr_GPS_L1_nsr_twobit_packed.conf | 308 +++---- ...-sdr_GPS_L1_pulse_blanking_gr_complex.conf | 222 ++--- conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf | 276 +++---- .../gnss-sdr_GPS_L1_udp_with_monitor.conf | 162 ++-- ...gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf | 230 +++--- .../gnss-sdr_GPS_L1_LimeSDR.conf | 258 +++--- .../gnss-sdr_GPS_L1_USRP_X300_realtime.conf | 314 +++---- .../gnss-sdr_GPS_L1_USRP_realtime.conf | 236 +++--- .../gnss-sdr_GPS_L1_bladeRF.conf | 218 ++--- .../gnss-sdr_GPS_L1_fmcomms2_realtime.conf | 268 +++--- .../gnss-sdr_GPS_L1_plutosdr_realtime.conf | 290 +++---- .../gnss-sdr_GPS_L1_rtl_tcp_realtime.conf | 302 +++---- .../gnss-sdr_GPS_L1_rtlsdr_realtime.conf | 306 +++---- .../gnss-sdr_GPS_L2C_USRP1_realtime.conf | 312 +++---- .../gnss-sdr_GPS_L2C_USRP_X300_realtime.conf | 324 ++++---- ...nss-sdr_Galileo_E1_USRP_X300_realtime.conf | 186 ++--- ...ultichannel_GPS_L1_USRP_X300_realtime.conf | 322 ++++---- conf/gnss-sdr.conf | 290 +++---- 69 files changed, 10182 insertions(+), 10182 deletions(-) diff --git a/conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf index 873653eea..e354a754d 100644 --- a/conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B1I_byte.conf @@ -1,127 +1,127 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=25000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/BDS3_datasets/BdsB1IStr01.dat -SignalSource.item_type=byte -SignalSource.sampling_frequency=25000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Byte_To_Short -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=short -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=25000000 -InputFilter.IF=6250000 -InputFilter.dump = false -InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat -Resampler.implementation=Pass_Through -Resampler.sample_freq_in=25000000 -Resampler.sample_freq_out=25000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_B1.count=10 -Channels.in_acquisition=1 -Channel.signal=B1 - -Channel0.satellite = 6; -Channel1.satellite = 8; -Channel2.satellite = 9; -Channel3.satellite = 13; -Channel4.satellite = 17; -Channel5.satellite = 1; -Channel6.satellite = 2; -Channel7.satellite = 3; -Channel8.satellite = 4; -Channel9.satellite = 5; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition -Acquisition_B1.item_type=gr_complex -Acquisition_B1.coherent_integration_time_ms=1 -Acquisition_B1.pfa=0.01 -;Acquisition_B1.pfa=0.0000001; -Acquisition_B1.doppler_max=10000 -Acquisition_B1.doppler_step=100 -Acquisition_B1.dump=true -Acquisition_B1.dump_filename=./bds_acq -Acquisition_B1.blocking=false; -Acquisition_B1.bit_transition_flag = false; - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking -Tracking_B1.item_type=gr_complex -Tracking_B1.pll_bw_hz=25.0; -Tracking_B1.dll_bw_hz=2.50; -Tracking_B1.dump=false; -Tracking_B1.dump_filename=./epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder -TelemetryDecoder_B1.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true -PVT.rinex_version=3 -PVT.rinex_output_enabled=true -PVT.gpx_output_enabled=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=25000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/BDS3_datasets/BdsB1IStr01.dat +SignalSource.item_type=byte +SignalSource.sampling_frequency=25000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Byte_To_Short +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=short +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=25000000 +InputFilter.IF=6250000 +InputFilter.dump = false +InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/tests/signal_samples/BdsB1IStr01_fs25e6_if0_4ms.dat +Resampler.implementation=Pass_Through +Resampler.sample_freq_in=25000000 +Resampler.sample_freq_out=25000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_B1.count=10 +Channels.in_acquisition=1 +Channel.signal=B1 + +Channel0.satellite = 6; +Channel1.satellite = 8; +Channel2.satellite = 9; +Channel3.satellite = 13; +Channel4.satellite = 17; +Channel5.satellite = 1; +Channel6.satellite = 2; +Channel7.satellite = 3; +Channel8.satellite = 4; +Channel9.satellite = 5; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B1.implementation=BEIDOU_B1I_PCPS_Acquisition +Acquisition_B1.item_type=gr_complex +Acquisition_B1.coherent_integration_time_ms=1 +Acquisition_B1.pfa=0.01 +;Acquisition_B1.pfa=0.0000001; +Acquisition_B1.doppler_max=10000 +Acquisition_B1.doppler_step=100 +Acquisition_B1.dump=true +Acquisition_B1.dump_filename=./bds_acq +Acquisition_B1.blocking=false; +Acquisition_B1.bit_transition_flag = false; + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B1.implementation=BEIDOU_B1I_DLL_PLL_Tracking +Tracking_B1.item_type=gr_complex +Tracking_B1.pll_bw_hz=25.0; +Tracking_B1.dll_bw_hz=2.50; +Tracking_B1.dump=false; +Tracking_B1.dump_filename=./epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B1.implementation=BEIDOU_B1I_Telemetry_Decoder +TelemetryDecoder_B1.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true +PVT.rinex_version=3 +PVT.rinex_output_enabled=true +PVT.gpx_output_enabled=true diff --git a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf index c17409232..f6df123ee 100644 --- a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_GPS_L1_CA_ibyte.conf @@ -1,212 +1,212 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=30000000 -GNSS-SDR.num_sources=2 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -;# Signal Source config for GPS, Galileo signals -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/BDS3_datasets/long/20180713_211400_3.dat -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=10000000 -SignalSource0.samples=0 -SignalSource0.repeat=false -SignalSource0.dump=false -SignalSource0.enable_throttle_control=false - -;# Signal Source config for BDS signals -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=30000000 -SignalSource1.samples=0 -SignalSource1.repeat=false -SignalSource1.dump=false -SignalSource1.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -;# Signal Conditioner config for GPS, Galileo signals -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=10000000 -InputFilter0.IF=420000 -Resampler0.implementation=Direct_Resampler -Resampler0.sample_freq_in=10000000 -Resampler0.sample_freq_out=30000000 -Resampler0.item_type=gr_complex - -;# Signal Conditioner config for BDS signals -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.70 -InputFilter1.band2_begin=0.80 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=10000000 -InputFilter1.IF=1020000 -Resampler1.implementation=Pass_Through -Resampler1.sample_freq_in=30000000 -Resampler1.sample_freq_out=30000000 -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=7 -Channels_B3.count=4 -Channels.in_acquisition=11 - -;# Preparing collection for GPS satellites -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel0.signal=1C -Channel0.satellite = 2 -Channel1.signal=1C -Channel1.satellite = 5 -Channel2.signal=1C -Channel2.satellite = 25 -Channel3.signal=1C -Channel3.satellite = 31 -Channel4.signal=1C -Channel4.satellite = 24 -Channel5.signal=1C -Channel5.satellite = 6 -Channel6.signal=1C -Channel6.satellite = 29 - -;# Preparing collection for BDS satellites -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 -Channel10.RF_channel_ID=1 - -Channel7.signal=B3 -Channel7.satellite = 29 -Channel8.signal=B3 -Channel8.satellite = 19 -Channel9.signal=B3 -Channel9.satellite = 20 -Channel10.signal=B3 -Channel10.satellite = 30 - - -;######### ACQUISITION GLOBAL CONFIG ############ -;# Acquisition config for BDS signals -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=1 -Acquisition_B3.pfa=0.01 -Acquisition_B3.doppler_max=15000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=false -Acquisition_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_acq -Acquisition_B3.blocking=false; -Acquisition_B3.use_CFAR_algorithm=true; -Acquisition_B3.bit_transition_flag = false; - -;# Acquisition config for GPS signals -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=15000 -Acquisition_1C.doppler_step=50 -Acquisition_1C.dump=true -Acquisition_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_acq -Acquisition_1C.blocking=false; -Acquisition_1C.use_CFAR_algorithm=true; -Acquisition_1C.bit_transition_flag = false; - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking -Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.50; -Tracking_B3.dump=true; -Tracking_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_trk_ch_ - -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=25.0; -Tracking_1C.dll_bw_hz=2.50; -Tracking_1C.dump=true; -Tracking_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_trk_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false - -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump=true -PVT.dump_filename = /home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/pvt_l1 -PVT.kml_output_enabled = false; -PVT.xml_output_enabled = false; -PVT.gpx_output_enabled = false; -PVT.rinex_output_enabled = false; -PVT.rtcm_output_enabled = false; -PVT.nmea_output_enabled = false; -PVT.geojson_output_enabled = false; +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=30000000 +GNSS-SDR.num_sources=2 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +;# Signal Source config for GPS, Galileo signals +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/BDS3_datasets/long/20180713_211400_3.dat +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=10000000 +SignalSource0.samples=0 +SignalSource0.repeat=false +SignalSource0.dump=false +SignalSource0.enable_throttle_control=false + +;# Signal Source config for BDS signals +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=30000000 +SignalSource1.samples=0 +SignalSource1.repeat=false +SignalSource1.dump=false +SignalSource1.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +;# Signal Conditioner config for GPS, Galileo signals +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=10000000 +InputFilter0.IF=420000 +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=10000000 +Resampler0.sample_freq_out=30000000 +Resampler0.item_type=gr_complex + +;# Signal Conditioner config for BDS signals +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.70 +InputFilter1.band2_begin=0.80 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=10000000 +InputFilter1.IF=1020000 +Resampler1.implementation=Pass_Through +Resampler1.sample_freq_in=30000000 +Resampler1.sample_freq_out=30000000 +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=7 +Channels_B3.count=4 +Channels.in_acquisition=11 + +;# Preparing collection for GPS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel0.signal=1C +Channel0.satellite = 2 +Channel1.signal=1C +Channel1.satellite = 5 +Channel2.signal=1C +Channel2.satellite = 25 +Channel3.signal=1C +Channel3.satellite = 31 +Channel4.signal=1C +Channel4.satellite = 24 +Channel5.signal=1C +Channel5.satellite = 6 +Channel6.signal=1C +Channel6.satellite = 29 + +;# Preparing collection for BDS satellites +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 +Channel10.RF_channel_ID=1 + +Channel7.signal=B3 +Channel7.satellite = 29 +Channel8.signal=B3 +Channel8.satellite = 19 +Channel9.signal=B3 +Channel9.satellite = 20 +Channel10.signal=B3 +Channel10.satellite = 30 + + +;######### ACQUISITION GLOBAL CONFIG ############ +;# Acquisition config for BDS signals +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms=1 +Acquisition_B3.pfa=0.01 +Acquisition_B3.doppler_max=15000 +Acquisition_B3.doppler_step=50 +Acquisition_B3.dump=false +Acquisition_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_acq +Acquisition_B3.blocking=false; +Acquisition_B3.use_CFAR_algorithm=true; +Acquisition_B3.bit_transition_flag = false; + +;# Acquisition config for GPS signals +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=15000 +Acquisition_1C.doppler_step=50 +Acquisition_1C.dump=true +Acquisition_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_acq +Acquisition_1C.blocking=false; +Acquisition_1C.use_CFAR_algorithm=true; +Acquisition_1C.bit_transition_flag = false; + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking +Tracking_B3.item_type=gr_complex +Tracking_B3.pll_bw_hz=25.0; +Tracking_B3.dll_bw_hz=2.50; +Tracking_B3.dump=true; +Tracking_B3.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/bds_b1i_trk_ch_ + +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=25.0; +Tracking_1C.dll_bw_hz=2.50; +Tracking_1C.dump=true; +Tracking_1C.dump_filename=/home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/gps_l1ca_trk_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=false + +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump=true +PVT.dump_filename = /home/dmiralles/Documents/Research/Publications/INSIDE_GNSS/bds_leg_pvt/Data/pvt_l1 +PVT.kml_output_enabled = false; +PVT.xml_output_enabled = false; +PVT.gpx_output_enabled = false; +PVT.rinex_output_enabled = false; +PVT.rtcm_output_enabled = false; +PVT.nmea_output_enabled = false; +PVT.geojson_output_enabled = false; diff --git a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf index 3c4baa708..edd60bcd8 100644 --- a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_byte.conf @@ -1,123 +1,123 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=50000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/BDS3_datasets/BdsB3IStr01.dat -SignalSource.item_type=byte -SignalSource.sampling_frequency=50000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.enable_throttle_control=false -;SignalSource.samples=200000 - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Byte_To_Short -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=short -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=50000000 -InputFilter.IF=12500000 -InputFilter.dump = false -InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat -Resampler.implementation=Pass_Through -Resampler.sample_freq_in=50000000 -Resampler.sample_freq_out=50000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_B3.count=10 -Channels.in_acquisition=1 -Channel.signal=B3 - -Channel0.satellite = 6; -Channel1.satellite = 23; -Channel2.satellite = 16; -Channel3.satellite = 18; -Channel4.satellite = 7; -Channel5.satellite = 1; -Channel6.satellite = 2; -Channel7.satellite = 3; -Channel8.satellite = 4; -Channel9.satellite = 5; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=3 -Acquisition_B3.max_dwells = 2 -Acquisition_B3.pfa=0.01 -Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=100 -Acquisition_B3.dump=false -Acquisition_B3.dump_filename=./bds_acq - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking -Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=40.0; -Tracking_B3.dll_bw_hz=4.0; -Tracking_B3.pll_bw_narrow_hz=20.0; -Tracking_B3.dll_bw_narrow_hz=3.0; -Tracking_B3.dump=false; -Tracking_B3.dump_filename=./epl_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=50000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/BDS3_datasets/BdsB3IStr01.dat +SignalSource.item_type=byte +SignalSource.sampling_frequency=50000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.enable_throttle_control=false +;SignalSource.samples=200000 + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Byte_To_Short +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=short +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=50000000 +InputFilter.IF=12500000 +InputFilter.dump = false +InputFilter.dump_filename=/home/dmiralles/Documents/gnss-sdr/tests/signal_samples/BdsB3IStr01_fs50e6_if0_4ms.dat +Resampler.implementation=Pass_Through +Resampler.sample_freq_in=50000000 +Resampler.sample_freq_out=50000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_B3.count=10 +Channels.in_acquisition=1 +Channel.signal=B3 + +Channel0.satellite = 6; +Channel1.satellite = 23; +Channel2.satellite = 16; +Channel3.satellite = 18; +Channel4.satellite = 7; +Channel5.satellite = 1; +Channel6.satellite = 2; +Channel7.satellite = 3; +Channel8.satellite = 4; +Channel9.satellite = 5; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms=3 +Acquisition_B3.max_dwells = 2 +Acquisition_B3.pfa=0.01 +Acquisition_B3.doppler_max=10000 +Acquisition_B3.doppler_step=100 +Acquisition_B3.dump=false +Acquisition_B3.dump_filename=./bds_acq + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking +Tracking_B3.item_type=gr_complex +Tracking_B3.pll_bw_hz=40.0; +Tracking_B3.dll_bw_hz=4.0; +Tracking_B3.pll_bw_narrow_hz=20.0; +Tracking_B3.dll_bw_narrow_hz=3.0; +Tracking_B3.dump=false; +Tracking_B3.dump_filename=./epl_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf index 651afa570..b8d1e9cb5 100644 --- a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_ibyte.conf @@ -1,132 +1,132 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=30000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=30000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=30000000 -InputFilter.IF=1020000 -Resampler.implementation=Pass_Through -Resampler.sample_freq_in=30000000 -Resampler.sample_freq_out=30000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_B3.count=4 -Channels.in_acquisition=1 -Channel.signal=B3 - -Channel0.satellite = 29; -Channel1.satellite = 19; -Channel2.satellite = 20; -Channel3.satellite = 30; - - -;Channel0.satellite = 6; -;Channel1.satellite = 7; -;Channel2.satellite = 9; -;Channel3.satellite = 16; -;Channel4.satellite = 18; -;Channel5.satellite = 1; -;Channel6.satellite = 2; -;Channel7.satellite = 3; -;Channel8.satellite = 4; -;Channel9.satellite = 5; -;Channel10.satellite = 23; -;Channel11.satellite = 25; -;Channel12.satellite = 32; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms=1 -Acquisition_B3.max_dwells = 1 -Acquisition_B3.pfa=0.01 -;Acquisition_B3.pfa=0.0000001; -Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=false -Acquisition_B3.dump_filename=./bds_acq -Acquisition_B3.blocking=false; -Acquisition_B3.bit_transition_flag = false; - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking -Tracking_B3.item_type=gr_complex -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.50; -Tracking_B3.dump=false; -Tracking_B3.dump_filename=./epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=30000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/BDS3_datasets/long/20180713_211400_2.dat +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=30000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=30000000 +InputFilter.IF=1020000 +Resampler.implementation=Pass_Through +Resampler.sample_freq_in=30000000 +Resampler.sample_freq_out=30000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_B3.count=4 +Channels.in_acquisition=1 +Channel.signal=B3 + +Channel0.satellite = 29; +Channel1.satellite = 19; +Channel2.satellite = 20; +Channel3.satellite = 30; + + +;Channel0.satellite = 6; +;Channel1.satellite = 7; +;Channel2.satellite = 9; +;Channel3.satellite = 16; +;Channel4.satellite = 18; +;Channel5.satellite = 1; +;Channel6.satellite = 2; +;Channel7.satellite = 3; +;Channel8.satellite = 4; +;Channel9.satellite = 5; +;Channel10.satellite = 23; +;Channel11.satellite = 25; +;Channel12.satellite = 32; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms=1 +Acquisition_B3.max_dwells = 1 +Acquisition_B3.pfa=0.01 +;Acquisition_B3.pfa=0.0000001; +Acquisition_B3.doppler_max=10000 +Acquisition_B3.doppler_step=50 +Acquisition_B3.dump=false +Acquisition_B3.dump_filename=./bds_acq +Acquisition_B3.blocking=false; +Acquisition_B3.bit_transition_flag = false; + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation=BEIDOU_B3I_DLL_PLL_Tracking +Tracking_B3.item_type=gr_complex +Tracking_B3.pll_bw_hz=25.0; +Tracking_B3.dll_bw_hz=2.50; +Tracking_B3.dump=false; +Tracking_B3.dump_filename=./epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf index 399d5d433..01606f841 100644 --- a/conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf +++ b/conf/File_input/Beidou/gnss-sdr_BDS_B3I_short.conf @@ -1,81 +1,81 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) -; 5C is the channel identifier for BeiDou B2a, both the data signal and the pilot signal - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=30000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -;SignalSource.filename=/home/dmiralles/Documents/gnss-sdr/src/tests/signal_samples/USRP_BDS_B2a_201805171115_fs_25e6_if0e3_ishort_200ms.bin -SignalSource.filename=/archive/USRP_BDS_B3I_201805171118_fs_25e6_if0e3_ishort.bin -SignalSource.item_type=ishort -SignalSource.sampling_frequency=30000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -InputFilter.implementation=Pass_Through -DataTypeAdapter.implementation=Ishort_To_Complex -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=30000000 -Resampler.sample_freq_out=30000000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=B3 -Channels.in_acquisition=1 -Channels_B3.count=5; - -Channel0.satellite = 27; -Channel1.satellite = 22; -Channel2.satellite = 21; -Channel3.satellite = 28; -Channel4.satellite = 30; - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition -Acquisition_B3.item_type=gr_complex -Acquisition_B3.coherent_integration_time_ms = 1 -Acquisition_B3.max_dwells = 1 -Acquisition_B3.pfa=0.01 -Acquisition_B3.doppler_max=10000 -Acquisition_B3.doppler_step=50 -Acquisition_B3.dump=true -Acquisition_B3.dump_channel = 0; -Acquisition_B3.dump_filename=/archive/bds_b3i_acq -Acquisition_B3.blocking=false; -Acquisition_B3.bit_transition_flag = false; - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_B3.implementation= BEIDOU_B3I_DLL_PLL_Tracking; -Tracking_B3.item_type=gr_complex -Tracking_B3.early_late_space_chips=0.5 -Tracking_B3.pll_bw_hz=25.0; -Tracking_B3.dll_bw_hz=2.0; -Tracking_B3.dump=true; -Tracking_B3.dump_filename=/archive/bds_b3i_trk_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder -TelemetryDecoder_B3.dump=true -TelemetryDecoder_B3.dump_filename=/archive/bds_b3i_tel_dec.dat - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/bds_b3i_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) +; 5C is the channel identifier for BeiDou B2a, both the data signal and the pilot signal + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=30000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +;SignalSource.filename=/home/dmiralles/Documents/gnss-sdr/tests/signal_samples/USRP_BDS_B2a_201805171115_fs_25e6_if0e3_ishort_200ms.bin +SignalSource.filename=/archive/USRP_BDS_B3I_201805171118_fs_25e6_if0e3_ishort.bin +SignalSource.item_type=ishort +SignalSource.sampling_frequency=30000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +InputFilter.implementation=Pass_Through +DataTypeAdapter.implementation=Ishort_To_Complex +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=30000000 +Resampler.sample_freq_out=30000000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=B3 +Channels.in_acquisition=1 +Channels_B3.count=5; + +Channel0.satellite = 27; +Channel1.satellite = 22; +Channel2.satellite = 21; +Channel3.satellite = 28; +Channel4.satellite = 30; + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_B3.implementation=BEIDOU_B3I_PCPS_Acquisition +Acquisition_B3.item_type=gr_complex +Acquisition_B3.coherent_integration_time_ms = 1 +Acquisition_B3.max_dwells = 1 +Acquisition_B3.pfa=0.01 +Acquisition_B3.doppler_max=10000 +Acquisition_B3.doppler_step=50 +Acquisition_B3.dump=true +Acquisition_B3.dump_channel = 0; +Acquisition_B3.dump_filename=/archive/bds_b3i_acq +Acquisition_B3.blocking=false; +Acquisition_B3.bit_transition_flag = false; + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_B3.implementation= BEIDOU_B3I_DLL_PLL_Tracking; +Tracking_B3.item_type=gr_complex +Tracking_B3.early_late_space_chips=0.5 +Tracking_B3.pll_bw_hz=25.0; +Tracking_B3.dll_bw_hz=2.0; +Tracking_B3.dump=true; +Tracking_B3.dump_filename=/archive/bds_b3i_trk_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_B3.implementation=BEIDOU_B3I_Telemetry_Decoder +TelemetryDecoder_B3.dump=true +TelemetryDecoder_B3.dump_filename=/archive/bds_b3i_tel_dec.dat + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/bds_b3i_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 diff --git a/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf b/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf index 17f62a765..a208366e5 100644 --- a/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf +++ b/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf @@ -1,67 +1,67 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 -GNSS-SDR.internal_fs_hz=2000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/glamountain/gnss-sdr/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.samples=0 - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ishort_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=2000000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=../data/kalman/acq_dump - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/kalman/epl_tracking_ch_ -Tracking_1C.bce_run = true; -Tracking_1C.p_transient = 0; -Tracking_1C.s_transient = 100; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=GPS_L1_CA_Observables - -;######### PVT CONFIG ############ -PVT.implementation=GPS_L1_CA_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 +GNSS-SDR.internal_fs_hz=2000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/home/glamountain/gnss-sdr/data/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.samples=0 + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ishort_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=../data/kalman/acq_dump + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/kalman/epl_tracking_ch_ +Tracking_1C.bce_run = true; +Tracking_1C.p_transient = 0; +Tracking_1C.s_transient = 100; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=GPS_L1_CA_Observables + +;######### PVT CONFIG ############ +PVT.implementation=GPS_L1_CA_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf index d698d540f..6afe08ced 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_CA_ibyte.conf @@ -1,94 +1,94 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -;SignalSource.samples=66250000 -SignalSource.samples=0 -SignalSource.dump=false; - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.70 -InputFilter.band2_begin=0.80 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=6625000 -InputFilter.IF=60000 -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=6625000 -Resampler.sample_freq_out=6625000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1C -Channels.in_acquisition=1 -Channels_1C.count=6 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false; -Acquisition_1C.dump_filename=/archive/gps_acquisition.dat -;Acquisition_1C.coherent_integration_time_ms=10 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.pll_bw_hz=25.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=/archive/gps_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/gps_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=3 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +;SignalSource.samples=66250000 +SignalSource.samples=0 +SignalSource.dump=false; + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.70 +InputFilter.band2_begin=0.80 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=6625000 +InputFilter.IF=60000 +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=6625000 +Resampler.sample_freq_out=6625000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1C +Channels.in_acquisition=1 +Channels_1C.count=6 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=25.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/gps_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=3 diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf index 02ff66fb5..d83bd63d3 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf @@ -1,137 +1,137 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Spir_File_Signal_Source -SignalSource.filename=/dtalogger/signals/spir/data/20Secs/20Secs_L1.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=int -SignalSource.sampling_frequency=80000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=80000000 -InputFilter.IF=10164 -InputFilter.decimation_factor=20 - - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=80000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=0 -Channels.in_acquisition=1 - -Channel.signal=1C - - -;######### CHANNEL 0 CONFIG ############ -;Channel0.satellite=20 - -;######### CHANNEL 1 CONFIG ############ -;Channel1.satellite=12 - -;######### CHANNEL 2 CONFIG ############ -;Channel2.satellite=11 - -;######### CHANNEL 3 CONFIG ############ -;Channel3.satellite=19 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.005 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=5 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation algorithm -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=500 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Spir_File_Signal_Source +SignalSource.filename=/dtalogger/signals/spir/data/20Secs/20Secs_L1.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=int +SignalSource.sampling_frequency=80000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=80000000 +InputFilter.IF=10164 +InputFilter.decimation_factor=20 + + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=80000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=0 +Channels.in_acquisition=1 + +Channel.signal=1C + + +;######### CHANNEL 0 CONFIG ############ +;Channel0.satellite=20 + +;######### CHANNEL 1 CONFIG ############ +;Channel1.satellite=12 + +;######### CHANNEL 2 CONFIG ############ +;Channel2.satellite=11 + +;######### CHANNEL 3 CONFIG ############ +;Channel3.satellite=19 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.005 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=5 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation algorithm +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=500 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf index c64b15c84..356dde132 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf @@ -1,108 +1,108 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/data_type_adapter.dat - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=5 -Channels.in_acquisition=1 - - -;######### ACQUISITION GLOBAL CONFIG ############_1C -Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent-integration_time_ms=4 -Acquisition_1C.dump=true -;Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### ACQUISITION CHANNELS CONFIG ###### -Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition -Acquisition_1C.threshold=0.4 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=50.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/data_type_adapter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 + + +;######### ACQUISITION GLOBAL CONFIG ############_1C +Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent-integration_time_ms=4 +Acquisition_1C.dump=true +;Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### ACQUISITION CHANNELS CONFIG ###### +Acquisition_1C.implementation=GPS_L1_CA_PCPS_QuickSync_Acquisition +Acquisition_1C.threshold=0.4 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=50.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf index cda1b5420..84179dbed 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf @@ -1,98 +1,98 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf - - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat - -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=5 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=true -Tracking_1C.dump_filename=epl_tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_c - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=1 -PVT.display_rate_ms=100 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf + + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat + +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=true +Tracking_1C.dump_filename=epl_tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_c + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=1 +PVT.display_rate_ms=100 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf index 60317c7cc..1d76c2a2f 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf @@ -1,102 +1,102 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=2000000 -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -;Acquisition_1C.pfa=0.000001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat -Acquisition_1C.blocking=false; - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=./epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +;Acquisition_1C.pfa=0.000001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat +Acquisition_1C.blocking=false; + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=./epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf index e58863107..d7a72f476 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf @@ -1,184 +1,184 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=0; -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 - -Channels.in_acquisition=1 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=10 -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.pll_bw_narrow_hz=35; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=0; +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 + +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=10 +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.pll_bw_narrow_hz=35; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf index c63314288..48727d42f 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf @@ -1,189 +1,189 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1a.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 - -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1a.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 + +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf index 0c15ff8a5..478cc875d 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf @@ -1,188 +1,188 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -;#frontend channels AGC -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +;#frontend channels AGC +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf index 5e54db37f..3ba4ba52d 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf @@ -1,195 +1,195 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_II-3b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=40000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=16 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -;#signal: -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_II-3b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=40000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=16 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +;#signal: +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf index ab1d04fc4..73624bc73 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf @@ -1,183 +1,183 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_I-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=40000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -;Channel4.RF_channel_ID=0 -;Channel5.RF_channel_ID=0 -;Channel6.RF_channel_ID=0 -;Channel7.RF_channel_ID=0 - -;#signal: -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_I-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=40000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +;Channel4.RF_channel_ID=0 +;Channel5.RF_channel_ID=0 +;Channel6.RF_channel_ID=0 +;Channel7.RF_channel_ID=0 + +;#signal: +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf index d74b51f15..9e77cb6ae 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf @@ -1,305 +1,305 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=2 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=-205000 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=100000 -InputFilter1.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_2S.count=8 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel0.signal=1C - -Channel1.RF_channel_ID=0 -Channel1.signal=1C - -Channel2.RF_channel_ID=0 -Channel2.signal=1C - -Channel3.RF_channel_ID=0 -Channel3.signal=1C - -Channel4.RF_channel_ID=0 -Channel4.signal=1C - -Channel5.RF_channel_ID=0 -Channel5.signal=1C - -Channel6.RF_channel_ID=0 -Channel6.signal=1C - -Channel7.RF_channel_ID=0 -Channel7.signal=1C - - -Channel8.RF_channel_ID=1 -Channel8.signal=2S - -Channel9.RF_channel_ID=1 -Channel9.signal=2S - -Channel10.RF_channel_ID=1 -Channel10.signal=2S - -Channel11.RF_channel_ID=1 -Channel11.signal=2S - -Channel12.RF_channel_ID=1 -Channel12.signal=2S - -Channel13.RF_channel_ID=1 -Channel13.signal=2S - -Channel14.RF_channel_ID=1 -Channel14.signal=2S - -Channel15.RF_channel_ID=1 -Channel15.signal=2S - -Channel8.RF_channel_ID=1 -Channel8.signal=2S - -Channel9.RF_channel_ID=1 -Channel9.signal=2S - -Channel10.RF_channel_ID=1 -Channel10.signal=2S - -Channel11.RF_channel_ID=1 -Channel11.signal=2S - -Channel12.RF_channel_ID=1 -Channel12.signal=2S - -Channel13.RF_channel_ID=1 -Channel13.signal=2S - -Channel14.RF_channel_ID=1 -Channel14.signal=2S - -Channel15.RF_channel_ID=1 -Channel15.signal=2S - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=true -Tracking_1C.dump_filename=./tracking_ch_ - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=30 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.3; -Tracking_2S.order=3; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS L1 CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GPS L2 CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.flag_averaging=true -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=2 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=-205000 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=100000 +InputFilter1.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_2S.count=8 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel0.signal=1C + +Channel1.RF_channel_ID=0 +Channel1.signal=1C + +Channel2.RF_channel_ID=0 +Channel2.signal=1C + +Channel3.RF_channel_ID=0 +Channel3.signal=1C + +Channel4.RF_channel_ID=0 +Channel4.signal=1C + +Channel5.RF_channel_ID=0 +Channel5.signal=1C + +Channel6.RF_channel_ID=0 +Channel6.signal=1C + +Channel7.RF_channel_ID=0 +Channel7.signal=1C + + +Channel8.RF_channel_ID=1 +Channel8.signal=2S + +Channel9.RF_channel_ID=1 +Channel9.signal=2S + +Channel10.RF_channel_ID=1 +Channel10.signal=2S + +Channel11.RF_channel_ID=1 +Channel11.signal=2S + +Channel12.RF_channel_ID=1 +Channel12.signal=2S + +Channel13.RF_channel_ID=1 +Channel13.signal=2S + +Channel14.RF_channel_ID=1 +Channel14.signal=2S + +Channel15.RF_channel_ID=1 +Channel15.signal=2S + +Channel8.RF_channel_ID=1 +Channel8.signal=2S + +Channel9.RF_channel_ID=1 +Channel9.signal=2S + +Channel10.RF_channel_ID=1 +Channel10.signal=2S + +Channel11.RF_channel_ID=1 +Channel11.signal=2S + +Channel12.RF_channel_ID=1 +Channel12.signal=2S + +Channel13.RF_channel_ID=1 +Channel13.signal=2S + +Channel14.RF_channel_ID=1 +Channel14.signal=2S + +Channel15.RF_channel_ID=1 +Channel15.signal=2S + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=true +Tracking_1C.dump_filename=./tracking_ch_ + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=30 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.3; +Tracking_2S.order=3; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS L1 CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GPS L2 CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.flag_averaging=true +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf index c5737900d..f2a47b807 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf @@ -1,278 +1,278 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2500000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=2 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=0 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=0 -InputFilter1.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############. -Channels_1C.count=2 -Channels_1B.count=4 -Channels_2S.count=4 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=1 -Channel3.RF_channel_ID=1 -Channel4.RF_channel_ID=1 -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=1.5; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=30 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.3; -Tracking_2S.order=3; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=../data/epl_tracking_ch_ - - -;# GALILEO E1B -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000005 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=./veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS L1 CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GPS L2 CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - -;######### TELEMETRY DECODER GALILEO E1B CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2500000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/datalogger/signals/Fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=2 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=0 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=0 +InputFilter1.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############. +Channels_1C.count=2 +Channels_1B.count=4 +Channels_2S.count=4 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=1 +Channel3.RF_channel_ID=1 +Channel4.RF_channel_ID=1 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=1.5; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=30 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.3; +Tracking_2S.order=3; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=../data/epl_tracking_ch_ + + +;# GALILEO E1B +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000005 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=./veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS L1 CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GPS L2 CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + +;######### TELEMETRY DECODER GALILEO E1B CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf index 73fc542af..c6ca7e8e0 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf @@ -1,363 +1,363 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=1 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20000000 -InputFilter0.IF=0 -InputFilter0.decimation_factor=4 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=0 -InputFilter1.decimation_factor=4 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - - -;###################################################### -;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Freq_Xlating_Fir_Filter -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter_ch2.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex -InputFilter2.taps_item_type=float -InputFilter2.number_of_taps=5 -InputFilter2.number_of_bands=2 -InputFilter2.band1_begin=0.0 -InputFilter2.band1_end=0.45 -InputFilter2.band2_begin=0.55 -InputFilter2.band2_end=1.0 -InputFilter2.ampl1_begin=1.0 -InputFilter2.ampl1_end=1.0 -InputFilter2.ampl2_begin=0.0 -InputFilter2.ampl2_end=0.0 -InputFilter2.band1_error=1.0 -InputFilter2.band2_error=1.0 -InputFilter2.filter_type=bandpass -InputFilter2.grid_density=16 -InputFilter2.sampling_frequency=40000000 -InputFilter2.IF=0 -InputFilter2.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler2.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=10 -Channels_2S.count=0 -Channels_5X.count=0 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 -;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a - -;# CHANNEL CONNECTION - -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=0 -Channel11.RF_channel_ID=0 -Channel12.RF_channel_ID=0 -Channel13.RF_channel_ID=0 -Channel14.RF_channel_ID=0 -Channel15.RF_channel_ID=0 -Channel16.RF_channel_ID=0 -Channel17.RF_channel_ID=0 -Channel18.RF_channel_ID=0 -Channel19.RF_channel_ID=0 -Channel20.RF_channel_ID=0 -Channel21.RF_channel_ID=0 -Channel22.RF_channel_ID=0 -Channel23.RF_channel_ID=0 -Channel24.RF_channel_ID=0 -Channel25.RF_channel_ID=0 -Channel26.RF_channel_ID=0 -Channel27.RF_channel_ID=0 -Channel28.RF_channel_ID=0 -Channel29.RF_channel_ID=0 -Channel30.RF_channel_ID=2 -Channel31.RF_channel_ID=2 -Channel32.RF_channel_ID=2 -Channel33.RF_channel_ID=2 -Channel34.RF_channel_ID=2 -Channel35.RF_channel_ID=2 -Channel36.RF_channel_ID=2 -Channel37.RF_channel_ID=2 -Channel38.RF_channel_ID=2 -Channel39.RF_channel_ID=2 - -;######### ACQUISITION CONFIG ###### - -;# GPS L1 CA -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;# Galileo E1 -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;# GALILEO E5a -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.threshold=0.009 -Acquisition_5X.doppler_max=5000 -Acquisition_5X.doppler_step=125 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.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 -Acquisition_5X.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. -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;######### TRACKING CONFIG ############ -;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### GALILEO E1 TRK CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=false -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### GALILEO E5 TRK CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.pll_bw_hz_init=20.0; **Only for E5a** PLL loop filter bandwidth during initialization [Hz] -Tracking_5X.dll_bw_hz_init=20.0; **Only for E5a** DLL loop filter bandwidth during initialization [Hz] -Tracking_5X.ti_ms=1; **Only for E5a** loop filter integration time after initialization (secondary code delay search)[ms] -Tracking_5X.pll_bw_hz=20.0; -Tracking_5X.dll_bw_hz=20.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=1 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20000000 +InputFilter0.IF=0 +InputFilter0.decimation_factor=4 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=0 +InputFilter1.decimation_factor=4 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + + +;###################################################### +;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Freq_Xlating_Fir_Filter +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter_ch2.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex +InputFilter2.taps_item_type=float +InputFilter2.number_of_taps=5 +InputFilter2.number_of_bands=2 +InputFilter2.band1_begin=0.0 +InputFilter2.band1_end=0.45 +InputFilter2.band2_begin=0.55 +InputFilter2.band2_end=1.0 +InputFilter2.ampl1_begin=1.0 +InputFilter2.ampl1_end=1.0 +InputFilter2.ampl2_begin=0.0 +InputFilter2.ampl2_end=0.0 +InputFilter2.band1_error=1.0 +InputFilter2.band2_error=1.0 +InputFilter2.filter_type=bandpass +InputFilter2.grid_density=16 +InputFilter2.sampling_frequency=40000000 +InputFilter2.IF=0 +InputFilter2.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler2.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=10 +Channels_2S.count=0 +Channels_5X.count=0 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 +;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a + +;# CHANNEL CONNECTION + +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=0 +Channel11.RF_channel_ID=0 +Channel12.RF_channel_ID=0 +Channel13.RF_channel_ID=0 +Channel14.RF_channel_ID=0 +Channel15.RF_channel_ID=0 +Channel16.RF_channel_ID=0 +Channel17.RF_channel_ID=0 +Channel18.RF_channel_ID=0 +Channel19.RF_channel_ID=0 +Channel20.RF_channel_ID=0 +Channel21.RF_channel_ID=0 +Channel22.RF_channel_ID=0 +Channel23.RF_channel_ID=0 +Channel24.RF_channel_ID=0 +Channel25.RF_channel_ID=0 +Channel26.RF_channel_ID=0 +Channel27.RF_channel_ID=0 +Channel28.RF_channel_ID=0 +Channel29.RF_channel_ID=0 +Channel30.RF_channel_ID=2 +Channel31.RF_channel_ID=2 +Channel32.RF_channel_ID=2 +Channel33.RF_channel_ID=2 +Channel34.RF_channel_ID=2 +Channel35.RF_channel_ID=2 +Channel36.RF_channel_ID=2 +Channel37.RF_channel_ID=2 +Channel38.RF_channel_ID=2 +Channel39.RF_channel_ID=2 + +;######### ACQUISITION CONFIG ###### + +;# GPS L1 CA +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;# Galileo E1 +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;# GALILEO E5a +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.threshold=0.009 +Acquisition_5X.doppler_max=5000 +Acquisition_5X.doppler_step=125 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.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 +Acquisition_5X.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. +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;######### TRACKING CONFIG ############ +;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### GALILEO E1 TRK CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=false +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### GALILEO E5 TRK CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.pll_bw_hz_init=20.0; **Only for E5a** PLL loop filter bandwidth during initialization [Hz] +Tracking_5X.dll_bw_hz_init=20.0; **Only for E5a** DLL loop filter bandwidth during initialization [Hz] +Tracking_5X.ti_ms=1; **Only for E5a** loop filter integration time after initialization (secondary code delay search)[ms] +Tracking_5X.pll_bw_hz=20.0; +Tracking_5X.dll_bw_hz=20.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf index cbc7def7f..0abf4188c 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf @@ -1,258 +1,258 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/home/javier/signals/20140923_20-24-17_L125_roof_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=2 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.IF=0 -InputFilter0.decimation_factor=4 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20000000 -InputFilter1.IF=0 -InputFilter1.decimation_factor=4 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Pass_Through -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_2S.count=4 - -;#GPS.prns=7,8 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 -;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 -Channel16.RF_channel_ID=1 -Channel17.RF_channel_ID=1 -Channel18.RF_channel_ID=1 -Channel19.RF_channel_ID=1 - - -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;######### TRACKING CONFIG ############ -;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=false -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/home/javier/signals/20140923_20-24-17_L125_roof_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=2 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.IF=0 +InputFilter0.decimation_factor=4 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20000000 +InputFilter1.IF=0 +InputFilter1.decimation_factor=4 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Pass_Through +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_2S.count=4 + +;#GPS.prns=7,8 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 +;# CHANNEL NUMBERING ORDER: GPS L1 C/A, GPS L2 L2C (M), GALILEO E1 B, GALILEO E5a + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 +Channel16.RF_channel_ID=1 +Channel17.RF_channel_ID=1 +Channel18.RF_channel_ID=1 +Channel19.RF_channel_ID=1 + + +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;######### TRACKING CONFIG ############ +;######### GPS L1 C/A GENERIC TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=false +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf index ce6ceac98..257bd9091 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf @@ -1,109 +1,109 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=true - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1B.count=8 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.00001 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.cboc=false -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat -Acquisition_1B.blocking=false - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.dump=true -Tracking_1B.dump_filename=./veml_tracking_ch_ -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=3.0; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.track_pilot=true -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true; -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MSM_rate_ms=1000 -PVT.flag_rtcm_tty_port=false; -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=true + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=8 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.00001 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.cboc=false +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat +Acquisition_1B.blocking=false + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.dump=true +Tracking_1B.dump_filename=./veml_tracking_ch_ +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=3.0; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.track_pilot=true +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true; +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MSM_rate_ms=1000 +PVT.flag_rtcm_tty_port=false; +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf index d4372a04f..883927c8e 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf @@ -1,127 +1,127 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;GNSS-SDR.internal_fs_sps=6826700 -GNSS-SDR.internal_fs_sps=2560000 -;GNSS-SDR.internal_fs_sps=4096000 -;GNSS-SDR.internal_fs_sps=5120000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 ; 0 means the entire file -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -InputFilter.IF=5499998.47412109 -InputFilter.decimation_factor=8 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1B.count=8 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.cboc=false ; This option allows you to choose between acquiring with CBOC signal [true] or sinboc(1,1) signal [false]. Use only if GNSS-SDR.internal_fs_sps is greater than or equal to 6138000 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump=true -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;GNSS-SDR.internal_fs_sps=6826700 +GNSS-SDR.internal_fs_sps=2560000 +;GNSS-SDR.internal_fs_sps=4096000 +;GNSS-SDR.internal_fs_sps=5120000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Nsr_File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 ; 0 means the entire file +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +InputFilter.IF=5499998.47412109 +InputFilter.decimation_factor=8 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=8 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.pfa=0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.cboc=false ; This option allows you to choose between acquiring with CBOC signal [true] or sinboc(1,1) signal [false]. Use only if GNSS-SDR.internal_fs_sps is greater than or equal to 6138000 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump=true +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf index b9534b4b0..7ac27534e 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a.conf @@ -1,121 +1,121 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=32000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -;GNSS-SDR.SUPL_gps_enabled=false -;GNSS-SDR.SUPL_read_gps_assistance_xml=false -;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -;GNSS-SDR.SUPL_gps_ephemeris_port=7275 -;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -;GNSS-SDR.SUPL_gps_acquisition_port=7275 -;GNSS-SDR.SUPL_MCC=244 -;GNSS-SDR.SUPL_MNC=5 -;GNSS-SDR.SUPL_LAC=0x59e2 -;GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/32MS_complex.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=32000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_5X.count=1 -Channels.in_acquisition=1 - -;######### SPECIFIC CHANNELS CONFIG ###### -;#The following options are specific to each channel and overwrite the generic options - -;######### CHANNEL 0 CONFIG ############ -;Channel0.satellite=19 - -;######### CHANNEL 1 CONFIG ############ -;Channel1.satellite=12 - -;######### CHANNEL 2 CONFIG ############ -;Channel2.satellite=11 - -;######### CHANNEL 3 CONFIG ############ - -;Channel3.system=Galileo -;Channel3.signal=5Q -;Channel3.satellite=20 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.pfa=0.01 -Acquisition_5X.pfa=0.0003 -Acquisition_5X.doppler_max=10000 -Acquisition_5X.doppler_step=250 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.CAF_window_hz=0 -Acquisition_5X.Zero_padding=0 -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.pll_bw_hz=20.0; -Tracking_5X.dll_bw_hz=20.0; -Tracking_5X.pll_bw_narrow_hz=2.0; -Tracking_5X.dll_bw_narrow_hz=5.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=32000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +;GNSS-SDR.SUPL_gps_enabled=false +;GNSS-SDR.SUPL_read_gps_assistance_xml=false +;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +;GNSS-SDR.SUPL_gps_ephemeris_port=7275 +;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +;GNSS-SDR.SUPL_gps_acquisition_port=7275 +;GNSS-SDR.SUPL_MCC=244 +;GNSS-SDR.SUPL_MNC=5 +;GNSS-SDR.SUPL_LAC=0x59e2 +;GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/32MS_complex.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=32000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_5X.count=1 +Channels.in_acquisition=1 + +;######### SPECIFIC CHANNELS CONFIG ###### +;#The following options are specific to each channel and overwrite the generic options + +;######### CHANNEL 0 CONFIG ############ +;Channel0.satellite=19 + +;######### CHANNEL 1 CONFIG ############ +;Channel1.satellite=12 + +;######### CHANNEL 2 CONFIG ############ +;Channel2.satellite=11 + +;######### CHANNEL 3 CONFIG ############ + +;Channel3.system=Galileo +;Channel3.signal=5Q +;Channel3.satellite=20 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.pfa=0.01 +Acquisition_5X.pfa=0.0003 +Acquisition_5X.doppler_max=10000 +Acquisition_5X.doppler_step=250 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.CAF_window_hz=0 +Acquisition_5X.Zero_padding=0 +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.pll_bw_hz=20.0; +Tracking_5X.dll_bw_hz=20.0; +Tracking_5X.pll_bw_narrow_hz=2.0; +Tracking_5X.dll_bw_narrow_hz=5.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf index 7aba98ac1..9c2ea55cc 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf @@ -1,157 +1,157 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=50000000 - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -;GNSS-SDR.SUPL_gps_enabled=false -;GNSS-SDR.SUPL_read_gps_assistance_xml=false -;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -;GNSS-SDR.SUPL_gps_ephemeris_port=7275 -;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -;GNSS-SDR.SUPL_gps_acquisition_port=7275 -;GNSS-SDR.SUPL_MCC=244 -;GNSS-SDR.SUPL_MNC=5 -;GNSS-SDR.SUPL_LAC=0x59e2 -;GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/Galileo_E5ab_IFEN_CTTC_run1.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=50000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=50000000 -InputFilter.IF=-15345000 -InputFilter.decimation_factor=1 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_5X.count=8 -Channels.in_acquisition=1 -Channel.signal=5X - -;######### SPECIFIC CHANNELS CONFIG ###### -;#The following options are specific to each channel and overwrite the generic options - -;######### CHANNEL 0 CONFIG ############ -Channel0.signal=5X -;Channel0.satellite=19 -;Channel0.repeat_satellite=true - -;######### CHANNEL 1 CONFIG ############ -Channel1.signal=5X -;Channel1.satellite=12 - -;######### CHANNEL 2 CONFIG ############ -Channel2.signal=5X -;Channel2.satellite=11 - -;######### CHANNEL 3 CONFIG ############ -Channel3.signal=5X -;Channel3.satellite=20 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.threshold=0.002 -Acquisition_5X.doppler_max=10000 -Acquisition_5X.doppler_step=250 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.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 -Acquisition_5X.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. -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.pll_bw_hz=20.0; -Tracking_5X.dll_bw_hz=20.0; -Tracking_5X.pll_bw_narrow_hz=20.0; -Tracking_5X.dll_bw_narrow_hz=20.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=OFF ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.dump=false -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=50000000 + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +;GNSS-SDR.SUPL_gps_enabled=false +;GNSS-SDR.SUPL_read_gps_assistance_xml=false +;GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +;GNSS-SDR.SUPL_gps_ephemeris_port=7275 +;GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +;GNSS-SDR.SUPL_gps_acquisition_port=7275 +;GNSS-SDR.SUPL_MCC=244 +;GNSS-SDR.SUPL_MNC=5 +;GNSS-SDR.SUPL_LAC=0x59e2 +;GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/Galileo_E5ab_IFEN_CTTC_run1.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=50000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=50000000 +InputFilter.IF=-15345000 +InputFilter.decimation_factor=1 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_5X.count=8 +Channels.in_acquisition=1 +Channel.signal=5X + +;######### SPECIFIC CHANNELS CONFIG ###### +;#The following options are specific to each channel and overwrite the generic options + +;######### CHANNEL 0 CONFIG ############ +Channel0.signal=5X +;Channel0.satellite=19 +;Channel0.repeat_satellite=true + +;######### CHANNEL 1 CONFIG ############ +Channel1.signal=5X +;Channel1.satellite=12 + +;######### CHANNEL 2 CONFIG ############ +Channel2.signal=5X +;Channel2.satellite=11 + +;######### CHANNEL 3 CONFIG ############ +Channel3.signal=5X +;Channel3.satellite=20 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.threshold=0.002 +Acquisition_5X.doppler_max=10000 +Acquisition_5X.doppler_step=250 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.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 +Acquisition_5X.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. +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.pll_bw_hz=20.0; +Tracking_5X.dll_bw_hz=20.0; +Tracking_5X.pll_bw_narrow_hz=20.0; +Tracking_5X.dll_bw_narrow_hz=20.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=OFF ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=OFF ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.dump=false +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf index e53d49252..a0715fba8 100644 --- a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf +++ b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf @@ -1,141 +1,141 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=20000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ibyte_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=8 - -Channels.in_acquisition=1 - -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.scoherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.acquire_pilot=true -Acquisition_1B.threshold=2.5 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.bit_transition_flag=true -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=../data/acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=30.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.track_pilot=true -Tracking_1B.pll_bw_hz=4.0; -Tracking_1B.dll_bw_hz=0.5; -Tracking_1B.pll_bw_narrow_hz=2.0; -Tracking_1B.dll_bw_narrow_hz=0.25; -Tracking_1B.extend_correlation_symbols=4; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.early_late_space_narrow_chips=0.06; -Tracking_1B.very_early_late_space_narrow_chips=0.25; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=20000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ibyte_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=8 + +Channels.in_acquisition=1 + +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.scoherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.acquire_pilot=true +Acquisition_1B.threshold=2.5 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.bit_transition_flag=true +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=../data/acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=30.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.track_pilot=true +Tracking_1B.pll_bw_hz=4.0; +Tracking_1B.dll_bw_hz=0.5; +Tracking_1B.pll_bw_narrow_hz=2.0; +Tracking_1B.dll_bw_narrow_hz=0.25; +Tracking_1B.extend_correlation_symbols=4; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.early_late_space_narrow_chips=0.06; +Tracking_1B.very_early_late_space_narrow_chips=0.25; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf index 9213ef302..91387a875 100644 --- a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf +++ b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf @@ -1,169 +1,169 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=5456000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Labsat_Signal_Source -SignalSource.selected_channel=1 -;#filename: path to file with the captured GNSS signal samples to be processed -;# Labsat sile source automatically increments the file name when the signal is split in several files -;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on -;# in this example, the first file complete path will be ../signals/GPS_025_0000.LS3 -SignalSource.filename=../signals/GPS_025 ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=16368000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=16368000 -InputFilter.IF=0 -InputFilter.decimation_factor=3 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=6 -Channels.in_acquisition=1 - -Channel0.signal=1B -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.acquire_pilot=true -Acquisition_1B.threshold=2.5 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.bit_transition_flag=true -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=../data/acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.track_pilot=true -Tracking_1B.pll_bw_hz=7.5; -Tracking_1B.dll_bw_hz=0.5; -Tracking_1B.pll_bw_narrow_hz=2.5; -Tracking_1B.dll_bw_narrow_hz=0.25; -Tracking_1B.extend_correlation_symbols=4; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.early_late_space_narrow_chips=0.15; -Tracking_1B.very_early_late_space_narrow_chips=0.30; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=5456000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Labsat_Signal_Source +SignalSource.selected_channel=1 +;#filename: path to file with the captured GNSS signal samples to be processed +;# Labsat sile source automatically increments the file name when the signal is split in several files +;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on +;# in this example, the first file complete path will be ../signals/GPS_025_0000.LS3 +SignalSource.filename=../signals/GPS_025 ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=16368000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=16368000 +InputFilter.IF=0 +InputFilter.decimation_factor=3 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=6 +Channels.in_acquisition=1 + +Channel0.signal=1B +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.acquire_pilot=true +Acquisition_1B.threshold=2.5 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.bit_transition_flag=true +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=../data/acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.track_pilot=true +Tracking_1B.pll_bw_hz=7.5; +Tracking_1B.dll_bw_hz=0.5; +Tracking_1B.pll_bw_narrow_hz=2.5; +Tracking_1B.dll_bw_narrow_hz=0.25; +Tracking_1B.extend_correlation_symbols=4; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.early_late_space_narrow_chips=0.15; +Tracking_1B.very_early_late_space_narrow_chips=0.30; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf index 372449d4c..021b12ae8 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf @@ -1,142 +1,142 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=../data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=../data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Direct_Resampler -Resampler0.sample_freq_in=6625000 -Resampler0.sample_freq_out=6625000 -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=1 -Channels_1G.count=5 -Channels_1C.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.0 -Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false; -Acquisition_1C.dump_filename=/archive/gps_acquisition.dat -;Acquisition_1C.coherent_integration_time_ms=10 - -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.00001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=10 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=/archive/gps_tracking_ch_ - -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=25.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=../data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=../data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=6625000 +Resampler0.sample_freq_out=6625000 +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_1G.count=5 +Channels_1C.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.0 +Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.00001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf index 8681ca8ba..8d37347c8 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L2C_ibyte.conf @@ -1,143 +1,143 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Pass_Through -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=5 -Channels_2S.count=5 -Channels_1G.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel0.signal=2S -Channel1.RF_channel_ID=0 -Channel1.signal=2S -Channel2.RF_channel_ID=0 -Channel2.signal=2S -Channel3.RF_channel_ID=0 -Channel3.signal=2S -Channel4.RF_channel_ID=0 -Channel4.signal=2S -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.threshold=0.0 -Acquisition_2S.pfa=0.00001 -Acquisition_2S.doppler_max=10000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 - -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.00001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.early_late_space_chips=0.5 -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.250; -Tracking_2S.order=2; -Tracking_2S.dump=false; -Tracking_2S.dump_filename=/archive/gps_tracking_ch_ - -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=25.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=3 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Pass_Through +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=5 +Channels_2S.count=5 +Channels_1G.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel0.signal=2S +Channel1.RF_channel_ID=0 +Channel1.signal=2S +Channel2.RF_channel_ID=0 +Channel2.signal=2S +Channel3.RF_channel_ID=0 +Channel3.signal=2S +Channel4.RF_channel_ID=0 +Channel4.signal=2S +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.threshold=0.0 +Acquisition_2S.pfa=0.00001 +Acquisition_2S.doppler_max=10000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 + +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.00001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.early_late_space_chips=0.5 +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.250; +Tracking_2S.order=2; +Tracking_2S.dump=false; +Tracking_2S.dump_filename=/archive/gps_tracking_ch_ + +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=3 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf index fda369294..46efcc5df 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte.conf @@ -1,82 +1,82 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1G -Channels.in_acquisition=1 -Channels_1G.count=5 - -Channel0.satellite=24 ; k= -Channel1.satellite=1 ; k=1 -Channel2.satellite=2 ; k=-4 -Channel3.satellite=20 ; k=-5 -Channel4.satellite=21 ; k=4 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.0001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=true; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=1 -;Acquisition_1G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=25.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.dump=true; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=1 +Channels_1G.count=5 + +Channel0.satellite=24 ; k= +Channel1.satellite=1 ; k=1 +Channel2.satellite=2 ; k=-4 +Channel3.satellite=20 ; k=-5 +Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=true; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=25.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.dump=true; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf index faa67b8ca..bc48c28a7 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_ibyte_coh_trk.conf @@ -1,86 +1,86 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1G -Channels.in_acquisition=2 -Channels_1G.count=8 - -;Channel0.satellite=24 ; k=2 -;Channel1.satellite=1 ; k=1 -;Channel2.satellite=2 ; k=-4 -;Channel3.satellite=20 ; k=-5 -;Channel4.satellite=21 ; k=4 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.0001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=1 -;Acquisition_1G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=40.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.pll_bw_narrow_hz = 25.0; -Tracking_1G.dll_bw_narrow_hz = 2.0; -Tracking_1G.extend_correlation_ms = 1; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=2 +Channels_1G.count=8 + +;Channel0.satellite=24 ; k=2 +;Channel1.satellite=1 ; k=1 +;Channel2.satellite=2 ; k=-4 +;Channel3.satellite=20 ; k=-5 +;Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=40.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.pll_bw_narrow_hz = 25.0; +Tracking_1G.dll_bw_narrow_hz = 2.0; +Tracking_1G.extend_correlation_ms = 1; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf index 4ab21d0b3..8f8baecfc 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf @@ -1,101 +1,101 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Hz]. -GNSS-SDR.internal_fs_sps=6625000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/dmiralles/Documents/GSOC/GSOC2017/gnss-sdr/data/dmirallesNT1065_L2_20160831_fs6625e6_60e3_schar_1H.bin -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.freq=1602000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.sample_type=iq -SignalSource.seconds_to_skip=0 -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -;InputFilter.input_item_type=gr_complex -;InputFilter.output_item_type=gr_complex -InputFilter.item_type=gr_complex -;Resampler.implementation=Pass_Through -;Resampler.item_type=gr_complex -Resampler.implementation=Pass_Through -;Resampler.sample_freq_in=4000000 -;Resampler.sample_freq_out=2000000 -;Resampler.item_type=gr_complex -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1R.count=8 ;Assuming here that identifier `1r=R` defines GLONASS SP signals -Channels.in_acquisition=1 -Channel.signal=1R -;Channel.item_type=cshort - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1R.dump=false -Acquisition_1R.dump_filename=./acq_dump.dat -Acquisition_1R.item_type=cshort -Acquisition_1R.sampled_ms=1 -Acquisition_1R.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1R.pfa=0.01 -;Acquisition_1C.pfa=0.000001 -Acquisition_1R.doppler_max=10000 -Acquisition_1R.doppler_step=250 -Acquisition_1R.tong_init_val=2 -Acquisition_1R.tong_max_val=10 -Acquisition_1R.tong_max_dwells=20 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1R.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking -Tracking_1R.item_type=cshort -Tracking_1R.dump=false -Tracking_1R.dump_filename=../data/epl_tracking_ch_ -Tracking_1R.pll_bw_hz=40.0; -Tracking_1R.dll_bw_hz=4.0; -Tracking_1R.order=3; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1R.implementation=GLONASS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1R.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Hz]. +GNSS-SDR.internal_fs_sps=6625000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/home/dmiralles/Documents/GSOC/GSOC2017/gnss-sdr/data/dmirallesNT1065_L2_20160831_fs6625e6_60e3_schar_1H.bin +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.freq=1602000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.sample_type=iq +SignalSource.seconds_to_skip=0 +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +;InputFilter.input_item_type=gr_complex +;InputFilter.output_item_type=gr_complex +InputFilter.item_type=gr_complex +;Resampler.implementation=Pass_Through +;Resampler.item_type=gr_complex +Resampler.implementation=Pass_Through +;Resampler.sample_freq_in=4000000 +;Resampler.sample_freq_out=2000000 +;Resampler.item_type=gr_complex +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1R.count=8 ;Assuming here that identifier `1r=R` defines GLONASS SP signals +Channels.in_acquisition=1 +Channel.signal=1R +;Channel.item_type=cshort + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1R.dump=false +Acquisition_1R.dump_filename=./acq_dump.dat +Acquisition_1R.item_type=cshort +Acquisition_1R.sampled_ms=1 +Acquisition_1R.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1R.pfa=0.01 +;Acquisition_1C.pfa=0.000001 +Acquisition_1R.doppler_max=10000 +Acquisition_1R.doppler_step=250 +Acquisition_1R.tong_init_val=2 +Acquisition_1R.tong_max_val=10 +Acquisition_1R.tong_max_dwells=20 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1R.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1R.item_type=cshort +Tracking_1R.dump=false +Tracking_1R.dump_filename=../data/epl_tracking_ch_ +Tracking_1R.pll_bw_hz=40.0; +Tracking_1R.dll_bw_hz=4.0; +Tracking_1R.order=3; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1R.implementation=GLONASS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1R.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf index 663f6451e..abdbea4b2 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L1_CA_ibyte.conf @@ -1,143 +1,143 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Direct_Resampler -Resampler0.sample_freq_in=6625000 -Resampler0.sample_freq_out=6625000 -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=1 -Channels_2G.count=5 -Channels_1C.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.0 -Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false; -Acquisition_1C.dump_filename=/archive/gps_acquisition.dat -;Acquisition_1C.coherent_integration_time_ms=10 - -Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition -Acquisition_2G.item_type=gr_complex -Acquisition_2G.threshold=0.0 -Acquisition_2G.pfa=0.00001 -Acquisition_2G.doppler_max=10000 -Acquisition_2G.doppler_step=250 -Acquisition_2G.dump=false; -Acquisition_2G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_2G.coherent_integration_time_ms=10 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.early_late_space_chips=0.5 -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dump=false; -Tracking_1C.dump_filename=/archive/gps_tracking_ch_ - -Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking -Tracking_2G.item_type=gr_complex -Tracking_2G.early_late_space_chips=0.5 -Tracking_2G.pll_bw_hz=25.0; -Tracking_2G.dll_bw_hz=2.0; -Tracking_2G.dump=false; -Tracking_2G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Direct_Resampler +Resampler0.sample_freq_in=6625000 +Resampler0.sample_freq_out=6625000 +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_2G.count=5 +Channels_1C.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.0 +Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false; +Acquisition_1C.dump_filename=/archive/gps_acquisition.dat +;Acquisition_1C.coherent_integration_time_ms=10 + +Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition +Acquisition_2G.item_type=gr_complex +Acquisition_2G.threshold=0.0 +Acquisition_2G.pfa=0.00001 +Acquisition_2G.doppler_max=10000 +Acquisition_2G.doppler_step=250 +Acquisition_2G.dump=false; +Acquisition_2G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_2G.coherent_integration_time_ms=10 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.early_late_space_chips=0.5 +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dump=false; +Tracking_1C.dump_filename=/archive/gps_tracking_ch_ + +Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking +Tracking_2G.item_type=gr_complex +Tracking_2G.early_late_space_chips=0.5 +Tracking_2G.pll_bw_hz=25.0; +Tracking_2G.dll_bw_hz=2.0; +Tracking_2G.dump=false; +Tracking_2G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf index faa27538d..79585a6ae 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_GPS_L2C_ibyte.conf @@ -1,144 +1,144 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 -GNSS-SDR.num_sources=2 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ibyte -SignalSource0.sampling_frequency=6625000 -SignalSource0.samples=0 -SignalSource0.dump=false; -SignalSource0.dump_filename=/archive/signal_glonass.bin - -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/archive/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ibyte -SignalSource1.sampling_frequency=6625000 -SignalSource1.samples=0 -SignalSource1.dump=false; -SignalSource1.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner -DataTypeAdapter0.implementation=Ibyte_To_Complex -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.70 -InputFilter0.band2_begin=0.80 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=6625000 -InputFilter0.IF=60000 -Resampler0.implementation=Pass_Through -Resampler0.item_type=gr_complex - -SignalConditioner1.implementation=Signal_Conditioner -DataTypeAdapter1.implementation=Ibyte_To_Complex -InputFilter1.implementation=Pass_Through -InputFilter1.item_type=gr_complex -Resampler1.implementation=Pass_Through -Resampler1.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=5 -Channels_2S.count=5 -Channels_2G.count=5 - -;# Defining GLONASS satellites -Channel0.RF_channel_ID=0 -Channel0.signal=2S -Channel1.RF_channel_ID=0 -Channel1.signal=2S -Channel2.RF_channel_ID=0 -Channel2.signal=2S -Channel3.RF_channel_ID=0 -Channel3.signal=2S -Channel4.RF_channel_ID=0 -Channel4.signal=2S -Channel5.RF_channel_ID=1 -Channel6.RF_channel_ID=1 -Channel7.RF_channel_ID=1 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.threshold=0.0 -Acquisition_2S.pfa=0.00001 -Acquisition_2S.doppler_max=10000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 - -Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition -Acquisition_2G.item_type=gr_complex -Acquisition_2G.threshold=0.0 -Acquisition_2G.pfa=0.00001 -Acquisition_2G.doppler_max=10000 -Acquisition_2G.doppler_step=250 -Acquisition_2G.dump=false; -Acquisition_2G.dump_filename=/archive/glo_acquisition.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.early_late_space_chips=0.5 -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.250; -Tracking_2S.order=2; -Tracking_2S.dump=false; -Tracking_2S.dump_filename=/archive/gps_tracking_ch_ - -Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking -Tracking_2G.item_type=gr_complex -Tracking_2G.early_late_space_chips=0.5 -Tracking_2G.pll_bw_hz=25.0; -Tracking_2G.dll_bw_hz=3.0; -Tracking_2G.dump=false; -Tracking_2G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false; -Observables.dump_filename=/archive/gnss_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=3 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 +GNSS-SDR.num_sources=2 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/archive/NT1065_L2_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ibyte +SignalSource0.sampling_frequency=6625000 +SignalSource0.samples=0 +SignalSource0.dump=false; +SignalSource0.dump_filename=/archive/signal_glonass.bin + +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/archive/NT1065_GLONASS_L2_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ibyte +SignalSource1.sampling_frequency=6625000 +SignalSource1.samples=0 +SignalSource1.dump=false; +SignalSource1.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner +DataTypeAdapter0.implementation=Ibyte_To_Complex +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.70 +InputFilter0.band2_begin=0.80 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=6625000 +InputFilter0.IF=60000 +Resampler0.implementation=Pass_Through +Resampler0.item_type=gr_complex + +SignalConditioner1.implementation=Signal_Conditioner +DataTypeAdapter1.implementation=Ibyte_To_Complex +InputFilter1.implementation=Pass_Through +InputFilter1.item_type=gr_complex +Resampler1.implementation=Pass_Through +Resampler1.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=5 +Channels_2S.count=5 +Channels_2G.count=5 + +;# Defining GLONASS satellites +Channel0.RF_channel_ID=0 +Channel0.signal=2S +Channel1.RF_channel_ID=0 +Channel1.signal=2S +Channel2.RF_channel_ID=0 +Channel2.signal=2S +Channel3.RF_channel_ID=0 +Channel3.signal=2S +Channel4.RF_channel_ID=0 +Channel4.signal=2S +Channel5.RF_channel_ID=1 +Channel6.RF_channel_ID=1 +Channel7.RF_channel_ID=1 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.threshold=0.0 +Acquisition_2S.pfa=0.00001 +Acquisition_2S.doppler_max=10000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 + +Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition +Acquisition_2G.item_type=gr_complex +Acquisition_2G.threshold=0.0 +Acquisition_2G.pfa=0.00001 +Acquisition_2G.doppler_max=10000 +Acquisition_2G.doppler_step=250 +Acquisition_2G.dump=false; +Acquisition_2G.dump_filename=/archive/glo_acquisition.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.early_late_space_chips=0.5 +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.250; +Tracking_2S.order=2; +Tracking_2S.dump=false; +Tracking_2S.dump_filename=/archive/gps_tracking_ch_ + +Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking +Tracking_2G.item_type=gr_complex +Tracking_2G.early_late_space_chips=0.5 +Tracking_2G.pll_bw_hz=25.0; +Tracking_2G.dll_bw_hz=3.0; +Tracking_2G.dump=false; +Tracking_2G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false; +Observables.dump_filename=/archive/gnss_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=3 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf index 8ded2ca7e..9ac3595eb 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte.conf @@ -1,76 +1,76 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160831_fs6625e6_60e3_schar_1m.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=2G -Channels.in_acquisition=1 -Channels_2G.count=5 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition -Acquisition_2G.item_type=gr_complex -Acquisition_2G.threshold=0.0 -Acquisition_2G.pfa=0.0001 -Acquisition_2G.doppler_max=10000 -Acquisition_2G.doppler_step=250 -Acquisition_2G.dump=true; -Acquisition_2G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_2G.coherent_integration_time_ms=1 -;Acquisition_2G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking -Tracking_2G.item_type=gr_complex -Tracking_2G.early_late_space_chips=0.5 -Tracking_2G.pll_bw_hz=20.0; -Tracking_2G.dll_bw_hz=2.0; -Tracking_2G.dump=true; -Tracking_2G.dump_filename=/archive/glo_tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true; -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/dmiralles/Seagate Backup Plus Drive/GNSS Data/NT1065_GLONASS_L2_20160831_fs6625e6_60e3_schar_1m.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=2G +Channels.in_acquisition=1 +Channels_2G.count=5 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2G.implementation=GLONASS_L2_CA_PCPS_Acquisition +Acquisition_2G.item_type=gr_complex +Acquisition_2G.threshold=0.0 +Acquisition_2G.pfa=0.0001 +Acquisition_2G.doppler_max=10000 +Acquisition_2G.doppler_step=250 +Acquisition_2G.dump=true; +Acquisition_2G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_2G.coherent_integration_time_ms=1 +;Acquisition_2G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2G.implementation=GLONASS_L2_CA_DLL_PLL_Tracking +Tracking_2G.item_type=gr_complex +Tracking_2G.early_late_space_chips=0.5 +Tracking_2G.pll_bw_hz=20.0; +Tracking_2G.dll_bw_hz=2.0; +Tracking_2G.dump=true; +Tracking_2G.dump_filename=/archive/glo_tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2G.implementation=GLONASS_L2_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true; +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf index faa67b8ca..bc48c28a7 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L2_CA_ibyte_coh_trk.conf @@ -1,86 +1,86 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=6625000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=ibyte -SignalSource.sampling_frequency=6625000 -SignalSource.samples=0 -SignalSource.dump=false; -SignalSource.dump_filename=/archive/signal_glonass.bin - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Ibyte_To_Complex -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channel.signal=1G -Channels.in_acquisition=2 -Channels_1G.count=8 - -;Channel0.satellite=24 ; k=2 -;Channel1.satellite=1 ; k=1 -;Channel2.satellite=2 ; k=-4 -;Channel3.satellite=20 ; k=-5 -;Channel4.satellite=21 ; k=4 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition -Acquisition_1G.item_type=gr_complex -Acquisition_1G.threshold=0.0 -Acquisition_1G.pfa=0.0001 -Acquisition_1G.doppler_max=10000 -Acquisition_1G.doppler_step=250 -Acquisition_1G.dump=false; -Acquisition_1G.dump_filename=/archive/glo_acquisition.dat -;Acquisition_1G.coherent_integration_time_ms=1 -;Acquisition_1G.max_dwells = 5 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking -Tracking_1G.item_type=gr_complex -Tracking_1G.early_late_space_chips=0.5 -Tracking_1G.pll_bw_hz=40.0; -Tracking_1G.dll_bw_hz=3.0; -Tracking_1G.pll_bw_narrow_hz = 25.0; -Tracking_1G.dll_bw_narrow_hz = 2.0; -Tracking_1G.extend_correlation_ms = 1; -Tracking_1G.dump=false; -Tracking_1G.dump_filename=/archive/glo_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=/archive/glo_observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1045_rate_ms=5000 -PVT.rtcm_MT1097_rate_ms=1000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=6625000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/archive/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=ibyte +SignalSource.sampling_frequency=6625000 +SignalSource.samples=0 +SignalSource.dump=false; +SignalSource.dump_filename=/archive/signal_glonass.bin + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Ibyte_To_Complex +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channel.signal=1G +Channels.in_acquisition=2 +Channels_1G.count=8 + +;Channel0.satellite=24 ; k=2 +;Channel1.satellite=1 ; k=1 +;Channel2.satellite=2 ; k=-4 +;Channel3.satellite=20 ; k=-5 +;Channel4.satellite=21 ; k=4 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1G.implementation=GLONASS_L1_CA_PCPS_Acquisition +Acquisition_1G.item_type=gr_complex +Acquisition_1G.threshold=0.0 +Acquisition_1G.pfa=0.0001 +Acquisition_1G.doppler_max=10000 +Acquisition_1G.doppler_step=250 +Acquisition_1G.dump=false; +Acquisition_1G.dump_filename=/archive/glo_acquisition.dat +;Acquisition_1G.coherent_integration_time_ms=1 +;Acquisition_1G.max_dwells = 5 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1G.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking +Tracking_1G.item_type=gr_complex +Tracking_1G.early_late_space_chips=0.5 +Tracking_1G.pll_bw_hz=40.0; +Tracking_1G.dll_bw_hz=3.0; +Tracking_1G.pll_bw_narrow_hz = 25.0; +Tracking_1G.dll_bw_narrow_hz = 2.0; +Tracking_1G.extend_correlation_ms = 1; +Tracking_1G.dump=false; +Tracking_1G.dump_filename=/archive/glo_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1G.implementation=GLONASS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=/archive/glo_observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1045_rate_ms=5000 +PVT.rtcm_MT1097_rate_ms=1000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf index a9f5495ba..3daee47ce 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf @@ -1,160 +1,160 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=20000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/media/javier/Extreme 500/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ibyte_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=20000000 -Resampler.sample_freq_out=20000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=10 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B -Channel16.signal=1B -Channel17.signal=1B -Channel18.signal=1B -Channel19.signal=1B - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=3.5 -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.5 -Acquisition_1B.blocking=true -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=1 -Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=30; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.5; -Tracking_1C.order=2; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=3.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10; -PVT.display_rate_ms=500; -PVT.elevation_mask=15; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=20000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/media/javier/Extreme 500/fraunhofer/L125_III1b_210s_L1.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ibyte_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=20000000 +Resampler.sample_freq_out=20000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=10 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B +Channel16.signal=1B +Channel17.signal=1B +Channel18.signal=1B +Channel19.signal=1B + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=3.5 +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.blocking=true +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=1 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.order=2; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=3.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10; +PVT.display_rate_ms=500; +PVT.elevation_mask=15; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf index 9ad05a378..b92bdc4a9 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf @@ -1,145 +1,145 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2600000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/Users/carlesfernandez/git/cttc/build/signal_out.bin ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ibyte_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type = gr_complex; - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=11 -Channels_1B.count=0 -Channels.in_acquisition=1 - -;#signal: -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C -Channel8.signal=1C -Channel9.signal=1C -Channel10.signal=1C -Channel11.signal=1C -Channel12.signal=1C -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=6000 -Acquisition_1C.doppler_step=100 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=20.0; -Tracking_1C.dll_bw_hz=1.5; -Tracking_1C.order=3; - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2600000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/Users/carlesfernandez/git/cttc/build/signal_out.bin ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ibyte_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type = gr_complex; + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=11 +Channels_1B.count=0 +Channels.in_acquisition=1 + +;#signal: +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C +Channel8.signal=1C +Channel9.signal=1C +Channel10.signal=1C +Channel11.signal=1C +Channel12.signal=1C +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=6000 +Acquisition_1C.doppler_step=100 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=20.0; +Tracking_1C.dll_bw_hz=1.5; +Tracking_1C.order=3; + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf index ad5cf520e..b375cec21 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf @@ -1,131 +1,131 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4092000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/sim/GPS_sim1.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=4092000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=1 -Channels_1B.count=0 -Channels.in_acquisition=1 - -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=100 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=10 -Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=25; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.fll_bw_hz=10.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10; -PVT.display_rate_ms=500; -PVT.dump=false -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4092000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/sim/GPS_sim1.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=4092000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=1 +Channels_1B.count=0 +Channels.in_acquisition=1 + +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=100 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=10 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=25; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.fll_bw_hz=10.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10; +PVT.display_rate_ms=500; +PVT.dump=false +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump_filename=./PVT diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf index 1950ff6d0..3931754e0 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf @@ -1,161 +1,161 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_1B.count=5 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "5X" GALILEO E5a I+Q -Channel0.signal=1B -Channel1.signal=1B -Channel2.signal=1B -Channel3.signal=1B -Channel4.signal=1B -Channel5.signal=1B -Channel6.signal=1B -Channel7.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008; 0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.cboc=false; -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=50.0; -Tracking_1C.dll_bw_hz=5.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of Galileo ephemeris messages. 0 mutes this message -PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of GPS ephemeris messages. 0 mutes this message -PVT.rtcm_MT1097_rate_ms=1000 ; Period (in ms) of Galileo observables. 0 mutes this message -PVT.rtcm_MT1077_rate_ms=1000 ; Period (in ms) of GPS observables. 0 mutes this message -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_1B.count=5 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "5X" GALILEO E5a I+Q +Channel0.signal=1B +Channel1.signal=1B +Channel2.signal=1B +Channel3.signal=1B +Channel4.signal=1B +Channel5.signal=1B +Channel6.signal=1B +Channel7.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000008; 0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.cboc=false; +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=50.0; +Tracking_1C.dll_bw_hz=5.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of Galileo ephemeris messages. 0 mutes this message +PVT.rtcm_MT1045_rate_ms=5000 ; Period (in ms) of GPS ephemeris messages. 0 mutes this message +PVT.rtcm_MT1097_rate_ms=1000 ; Period (in ms) of Galileo observables. 0 mutes this message +PVT.rtcm_MT1077_rate_ms=1000 ; Period (in ms) of GPS observables. 0 mutes this message +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf b/conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf index 0e906aca7..31787abab 100644 --- a/conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf +++ b/conf/File_input/MultiCons/gnss-sdr_labsat_kf.conf @@ -1,185 +1,185 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=5456000 -GNSS-SDR.use_acquisition_resampler=true - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Labsat_Signal_Source -SignalSource.selected_channel=1 -;#filename: path to file with the captured GNSS signal samples to be processed -;# Labsat sile source automatically increments the file name when the signal is split in several files -;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on -;# in this example, the first file complete path will be ../signals/GPS_025_ -SignalSource.filename=/home/javier/signals/satgen_30mins/output/output -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=16368000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=./out.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=/media/javier/WDNASNTFS/output_5.456Msps_gr_complex.dat - -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -InputFilter.filter_type=lowpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=16368000 -InputFilter.IF=0 -InputFilter.decimation_factor=3 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels_1B.count=0 -Channels_L5.count=0 -Channels_5X.count=0 - -Channels.in_acquisition=1 - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=3.0 -Acquisition_1C.use_CFAR_algorithm=false -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=125 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.8 -Acquisition_1B.use_CFAR_algorithm=false -Acquisition_1B.blocking=false -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_KF_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=true -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.extend_correlation_symbols=20; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.early_late_space_narrow_chips=0.15 - -;Tracking_1C.code_disc_sd_chips=0.2; // Initial R -;Tracking_1C.carrier_disc_sd_rads=0.3; // Initial R - -;Tracking_1C.init_code_phase_sd_chips=0.5; // Initial P_0_0 -;Tracking_1C.init_carrier_phase_sd_rad=0.7; -;Tracking_1C.init_carrier_freq_sd_hz=5; -;Tracking_1C.init_carrier_freq_rate_sd_hz_s=1; - -;Tracking_1C.code_phase_sd_chips=0.15; // Initial Q -;Tracking_1C.carrier_phase_sd_rad=0.25; -;Tracking_1C.carrier_freq_sd_hz=0.6; -;Tracking_1C.carrier_freq_rate_sd_hz_s=0.01; - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=0.75; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.5; -Tracking_1B.early_late_space_narrow_chips=0.10; -Tracking_1B.very_early_late_space_narrow_chips=0.5; -Tracking_1B.pll_bw_narrow_hz=2.5 -Tracking_1B.dll_bw_narrow_hz=0.2 -Tracking_1B.extend_correlation_symbols=5 -Tracking_1B.track_pilot=true -Tracking_1B.enable_fll_pull_in=true; -;Tracking_1B.pull_in_time_s=60 -Tracking_1B.enable_fll_steady_state=false -Tracking_1B.fll_bw_hz=10 -Tracking_1B.dump=false -Tracking_1B.dump_filename=tracking_ch_ - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat -Observables.enable_carrier_smoothing=false -Observables.smoothing_factor=200 - - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.enable_rx_clock_correction=false -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=1000; -PVT.rinexobs_rate_ms=1000; -PVT.display_rate_ms=1000; -PVT.elevation_mask=15; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT -PVT.enable_monitor=false -PVT.monitor_udp_port=1337 -PVT.monitor_client_addresses=127.0.0.1 - -;######### MONITOR CONFIG ############ -Monitor.enable_monitor=false -Monitor.decimation_factor=1 -Monitor.client_addresses=127.0.0.1 -Monitor.udp_port=1234 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=5456000 +GNSS-SDR.use_acquisition_resampler=true + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Labsat_Signal_Source +SignalSource.selected_channel=1 +;#filename: path to file with the captured GNSS signal samples to be processed +;# Labsat sile source automatically increments the file name when the signal is split in several files +;# the adapter adds "_0000.LS3" to this base path and filename. Next file will be "_0001.LS3" and so on +;# in this example, the first file complete path will be ../signals/GPS_025_ +SignalSource.filename=/home/javier/signals/satgen_30mins/output/output +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=16368000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./out.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=/media/javier/WDNASNTFS/output_5.456Msps_gr_complex.dat + +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +InputFilter.filter_type=lowpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=16368000 +InputFilter.IF=0 +InputFilter.decimation_factor=3 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels_1B.count=0 +Channels_L5.count=0 +Channels_5X.count=0 + +Channels.in_acquisition=1 + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=3.0 +Acquisition_1C.use_CFAR_algorithm=false +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=125 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.8 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_KF_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=true +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.extend_correlation_symbols=20; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.15 + +;Tracking_1C.code_disc_sd_chips=0.2; // Initial R +;Tracking_1C.carrier_disc_sd_rads=0.3; // Initial R + +;Tracking_1C.init_code_phase_sd_chips=0.5; // Initial P_0_0 +;Tracking_1C.init_carrier_phase_sd_rad=0.7; +;Tracking_1C.init_carrier_freq_sd_hz=5; +;Tracking_1C.init_carrier_freq_rate_sd_hz_s=1; + +;Tracking_1C.code_phase_sd_chips=0.15; // Initial Q +;Tracking_1C.carrier_phase_sd_rad=0.25; +;Tracking_1C.carrier_freq_sd_hz=0.6; +;Tracking_1C.carrier_freq_rate_sd_hz_s=0.01; + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.early_late_space_narrow_chips=0.10; +Tracking_1B.very_early_late_space_narrow_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=2.5 +Tracking_1B.dll_bw_narrow_hz=0.2 +Tracking_1B.extend_correlation_symbols=5 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +;Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat +Observables.enable_carrier_smoothing=false +Observables.smoothing_factor=200 + + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.enable_rx_clock_correction=false +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=1000; +PVT.rinexobs_rate_ms=1000; +PVT.display_rate_ms=1000; +PVT.elevation_mask=15; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT +PVT.enable_monitor=false +PVT.monitor_udp_port=1337 +PVT.monitor_client_addresses=127.0.0.1 + +;######### MONITOR CONFIG ############ +Monitor.enable_monitor=false +Monitor.decimation_factor=1 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1234 diff --git a/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf index d9ebe3069..a9ec9e564 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf @@ -1,385 +1,385 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=5000000 -GNSS-SDR.Galileo_banned_prns=14,18 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Flexiband_Signal_Source -SignalSource.flag_read_file=true -SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.firmware_file=flexiband_III-1b.bit -SignalSource.RF_channels=3 -;#frontend channels gain. Not usable yet! -SignalSource.gain1=0 -SignalSource.gain2=0 -SignalSource.gain3=0 -SignalSource.AGC=true -SignalSource.usb_packet_buffer=128 - -;###################################################### -;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.IF=0 -InputFilter0.decimation_factor=4 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - - -;###################################################### -;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=gr_complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.IF=0 -InputFilter1.decimation_factor=4 - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - - -;###################################################### -;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ -;###################################################### - -;######### SIGNAL_CONDITIONER 2 CONFIG ############ -SignalConditioner2.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 2 CONFIG ############ -DataTypeAdapter2.implementation=Pass_Through -DataTypeAdapter2.item_type=gr_complex - -;######### INPUT_FILTER 2 CONFIG ############ -InputFilter2.implementation=Freq_Xlating_Fir_Filter -InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter_ch2.dat -InputFilter2.input_item_type=gr_complex -InputFilter2.output_item_type=gr_complex -InputFilter2.taps_item_type=float -InputFilter2.number_of_taps=5 -InputFilter2.number_of_bands=2 -InputFilter2.band1_begin=0.0 -InputFilter2.band1_end=0.45 -InputFilter2.band2_begin=0.55 -InputFilter2.band2_end=1.0 -InputFilter2.ampl1_begin=1.0 -InputFilter2.ampl1_end=1.0 -InputFilter2.ampl2_begin=0.0 -InputFilter2.ampl2_end=0.0 -InputFilter2.band1_error=1.0 -InputFilter2.band2_error=1.0 -InputFilter2.filter_type=bandpass -InputFilter2.grid_density=16 -InputFilter2.IF=0 -InputFilter2.decimation_factor=8 - - -;######### RESAMPLER CONFIG 2 ############ -Resampler2.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=10 -Channels_2S.count=10 -Channels_5X.count=2 -Channels_L5.count=2 - -;#GPS.prns=7,8 -;Channels.in_acquisition=2 - -;# CHANNEL CONNECTION - -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=0 -Channel9.RF_channel_ID=0 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 -Channel16.RF_channel_ID=1 -Channel17.RF_channel_ID=1 -Channel18.RF_channel_ID=1 -Channel19.RF_channel_ID=1 -Channel20.RF_channel_ID=0 -Channel21.RF_channel_ID=0 -Channel22.RF_channel_ID=0 -Channel23.RF_channel_ID=0 -Channel24.RF_channel_ID=0 -Channel25.RF_channel_ID=0 -Channel26.RF_channel_ID=0 -Channel27.RF_channel_ID=0 -Channel28.RF_channel_ID=0 -Channel29.RF_channel_ID=0 -Channel30.RF_channel_ID=2 -Channel31.RF_channel_ID=2 -Channel32.RF_channel_ID=2 -Channel33.RF_channel_ID=2 -Channel34.RF_channel_ID=2 -Channel35.RF_channel_ID=2 -Channel36.RF_channel_ID=2 -Channel37.RF_channel_ID=2 -Channel38.RF_channel_ID=2 -Channel39.RF_channel_ID=2 -Channel40.RF_channel_ID=2 -Channel41.RF_channel_ID=2 -Channel42.RF_channel_ID=2 - -;Channel20.satellite=7 - - -;# GPS L1 CA -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;# Galileo E1 -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump_filename=./acq_dump.dat - - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.01 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;# GALILEO E5a -Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF -Acquisition_5X.item_type=gr_complex -Acquisition_5X.coherent_integration_time_ms=1 -Acquisition_5X.threshold=0.009 -Acquisition_5X.doppler_max=5000 -Acquisition_5X.doppler_step=125 -Acquisition_5X.bit_transition_flag=false -Acquisition_5X.max_dwells=1 -Acquisition_5X.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 -Acquisition_5X.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. -Acquisition_5X.dump=false -Acquisition_5X.dump_filename=./acq_dump.dat - - -;# GPS L5 -Acquisition_L5.implementation=GPS_L5i_PCPS_Acquisition -Acquisition_L5.item_type=gr_complex -Acquisition_L5.pfa=0.01 -;Acquisition_L5.pfa=0.001 -Acquisition_L5.doppler_max=5000 -Acquisition_L5.doppler_min=-5000 -Acquisition_L5.doppler_step=125 -Acquisition_L5.max_dwells=1 -Acquisition_L5.dump=false -Acquisition_L5.dump_filename=./acq_dump.dat - - - -;######### TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - -;######### GALILEO E1 TRK CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=false -Tracking_2S.dump_filename=./tracking_ch_ - -;######### GALILEO E5 TRK CONFIG ############ -Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking -Tracking_5X.item_type=gr_complex -Tracking_5X.track_pilot=true -Tracking_5X.pll_bw_hz=15.0; -Tracking_5X.dll_bw_hz=2.0; -Tracking_5X.pll_bw_narrow_hz=5.0; -Tracking_5X.dll_bw_narrow_hz=1.0; -Tracking_5X.order=2; -Tracking_5X.early_late_space_chips=0.5; -Tracking_5X.dump=false -Tracking_5X.dump_filename=./tracking_ch_ - -;######### GALILEO E5 TRK CONFIG ############ -Tracking_L5.implementation=GPS_L5_DLL_PLL_Tracking -Tracking_L5.item_type=gr_complex -Tracking_L5.track_pilot=true -Tracking_L5.pll_bw_hz=15.0; -Tracking_L5.dll_bw_hz=2.0; -Tracking_L5.pll_bw_narrow_hz=4.0; -Tracking_L5.dll_bw_narrow_hz=1.0; -Tracking_L5.order=2; -Tracking_L5.early_late_space_chips=0.5; -Tracking_L5.dump=false -Tracking_L5.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - -TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder -TelemetryDecoder_5X.dump=false - -TelemetryDecoder_L5.implementation=GPS_L5_Telemetry_Decoder -TelemetryDecoder_L5.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=100 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=5000000 +GNSS-SDR.Galileo_banned_prns=14,18 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Flexiband_Signal_Source +SignalSource.flag_read_file=true +SignalSource.signal_file=/media/javier/SISTEMA/signals/fraunhofer/L125_III1b_210s.usb ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.firmware_file=flexiband_III-1b.bit +SignalSource.RF_channels=3 +;#frontend channels gain. Not usable yet! +SignalSource.gain1=0 +SignalSource.gain2=0 +SignalSource.gain3=0 +SignalSource.AGC=true +SignalSource.usb_packet_buffer=128 + +;###################################################### +;######### RF CHANNEL 0 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.IF=0 +InputFilter0.decimation_factor=4 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + + +;###################################################### +;######### RF CHANNEL 1 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=gr_complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.IF=0 +InputFilter1.decimation_factor=4 + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + + +;###################################################### +;######### RF CHANNEL 2 SIGNAL CONDITIONER ############ +;###################################################### + +;######### SIGNAL_CONDITIONER 2 CONFIG ############ +SignalConditioner2.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 2 CONFIG ############ +DataTypeAdapter2.implementation=Pass_Through +DataTypeAdapter2.item_type=gr_complex + +;######### INPUT_FILTER 2 CONFIG ############ +InputFilter2.implementation=Freq_Xlating_Fir_Filter +InputFilter2.dump=false +InputFilter2.dump_filename=../data/input_filter_ch2.dat +InputFilter2.input_item_type=gr_complex +InputFilter2.output_item_type=gr_complex +InputFilter2.taps_item_type=float +InputFilter2.number_of_taps=5 +InputFilter2.number_of_bands=2 +InputFilter2.band1_begin=0.0 +InputFilter2.band1_end=0.45 +InputFilter2.band2_begin=0.55 +InputFilter2.band2_end=1.0 +InputFilter2.ampl1_begin=1.0 +InputFilter2.ampl1_end=1.0 +InputFilter2.ampl2_begin=0.0 +InputFilter2.ampl2_end=0.0 +InputFilter2.band1_error=1.0 +InputFilter2.band2_error=1.0 +InputFilter2.filter_type=bandpass +InputFilter2.grid_density=16 +InputFilter2.IF=0 +InputFilter2.decimation_factor=8 + + +;######### RESAMPLER CONFIG 2 ############ +Resampler2.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=10 +Channels_2S.count=10 +Channels_5X.count=2 +Channels_L5.count=2 + +;#GPS.prns=7,8 +;Channels.in_acquisition=2 + +;# CHANNEL CONNECTION + +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=0 +Channel9.RF_channel_ID=0 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 +Channel16.RF_channel_ID=1 +Channel17.RF_channel_ID=1 +Channel18.RF_channel_ID=1 +Channel19.RF_channel_ID=1 +Channel20.RF_channel_ID=0 +Channel21.RF_channel_ID=0 +Channel22.RF_channel_ID=0 +Channel23.RF_channel_ID=0 +Channel24.RF_channel_ID=0 +Channel25.RF_channel_ID=0 +Channel26.RF_channel_ID=0 +Channel27.RF_channel_ID=0 +Channel28.RF_channel_ID=0 +Channel29.RF_channel_ID=0 +Channel30.RF_channel_ID=2 +Channel31.RF_channel_ID=2 +Channel32.RF_channel_ID=2 +Channel33.RF_channel_ID=2 +Channel34.RF_channel_ID=2 +Channel35.RF_channel_ID=2 +Channel36.RF_channel_ID=2 +Channel37.RF_channel_ID=2 +Channel38.RF_channel_ID=2 +Channel39.RF_channel_ID=2 +Channel40.RF_channel_ID=2 +Channel41.RF_channel_ID=2 +Channel42.RF_channel_ID=2 + +;Channel20.satellite=7 + + +;# GPS L1 CA +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;# Galileo E1 +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump_filename=./acq_dump.dat + + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.01 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;# GALILEO E5a +Acquisition_5X.implementation=Galileo_E5a_Noncoherent_IQ_Acquisition_CAF +Acquisition_5X.item_type=gr_complex +Acquisition_5X.coherent_integration_time_ms=1 +Acquisition_5X.threshold=0.009 +Acquisition_5X.doppler_max=5000 +Acquisition_5X.doppler_step=125 +Acquisition_5X.bit_transition_flag=false +Acquisition_5X.max_dwells=1 +Acquisition_5X.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 +Acquisition_5X.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. +Acquisition_5X.dump=false +Acquisition_5X.dump_filename=./acq_dump.dat + + +;# GPS L5 +Acquisition_L5.implementation=GPS_L5i_PCPS_Acquisition +Acquisition_L5.item_type=gr_complex +Acquisition_L5.pfa=0.01 +;Acquisition_L5.pfa=0.001 +Acquisition_L5.doppler_max=5000 +Acquisition_L5.doppler_min=-5000 +Acquisition_L5.doppler_step=125 +Acquisition_L5.max_dwells=1 +Acquisition_L5.dump=false +Acquisition_L5.dump_filename=./acq_dump.dat + + + +;######### TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + +;######### GALILEO E1 TRK CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=false +Tracking_2S.dump_filename=./tracking_ch_ + +;######### GALILEO E5 TRK CONFIG ############ +Tracking_5X.implementation=Galileo_E5a_DLL_PLL_Tracking +Tracking_5X.item_type=gr_complex +Tracking_5X.track_pilot=true +Tracking_5X.pll_bw_hz=15.0; +Tracking_5X.dll_bw_hz=2.0; +Tracking_5X.pll_bw_narrow_hz=5.0; +Tracking_5X.dll_bw_narrow_hz=1.0; +Tracking_5X.order=2; +Tracking_5X.early_late_space_chips=0.5; +Tracking_5X.dump=false +Tracking_5X.dump_filename=./tracking_ch_ + +;######### GALILEO E5 TRK CONFIG ############ +Tracking_L5.implementation=GPS_L5_DLL_PLL_Tracking +Tracking_L5.item_type=gr_complex +Tracking_L5.track_pilot=true +Tracking_L5.pll_bw_hz=15.0; +Tracking_L5.dll_bw_hz=2.0; +Tracking_L5.pll_bw_narrow_hz=4.0; +Tracking_L5.dll_bw_narrow_hz=1.0; +Tracking_L5.order=2; +Tracking_L5.early_late_space_chips=0.5; +Tracking_L5.dump=false +Tracking_L5.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + +TelemetryDecoder_5X.implementation=Galileo_E5a_Telemetry_Decoder +TelemetryDecoder_5X.dump=false + +TelemetryDecoder_L5.implementation=GPS_L5_Telemetry_Decoder +TelemetryDecoder_L5.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=100 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf index 5839e4483..5838a3b88 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf @@ -1,169 +1,169 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - -GNSS-SDR.num_sources=2 - -SignalSource.enable_throttle_control=false -SignalSource.repeat=false - - -;######### SIGNAL_SOURCE 0 CONFIG ############ -SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource0.item_type=ishort -SignalSource0.sampling_frequency=4000000 -SignalSource0.samples=0 - - -;######### SIGNAL_SOURCE 1 CONFIG ############ -SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource1.item_type=ishort -SignalSource1.sampling_frequency=4000000 -SignalSource1.freq=1575420000 -SignalSource1.samples=0 - - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Ishort_To_Complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Pass_Through -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex - - - -;######### RESAMPLER 1 CONFIG ############ -Resampler1.implementation=Pass_Through -Resampler1.dump=false -Resampler1.dump_filename=../data/resampler.dat -Resampler1.item_type=gr_complex -Resampler1.sample_freq_in=4000000 -Resampler1.sample_freq_out=4000000 - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Ishort_To_Complex - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false - - -;######### RESAMPLER 1 CONFIG ############ -Resampler1.implementation=Pass_Through -Resampler1.dump=false -Resampler1.dump_filename=../data/resampler.dat. -Resampler1.item_type=gr_complex -Resampler1.sample_freq_in=4000000 -Resampler1.sample_freq_out=4000000 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=2 -Channels_1B.count=2 -Channels.in_acquisition=1 - - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=1 -Channel3.RF_channel_ID=1 -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000008 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump_filename=./PVT -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + +GNSS-SDR.num_sources=2 + +SignalSource.enable_throttle_control=false +SignalSource.repeat=false + + +;######### SIGNAL_SOURCE 0 CONFIG ############ +SignalSource0.implementation=File_Signal_Source +SignalSource0.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource0.item_type=ishort +SignalSource0.sampling_frequency=4000000 +SignalSource0.samples=0 + + +;######### SIGNAL_SOURCE 1 CONFIG ############ +SignalSource1.implementation=File_Signal_Source +SignalSource1.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource1.item_type=ishort +SignalSource1.sampling_frequency=4000000 +SignalSource1.freq=1575420000 +SignalSource1.samples=0 + + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Ishort_To_Complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Pass_Through +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex + + + +;######### RESAMPLER 1 CONFIG ############ +Resampler1.implementation=Pass_Through +Resampler1.dump=false +Resampler1.dump_filename=../data/resampler.dat +Resampler1.item_type=gr_complex +Resampler1.sample_freq_in=4000000 +Resampler1.sample_freq_out=4000000 + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Ishort_To_Complex + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false + + +;######### RESAMPLER 1 CONFIG ############ +Resampler1.implementation=Pass_Through +Resampler1.dump=false +Resampler1.dump_filename=../data/resampler.dat. +Resampler1.item_type=gr_complex +Resampler1.sample_freq_in=4000000 +Resampler1.sample_freq_out=4000000 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=2 +Channels_1B.count=2 +Channels.in_acquisition=1 + + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=1 +Channel3.RF_channel_ID=1 +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000008 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump_filename=./PVT +PVT.dump=false diff --git a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf index a6a1a0ea2..c5c5e9134 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf @@ -1,231 +1,231 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -GNSS-SDR.num_sources=2 - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;GNSS-SDR.internal_fs_sps=6826700 -GNSS-SDR.internal_fs_sps=2560000 -;GNSS-SDR.internal_fs_sps=4096000 -;GNSS-SDR.internal_fs_sps=5120000 - -SignalSource.enable_throttle_control=false -SignalSource.repeat=false - - -;######### SIGNAL_SOURCE 0 CONFIG ############ -SignalSource0.implementation=Nsr_File_Signal_Source -SignalSource0.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource0.item_type=byte -SignalSource0.sampling_frequency=20480000 -SignalSource0.samples=0 - - -;######### SIGNAL_SOURCE 1 CONFIG ############ -SignalSource1.implementation=Nsr_File_Signal_Source -SignalSource1.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream -SignalSource1.item_type=byte -SignalSource1.sampling_frequency=20480000 -SignalSource1.samples=0 - - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=float - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Freq_Xlating_Fir_Filter -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=float -InputFilter0.output_item_type=gr_complex -InputFilter0.taps_item_type=float -InputFilter0.number_of_taps=5 -InputFilter0.number_of_bands=2 -InputFilter0.band1_begin=0.0 -InputFilter0.band1_end=0.45 -InputFilter0.band2_begin=0.55 -InputFilter0.band2_end=1.0 -InputFilter0.ampl1_begin=1.0 -InputFilter0.ampl1_end=1.0 -InputFilter0.ampl2_begin=0.0 -InputFilter0.ampl2_end=0.0 -InputFilter0.band1_error=1.0 -InputFilter0.band2_error=1.0 -InputFilter0.filter_type=bandpass -InputFilter0.grid_density=16 -InputFilter0.sampling_frequency=20480000 -InputFilter0.IF=5499998.47412109 -InputFilter0.decimation_factor=8 - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER 1 CONFIG ############ -DataTypeAdapter1.implementation=Pass_Through -DataTypeAdapter1.item_type=float - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Freq_Xlating_Fir_Filter -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=float -InputFilter1.output_item_type=gr_complex -InputFilter1.taps_item_type=float -InputFilter1.number_of_taps=5 -InputFilter1.number_of_bands=2 -InputFilter1.band1_begin=0.0 -InputFilter1.band1_end=0.45 -InputFilter1.band2_begin=0.55 -InputFilter1.band2_end=1.0 -InputFilter1.ampl1_begin=1.0 -InputFilter1.ampl1_end=1.0 -InputFilter1.ampl2_begin=0.0 -InputFilter1.ampl2_end=0.0 -InputFilter1.band1_error=1.0 -InputFilter1.band2_error=1.0 -InputFilter1.filter_type=bandpass -InputFilter1.grid_density=16 -InputFilter1.sampling_frequency=20480000 -InputFilter1.IF=5499998.47412109 -InputFilter1.decimation_factor=8 - - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=8 -Channels.in_acquisition=1 - -;# SOURCE CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 - -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 -Channel10.RF_channel_ID=1 -Channel11.RF_channel_ID=1 -Channel12.RF_channel_ID=1 -Channel13.RF_channel_ID=1 -Channel14.RF_channel_ID=1 -Channel15.RF_channel_ID=1 - -;#signal: -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1B -Channel8.signal=1B -Channel9.signal=1B -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.scoherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=0 -Acquisition_1B.pfa=0.0000002 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +GNSS-SDR.num_sources=2 + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;GNSS-SDR.internal_fs_sps=6826700 +GNSS-SDR.internal_fs_sps=2560000 +;GNSS-SDR.internal_fs_sps=4096000 +;GNSS-SDR.internal_fs_sps=5120000 + +SignalSource.enable_throttle_control=false +SignalSource.repeat=false + + +;######### SIGNAL_SOURCE 0 CONFIG ############ +SignalSource0.implementation=Nsr_File_Signal_Source +SignalSource0.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource0.item_type=byte +SignalSource0.sampling_frequency=20480000 +SignalSource0.samples=0 + + +;######### SIGNAL_SOURCE 1 CONFIG ############ +SignalSource1.implementation=Nsr_File_Signal_Source +SignalSource1.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream +SignalSource1.item_type=byte +SignalSource1.sampling_frequency=20480000 +SignalSource1.samples=0 + + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=float + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Freq_Xlating_Fir_Filter +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=float +InputFilter0.output_item_type=gr_complex +InputFilter0.taps_item_type=float +InputFilter0.number_of_taps=5 +InputFilter0.number_of_bands=2 +InputFilter0.band1_begin=0.0 +InputFilter0.band1_end=0.45 +InputFilter0.band2_begin=0.55 +InputFilter0.band2_end=1.0 +InputFilter0.ampl1_begin=1.0 +InputFilter0.ampl1_end=1.0 +InputFilter0.ampl2_begin=0.0 +InputFilter0.ampl2_end=0.0 +InputFilter0.band1_error=1.0 +InputFilter0.band2_error=1.0 +InputFilter0.filter_type=bandpass +InputFilter0.grid_density=16 +InputFilter0.sampling_frequency=20480000 +InputFilter0.IF=5499998.47412109 +InputFilter0.decimation_factor=8 + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER 1 CONFIG ############ +DataTypeAdapter1.implementation=Pass_Through +DataTypeAdapter1.item_type=float + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Freq_Xlating_Fir_Filter +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=float +InputFilter1.output_item_type=gr_complex +InputFilter1.taps_item_type=float +InputFilter1.number_of_taps=5 +InputFilter1.number_of_bands=2 +InputFilter1.band1_begin=0.0 +InputFilter1.band1_end=0.45 +InputFilter1.band2_begin=0.55 +InputFilter1.band2_end=1.0 +InputFilter1.ampl1_begin=1.0 +InputFilter1.ampl1_end=1.0 +InputFilter1.ampl2_begin=0.0 +InputFilter1.ampl2_end=0.0 +InputFilter1.band1_error=1.0 +InputFilter1.band2_error=1.0 +InputFilter1.filter_type=bandpass +InputFilter1.grid_density=16 +InputFilter1.sampling_frequency=20480000 +InputFilter1.IF=5499998.47412109 +InputFilter1.decimation_factor=8 + + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_1B.count=8 +Channels.in_acquisition=1 + +;# SOURCE CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 + +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 +Channel10.RF_channel_ID=1 +Channel11.RF_channel_ID=1 +Channel12.RF_channel_ID=1 +Channel13.RF_channel_ID=1 +Channel14.RF_channel_ID=1 +Channel15.RF_channel_ID=1 + +;#signal: +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1B +Channel8.signal=1B +Channel9.signal=1B +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.scoherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=0 +Acquisition_1B.pfa=0.0000002 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf index bde11e2a2..d0682aa30 100644 --- a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf @@ -1,164 +1,164 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Sample configuration file for IFEN SX-NSR software receiver front-end -; https://www.ifen.com/products/sx3-gnss-software-receiver/ -; This sample configuration is able to process directly .sream binary files -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2560000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/home/javier/Descargas/RoofTop_FE0_Band1.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -#InputFilter.IF=5499998.47412109 -InputFilter.IF=5679999.2370605494 -InputFilter.decimation_factor=8 - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=0 -Channels_2S.count=8 -Channels.in_acquisition=1 - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.scoherent_integration_time_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.coherent_integration_time_ms=20 -Acquisition_2S.pfa=0.01 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_step=100 -Acquisition_2S.bit_transition_flag=false -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - -;######### GPS L2C GENERIC TRACKING CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.4; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Sample configuration file for IFEN SX-NSR software receiver front-end +; https://www.ifen.com/products/sx3-gnss-software-receiver/ +; This sample configuration is able to process directly .sream binary files +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2560000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Nsr_File_Signal_Source +SignalSource.filename=/home/javier/Descargas/RoofTop_FE0_Band1.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +#InputFilter.IF=5499998.47412109 +InputFilter.IF=5679999.2370605494 +InputFilter.decimation_factor=8 + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=0 +Channels_2S.count=8 +Channels.in_acquisition=1 + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.scoherent_integration_time_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.coherent_integration_time_ms=20 +Acquisition_2S.pfa=0.01 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_step=100 +Acquisition_2S.bit_transition_flag=false +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + +;######### GPS L2C GENERIC TRACKING CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.4; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf index 5b9358268..a127a5870 100644 --- a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf @@ -1,207 +1,207 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;GNSS-SDR.internal_fs_sps=6826700 -GNSS-SDR.internal_fs_sps=2560000 -;GNSS-SDR.internal_fs_sps=4096000 -;GNSS-SDR.internal_fs_sps=5120000 - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation: Use [File_Signal_Source] [Nsr_File_Signal_Source] or [UHD_Signal_Source] -SignalSource.implementation=Nsr_File_Signal_Source - -;#filename: path to file with the captured GNSS signal samples to be processed -SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE - -;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. -SignalSource.item_type=byte - -;#sampling_frequency: Original Signal sampling frequency in [Hz] -SignalSource.sampling_frequency=20480000 - -;#freq: RF front-end center frequency in [Hz] -SignalSource.freq=1575420000 - -;#samples: Number of samples to be processed. Notice that 0 indicates the entire file. -SignalSource.samples=0 - -;#repeat: Repeat the processing file. Disable this option in this version -SignalSource.repeat=false - -;#dump: Dump the Signal source data to a file. Disable this option in this version -SignalSource.dump=false - -SignalSource.dump_filename=../data/signal_source.dat - - -;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. -; it helps to not overload the CPU, but the processing time will be longer. -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -;## It holds blocks to change data type, filter and resample input data. - -;#implementation: Use [Pass_Through] or [Signal_Conditioner] -;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks -;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -;## Changes the type of input data. -;#implementation: [Pass_Through] disables this block -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -;## Filter the input data. Can be combined with frequency translation for IF signals - -;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter] -;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation -;# that shifts IF down to zero Hz. - -InputFilter.implementation=Freq_Xlating_Fir_Filter - -;#dump: Dump the filtered data to a file. -InputFilter.dump=false - -;#dump_filename: Log path and filename. -InputFilter.dump_filename=../data/input_filter.dat - -;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. -;#These options are based on parameters of gnuradio's function: gr_remez. -;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse -;#reponse given a set of band edges, the desired reponse on those bands, -;#and the weight given to the error in those bands. - -;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. -InputFilter.input_item_type=float - -;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version. -InputFilter.output_item_type=gr_complex - -;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version. -InputFilter.taps_item_type=float - -;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time -InputFilter.number_of_taps=5 - -;#number_of _bands: Number of frequency bands in the filter. -InputFilter.number_of_bands=2 - -;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]. -;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2) -;#The number of band_begin and band_end elements must match the number of bands - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 - -;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]. -;#The number of ampl_begin and ampl_end elements must match the number of bands - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -;#band_error: weighting applied to each band (usually 1). -;#The number of band_error elements must match the number of bands -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -;#filter_type: one of "bandpass", "hilbert" or "differentiator" -InputFilter.filter_type=bandpass - -;#grid_density: determines how accurately the filter will be constructed. -;The minimum value is 16; higher values are slower to compute the filter. -InputFilter.grid_density=16 - -;# Original sampling frequency stored in the signal file -InputFilter.sampling_frequency=20480000 - -;#The following options are used only in Freq_Xlating_Fir_Filter implementation. -;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz - -InputFilter.IF=5499998.47412109 - -;# Decimation factor after the frequency tranaslating block -InputFilter.decimation_factor=8 - - -;######### RESAMPLER CONFIG ############ -;## Resamples the input data. - -;#implementation: Use [Pass_Through] or [Direct_Resampler] -;#[Pass_Through] disables this block -;#[Direct_Resampler] enables a resampler that implements a nearest neighbourhood interpolation -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -;#count: Number of available GPS satellite channels. -Channels_1C.count=8 -Channels.in_acquisition=1 -#Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat -Acquisition_1C.item_type=gr_complex -Acquisition_1C.if=0 -Acquisition_1C.sampled_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=100 - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.if=0 -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ -Tracking_1C.pll_bw_hz=15.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false -TelemetryDecoder_1C.decimation_factor=1; - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables - -;#dump: Enable or disable the Observables internal binary data file logging [true] or [false] -Observables.dump=false - -;#dump_filename: Log path and filename. -Observables.dump_filename=./observables.dat - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;GNSS-SDR.internal_fs_sps=6826700 +GNSS-SDR.internal_fs_sps=2560000 +;GNSS-SDR.internal_fs_sps=4096000 +;GNSS-SDR.internal_fs_sps=5120000 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation: Use [File_Signal_Source] [Nsr_File_Signal_Source] or [UHD_Signal_Source] +SignalSource.implementation=Nsr_File_Signal_Source + +;#filename: path to file with the captured GNSS signal samples to be processed +SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE + +;#item_type: Type and resolution for each of the signal samples. Use only gr_complex in this version. +SignalSource.item_type=byte + +;#sampling_frequency: Original Signal sampling frequency in [Hz] +SignalSource.sampling_frequency=20480000 + +;#freq: RF front-end center frequency in [Hz] +SignalSource.freq=1575420000 + +;#samples: Number of samples to be processed. Notice that 0 indicates the entire file. +SignalSource.samples=0 + +;#repeat: Repeat the processing file. Disable this option in this version +SignalSource.repeat=false + +;#dump: Dump the Signal source data to a file. Disable this option in this version +SignalSource.dump=false + +SignalSource.dump_filename=../data/signal_source.dat + + +;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. +; it helps to not overload the CPU, but the processing time will be longer. +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +;## It holds blocks to change data type, filter and resample input data. + +;#implementation: Use [Pass_Through] or [Signal_Conditioner] +;#[Pass_Through] disables this block and the [DataTypeAdapter], [InputFilter] and [Resampler] blocks +;#[Signal_Conditioner] enables this block. Then you have to configure [DataTypeAdapter], [InputFilter] and [Resampler] blocks +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +;## Changes the type of input data. +;#implementation: [Pass_Through] disables this block +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +;## Filter the input data. Can be combined with frequency translation for IF signals + +;#implementation: Use [Pass_Through] or [Fir_Filter] or [Freq_Xlating_Fir_Filter] +;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation +;# that shifts IF down to zero Hz. + +InputFilter.implementation=Freq_Xlating_Fir_Filter + +;#dump: Dump the filtered data to a file. +InputFilter.dump=false + +;#dump_filename: Log path and filename. +InputFilter.dump_filename=../data/input_filter.dat + +;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. +;#These options are based on parameters of gnuradio's function: gr_remez. +;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse +;#reponse given a set of band edges, the desired reponse on those bands, +;#and the weight given to the error in those bands. + +;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. +InputFilter.input_item_type=float + +;#outut_item_type: Type and resolution for output filtered signal samples. Use only gr_complex in this version. +InputFilter.output_item_type=gr_complex + +;#taps_item_type: Type and resolution for the taps of the filter. Use only float in this version. +InputFilter.taps_item_type=float + +;#number_of_taps: Number of taps in the filter. Increasing this parameter increases the processing time +InputFilter.number_of_taps=5 + +;#number_of _bands: Number of frequency bands in the filter. +InputFilter.number_of_bands=2 + +;#bands: frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]. +;#Frequency is in the range [0, 1], with 1 being the Nyquist frequency (Fs/2) +;#The number of band_begin and band_end elements must match the number of bands + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 + +;#ampl: desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]. +;#The number of ampl_begin and ampl_end elements must match the number of bands + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +;#band_error: weighting applied to each band (usually 1). +;#The number of band_error elements must match the number of bands +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +;#filter_type: one of "bandpass", "hilbert" or "differentiator" +InputFilter.filter_type=bandpass + +;#grid_density: determines how accurately the filter will be constructed. +;The minimum value is 16; higher values are slower to compute the filter. +InputFilter.grid_density=16 + +;# Original sampling frequency stored in the signal file +InputFilter.sampling_frequency=20480000 + +;#The following options are used only in Freq_Xlating_Fir_Filter implementation. +;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz + +InputFilter.IF=5499998.47412109 + +;# Decimation factor after the frequency tranaslating block +InputFilter.decimation_factor=8 + + +;######### RESAMPLER CONFIG ############ +;## Resamples the input data. + +;#implementation: Use [Pass_Through] or [Direct_Resampler] +;#[Pass_Through] disables this block +;#[Direct_Resampler] enables a resampler that implements a nearest neighbourhood interpolation +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +;#count: Number of available GPS satellite channels. +Channels_1C.count=8 +Channels.in_acquisition=1 +#Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat +Acquisition_1C.item_type=gr_complex +Acquisition_1C.if=0 +Acquisition_1C.sampled_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=100 + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.if=0 +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.pll_bw_hz=15.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false +TelemetryDecoder_1C.decimation_factor=1; + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables + +;#dump: Enable or disable the Observables internal binary data file logging [true] or [false] +Observables.dump=false + +;#dump_filename: Log path and filename. +Observables.dump_filename=./observables.dat + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf b/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf index 7f5d30494..91bbc1c69 100644 --- a/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf +++ b/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf @@ -1,176 +1,176 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2560000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Nsr_File_Signal_Source -SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -InputFilter.IF=5499998.47412109 -InputFilter.decimation_factor=8 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=10 -Channels_1B.count=10 -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;#if the option is disabled by default is assigned "1C" GPS L1 C/A -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C -Channel4.signal=1C -Channel5.signal=1C -Channel6.signal=1C -Channel7.signal=1C -Channel8.signal=1C -Channel9.signal=1C -Channel10.signal=1B -Channel11.signal=1B -Channel12.signal=1B -Channel13.signal=1B -Channel14.signal=1B -Channel15.signal=1B -Channel16.signal=1B -Channel17signal=1B -Channel18.signal=1B -Channel19.signal=1B - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=2.5 -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.5 -Acquisition_1B.blocking=true -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=250 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=1 -Tracking_1C.pll_bw_hz=40; -Tracking_1C.pll_bw_narrow_hz=30; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.5; -Tracking_1C.order=2; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### TELEMETRY DECODER GALILEO CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10; -PVT.display_rate_ms=500; -PVT.elevation_mask=20; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2560000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Nsr_File_Signal_Source +SignalSource.filename=/home/javier/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +InputFilter.IF=5499998.47412109 +InputFilter.decimation_factor=8 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=10 +Channels_1B.count=10 +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;#if the option is disabled by default is assigned "1C" GPS L1 C/A +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C +Channel4.signal=1C +Channel5.signal=1C +Channel6.signal=1C +Channel7.signal=1C +Channel8.signal=1C +Channel9.signal=1C +Channel10.signal=1B +Channel11.signal=1B +Channel12.signal=1B +Channel13.signal=1B +Channel14.signal=1B +Channel15.signal=1B +Channel16.signal=1B +Channel17signal=1B +Channel18.signal=1B +Channel19.signal=1B + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=2.5 +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.blocking=true +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=250 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=1 +Tracking_1C.pll_bw_hz=40; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.order=2; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### TELEMETRY DECODER GALILEO CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10; +PVT.display_rate_ms=500; +PVT.elevation_mask=20; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf b/conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf index 281ef2f81..c25dc85f9 100644 --- a/conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf +++ b/conf/Other/gnss-sdr_GPS_L1_2ch_udp.conf @@ -1,103 +1,103 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. -GNSS-SDR.internal_fs_sps=13250000 ;//66.25/5 -;GNSS-SDR.internal_fs_sps=6625000 ;//66.25/10 -;GNSS-SDR.internal_fs_sps=3312500 ;//66.25/20 -;GNSS-SDR.internal_fs_sps=2650000 ;//66.25/25 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Custom_UDP_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.origin_address=0.0.0.0 -SignalSource.capture_device=eth0 -SignalSource.port=1234 -SignalSource.payload_bytes=1472 -;SignalSource.sample_type=cbyte -SignalSource.sample_type=c4bits -SignalSource.IQ_swap=false -SignalSource.RF_channels=1 -SignalSource.channels_in_udp=2 -SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through -;SignalConditioner0.implementation=Pass_Through -;SignalConditioner1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 - -;# CHANNEL CONNECTION -Channel.signal=1C -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=0 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=0 -Channel4.RF_channel_ID=0 -Channel5.RF_channel_ID=0 -Channel6.RF_channel_ID=0 -Channel7.RF_channel_ID=0 -Channel8.RF_channel_ID=1 -Channel9.RF_channel_ID=1 - -;Channel0.signal=1C -;Channel1.RF_channel_ID=1 -;Channel1.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=2.5 -Acquisition_1C.blocking=false -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. +GNSS-SDR.internal_fs_sps=13250000 ;//66.25/5 +;GNSS-SDR.internal_fs_sps=6625000 ;//66.25/10 +;GNSS-SDR.internal_fs_sps=3312500 ;//66.25/20 +;GNSS-SDR.internal_fs_sps=2650000 ;//66.25/25 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Custom_UDP_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.origin_address=0.0.0.0 +SignalSource.capture_device=eth0 +SignalSource.port=1234 +SignalSource.payload_bytes=1472 +;SignalSource.sample_type=cbyte +SignalSource.sample_type=c4bits +SignalSource.IQ_swap=false +SignalSource.RF_channels=1 +SignalSource.channels_in_udp=2 +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through +;SignalConditioner0.implementation=Pass_Through +;SignalConditioner1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel.signal=1C +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=0 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=0 +Channel4.RF_channel_ID=0 +Channel5.RF_channel_ID=0 +Channel6.RF_channel_ID=0 +Channel7.RF_channel_ID=0 +Channel8.RF_channel_ID=1 +Channel9.RF_channel_ID=1 + +;Channel0.signal=1C +;Channel1.RF_channel_ID=1 +;Channel1.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=2.5 +Acquisition_1C.blocking=false +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/Other/gnss-sdr_GPS_L1_FPGA.conf b/conf/Other/gnss-sdr_GPS_L1_FPGA.conf index 271b27811..c873f60cc 100644 --- a/conf/Other/gnss-sdr_GPS_L1_FPGA.conf +++ b/conf/Other/gnss-sdr_GPS_L1_FPGA.conf @@ -1,72 +1,72 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=12500000 -GNSS-SDR.enable_FPGA=true - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Ad9361_Fpga_Signal_Source -SignalSource.sampling_frequency=12500000 -SignalSource.freq=1575420000 -SignalSource.switch_position=2 -SignalSource.gain_mode_rx1=slow_attack - -;######### CHANNELS GLOBAL CONFIG ############ -Channels.in_acquisition=1 -Channels_1C.count=12 - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fpga -Acquisition_1C.threshold=2.0 -Acquisition_1C.doppler_max=50000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.make_two_steps=true -Acquisition_1C.second_nbins=3 -Acquisition_1C.doppler_step2=250 -Acquisition_1C.max_num_acqs=100 - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_Fpga -Tracking_1C.extend_correlation_symbols=20 -Tracking_1C.pll_bw_hz=35; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.pll_bw_narrow_hz=5.0; -Tracking_1C.dll_bw_narrow_hz=0.50; -Tracking_1C.fll_bw_hz=10 -Tracking_1C.enable_fll_pull_in=true; -Tracking_1C.enable_fll_steady_state=false -Tracking_1C.high_dyn=true -Tracking_1C.dump=false -Tracking_1C.dump_filename=tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.iono_model=OFF -PVT.trop_model=OFF -PVT.raim_fde=1 -PVT.output_rate_ms=20; -PVT.display_rate_ms=500; -PVT.elevation_mask=0; -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=12500000 +GNSS-SDR.enable_FPGA=true + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Ad9361_Fpga_Signal_Source +SignalSource.sampling_frequency=12500000 +SignalSource.freq=1575420000 +SignalSource.switch_position=2 +SignalSource.gain_mode_rx1=slow_attack + +;######### CHANNELS GLOBAL CONFIG ############ +Channels.in_acquisition=1 +Channels_1C.count=12 + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fpga +Acquisition_1C.threshold=2.0 +Acquisition_1C.doppler_max=50000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.make_two_steps=true +Acquisition_1C.second_nbins=3 +Acquisition_1C.doppler_step2=250 +Acquisition_1C.max_num_acqs=100 + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_Fpga +Tracking_1C.extend_correlation_symbols=20 +Tracking_1C.pll_bw_hz=35; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.50; +Tracking_1C.fll_bw_hz=10 +Tracking_1C.enable_fll_pull_in=true; +Tracking_1C.enable_fll_steady_state=false +Tracking_1C.high_dyn=true +Tracking_1C.dump=false +Tracking_1C.dump_filename=tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.iono_model=OFF +PVT.trop_model=OFF +PVT.raim_fde=1 +PVT.output_rate_ms=20; +PVT.display_rate_ms=500; +PVT.elevation_mask=0; +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/Other/gnss-sdr_GPS_L1_fifo.conf b/conf/Other/gnss-sdr_GPS_L1_fifo.conf index a8bf9d4fb..a339ffb35 100644 --- a/conf/Other/gnss-sdr_GPS_L1_fifo.conf +++ b/conf/Other/gnss-sdr_GPS_L1_fifo.conf @@ -1,56 +1,56 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=25000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Fifo_Signal_Source -SignalSource.filename=fifo.fifo ; example usage: mkfifo fifo.fifo && cat path_to.bin >> fifo.fifo -SignalSource.sample_type=ishort; ; sample representation in fifo stream - will always output gr_complex -SignalSource.dump=false -;SignalSource.dump_filename=dump - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.iono_model=Broadcast -PVT.trop_model=Saastamoinen -PVT.output_path=./files +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=25000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fifo_Signal_Source +SignalSource.filename=fifo.fifo ; example usage: mkfifo fifo.fifo && cat path_to.bin >> fifo.fifo +SignalSource.sample_type=ishort; ; sample representation in fifo stream - will always output gr_complex +SignalSource.dump=false +;SignalSource.dump_filename=dump + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.iono_model=Broadcast +PVT.trop_model=Saastamoinen +PVT.output_path=./files diff --git a/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf b/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf index 67466b929..c1b99441b 100644 --- a/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf +++ b/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf @@ -1,85 +1,85 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/Agilent/New York/4msps.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=gr_complex -SignalSource.samples=250000000 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.005 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_GPU -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/Agilent/New York/4msps.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=gr_complex +SignalSource.samples=250000000 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.005 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_GPU +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/Other/gnss-sdr_GPS_L1_monitor.conf b/conf/Other/gnss-sdr_GPS_L1_monitor.conf index fddce6450..a24a4fc9b 100644 --- a/conf/Other/gnss-sdr_GPS_L1_monitor.conf +++ b/conf/Other/gnss-sdr_GPS_L1_monitor.conf @@ -1,89 +1,89 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/tmp/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.samples=0 -SignalSource.enable_throttle_control=true - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through -InputFilter.item_type=gr_complex - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Direct_Resampler -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=2000000 -Resampler.item_type=gr_complex - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=3 -Channels.in_acquisition=1 -Channel.signal=1C -Channel0.satellite=1 -Channel1.satellite=11 -Channel2.satellite=17 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.008 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.enable_monitor=true -PVT.monitor_client_addresses=127.0.0.1 -PVT.monitor_udp_port=1234 - -;######### MONITOR CONFIG ############ -Monitor.enable_monitor=true -Monitor.decimation_factor=1 -Monitor.client_addresses=127.0.0.1 -Monitor.udp_port=1233 - -;######### ACQUISITION MONITOR CONFIG ############ -AcquisitionMonitor.enable_monitor=true -AcquisitionMonitor.decimation_factor=1 -AcquisitionMonitor.client_addresses=127.0.0.1 -AcquisitionMonitor.udp_port=1231 - -;######### TRACKING MONITOR CONFIG ############ -TrackingMonitor.enable_monitor=true -TrackingMonitor.decimation_factor=1 -TrackingMonitor.client_addresses=127.0.0.1 -TrackingMonitor.udp_port=1232 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=2000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/tmp/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.samples=0 +SignalSource.enable_throttle_control=true + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through +InputFilter.item_type=gr_complex + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Direct_Resampler +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=2000000 +Resampler.item_type=gr_complex + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=3 +Channels.in_acquisition=1 +Channel.signal=1C +Channel0.satellite=1 +Channel1.satellite=11 +Channel2.satellite=17 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.008 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.enable_monitor=true +PVT.monitor_client_addresses=127.0.0.1 +PVT.monitor_udp_port=1234 + +;######### MONITOR CONFIG ############ +Monitor.enable_monitor=true +Monitor.decimation_factor=1 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1233 + +;######### ACQUISITION MONITOR CONFIG ############ +AcquisitionMonitor.enable_monitor=true +AcquisitionMonitor.decimation_factor=1 +AcquisitionMonitor.client_addresses=127.0.0.1 +AcquisitionMonitor.udp_port=1231 + +;######### TRACKING MONITOR CONFIG ############ +TrackingMonitor.enable_monitor=true +TrackingMonitor.decimation_factor=1 +TrackingMonitor.client_addresses=127.0.0.1 +TrackingMonitor.udp_port=1232 diff --git a/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf index 30d080c51..01209aefb 100644 --- a/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf +++ b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf @@ -1,154 +1,154 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Sample configuration file for IFEN SX-NSR software receiver front-end -; https://www.ifen.com/products/sx3-gnss-software-receiver/ -; This sample configuration is able to process directly .sream binary files -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2560000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Two_Bit_Packed_File_Signal_Source -SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -; big_endian_items : not needed for byte inputs -; If the input were 'short' then this can either be big endian or little -; endian. If it is big endian then the second byte should be output -; first in each short. -; SignalSource.big_endian_items=false -; big_endian_bytes: true if the most signficiant two bits in the byte -; are the first two to be output. -SignalSource.big_endian_bytes=false -; sample_type: one of 'real' 'iq' or 'qi' -; Data is either real or complex. -; if the data is complex there are two conventions for sample ordering: -; 1) Real first : 'iq' -; 2) Imaginary first: 'qi' -; This setting specifies which of the three cases holds for this data file -SignalSource.sample_type=real -SignalSource.sampling_frequency=20480000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=float - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=float -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20480000 -InputFilter.IF=5499998.47412109 -InputFilter.decimation_factor=8 - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.sampled_ms=1 -Acquisition_1C.pfa=0.015 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Sample configuration file for IFEN SX-NSR software receiver front-end +; https://www.ifen.com/products/sx3-gnss-software-receiver/ +; This sample configuration is able to process directly .sream binary files +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2560000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Two_Bit_Packed_File_Signal_Source +SignalSource.filename=/datalogger/signals/ifen/E1L1_FE0_Band0.stream ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +; big_endian_items : not needed for byte inputs +; If the input were 'short' then this can either be big endian or little +; endian. If it is big endian then the second byte should be output +; first in each short. +; SignalSource.big_endian_items=false +; big_endian_bytes: true if the most signficiant two bits in the byte +; are the first two to be output. +SignalSource.big_endian_bytes=false +; sample_type: one of 'real' 'iq' or 'qi' +; Data is either real or complex. +; if the data is complex there are two conventions for sample ordering: +; 1) Real first : 'iq' +; 2) Imaginary first: 'qi' +; This setting specifies which of the three cases holds for this data file +SignalSource.sample_type=real +SignalSource.sampling_frequency=20480000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=float + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=float +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20480000 +InputFilter.IF=5499998.47412109 +InputFilter.decimation_factor=8 + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.sampled_ms=1 +Acquisition_1C.pfa=0.015 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true diff --git a/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf b/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf index d9c8918c5..b0d592f84 100644 --- a/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf +++ b/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf @@ -1,111 +1,111 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - -;######### CONTROL_THREAD CONFIG ############ -ControlThread.wait_for_flowgraph=false - -;######### SUPL RRLP GPS assistance configuration ##### -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/home/javier/signals/signal_source_int.dat -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=dump.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pulse_Blanking_Filter -InputFilter.Pfa=0.001 -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=8 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.extend_correlation_ms=10 -Tracking_1C.pll_bw_hz=35; -Tracking_1C.pll_bw_narrow_hz=30; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.dll_bw_narrow_hz=1.5; -Tracking_1C.fll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=true -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=1 -PVT.display_rate_ms=100 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + +;######### CONTROL_THREAD CONFIG ############ +ControlThread.wait_for_flowgraph=false + +;######### SUPL RRLP GPS assistance configuration ##### +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.nokia.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/home/javier/signals/signal_source_int.dat +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=dump.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pulse_Blanking_Filter +InputFilter.Pfa=0.001 +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=8 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.extend_correlation_ms=10 +Tracking_1C.pll_bw_hz=35; +Tracking_1C.pll_bw_narrow_hz=30; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.dll_bw_narrow_hz=1.5; +Tracking_1C.fll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=true +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=1 +PVT.display_rate_ms=100 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf b/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf index 93efcedc1..67c4d60e1 100644 --- a/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf +++ b/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf @@ -1,138 +1,138 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=3200000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Two_Bit_Cpx_File_Signal_Source -SignalSource.filename=/datalogger/captures/ajith/test1_two_cpx_live.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=byte -SignalSource.sampling_frequency=19200000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=19200000 -InputFilter.IF=4024000 -InputFilter.decimation_factor=6 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### GPS ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GPS CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=1.5; -Tracking_1C.order=3; -Tracking_1C.dump=true -Tracking_1C.dump_filename=./tracking_ch - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=3200000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Two_Bit_Cpx_File_Signal_Source +SignalSource.filename=/datalogger/captures/ajith/test1_two_cpx_live.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=byte +SignalSource.sampling_frequency=19200000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=19200000 +InputFilter.IF=4024000 +InputFilter.decimation_factor=6 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### GPS ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GPS CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=1.5; +Tracking_1C.order=3; +Tracking_1C.dump=true +Tracking_1C.dump_filename=./tracking_ch + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf b/conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf index 5e7067ed7..9b7b18b94 100644 --- a/conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf +++ b/conf/Other/gnss-sdr_GPS_L1_udp_with_monitor.conf @@ -1,82 +1,82 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps] -GNSS-SDR.internal_fs_sps=4000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Custom_UDP_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.origin_address=127.0.0.1 -SignalSource.capture_device=lo -SignalSource.port=1230 -;SignalSource.payload_bytes=1472 # Not used! Size is retrieved from UDP Packet -SignalSource.sample_type=cfloat -SignalSource.IQ_swap=true -SignalSource.RF_channels=1 -SignalSource.channels_in_udp=1 -SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=3 -Channels.in_acquisition=1 -Channel.signal=1C -Channel0.satellite=1 -Channel1.satellite=11 -Channel2.satellite=17 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=0.008 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.averaging_depth=100 -PVT.flag_averaging=true -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.enable_monitor=true -PVT.monitor_client_addresses=127.0.0.1 -PVT.monitor_udp_port=1234 - -;######### MONITOR CONFIG ############ -Monitor.enable_monitor=true -Monitor.decimation_factor=1 -Monitor.client_addresses=127.0.0.1 -Monitor.udp_port=1233 - -;######### ACQUISITION MONITOR CONFIG ############ -AcquisitionMonitor.enable_monitor=true -AcquisitionMonitor.decimation_factor=1 -AcquisitionMonitor.client_addresses=127.0.0.1 -AcquisitionMonitor.udp_port=1231 - -;######### TRACKING MONITOR CONFIG ############ -TrackingMonitor.enable_monitor=true -TrackingMonitor.decimation_factor=1 -TrackingMonitor.client_addresses=127.0.0.1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps] +GNSS-SDR.internal_fs_sps=4000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Custom_UDP_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.origin_address=127.0.0.1 +SignalSource.capture_device=lo +SignalSource.port=1230 +;SignalSource.payload_bytes=1472 # Not used! Size is retrieved from UDP Packet +SignalSource.sample_type=cfloat +SignalSource.IQ_swap=true +SignalSource.RF_channels=1 +SignalSource.channels_in_udp=1 +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=3 +Channels.in_acquisition=1 +Channel.signal=1C +Channel0.satellite=1 +Channel1.satellite=11 +Channel2.satellite=17 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=0.008 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.averaging_depth=100 +PVT.flag_averaging=true +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.enable_monitor=true +PVT.monitor_client_addresses=127.0.0.1 +PVT.monitor_udp_port=1234 + +;######### MONITOR CONFIG ############ +Monitor.enable_monitor=true +Monitor.decimation_factor=1 +Monitor.client_addresses=127.0.0.1 +Monitor.udp_port=1233 + +;######### ACQUISITION MONITOR CONFIG ############ +AcquisitionMonitor.enable_monitor=true +AcquisitionMonitor.decimation_factor=1 +AcquisitionMonitor.client_addresses=127.0.0.1 +AcquisitionMonitor.udp_port=1231 + +;######### TRACKING MONITOR CONFIG ############ +TrackingMonitor.enable_monitor=true +TrackingMonitor.decimation_factor=1 +TrackingMonitor.client_addresses=127.0.0.1 TrackingMonitor.udp_port=1232 \ No newline at end of file diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf index 9635f93c7..3fc5c22d2 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf @@ -1,115 +1,115 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. -GNSS-SDR.internal_fs_sps=7000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Fmcomms2_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=192.168.0.4 -SignalSource.sampling_frequency=7000000 -SignalSource.freq=1575420000 -SignalSource.bandwidth=4000000 -SignalSource.RF_channels=2 -SignalSource.rx1_enable=true -SignalSource.rx2_enable=true -SignalSource.gain_mode_rx1=slow_attack -SignalSource.gain_mode_rx2=slow_attack -SignalSource.rf_port_select=A_BALANCED -SignalSource.gain_rx1=64 -SignalSource.gain_rx2=64 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.enable_dds_lo=false -SignalSource.freq_rf_tx_hz=1260000000 -SignalSource.freq_dds_tx_hz=1000 -SignalSource.scale_dds_dbfs=0.0 -SignalSource.phase_dds_deg=0.0 -SignalSource.tx_attenuation_db=0.0 - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner0.implementation=Pass_Through -SignalConditioner1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel0.signal=1C -Channel1.RF_channel_ID=0 -Channel1.signal=1C -Channel2.RF_channel_ID=0 -Channel2.signal=1C -Channel3.RF_channel_ID=0 -Channel3.signal=1C -Channel4.RF_channel_ID=1 -Channel4.signal=1C -Channel5.RF_channel_ID=1 -Channel5.signal=1C -Channel6.RF_channel_ID=1 -Channel6.signal=1C -Channel7.RF_channel_ID=1 -Channel7.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.threshold=2.5 -Acquisition_1C.blocking=true -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [Sps]. +GNSS-SDR.internal_fs_sps=7000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fmcomms2_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.0.4 +SignalSource.sampling_frequency=7000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=4000000 +SignalSource.RF_channels=2 +SignalSource.rx1_enable=true +SignalSource.rx2_enable=true +SignalSource.gain_mode_rx1=slow_attack +SignalSource.gain_mode_rx2=slow_attack +SignalSource.rf_port_select=A_BALANCED +SignalSource.gain_rx1=64 +SignalSource.gain_rx2=64 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.enable_dds_lo=false +SignalSource.freq_rf_tx_hz=1260000000 +SignalSource.freq_dds_tx_hz=1000 +SignalSource.scale_dds_dbfs=0.0 +SignalSource.phase_dds_deg=0.0 +SignalSource.tx_attenuation_db=0.0 + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner0.implementation=Pass_Through +SignalConditioner1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel0.signal=1C +Channel1.RF_channel_ID=0 +Channel1.signal=1C +Channel2.RF_channel_ID=0 +Channel2.signal=1C +Channel3.RF_channel_ID=0 +Channel3.signal=1C +Channel4.RF_channel_ID=1 +Channel4.signal=1C +Channel5.RF_channel_ID=1 +Channel5.signal=1C +Channel6.RF_channel_ID=1 +Channel6.signal=1C +Channel7.RF_channel_ID=1 +Channel7.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.threshold=2.5 +Acquisition_1C.blocking=true +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf index 7a1fea65e..c2a6b5019 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_LimeSDR.conf @@ -1,129 +1,129 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=5000000 -GNSS-SDR.use_acquisition_resampler=true - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Limesdr_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=5000000 -SignalSource.freq=1575420000 -SignalSource.gain=50 ; 0-73 dB no AGC in LimeSDR -; SignalSource.analog_bw ; if not set, defaults to sample_rate/2 -; SignalSource.digital_bw ; if not set, defaults to 0 (disabled filter) -; SignalSource.limesdr_serial ; if not set, its automatic -SignalSource.antenna=2 ; None(0), LNAH(1), LNAL(2), LNAW(3), AUTO(255) -SignalSource.ext_clock_MHz=0 ; 0 -> internal clock -SignalSource.limechannel_mode=0 ; A(0), B(1) or (A+B) MIMO(2) -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=./captured_signal.dat - -SignalConditioner.implementation=Signal_Conditioner -DataTypeAdapter.implementation=Pass_Through -InputFilter.implementation=Pulse_Blanking_Filter ; <- Required in some locations -InputFilter.pfa=0.001 -InputFilter.segments_est=2500 -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=7 -Channels_1B.count=0 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### GPS L1 ACQUISITION CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=5000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### GALILEO E1 ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.pfa=0.01 -Acquisition_1B.blocking=false -Acquisition_1B.doppler_max=5000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### GPS L1 TRACKING CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.pll_bw_narrow_hz=5.0; -Tracking_1C.dll_bw_narrow_hz=0.75; -Tracking_1C.extend_correlation_symbols=1; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.early_late_space_narrow_chips=0.5 - -;######### GALILEO E1 TRACKING CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=0.75; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.5; -Tracking_1B.pll_bw_narrow_hz=5.0 -Tracking_1B.dll_bw_narrow_hz=0.5 -Tracking_1B.extend_correlation_symbols=1 -Tracking_1B.track_pilot=true -Tracking_1B.enable_fll_pull_in=true; -; Tracking_1B.pull_in_time_s=60 -Tracking_1B.enable_fll_steady_state=false -Tracking_1B.fll_bw_hz=10 -Tracking_1B.dump=false -Tracking_1B.dump_filename=tracking_ch_ - - -;######### TELEMETRY DECODER GPS L1 CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### TELEMETRY DECODER Galileo E1 CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.enable_rx_clock_correction=false -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.rinexobs_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2021 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=5000000 +GNSS-SDR.use_acquisition_resampler=true + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Limesdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=5000000 +SignalSource.freq=1575420000 +SignalSource.gain=50 ; 0-73 dB no AGC in LimeSDR +; SignalSource.analog_bw ; if not set, defaults to sample_rate/2 +; SignalSource.digital_bw ; if not set, defaults to 0 (disabled filter) +; SignalSource.limesdr_serial ; if not set, its automatic +SignalSource.antenna=2 ; None(0), LNAH(1), LNAL(2), LNAW(3), AUTO(255) +SignalSource.ext_clock_MHz=0 ; 0 -> internal clock +SignalSource.limechannel_mode=0 ; A(0), B(1) or (A+B) MIMO(2) +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./captured_signal.dat + +SignalConditioner.implementation=Signal_Conditioner +DataTypeAdapter.implementation=Pass_Through +InputFilter.implementation=Pulse_Blanking_Filter ; <- Required in some locations +InputFilter.pfa=0.001 +InputFilter.segments_est=2500 +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=7 +Channels_1B.count=0 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### GPS L1 ACQUISITION CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=5000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### GALILEO E1 ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.pfa=0.01 +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=5000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### GPS L1 TRACKING CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.75; +Tracking_1C.extend_correlation_symbols=1; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.5 + +;######### GALILEO E1 TRACKING CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=5.0 +Tracking_1B.dll_bw_narrow_hz=0.5 +Tracking_1B.extend_correlation_symbols=1 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +; Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + + +;######### TELEMETRY DECODER GPS L1 CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### TELEMETRY DECODER Galileo E1 CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.enable_rx_clock_correction=false +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.rinexobs_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf index cf1840aeb..f0ab33656 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf @@ -1,157 +1,157 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP X300 as a RF front-end for GPS L1 signals. -; Set SignalSource.device_address to the IP address of your device -; and run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=cshort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=cshort - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Fir_Filter -InputFilter.input_item_type=cshort -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=11 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.48 -InputFilter.band2_begin=0.52 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=4000000 -InputFilter.IF=0 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=0 -Channels.in_acquisition=1 -Channel.signal=1C - -;Channel0.signal=1C -;Channel1.signal=1C -;Channel2.signal=1C -;Channel3.signal=1C -;Channel4.signal=1C -;Channel5.signal=1C -;Channel6.signal=1C -;Channel7.signal=1C -;Channel8.signal=1C -;Channel9.signal=1C -;Channel10.signal=1C -;Channel11.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.00001 -Acquisition_1C.doppler_max=8000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=30.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP X300 as a RF front-end for GPS L1 signals. +; Set SignalSource.device_address to the IP address of your device +; and run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_X300_realtime_new.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=cshort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.gain=40 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=cshort + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Fir_Filter +InputFilter.input_item_type=cshort +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=11 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.48 +InputFilter.band2_begin=0.52 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=4000000 +InputFilter.IF=0 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_1B.count=0 +Channels.in_acquisition=1 +Channel.signal=1C + +;Channel0.signal=1C +;Channel1.signal=1C +;Channel2.signal=1C +;Channel3.signal=1C +;Channel4.signal=1C +;Channel5.signal=1C +;Channel6.signal=1C +;Channel7.signal=1C +;Channel8.signal=1C +;Channel9.signal=1C +;Channel10.signal=1C +;Channel11.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.00001 +Acquisition_1C.doppler_max=8000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=30.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf index c89fb7f3a..04afb9a6c 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf @@ -1,118 +1,118 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP 1 as a RF front-end for GPS L1 signals. -; Run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -;SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -SignalSource.gain=60 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels_1B.count=0 -Channels.in_acquisition=1 - - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=30.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation: -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP 1 as a RF front-end for GPS L1 signals. +; Run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L1_USRP_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +;SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.gain=60 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels_1B.count=0 +Channels.in_acquisition=1 + + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=30.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation: +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf index 8a726ea8a..e751730de 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf @@ -1,109 +1,109 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Osmosdr_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -;# RF Gain: LNA Gain {0, 3, 6} -SignalSource.gain=6 -;# IF Gain: N/A -SignalSource.rf_gain=40 -;# BB Gain: RX VGA1 + VGA2 [5, 60] -SignalSource.if_gain=48 -SignalSource.AGC_enabled=false -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.osmosdr_args=bladerf=0 ; This line enables the bladeRF -SignalSource.dump=false -SignalSource.dump_filename=./signal_source.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.decimation_factor=1 -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.85 -InputFilter.band2_begin=0.9 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels.in_acquisition=1 -Channel.signal=1C - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - -;######### PVT CONFIG ############ -;PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=Single -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.iono_model=Broadcast -PVT.trop_model=Saastamoinen -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.rtcm_tcp_port=2101 -PVT.rtcm_MT1019_rate_ms=5000 -PVT.rtcm_MT1077_rate_ms=1000 -PVT.rinex_version=2 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=2000000 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +;# RF Gain: LNA Gain {0, 3, 6} +SignalSource.gain=6 +;# IF Gain: N/A +SignalSource.rf_gain=40 +;# BB Gain: RX VGA1 + VGA2 [5, 60] +SignalSource.if_gain=48 +SignalSource.AGC_enabled=false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.osmosdr_args=bladerf=0 ; This line enables the bladeRF +SignalSource.dump=false +SignalSource.dump_filename=./signal_source.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.decimation_factor=1 +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.85 +InputFilter.band2_begin=0.9 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels.in_acquisition=1 +Channel.signal=1C + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + +;######### PVT CONFIG ############ +;PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=Single +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.iono_model=Broadcast +PVT.trop_model=Saastamoinen +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.rtcm_tcp_port=2101 +PVT.rtcm_MT1019_rate_ms=5000 +PVT.rtcm_MT1077_rate_ms=1000 +PVT.rinex_version=2 diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf index 63a02ee23..df763f64e 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -1,134 +1,134 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -GNSS-SDR.internal_fs_sps=2000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Fmcomms2_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=10.42.0.196 -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -SignalSource.bandwidth=2000000 -SignalSource.rx1_enable=true -SignalSource.gain_mode_rx1=manual -SignalSource.rf_port_select=A_BALANCED -SignalSource.gain_rx1=64 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=2000000 -InputFilter.IF=0; IF deviation due to front-end LO inaccuracies [Hz] - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=5 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +GNSS-SDR.internal_fs_sps=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Fmcomms2_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=10.42.0.196 +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=2000000 +SignalSource.rx1_enable=true +SignalSource.gain_mode_rx1=manual +SignalSource.rf_port_select=A_BALANCED +SignalSource.gain_rx1=64 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=2000000 +InputFilter.IF=0; IF deviation due to front-end LO inaccuracies [Hz] + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=5 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf index 2ec584332..e140810d2 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_plutosdr_realtime.conf @@ -1,145 +1,145 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps]. -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -GNSS-SDR.internal_fs_sps=4000000 -GNSS-SDR.use_acquisition_resampler=true - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Plutosdr_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=192.168.2.1 -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.bandwidth=2000000 -SignalSource.gain_mode=slow_attack -SignalSource.gain=30 -SignalSource.samples=0 -SignalSource.buffer_size=65000 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=./capture.dat - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=8 -Channels_1B.count=0 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.use_CFAR_algorithm=false; -Acquisition_1C.threshold=2.6 -Acquisition_1C.doppler_max=50000 -Acquisition_1C.doppler_step=250 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - -;######### GALILEO ACQUISITION CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.threshold=2.5 -Acquisition_1B.use_CFAR_algorithm=false -Acquisition_1B.blocking=false -Acquisition_1B.doppler_max=6000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=35.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.enable_fll_pull_in=true; -Tracking_1C.fll_bw_hz=10 -Tracking_1C.pll_bw_narrow_hz=5.0; -Tracking_1C.dll_bw_narrow_hz=0.75; -Tracking_1C.extend_correlation_symbols=1; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.early_late_space_narrow_chips=0.5 - -;######### TRACKING GALILEO CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=15.0; -Tracking_1B.dll_bw_hz=0.75; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.5; -Tracking_1B.pll_bw_narrow_hz=5.0 -Tracking_1B.dll_bw_narrow_hz=0.5 -Tracking_1B.extend_correlation_symbols=1 -Tracking_1B.track_pilot=true -Tracking_1B.enable_fll_pull_in=true; -;Tracking_1B.pull_in_time_s=60 -Tracking_1B.enable_fll_steady_state=false -Tracking_1B.fll_bw_hz=10 -Tracking_1B.dump=false -Tracking_1B.dump_filename=tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.enable_rx_clock_correction=false -PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.rinexobs_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [sps]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +GNSS-SDR.internal_fs_sps=4000000 +GNSS-SDR.use_acquisition_resampler=true + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Plutosdr_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.2.1 +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.bandwidth=2000000 +SignalSource.gain_mode=slow_attack +SignalSource.gain=30 +SignalSource.samples=0 +SignalSource.buffer_size=65000 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=./capture.dat + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=8 +Channels_1B.count=0 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.use_CFAR_algorithm=false; +Acquisition_1C.threshold=2.6 +Acquisition_1C.doppler_max=50000 +Acquisition_1C.doppler_step=250 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + +;######### GALILEO ACQUISITION CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.threshold=2.5 +Acquisition_1B.use_CFAR_algorithm=false +Acquisition_1B.blocking=false +Acquisition_1B.doppler_max=6000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=35.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.enable_fll_pull_in=true; +Tracking_1C.fll_bw_hz=10 +Tracking_1C.pll_bw_narrow_hz=5.0; +Tracking_1C.dll_bw_narrow_hz=0.75; +Tracking_1C.extend_correlation_symbols=1; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.early_late_space_narrow_chips=0.5 + +;######### TRACKING GALILEO CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=15.0; +Tracking_1B.dll_bw_hz=0.75; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.5; +Tracking_1B.pll_bw_narrow_hz=5.0 +Tracking_1B.dll_bw_narrow_hz=0.5 +Tracking_1B.extend_correlation_symbols=1 +Tracking_1B.track_pilot=true +Tracking_1B.enable_fll_pull_in=true; +;Tracking_1B.pull_in_time_s=60 +Tracking_1B.enable_fll_steady_state=false +Tracking_1B.fll_bw_hz=10 +Tracking_1B.dump=false +Tracking_1B.dump_filename=tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.enable_rx_clock_correction=false +PVT.positioning_mode=Single ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.rinexobs_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf index 8d856d183..370931cca 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -1,151 +1,151 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -GNSS-SDR.internal_fs_sps=1200000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation -SignalSource.implementation=RtlTcp_Signal_Source -SignalSource.sampling_frequency=1200000 -SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.rf_gain=40 -SignalSource.if_gain=30 -SignalSource.AGC_enabled = false -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat -SignalSource.address=127.0.0.1 -SignalSource.port=1234 -SignalSource.swap_iq=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 - -;#The following options are used only in Freq_Xlating_Fir_Filter implementation. -;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -InputFilter.sampling_frequency=1200000 -InputFilter.IF=80558 - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 -Channels.in_acquisition=1 -Channel.signal=1C - - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -;#implementation: -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -;#implementation: Position Velocity and Time (PVT) implementation: -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=true -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +GNSS-SDR.internal_fs_sps=1200000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation +SignalSource.implementation=RtlTcp_Signal_Source +SignalSource.sampling_frequency=1200000 +SignalSource.freq=1575420000 +SignalSource.gain=40 +SignalSource.rf_gain=40 +SignalSource.if_gain=30 +SignalSource.AGC_enabled = false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat +SignalSource.address=127.0.0.1 +SignalSource.port=1234 +SignalSource.swap_iq=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 + +;#The following options are used only in Freq_Xlating_Fir_Filter implementation. +;#InputFilter.IF is the intermediate frequency (in Hz) shifted down to zero Hz +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +InputFilter.sampling_frequency=1200000 +InputFilter.IF=80558 + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 +Channels.in_acquisition=1 +Channel.signal=1C + + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +;#implementation: +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +;#implementation: Position Velocity and Time (PVT) implementation: +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=true +PVT.dump_filename=./PVT diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf index 0319813c0..8994bb3f3 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf @@ -1,153 +1,153 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -GNSS-SDR.internal_fs_sps=1999898 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=false -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=Osmosdr_Signal_Source -SignalSource.item_type=gr_complex -; FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1575420000 -SignalSource.gain=40 -SignalSource.rf_gain=40 -SignalSource.if_gain=30 -SignalSource.AGC_enabled = false -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - -;# Please note that the new RTL-SDR Blog V3 dongles ship a < 1 PPM -;# temperature compensated oscillator (TCXO), which is well suited for GNSS -;# signal processing, and a 4.5 V powered bias-tee to feed an active antenna. -;# Whether the bias-tee is turned off before reception depends on which version -;# of gr-osmosdr was used when compiling GNSS-SDR. With an old version -;# (for example, v0.1.4-8), the utility rtl_biast may be used to switch the -;# bias-tee, and then call gnss-sdr. -;# See https://github.com/rtlsdrblog/rtl_biast -;# After reception the bias-tee is switched off automatically by the program. -;# With newer versions of gr-osmosdr (>= 0.1.4-13), the bias-tee can be -;# activated by uncommenting the following line: -;SignalSource.osmosdr_args=rtl,bias=1 - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE -; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver -InputFilter.sampling_frequency=1999898 -InputFilter.IF=80558 ; IF deviation due to front-end LO inaccuracies [Hz] - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 -Channels.in_acquisition=1 -Channel.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.015 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_min=-10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=15 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=2.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.dump=false -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +GNSS-SDR.internal_fs_sps=1999898 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=false +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=Osmosdr_Signal_Source +SignalSource.item_type=gr_complex +; FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1575420000 +SignalSource.gain=40 +SignalSource.rf_gain=40 +SignalSource.if_gain=30 +SignalSource.AGC_enabled = false +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + +;# Please note that the new RTL-SDR Blog V3 dongles ship a < 1 PPM +;# temperature compensated oscillator (TCXO), which is well suited for GNSS +;# signal processing, and a 4.5 V powered bias-tee to feed an active antenna. +;# Whether the bias-tee is turned off before reception depends on which version +;# of gr-osmosdr was used when compiling GNSS-SDR. With an old version +;# (for example, v0.1.4-8), the utility rtl_biast may be used to switch the +;# bias-tee, and then call gnss-sdr. +;# See https://github.com/rtlsdrblog/rtl_biast +;# After reception the bias-tee is switched off automatically by the program. +;# With newer versions of gr-osmosdr (>= 0.1.4-13), the bias-tee can be +;# activated by uncommenting the following line: +;SignalSource.osmosdr_args=rtl,bias=1 + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +;FOR USE GNSS-SDR WITH RTLSDR DONGLES USER MUST SET THE CALIBRATED SAMPLE RATE HERE +; i.e. using front-end-cal as reported here: https://www.researchgate.net/publication/257137427_Turning_a_Television_into_a_GNSS_Receiver +InputFilter.sampling_frequency=1999898 +InputFilter.IF=80558 ; IF deviation due to front-end LO inaccuracies [Hz] + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 +Channels.in_acquisition=1 +Channel.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.015 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_min=-10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=15 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=2.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.dump=false +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf index 85edb5451..cffb6f9b0 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf @@ -1,156 +1,156 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP1 as a RF front-end for GPS L2C signals -; Run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP1_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=2000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.sampling_frequency=2000000 -SignalSource.freq=1227600000 -SignalSource.gain=60 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=gr_complex - - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter.implementation=Freq_Xlating_Fir_Filter -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.45 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=20000000 -InputFilter.IF=-1600000 -InputFilter.decimation_factor=1 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex -Resampler.sample_freq_in=2000000 -Resampler.sample_freq_out=2000000 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_2S.count=1 -Channels.in_acquisition=1 - -Channel.signal=2S - -Channel0.signal=2S -Channel1.signal=2S -Channel2.signal=2S -Channel3.signal=2S -Channel4.signal=2S -Channel5.signal=2S -Channel6.signal=2S -Channel7.signal=2S -;Channel8.signal=2S -;Channel9.signal=2S -;Channel10.signal=2S -;Channel11.signal=2S - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.013 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=10000 -Acquisition_2S.doppler_step=100 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=1.5; -Tracking_2S.dll_bw_hz=0.3; -Tracking_2S.order=3; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=false - - -;######### OBSERVABLES CONFIG ############. -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP1 as a RF front-end for GPS L2C signals +; Run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP1_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=2000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.sampling_frequency=2000000 +SignalSource.freq=1227600000 +SignalSource.gain=60 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=gr_complex + + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter.implementation=Freq_Xlating_Fir_Filter +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.45 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=20000000 +InputFilter.IF=-1600000 +InputFilter.decimation_factor=1 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex +Resampler.sample_freq_in=2000000 +Resampler.sample_freq_out=2000000 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_2S.count=1 +Channels.in_acquisition=1 + +Channel.signal=2S + +Channel0.signal=2S +Channel1.signal=2S +Channel2.signal=2S +Channel3.signal=2S +Channel4.signal=2S +Channel5.signal=2S +Channel6.signal=2S +Channel7.signal=2S +;Channel8.signal=2S +;Channel9.signal=2S +;Channel10.signal=2S +;Channel11.signal=2S + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.013 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=10000 +Acquisition_2S.doppler_step=100 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=1.5; +Tracking_2S.dll_bw_hz=0.3; +Tracking_2S.order=3; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=false + + +;######### OBSERVABLES CONFIG ############. +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false diff --git a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf index f27bc5ed0..a221b7169 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf @@ -1,162 +1,162 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP X300 as a RF front-end for GPS L2C signals -; Set SignalSource.device_address to the IP address of your device -; and run: -; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.device_address=192.168.50.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=cshort -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1227600000 -;### Options: internal, external, or MIMO -SignalSource.clock_source=internal -SignalSource.gain=35 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Pass_Through -DataTypeAdapter.item_type=cshort - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Fir_Filter -InputFilter.input_item_type=cshort -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=11 -InputFilter.number_of_bands=2 - -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.48 -InputFilter.band2_begin=0.52 -InputFilter.band2_end=1.0 - -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 - -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 - -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=4000000 -InputFilter.IF=0 - -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex -Resampler.sample_freq_in=4000000 -Resampler.sample_freq_out=4000000 - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_2S.count=1 -Channels.in_acquisition=1 - -Channel.signal=2S - -Channel0.signal=2S -Channel1.signal=2S -Channel2.signal=2S -Channel3.signal=2S -Channel4.signal=2S -Channel5.signal=2S -Channel6.signal=2S -Channel7.signal=2S -;Channel8.signal=2S -;Channel9.signal=2S -;Channel10.signal=2S -;Channel11.signal=2S - -;######### ACQUISITION GLOBAL CONFIG ############ - -;# GPS L2C M -Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition -Acquisition_2S.item_type=gr_complex -Acquisition_2S.pfa=0.015 -;Acquisition_2S.pfa=0.001 -Acquisition_2S.doppler_max=5000 -Acquisition_2S.doppler_min=-5000 -Acquisition_2S.doppler_step=60 -Acquisition_2S.max_dwells=1 -Acquisition_2S.dump=false -Acquisition_2S.dump_filename=./acq_dump.dat - - -Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking -Tracking_2S.item_type=gr_complex -Tracking_2S.pll_bw_hz=2.0; -Tracking_2S.dll_bw_hz=0.25; -Tracking_2S.order=2; -Tracking_2S.early_late_space_chips=0.5; -Tracking_2S.dump=true -Tracking_2S.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder -TelemetryDecoder_2S.dump=true - - -;######### OBSERVABLES CONFIG ############. -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP X300 as a RF front-end for GPS L2C signals +; Set SignalSource.device_address to the IP address of your device +; and run: +; gnss-sdr --config_file=/path/to/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.device_address=192.168.50.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=cshort +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1227600000 +;### Options: internal, external, or MIMO +SignalSource.clock_source=internal +SignalSource.gain=35 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Pass_Through +DataTypeAdapter.item_type=cshort + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Fir_Filter +InputFilter.input_item_type=cshort +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=11 +InputFilter.number_of_bands=2 + +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.48 +InputFilter.band2_begin=0.52 +InputFilter.band2_end=1.0 + +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 + +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 + +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=4000000 +InputFilter.IF=0 + +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat +Resampler.item_type=gr_complex +Resampler.sample_freq_in=4000000 +Resampler.sample_freq_out=4000000 + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_2S.count=1 +Channels.in_acquisition=1 + +Channel.signal=2S + +Channel0.signal=2S +Channel1.signal=2S +Channel2.signal=2S +Channel3.signal=2S +Channel4.signal=2S +Channel5.signal=2S +Channel6.signal=2S +Channel7.signal=2S +;Channel8.signal=2S +;Channel9.signal=2S +;Channel10.signal=2S +;Channel11.signal=2S + +;######### ACQUISITION GLOBAL CONFIG ############ + +;# GPS L2C M +Acquisition_2S.implementation=GPS_L2_M_PCPS_Acquisition +Acquisition_2S.item_type=gr_complex +Acquisition_2S.pfa=0.015 +;Acquisition_2S.pfa=0.001 +Acquisition_2S.doppler_max=5000 +Acquisition_2S.doppler_min=-5000 +Acquisition_2S.doppler_step=60 +Acquisition_2S.max_dwells=1 +Acquisition_2S.dump=false +Acquisition_2S.dump_filename=./acq_dump.dat + + +Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking +Tracking_2S.item_type=gr_complex +Tracking_2S.pll_bw_hz=2.0; +Tracking_2S.dll_bw_hz=0.25; +Tracking_2S.order=2; +Tracking_2S.early_late_space_chips=0.5; +Tracking_2S.dump=true +Tracking_2S.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_2S.implementation=GPS_L2C_Telemetry_Decoder +TelemetryDecoder_2S.dump=true + + +;######### OBSERVABLES CONFIG ############. +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf index 4b0624fdc..b49801d10 100644 --- a/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf @@ -1,93 +1,93 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Configuration file for using USRP X300 as a RF front-end for Galileo E1 signals. -; Set SignalSource.device_address to the IP address of your device -; and run: -; gnss-sdr --config_file=/path/to/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 -GNSS-SDR.Galileo_banned_prns=14,18 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=UHD_Signal_Source -SignalSource.item_type=gr_complex -SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.sampling_frequency=4000000 -SignalSource.freq=1575420000 -SignalSource.gain=50 -SignalSource.subdevice=A:0 -SignalSource.samples=0 -SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Pass_Through - - -;######### CHANNELS GLOBAL CONFIG ###### -Channels_1B.count=4 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -;Acquisition_1B.threshold=1 -Acquisition_1B.pfa=0.000008 -Acquisition_1B.doppler_max=6000 -Acquisition_1B.doppler_step=250 -Acquisition_1B.cboc=false -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Configuration file for using USRP X300 as a RF front-end for Galileo E1 signals. +; Set SignalSource.device_address to the IP address of your device +; and run: +; gnss-sdr --config_file=/path/to/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 +GNSS-SDR.Galileo_banned_prns=14,18 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=UHD_Signal_Source +SignalSource.item_type=gr_complex +SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.sampling_frequency=4000000 +SignalSource.freq=1575420000 +SignalSource.gain=50 +SignalSource.subdevice=A:0 +SignalSource.samples=0 +SignalSource.dump=false +SignalSource.dump_filename=../data/signal_source.dat + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Pass_Through + + +;######### CHANNELS GLOBAL CONFIG ###### +Channels_1B.count=4 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +;Acquisition_1B.threshold=1 +Acquisition_1B.pfa=0.000008 +Acquisition_1B.doppler_max=6000 +Acquisition_1B.doppler_step=250 +Acquisition_1B.cboc=false +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=../data/veml_tracking_ch_ + + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf index bf6e8043d..61f18e09f 100644 --- a/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf @@ -1,161 +1,161 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_1C_enabled=false -GNSS-SDR.SUPL_read_1C_assistance_xml=true -GNSS-SDR.SUPL_1C_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_1C_ephemeris_port=7275 -GNSS-SDR.SUPL_1C_acquisition_server=supl.google.com -GNSS-SDR.SUPL_1C_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -;#implementation -SignalSource.implementation=UHD_Signal_Source -SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE -SignalSource.item_type=gr_complex -SignalSource.RF_channels=2 -SignalSource.sampling_frequency=4000000 -SignalSource.subdevice=A:0 B:0 - -;######### RF Channels specific settings ###### -;## RF CHANNEL 0 ## -SignalSource.freq0=1575420000 -SignalSource.gain0=50 -SignalSource.samples0=0 - -;## RF CHANNEL 1 ## -SignalSource.freq1=1575420000 -SignalSource.gain1=50 -SignalSource.samples1=0 - - -;######### SIGNAL_CONDITIONER 0 CONFIG ############ -SignalConditioner0.implementation=Pass_Through - -;######### DATA_TYPE_ADAPTER 0 CONFIG ############ -DataTypeAdapter0.implementation=Pass_Through -DataTypeAdapter0.item_type=gr_complex - -;######### INPUT_FILTER 0 CONFIG ############ -InputFilter0.implementation=Pass_Through -InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat -InputFilter0.input_item_type=gr_complex -InputFilter0.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 0 ############ -Resampler0.implementation=Pass_Through - - -;######### SIGNAL_CONDITIONER 1 CONFIG ############ -SignalConditioner1.implementation=Pass_Through - - -;######### INPUT_FILTER 1 CONFIG ############ -InputFilter1.implementation=Pass_Through -InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat -InputFilter1.input_item_type=gr_complex -InputFilter1.output_item_type=gr_complex - -;######### RESAMPLER CONFIG 1 ############ -Resampler1.implementation=Pass_Through - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=4 - -Channels.in_acquisition=1 - -;#signal: -;# "1C" GPS L1 C/A -;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) -;# "1G" GLONASS L1 C/A -;# "2S" GPS L2 L2C (M) -;# "5X" GALILEO E5a I+Q -;# "L5" GPS L5 - -;# CHANNEL CONNECTION -Channel0.RF_channel_ID=0 -Channel1.RF_channel_ID=1 -Channel2.RF_channel_ID=0 -Channel3.RF_channel_ID=1 - - -;#signal: -Channel0.signal=1C -Channel1.signal=1C -Channel2.signal=1C -Channel3.signal=1C - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=0.01 -;Acquisition_1C.pfa=0.01 -Acquisition_1C.doppler_max=8000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.bit_transition_flag=false -Acquisition_1C.max_dwells=1 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=40.0; -Tracking_1C.dll_bw_hz=4.0; -Tracking_1C.order=3; -Tracking_1C.early_late_space_chips=0.5; -Tracking_1C.dump=false -Tracking_1C.dump_filename=./tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=false; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_1C_enabled=false +GNSS-SDR.SUPL_read_1C_assistance_xml=true +GNSS-SDR.SUPL_1C_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_1C_ephemeris_port=7275 +GNSS-SDR.SUPL_1C_acquisition_server=supl.google.com +GNSS-SDR.SUPL_1C_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +;#implementation +SignalSource.implementation=UHD_Signal_Source +SignalSource.device_address=192.168.40.2 ; <- PUT THE IP ADDRESS OF YOUR USRP HERE +SignalSource.item_type=gr_complex +SignalSource.RF_channels=2 +SignalSource.sampling_frequency=4000000 +SignalSource.subdevice=A:0 B:0 + +;######### RF Channels specific settings ###### +;## RF CHANNEL 0 ## +SignalSource.freq0=1575420000 +SignalSource.gain0=50 +SignalSource.samples0=0 + +;## RF CHANNEL 1 ## +SignalSource.freq1=1575420000 +SignalSource.gain1=50 +SignalSource.samples1=0 + + +;######### SIGNAL_CONDITIONER 0 CONFIG ############ +SignalConditioner0.implementation=Pass_Through + +;######### DATA_TYPE_ADAPTER 0 CONFIG ############ +DataTypeAdapter0.implementation=Pass_Through +DataTypeAdapter0.item_type=gr_complex + +;######### INPUT_FILTER 0 CONFIG ############ +InputFilter0.implementation=Pass_Through +InputFilter0.dump=false +InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.input_item_type=gr_complex +InputFilter0.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 0 ############ +Resampler0.implementation=Pass_Through + + +;######### SIGNAL_CONDITIONER 1 CONFIG ############ +SignalConditioner1.implementation=Pass_Through + + +;######### INPUT_FILTER 1 CONFIG ############ +InputFilter1.implementation=Pass_Through +InputFilter1.dump=false +InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.input_item_type=gr_complex +InputFilter1.output_item_type=gr_complex + +;######### RESAMPLER CONFIG 1 ############ +Resampler1.implementation=Pass_Through + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=4 + +Channels.in_acquisition=1 + +;#signal: +;# "1C" GPS L1 C/A +;# "1B" GALILEO E1 B (I/NAV OS/CS/SoL) +;# "1G" GLONASS L1 C/A +;# "2S" GPS L2 L2C (M) +;# "5X" GALILEO E5a I+Q +;# "L5" GPS L5 + +;# CHANNEL CONNECTION +Channel0.RF_channel_ID=0 +Channel1.RF_channel_ID=1 +Channel2.RF_channel_ID=0 +Channel3.RF_channel_ID=1 + + +;#signal: +Channel0.signal=1C +Channel1.signal=1C +Channel2.signal=1C +Channel3.signal=1C + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=0.01 +;Acquisition_1C.pfa=0.01 +Acquisition_1C.doppler_max=8000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.bit_transition_flag=false +Acquisition_1C.max_dwells=1 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=40.0; +Tracking_1C.dll_bw_hz=4.0; +Tracking_1C.order=3; +Tracking_1C.early_late_space_chips=0.5; +Tracking_1C.dump=false +Tracking_1C.dump_filename=./tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=false; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT diff --git a/conf/gnss-sdr.conf b/conf/gnss-sdr.conf index 9c2b654d6..3f4b61766 100644 --- a/conf/gnss-sdr.conf +++ b/conf/gnss-sdr.conf @@ -1,145 +1,145 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; Default configuration file -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SUPL RRLP GPS assistance configuration ##### -; Check https://www.mcc-mnc.com/ -; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en -GNSS-SDR.SUPL_gps_enabled=false -GNSS-SDR.SUPL_read_gps_assistance_xml=true -GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com -GNSS-SDR.SUPL_gps_ephemeris_port=7275 -GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com -GNSS-SDR.SUPL_gps_acquisition_port=7275 -GNSS-SDR.SUPL_MCC=244 -GNSS-SDR.SUPL_MNC=5 -GNSS-SDR.SUPL_LAC=0x59e2 -GNSS-SDR.SUPL_CI=0x31b0 - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through ; or Fir_Filter - -InputFilter.input_item_type=gr_complex -InputFilter.output_item_type=gr_complex -InputFilter.taps_item_type=float -InputFilter.number_of_taps=5 -InputFilter.number_of_bands=2 -InputFilter.band1_begin=0.0 -InputFilter.band1_end=0.44 -InputFilter.band2_begin=0.55 -InputFilter.band2_end=1.0 -InputFilter.ampl1_begin=1.0 -InputFilter.ampl1_end=1.0 -InputFilter.ampl2_begin=0.0 -InputFilter.ampl2_end=0.0 -InputFilter.band1_error=1.0 -InputFilter.band2_error=1.0 -InputFilter.filter_type=bandpass -InputFilter.grid_density=16 -InputFilter.sampling_frequency=4000000 -InputFilter.IF=0 -InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1C.count=6 -Channels_1B.count=0 -Channels.in_acquisition=1 - - -;######### SPECIFIC CHANNELS CONFIG ###### - -;######### CHANNEL 0 CONFIG ############ -;Channel0.signal=1C -;Channel0.satellite=11 - -;######### CHANNEL 1 CONFIG ############ -;Channel1.signal=1C -;Channel1.satellite=18 - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler -Acquisition_1C.item_type=gr_complex -Acquisition_1C.coherent_integration_time_ms=1 -Acquisition_1C.threshold=2.5 -;Acquisition_1C.pfa=0.0001 -Acquisition_1C.doppler_max=10000 -Acquisition_1C.doppler_step=500 -Acquisition_1C.max_dwells=5 -Acquisition_1C.dump=false -Acquisition_1C.dump_filename=./acq_dump.dat - - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking -Tracking_1C.item_type=gr_complex -Tracking_1C.pll_bw_hz=45.0; -Tracking_1C.dll_bw_hz=3.0; -Tracking_1C.order=3; -Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ - - -;######### TELEMETRY DECODER GPS CONFIG ############ -TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder -TelemetryDecoder_1C.dump=false - - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.AR_GPS=PPP-AR ; options: OFF, Continuous, Instantaneous, Fix-and-Hold, PPP-AR -PVT.output_rate_ms=10 -PVT.display_rate_ms=500 -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea -PVT.flag_nmea_tty_port=true -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=true -PVT.flag_rtcm_tty_port=false -PVT.rtcm_dump_devname=/dev/pts/1 -PVT.dump=false -PVT.dump_filename=./PVT +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; Default configuration file +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SUPL RRLP GPS assistance configuration ##### +; Check https://www.mcc-mnc.com/ +; On Android: https://play.google.com/store/apps/details?id=net.its_here.cellidinfo&hl=en +GNSS-SDR.SUPL_gps_enabled=false +GNSS-SDR.SUPL_read_gps_assistance_xml=true +GNSS-SDR.SUPL_gps_ephemeris_server=supl.google.com +GNSS-SDR.SUPL_gps_ephemeris_port=7275 +GNSS-SDR.SUPL_gps_acquisition_server=supl.google.com +GNSS-SDR.SUPL_gps_acquisition_port=7275 +GNSS-SDR.SUPL_MCC=244 +GNSS-SDR.SUPL_MNC=5 +GNSS-SDR.SUPL_LAC=0x59e2 +GNSS-SDR.SUPL_CI=0x31b0 + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through ; or Fir_Filter + +InputFilter.input_item_type=gr_complex +InputFilter.output_item_type=gr_complex +InputFilter.taps_item_type=float +InputFilter.number_of_taps=5 +InputFilter.number_of_bands=2 +InputFilter.band1_begin=0.0 +InputFilter.band1_end=0.44 +InputFilter.band2_begin=0.55 +InputFilter.band2_end=1.0 +InputFilter.ampl1_begin=1.0 +InputFilter.ampl1_end=1.0 +InputFilter.ampl2_begin=0.0 +InputFilter.ampl2_end=0.0 +InputFilter.band1_error=1.0 +InputFilter.band2_error=1.0 +InputFilter.filter_type=bandpass +InputFilter.grid_density=16 +InputFilter.sampling_frequency=4000000 +InputFilter.IF=0 +InputFilter.dump=false +InputFilter.dump_filename=../data/input_filter.dat + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=../data/resampler.dat + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1C.count=6 +Channels_1B.count=0 +Channels.in_acquisition=1 + + +;######### SPECIFIC CHANNELS CONFIG ###### + +;######### CHANNEL 0 CONFIG ############ +;Channel0.signal=1C +;Channel0.satellite=11 + +;######### CHANNEL 1 CONFIG ############ +;Channel1.signal=1C +;Channel1.satellite=18 + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1C.implementation=GPS_L1_CA_PCPS_Acquisition_Fine_Doppler +Acquisition_1C.item_type=gr_complex +Acquisition_1C.coherent_integration_time_ms=1 +Acquisition_1C.threshold=2.5 +;Acquisition_1C.pfa=0.0001 +Acquisition_1C.doppler_max=10000 +Acquisition_1C.doppler_step=500 +Acquisition_1C.max_dwells=5 +Acquisition_1C.dump=false +Acquisition_1C.dump_filename=./acq_dump.dat + + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking +Tracking_1C.item_type=gr_complex +Tracking_1C.pll_bw_hz=45.0; +Tracking_1C.dll_bw_hz=3.0; +Tracking_1C.order=3; +Tracking_1C.dump=false +Tracking_1C.dump_filename=../data/epl_tracking_ch_ + + +;######### TELEMETRY DECODER GPS CONFIG ############ +TelemetryDecoder_1C.implementation=GPS_L1_CA_Telemetry_Decoder +TelemetryDecoder_1C.dump=false + + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.AR_GPS=PPP-AR ; options: OFF, Continuous, Instantaneous, Fix-and-Hold, PPP-AR +PVT.output_rate_ms=10 +PVT.display_rate_ms=500 +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea +PVT.flag_nmea_tty_port=true +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=true +PVT.flag_rtcm_tty_port=false +PVT.rtcm_dump_devname=/dev/pts/1 +PVT.dump=false +PVT.dump_filename=./PVT From b5a5b9a2981ea9839072ac0f1584e2d548bd0291 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 4 Oct 2024 17:09:19 +0200 Subject: [PATCH 410/499] Fix issues in some IDEs --- .../volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h index 07eb3f849..63b1bd429 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: Carles Fernandez-Prades #ifndef _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] +#else #ifndef _MSC_SYS_TIME_H #define _MSC_SYS_TIME_H @@ -72,3 +72,6 @@ static inline int gettimeofday(struct timeval *tv, struct timezone *tz) return 0; } + +#endif // _MSC_SYS_TIME_H +#endif // _MSC_VER \ No newline at end of file From bb3456f7495e992798fe31e8b88db163b20da00d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 4 Oct 2024 17:09:19 +0200 Subject: [PATCH 411/499] Fix issues in some IDEs --- .../volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h index 07eb3f849..63b1bd429 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/msvc/sys/time.h @@ -2,7 +2,7 @@ // SPDX-FileCopyrightText: Carles Fernandez-Prades #ifndef _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] +#else #ifndef _MSC_SYS_TIME_H #define _MSC_SYS_TIME_H @@ -72,3 +72,6 @@ static inline int gettimeofday(struct timeval *tv, struct timezone *tz) return 0; } + +#endif // _MSC_SYS_TIME_H +#endif // _MSC_VER \ No newline at end of file From 2a98217f25c740f7d0369b757ebd0d31b571cf24 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 4 Oct 2024 19:43:07 +0200 Subject: [PATCH 412/499] Remove references to the data folder --- README.md | 10 +- conf/File_input/GPS/gnss-sdr-L1-gaussian.conf | 4 +- conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf | 6 +- .../GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf | 6 +- .../GPS/gnss-sdr_GPS_L1_gr_complex.conf | 4 +- .../GPS/gnss-sdr_GPS_L1_ishort.conf | 2 +- ...nnel_GPS_L1_Flexiband_bin_file_III_1a.conf | 8 +- ...nnel_GPS_L1_Flexiband_realtime_III_1a.conf | 6 +- ...nnel_GPS_L1_Flexiband_realtime_III_1b.conf | 6 +- ...annel_GPS_L1_Flexiband_realtime_II_3b.conf | 6 +- ...hannel_GPS_L1_Flexiband_realtime_I_1b.conf | 6 +- ...l_GPS_L1_L2_Flexiband_realtime_III_1b.conf | 6 +- ...Galileo_E1B_Flexiband_bin_file_III_1b.conf | 10 +- ...el_GPS_L2_M_Flexiband_bin_file_III_1b.conf | 10 +- ...S_L2_M_Flexiband_bin_file_III_1b_real.conf | 8 +- .../gnss-sdr_Galileo_E1_acq_QuickSync.conf | 200 +++++++++--------- .../Galileo/gnss-sdr_Galileo_E1_ishort.conf | 4 +- .../Galileo/gnss-sdr_Galileo_E1_nsr.conf | 6 +- .../gnss-sdr_Galileo_E5a_IFEN_CTTC.conf | 6 +- ...r_galileo_E1_extended_correlator_byte.conf | 6 +- ...galileo_E1_extended_correlator_labsat.conf | 10 +- ...nss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf | 4 +- .../Glonass/gnss-sdr_GLONASS_L1_ibyte.conf | 4 +- .../MultiCons/gnss-sdr_Hybrid_byte.conf | 8 +- .../MultiCons/gnss-sdr_Hybrid_byte_sim.conf | 10 +- .../MultiCons/gnss-sdr_Hybrid_gr_complex.conf | 4 +- .../MultiCons/gnss-sdr_Hybrid_ishort.conf | 6 +- ..._all_in_one_Flexiband_bin_file_III_1b.conf | 10 +- .../gnss-sdr_multisource_Hybrid_ishort.conf | 10 +- .../gnss-sdr_multisource_Hybrid_nsr.conf | 8 +- conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf | 10 +- conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf | 6 +- conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf | 8 +- conf/Other/front-end-cal.conf | 6 +- .../Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf | 4 +- .../gnss-sdr_GPS_L1_nsr_twobit_packed.conf | 8 +- ...-sdr_GPS_L1_pulse_blanking_gr_complex.conf | 4 +- conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf | 6 +- ...gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf | 2 +- .../gnss-sdr_GPS_L1_USRP_X300_realtime.conf | 6 +- .../gnss-sdr_GPS_L1_USRP_realtime.conf | 2 +- .../gnss-sdr_GPS_L1_bladeRF.conf | 2 +- .../gnss-sdr_GPS_L1_fmcomms2_realtime.conf | 4 +- .../gnss-sdr_GPS_L1_rtl_tcp_realtime.conf | 4 +- .../gnss-sdr_GPS_L1_rtlsdr_realtime.conf | 4 +- .../gnss-sdr_GPS_L2C_USRP1_realtime.conf | 6 +- .../gnss-sdr_GPS_L2C_USRP_X300_realtime.conf | 6 +- ...nss-sdr_Galileo_E1_USRP_X300_realtime.conf | 4 +- ...lileo_Beidou_Glonass_L1_USRP_realtime.conf | 6 +- ...GPS_Galileo_Beidou_L1_hackrf_realtime.conf | 4 +- ...ultichannel_GPS_L1_USRP_X300_realtime.conf | 4 +- conf/gnss-sdr.conf | 6 +- docs/CHANGELOG.md | 2 + docs/doxygen/other/main_page.dox | 2 +- ...lileo_e1_pcps_8ms_ambiguous_acquisition.cc | 2 +- ...eo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 2 +- ...e1_pcps_quicksync_ambiguous_acquisition.cc | 2 +- ...ileo_e1_pcps_tong_ambiguous_acquisition.cc | 2 +- ...ileo_e5a_noncoherent_iq_acquisition_caf.cc | 2 +- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 4 +- .../galileo_pcps_8ms_acquisition_cc.cc | 2 +- .../pcps_assisted_acquisition_cc.cc | 2 +- .../pcps_cccwsr_acquisition_cc.cc | 2 +- .../pcps_opencl_acquisition_cc.cc | 4 +- .../pcps_quicksync_acquisition_cc.cc | 2 +- .../pcps_tong_acquisition_cc.cc | 2 +- .../adapters/byte_to_short.cc | 2 +- .../adapters/cshort_to_grcomplex.cc | 2 +- .../adapters/ibyte_to_cbyte.cc | 2 +- .../adapters/ibyte_to_complex.cc | 2 +- .../adapters/ibyte_to_cshort.cc | 2 +- .../adapters/ishort_to_complex.cc | 2 +- .../adapters/ishort_to_cshort.cc | 2 +- .../input_filter/adapters/fir_filter.cc | 2 +- .../adapters/freq_xlating_fir_filter.cc | 2 +- .../adapters/pulse_blanking_filter.cc | 2 +- .../adapters/fifo_signal_source.cc | 2 +- .../adapters/file_source_base.cc | 4 +- .../adapters/file_timestamp_signal_source.cc | 2 +- .../adapters/ion_gsms_signal_source.cc | 2 +- .../spir_gss6450_file_signal_source.cc | 4 +- ...ync_ambiguous_acquisition_gsoc2014_test.cc | 4 +- ...cps_acquisition_gsoc2014_gensource_test.cc | 10 +- .../galileo_e5b_pcps_acquisition_test.cc | 2 +- .../galileo_e6_pcps_acquisition_test.cc | 2 +- ...cps_quicksync_acquisition_gsoc2014_test.cc | 4 +- .../galileo_e1_dll_pll_veml_tracking_test.cc | 2 +- .../tracking/galileo_e5a_tracking_test.cc | 2 +- .../galileo_e5b_dll_pll_tracking_test.cc | 2 +- .../gps_l2_m_dll_pll_tracking_test.cc | 2 +- .../system-parameters/has_decoding_test.cc | 2 +- 91 files changed, 303 insertions(+), 301 deletions(-) diff --git a/README.md b/README.md index 8997686d1..6bad46ab8 100644 --- a/README.md +++ b/README.md @@ -1070,7 +1070,7 @@ You can use a single configuration file for processing different data files, specifying the file to be processed with the `--signal_source` flag: ``` -$ gnss-sdr --config_file=../conf/my_receiver.conf --signal_source=../data/my_captured_data.dat +$ gnss-sdr --config_file=../conf/my_receiver.conf --signal_source=./my_captured_data.dat ``` This will override the `SignalSource.filename` specified in the configuration @@ -1455,7 +1455,7 @@ SignalSource.port=1234 SignalSource.swap_iq=false SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ``` Example for a dual-frequency receiver: @@ -1549,7 +1549,7 @@ The block can be configured like this: ;#[Freq_Xlating_Fir_Filter] enables FIR filter and a composite frequency translation that shifts IF down to zero Hz. InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false ; #dump: Dump the filtered data to a file. -InputFilter.dump_filename=../data/input_filter.dat ; #dump_filename: Log path and filename. +InputFilter.dump_filename=./input_filter.dat ; #dump_filename: Log path and filename. InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float @@ -1602,7 +1602,7 @@ implements a nearest neighbourhood interpolation: ;#[Pass_Through] disables this block Resampler.implementation=Direct_Resampler Resampler.dump=false ; Dumps the resampled data to a file. -Resampler.dump_filename=../data/resampler.dat ; log path and filename. +Resampler.dump_filename=./resampler.dat ; log path and filename. Resampler.item_type=gr_complex Resampler.sample_freq_in=8000000 ; sample frequency of the input signal Resampler.sample_freq_out=4000000 ; desired sample frequency of the output signal @@ -1830,7 +1830,7 @@ Tracking_1B.dll_filter_order=2 ; DLL loop filter order [1], [2] or [3] Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ``` More documentation at the diff --git a/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf b/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf index a208366e5..32b24bccc 100644 --- a/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf +++ b/conf/File_input/GPS/gnss-sdr-L1-gaussian.conf @@ -39,7 +39,7 @@ Acquisition_1C.pfa=0.01 Acquisition_1C.doppler_max=10000 Acquisition_1C.doppler_step=250 Acquisition_1C.dump=false -Acquisition_1C.dump_filename=../data/kalman/acq_dump +Acquisition_1C.dump_filename=./kalman/acq_dump ;######### TRACKING GLOBAL CONFIG ############ Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking @@ -48,7 +48,7 @@ Tracking_1C.pll_bw_hz=40.0; Tracking_1C.dll_bw_hz=4.0; Tracking_1C.order=3; Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/kalman/epl_tracking_ch_ +Tracking_1C.dump_filename=./kalman/epl_tracking_ch_ Tracking_1C.bce_run = true; Tracking_1C.p_transient = 0; Tracking_1C.s_transient = 100; diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf index d83bd63d3..f0a90781b 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_SPIR.conf @@ -34,7 +34,7 @@ DataTypeAdapter.item_type=float ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=float InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float @@ -64,7 +64,7 @@ Resampler.item_type=gr_complex Resampler.sample_freq_in=80000000 Resampler.sample_freq_out=4000000 Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ @@ -107,7 +107,7 @@ Tracking_1C.item_type=gr_complex Tracking_1C.pll_bw_hz=20.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf index 356dde132..6961b3c3f 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_acq_QuickSync.conf @@ -30,14 +30,14 @@ SignalConditioner.implementation=Signal_Conditioner ;######### DATA_TYPE_ADAPTER CONFIG ############ DataTypeAdapter.implementation=Ishort_To_Complex DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/data_type_adapter.dat +DataTypeAdapter.dump_filename=./data_type_adapter.dat ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Pass_Through InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ @@ -46,7 +46,7 @@ Resampler.item_type=gr_complex Resampler.sample_freq_in=4000000 Resampler.sample_freq_out=4000000 Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf index 84179dbed..d61355a00 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_gr_complex.conf @@ -30,7 +30,7 @@ SignalConditioner.implementation=Signal_Conditioner DataTypeAdapter.implementation=Ishort_To_Complex DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat +DataTypeAdapter.dump_filename=./DataTypeAdapter.dat InputFilter.implementation=Pass_Through InputFilter.input_item_type=gr_complex @@ -67,7 +67,7 @@ Tracking_1C.pll_bw_hz=40.0; Tracking_1C.dll_bw_hz=4.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_c +Tracking_1C.dump_filename=./epl_tracking_c ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf b/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf index 1d76c2a2f..3a90a518d 100644 --- a/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf +++ b/conf/File_input/GPS/gnss-sdr_GPS_L1_ishort.conf @@ -24,7 +24,7 @@ SignalSource.sampling_frequency=4000000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf index d7a72f476..8f3a44652 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_bin_file_III_1a.conf @@ -51,7 +51,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -86,7 +86,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Pass_Through InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex @@ -103,7 +103,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex @@ -153,7 +153,7 @@ Tracking_1C.dll_bw_narrow_hz=2.0; Tracking_1C.order=3; Tracking_1C.early_late_space_chips=0.5; Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf index 48727d42f..a543752ef 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1a.conf @@ -50,7 +50,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -85,7 +85,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Pass_Through InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex @@ -102,7 +102,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf index 478cc875d..b86f734d4 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_III_1b.conf @@ -51,7 +51,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -85,7 +85,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Pass_Through InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex @@ -102,7 +102,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf index 3ba4ba52d..ac8157f4e 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_II_3b.conf @@ -50,7 +50,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -85,7 +85,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Pass_Through InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex @@ -102,7 +102,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf index 73624bc73..f919973d2 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_Flexiband_realtime_I_1b.conf @@ -50,7 +50,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -85,7 +85,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Pass_Through InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex @@ -102,7 +102,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf index 9e77cb6ae..746330acf 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Flexiband_realtime_III_1b.conf @@ -54,7 +54,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -93,7 +93,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.dump_filename=./input_filter_ch1.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex InputFilter1.taps_item_type=float @@ -129,7 +129,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf index f2a47b807..7e494914e 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L1_L2_Galileo_E1B_Flexiband_bin_file_III_1b.conf @@ -56,7 +56,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -95,7 +95,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.dump_filename=./input_filter_ch1.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex InputFilter1.taps_item_type=float @@ -131,7 +131,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex @@ -190,7 +190,7 @@ Acquisition_1C.dump_filename=./acq_dump.dat Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking Tracking_1C.item_type=gr_complex Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ Tracking_1C.pll_bw_hz=40.0; Tracking_1C.dll_bw_hz=1.5; Tracking_1C.order=3; @@ -215,7 +215,7 @@ Tracking_2S.dll_bw_hz=0.3; Tracking_2S.order=3; Tracking_2S.early_late_space_chips=0.5; Tracking_2S.dump=true -Tracking_2S.dump_filename=../data/epl_tracking_ch_ +Tracking_2S.dump_filename=./epl_tracking_ch_ ;# GALILEO E1B diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf index c6ca7e8e0..7b5609ada 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf @@ -56,7 +56,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.dump_filename=./input_filter_ch0.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -95,7 +95,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.dump_filename=./input_filter_ch1.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex InputFilter1.taps_item_type=float @@ -136,7 +136,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Freq_Xlating_Fir_Filter InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter_ch2.dat +InputFilter2.dump_filename=./input_filter_ch2.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex InputFilter2.taps_item_type=float @@ -286,7 +286,7 @@ Tracking_1C.dll_bw_hz=3.0; Tracking_1C.order=3; Tracking_1C.early_late_space_chips=0.5; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### GALILEO E1 TRK CONFIG ############ @@ -298,7 +298,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### GPS L2C GENERIC TRACKING CONFIG ############ diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf index 0abf4188c..0e0f9f289 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b_real.conf @@ -56,7 +56,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.dump_filename=./input_filter_ch0.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -94,7 +94,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.dump_filename=./input_filter_ch1.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex InputFilter1.taps_item_type=float @@ -130,7 +130,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Pass_Through InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex @@ -212,7 +212,7 @@ Tracking_1C.dll_bw_hz=3.0; Tracking_1C.order=3; Tracking_1C.early_late_space_chips=0.5; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### GPS L2C GENERIC TRACKING CONFIG ############ diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf index 1f58776f7..5146a4f1b 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_acq_QuickSync.conf @@ -1,100 +1,100 @@ -; This is a GNSS-SDR configuration file -; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ -; SPDX-License-Identifier: GPL-3.0-or-later -; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) - -; You can define your own receiver and invoke it by doing -; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf -; - -[GNSS-SDR] - -;######### GLOBAL OPTIONS ################## -;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. -GNSS-SDR.internal_fs_sps=4000000 - - -;######### SIGNAL_SOURCE CONFIG ############ -SignalSource.implementation=File_Signal_Source -SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE -SignalSource.item_type=ishort -SignalSource.sampling_frequency=4000000 -SignalSource.samples=0 -SignalSource.repeat=false -SignalSource.enable_throttle_control=false - - -;######### SIGNAL_CONDITIONER CONFIG ############ -SignalConditioner.implementation=Signal_Conditioner - -;######### DATA_TYPE_ADAPTER CONFIG ############ -DataTypeAdapter.implementation=Ishort_To_Complex -DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/data_type_adapter.dat - -;######### INPUT_FILTER CONFIG ############ -InputFilter.implementation=Pass_Through - - -;######### RESAMPLER CONFIG ############ -Resampler.implementation=Pass_Through -Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat -Resampler.item_type=gr_complex - - -;######### CHANNELS GLOBAL CONFIG ############ -Channels_1B.count=4 -Channels.in_acquisition=1 -Channel.signal=1B - - -;######### ACQUISITION GLOBAL CONFIG ############ -Acquisition_1B.implementation=Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition -Acquisition_1B.item_type=gr_complex -Acquisition_1B.coherent_integration_time_ms=4 -Acquisition_1B.threshold=0.05 -Acquisition_1B.doppler_max=15000 -Acquisition_1B.doppler_step=125 -Acquisition_1B.coherent_integration_time_ms=8 -Acquisition_1B.cboc=false -Acquisition_1B.dump=false -Acquisition_1B.dump_filename=./acq_dump.dat - -;######### TRACKING GLOBAL CONFIG ############ -Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking -Tracking_1B.item_type=gr_complex -Tracking_1B.pll_bw_hz=20.0; -Tracking_1B.dll_bw_hz=2.0; -Tracking_1B.order=3; -Tracking_1B.early_late_space_chips=0.15; -Tracking_1B.very_early_late_space_chips=0.6; -Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ - -;######### TELEMETRY DECODER CONFIG ############ -TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder -TelemetryDecoder_1B.dump=false - -;######### OBSERVABLES CONFIG ############ -Observables.implementation=Hybrid_Observables -Observables.dump=false -Observables.dump_filename=./observables.dat - - -;######### PVT CONFIG ############ -PVT.implementation=RTKLIB_PVT -PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic -PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX -PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad -PVT.output_rate_ms=100; -PVT.display_rate_ms=500; -PVT.dump=false -PVT.dump_filename=./PVT -PVT.dump_filename=./PVT -PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; -PVT.flag_nmea_tty_port=true; -PVT.nmea_dump_devname=/dev/pts/4 -PVT.flag_rtcm_server=false; -PVT.flag_rtcm_tty_port=false; -PVT.rtcm_dump_devname=/dev/pts/1 +; This is a GNSS-SDR configuration file +; The configuration API is described at https://gnss-sdr.org/docs/sp-blocks/ +; SPDX-License-Identifier: GPL-3.0-or-later +; SPDX-FileCopyrightText: (C) 2010-2020 (see AUTHORS file for a list of contributors) + +; You can define your own receiver and invoke it by doing +; gnss-sdr --config_file=my_GNSS_SDR_configuration.conf +; + +[GNSS-SDR] + +;######### GLOBAL OPTIONS ################## +;internal_fs_sps: Internal signal sampling frequency after the signal conditioning stage [samples per second]. +GNSS-SDR.internal_fs_sps=4000000 + + +;######### SIGNAL_SOURCE CONFIG ############ +SignalSource.implementation=File_Signal_Source +SignalSource.filename=/datalogger/signals/CTTC/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN/2013_04_04_GNSS_SIGNAL_at_CTTC_SPAIN.dat ; <- PUT YOUR FILE HERE +SignalSource.item_type=ishort +SignalSource.sampling_frequency=4000000 +SignalSource.samples=0 +SignalSource.repeat=false +SignalSource.enable_throttle_control=false + + +;######### SIGNAL_CONDITIONER CONFIG ############ +SignalConditioner.implementation=Signal_Conditioner + +;######### DATA_TYPE_ADAPTER CONFIG ############ +DataTypeAdapter.implementation=Ishort_To_Complex +DataTypeAdapter.dump=false +DataTypeAdapter.dump_filename=./data_type_adapter.dat + +;######### INPUT_FILTER CONFIG ############ +InputFilter.implementation=Pass_Through + + +;######### RESAMPLER CONFIG ############ +Resampler.implementation=Pass_Through +Resampler.dump=false +Resampler.dump_filename=./resampler.dat +Resampler.item_type=gr_complex + + +;######### CHANNELS GLOBAL CONFIG ############ +Channels_1B.count=4 +Channels.in_acquisition=1 +Channel.signal=1B + + +;######### ACQUISITION GLOBAL CONFIG ############ +Acquisition_1B.implementation=Galileo_E1_PCPS_QuickSync_Ambiguous_Acquisition +Acquisition_1B.item_type=gr_complex +Acquisition_1B.coherent_integration_time_ms=4 +Acquisition_1B.threshold=0.05 +Acquisition_1B.doppler_max=15000 +Acquisition_1B.doppler_step=125 +Acquisition_1B.coherent_integration_time_ms=8 +Acquisition_1B.cboc=false +Acquisition_1B.dump=false +Acquisition_1B.dump_filename=./acq_dump.dat + +;######### TRACKING GLOBAL CONFIG ############ +Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking +Tracking_1B.item_type=gr_complex +Tracking_1B.pll_bw_hz=20.0; +Tracking_1B.dll_bw_hz=2.0; +Tracking_1B.order=3; +Tracking_1B.early_late_space_chips=0.15; +Tracking_1B.very_early_late_space_chips=0.6; +Tracking_1B.dump=false +Tracking_1B.dump_filename=./veml_tracking_ch_ + +;######### TELEMETRY DECODER CONFIG ############ +TelemetryDecoder_1B.implementation=Galileo_E1B_Telemetry_Decoder +TelemetryDecoder_1B.dump=false + +;######### OBSERVABLES CONFIG ############ +Observables.implementation=Hybrid_Observables +Observables.dump=false +Observables.dump_filename=./observables.dat + + +;######### PVT CONFIG ############ +PVT.implementation=RTKLIB_PVT +PVT.positioning_mode=PPP_Static ; options: Single, Static, Kinematic, PPP_Static, PPP_Kinematic +PVT.iono_model=Broadcast ; options: OFF, Broadcast, SBAS, Iono-Free-LC, Estimate_STEC, IONEX +PVT.trop_model=Saastamoinen ; options: OFF, Saastamoinen, SBAS, Estimate_ZTD, Estimate_ZTD_Grad +PVT.output_rate_ms=100; +PVT.display_rate_ms=500; +PVT.dump=false +PVT.dump_filename=./PVT +PVT.dump_filename=./PVT +PVT.nmea_dump_filename=./gnss_sdr_pvt.nmea; +PVT.flag_nmea_tty_port=true; +PVT.nmea_dump_devname=/dev/pts/4 +PVT.flag_rtcm_server=false; +PVT.flag_rtcm_tty_port=false; +PVT.rtcm_dump_devname=/dev/pts/1 diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf index 257bd9091..2a9fedb8d 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_ishort.conf @@ -41,7 +41,7 @@ Resampler.item_type=gr_complex Resampler.sample_freq_in=4000000 Resampler.sample_freq_out=4000000 Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ @@ -75,7 +75,7 @@ Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.track_pilot=true Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER CONFIG ############ diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf index 883927c8e..0b2dffd9b 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E1_nsr.conf @@ -25,7 +25,7 @@ SignalSource.sampling_frequency=20480000 SignalSource.samples=0 ; 0 means the entire file SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -62,7 +62,7 @@ InputFilter.sampling_frequency=20480000 InputFilter.IF=5499998.47412109 InputFilter.decimation_factor=8 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ @@ -96,7 +96,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER CONFIG ############ diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf index 9c2ea55cc..75dd5981a 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf @@ -35,7 +35,7 @@ SignalSource.sampling_frequency=50000000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -68,13 +68,13 @@ InputFilter.sampling_frequency=50000000 InputFilter.IF=-15345000 InputFilter.decimation_factor=1 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ diff --git a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf index a0715fba8..638a045d6 100644 --- a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf +++ b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_byte.conf @@ -81,7 +81,7 @@ Acquisition_1B.doppler_max=5000 Acquisition_1B.doppler_step=125 Acquisition_1B.bit_transition_flag=true Acquisition_1B.dump=false -Acquisition_1B.dump_filename=../data/acq_dump.dat +Acquisition_1B.dump_filename=./acq_dump.dat ;######### TRACKING GPS CONFIG ############ @@ -91,7 +91,7 @@ Tracking_1C.pll_bw_hz=30.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -109,7 +109,7 @@ Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.early_late_space_narrow_chips=0.06; Tracking_1B.very_early_late_space_narrow_chips=0.25; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf index 91387a875..cf17d5140 100644 --- a/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf +++ b/conf/File_input/Galileo/gnss-sdr_galileo_E1_extended_correlator_labsat.conf @@ -25,7 +25,7 @@ SignalSource.sampling_frequency=16368000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -39,7 +39,7 @@ DataTypeAdapter.item_type=gr_complex ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex @@ -110,7 +110,7 @@ Acquisition_1B.doppler_max=5000 Acquisition_1B.doppler_step=125 Acquisition_1B.bit_transition_flag=true Acquisition_1B.dump=false -Acquisition_1B.dump_filename=../data/acq_dump.dat +Acquisition_1B.dump_filename=./acq_dump.dat ;######### TRACKING GPS CONFIG ############ @@ -120,7 +120,7 @@ Tracking_1C.pll_bw_hz=40.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking @@ -137,7 +137,7 @@ Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.early_late_space_narrow_chips=0.15; Tracking_1B.very_early_late_space_narrow_chips=0.30; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf index 021b12ae8..12378e46f 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_CA_GPS_L1_CA_ibyte.conf @@ -11,7 +11,7 @@ GNSS-SDR.num_sources=2 ;######### SIGNAL_SOURCE CONFIG ############ SignalSource0.implementation=File_Signal_Source -SignalSource0.filename=../data/NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource0.filename=./NT1065_L1_20160923_fs6625e6_if60e3_schar.bin ; <- PUT YOUR FILE HERE SignalSource0.item_type=ibyte SignalSource0.sampling_frequency=6625000 SignalSource0.samples=0 @@ -19,7 +19,7 @@ SignalSource0.dump=false; SignalSource0.dump_filename=/archive/signal_glonass.bin SignalSource1.implementation=File_Signal_Source -SignalSource1.filename=../data/NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE +SignalSource1.filename=./NT1065_GLONASS_L1_20160923_fs6625e6_if0e3_schar.bin ; <- PUT YOUR FILE HERE SignalSource1.item_type=ibyte SignalSource1.sampling_frequency=6625000 SignalSource1.samples=0 diff --git a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf index 8f8baecfc..254196c30 100644 --- a/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf +++ b/conf/File_input/Glonass/gnss-sdr_GLONASS_L1_ibyte.conf @@ -23,7 +23,7 @@ SignalSource.repeat=false SignalSource.sample_type=iq SignalSource.seconds_to_skip=0 SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -69,7 +69,7 @@ Acquisition_1R.tong_max_dwells=20 Tracking_1R.implementation=GLONASS_L1_CA_DLL_PLL_C_Aid_Tracking Tracking_1R.item_type=cshort Tracking_1R.dump=false -Tracking_1R.dump_filename=../data/epl_tracking_ch_ +Tracking_1R.dump_filename=./epl_tracking_ch_ Tracking_1R.pll_bw_hz=40.0; Tracking_1R.dll_bw_hz=4.0; Tracking_1R.order=3; diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf index 3daee47ce..7e0df6bd2 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte.conf @@ -35,7 +35,7 @@ InputFilter.implementation=Pass_Through InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ @@ -44,7 +44,7 @@ Resampler.item_type=gr_complex Resampler.sample_freq_in=20000000 Resampler.sample_freq_out=20000000 Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ @@ -113,7 +113,7 @@ Tracking_1C.dll_bw_hz=2.0; Tracking_1C.dll_bw_narrow_hz=1.5; Tracking_1C.order=2; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -125,7 +125,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf index b92bdc4a9..1360f71bf 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_byte_sim.conf @@ -22,7 +22,7 @@ SignalSource.sampling_frequency=4000000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -32,12 +32,12 @@ SignalConditioner.implementation=Signal_Conditioner ;######### DATA_TYPE_ADAPTER CONFIG ############ DataTypeAdapter.implementation=Ibyte_To_Complex DataTypeAdapter.dump=false -DataTypeAdapter.dump_filename=../data/DataTypeAdapter.dat +DataTypeAdapter.dump_filename=./DataTypeAdapter.dat ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Pass_Through InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex @@ -106,14 +106,14 @@ Tracking_1C.order=3; Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking Tracking_1B.item_type=gr_complex Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ Tracking_1B.pll_bw_hz=15.0; Tracking_1B.dll_bw_hz=2.0; Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf index b375cec21..aa404633c 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_gr_complex.conf @@ -85,7 +85,7 @@ Tracking_1C.dll_bw_hz=2.0; Tracking_1C.dll_bw_narrow_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -98,7 +98,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf b/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf index 3931754e0..c9f0de8f5 100644 --- a/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf +++ b/conf/File_input/MultiCons/gnss-sdr_Hybrid_ishort.conf @@ -56,7 +56,7 @@ InputFilter.output_item_type=gr_complex Resampler.implementation=Pass_Through Resampler.item_type=gr_complex Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ @@ -111,7 +111,7 @@ Tracking_1C.pll_bw_hz=50.0; Tracking_1C.dll_bw_hz=5.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -123,7 +123,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf index a9ec9e564..ebff509e6 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf @@ -57,7 +57,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter_ch0.dat +InputFilter0.dump_filename=./input_filter_ch0.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -96,7 +96,7 @@ DataTypeAdapter1.item_type=gr_complex ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter_ch1.dat +InputFilter1.dump_filename=./input_filter_ch1.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex InputFilter1.taps_item_type=float @@ -135,7 +135,7 @@ DataTypeAdapter2.item_type=gr_complex ;######### INPUT_FILTER 2 CONFIG ############ InputFilter2.implementation=Freq_Xlating_Fir_Filter InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter_ch2.dat +InputFilter2.dump_filename=./input_filter_ch2.dat InputFilter2.input_item_type=gr_complex InputFilter2.output_item_type=gr_complex InputFilter2.taps_item_type=float @@ -294,7 +294,7 @@ Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.early_late_space_chips=0.5; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### GALILEO E1 TRK CONFIG ############ Tracking_1B.implementation=Galileo_E1_DLL_PLL_VEML_Tracking @@ -305,7 +305,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### GPS L2C GENERIC TRACKING CONFIG ############ diff --git a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf index 5838a3b88..04070f0b7 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_ishort.conf @@ -45,7 +45,7 @@ DataTypeAdapter0.implementation=Ishort_To_Complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Pass_Through InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex @@ -54,7 +54,7 @@ InputFilter0.output_item_type=gr_complex ;######### RESAMPLER 1 CONFIG ############ Resampler1.implementation=Pass_Through Resampler1.dump=false -Resampler1.dump_filename=../data/resampler.dat +Resampler1.dump_filename=./resampler.dat Resampler1.item_type=gr_complex Resampler1.sample_freq_in=4000000 Resampler1.sample_freq_out=4000000 @@ -73,7 +73,7 @@ InputFilter1.dump=false ;######### RESAMPLER 1 CONFIG ############ Resampler1.implementation=Pass_Through Resampler1.dump=false -Resampler1.dump_filename=../data/resampler.dat. +Resampler1.dump_filename=./resampler.dat. Resampler1.item_type=gr_complex Resampler1.sample_freq_in=4000000 Resampler1.sample_freq_out=4000000 @@ -126,7 +126,7 @@ Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=4.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -138,7 +138,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf index c5c5e9134..671dd346d 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multisource_Hybrid_nsr.conf @@ -48,7 +48,7 @@ DataTypeAdapter0.item_type=float ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Freq_Xlating_Fir_Filter InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=float InputFilter0.output_item_type=gr_complex InputFilter0.taps_item_type=float @@ -83,7 +83,7 @@ DataTypeAdapter1.item_type=float ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=float InputFilter1.output_item_type=gr_complex InputFilter1.taps_item_type=float @@ -184,7 +184,7 @@ Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -196,7 +196,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf index d0682aa30..0452136ec 100644 --- a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr.conf @@ -39,7 +39,7 @@ SignalSource.sampling_frequency=20480000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -53,7 +53,7 @@ DataTypeAdapter.item_type=float ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=float InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float @@ -80,7 +80,7 @@ InputFilter.decimation_factor=8 ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat Resampler.item_type=gr_complex @@ -120,7 +120,7 @@ Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### GPS L2C GENERIC TRACKING CONFIG ############ Tracking_2S.implementation=GPS_L2_M_DLL_PLL_Tracking @@ -130,7 +130,7 @@ Tracking_2S.dll_bw_hz=0.4; Tracking_2S.order=2; Tracking_2S.early_late_space_chips=0.5; Tracking_2S.dump=true -Tracking_2S.dump_filename=../data/epl_tracking_ch_ +Tracking_2S.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf index a127a5870..ef553d655 100644 --- a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf @@ -37,7 +37,7 @@ SignalSource.repeat=false ;#dump: Dump the Signal source data to a file. Disable this option in this version SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;#enable_throttle_control: Enabling this option tells the signal source to keep the delay between samples in post processing. @@ -72,7 +72,7 @@ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false ;#dump_filename: Log path and filename. -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. ;#These options are based on parameters of gnuradio's function: gr_remez. @@ -169,7 +169,7 @@ Tracking_1C.implementation=GPS_L1_CA_Gaussian_Tracking Tracking_1C.item_type=gr_complex Tracking_1C.if=0 Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ Tracking_1C.pll_bw_hz=15.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; diff --git a/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf b/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf index 91bbc1c69..8e2e10e7b 100644 --- a/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf +++ b/conf/Nsr_input/gnss-sdr_Hybrid_nsr.conf @@ -22,7 +22,7 @@ SignalSource.sampling_frequency=20480000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -56,7 +56,7 @@ InputFilter.sampling_frequency=20480000 InputFilter.IF=5499998.47412109 InputFilter.decimation_factor=8 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ @@ -129,7 +129,7 @@ Tracking_1C.dll_bw_hz=2.0; Tracking_1C.dll_bw_narrow_hz=1.5; Tracking_1C.order=2; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TRACKING GALILEO CONFIG ############ @@ -141,7 +141,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/Other/front-end-cal.conf b/conf/Other/front-end-cal.conf index 39510a009..2753abf6d 100644 --- a/conf/Other/front-end-cal.conf +++ b/conf/Other/front-end-cal.conf @@ -85,7 +85,7 @@ SignalSource.repeat=false ;#dump: Dump the Signal source data to a file. SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ ;## It holds blocks to change data type, filter and resample input data. @@ -102,7 +102,7 @@ DataTypeAdapter.implementation=Pass_Through ;#dump: Dump the filtered data to a file. DataTypeAdapter.dump=false ;#dump_filename: Log path and filename. -DataTypeAdapter.dump_filename=../data/data_type_adapter.dat +DataTypeAdapter.dump_filename=./data_type_adapter.dat ;######### INPUT_FILTER CONFIG ############ ;## Filter the input data. Can be combined with frequency translation for IF signals @@ -176,7 +176,7 @@ InputFilter.decimation_factor=1 InputFilter.dump=false ;#dump_filename: Log path and filename. -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ ;## Resamples the input data. diff --git a/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf b/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf index c1b99441b..f920c7cb6 100644 --- a/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf +++ b/conf/Other/gnss-sdr_GPS_L1_gr_complex_gpu.conf @@ -21,7 +21,7 @@ SignalSource.item_type=gr_complex SignalSource.samples=250000000 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -51,7 +51,7 @@ Acquisition_1C.dump_filename=./acq_dump.dat Tracking_1C.implementation=GPS_L1_CA_DLL_PLL_Tracking_GPU Tracking_1C.item_type=gr_complex Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; diff --git a/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf index 01209aefb..699640977 100644 --- a/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf +++ b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf @@ -54,7 +54,7 @@ SignalSource.sampling_frequency=20480000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -68,7 +68,7 @@ DataTypeAdapter.item_type=float ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=float InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float @@ -94,7 +94,7 @@ InputFilter.decimation_factor=8 ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat Resampler.item_type=gr_complex @@ -123,7 +123,7 @@ Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf b/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf index b0d592f84..94ab55c7c 100644 --- a/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf +++ b/conf/Other/gnss-sdr_GPS_L1_pulse_blanking_gr_complex.conf @@ -49,7 +49,7 @@ InputFilter.Pfa=0.001 InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### CHANNELS GLOBAL CONFIG ############ Channels_1C.count=8 @@ -80,7 +80,7 @@ Tracking_1C.dll_bw_narrow_hz=1.5; Tracking_1C.fll_bw_hz=2.0; Tracking_1C.order=3; Tracking_1C.dump=true -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf b/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf index 67c4d60e1..efef7d428 100644 --- a/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf +++ b/conf/Other/gnss-sdr_GPS_L1_two_bits_cpx.conf @@ -36,7 +36,7 @@ SignalSource.sampling_frequency=19200000 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_throttle_control=false @@ -70,13 +70,13 @@ InputFilter.sampling_frequency=19200000 InputFilter.IF=4024000 InputFilter.decimation_factor=6 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat Resampler.item_type=gr_complex diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf index 3fc5c22d2..1b057e4aa 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_2ch_fmcomms2_realtime.conf @@ -31,7 +31,7 @@ SignalSource.gain_rx2=64 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.enable_dds_lo=false SignalSource.freq_rf_tx_hz=1260000000 SignalSource.freq_dds_tx_hz=1000 diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf index f0ab33656..12c4bd0ee 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_X300_realtime.conf @@ -41,7 +41,7 @@ SignalSource.subdevice=A:0 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ @@ -73,7 +73,7 @@ InputFilter.grid_density=16 InputFilter.sampling_frequency=4000000 InputFilter.IF=0 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ @@ -82,7 +82,7 @@ Resampler.item_type=gr_complex Resampler.sample_freq_in=4000000 Resampler.sample_freq_out=4000000 Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf index 04afb9a6c..e75b568dc 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_USRP_realtime.conf @@ -40,7 +40,7 @@ SignalSource.subdevice=A:0 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf index e751730de..c2ec58cd6 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_bladeRF.conf @@ -53,7 +53,7 @@ InputFilter.band2_error=1.0 InputFilter.filter_type=bandpass InputFilter.grid_density=16 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf index df763f64e..deef32d6f 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_fmcomms2_realtime.conf @@ -41,7 +41,7 @@ SignalSource.gain_rx1=64 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ SignalConditioner.implementation=Signal_Conditioner @@ -52,7 +52,7 @@ DataTypeAdapter.implementation=Pass_Through ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf index 370931cca..000e2cb18 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_rtl_tcp_realtime.conf @@ -43,7 +43,7 @@ SignalSource.AGC_enabled = false SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat SignalSource.address=127.0.0.1 SignalSource.port=1234 SignalSource.swap_iq=false @@ -58,7 +58,7 @@ DataTypeAdapter.implementation=Pass_Through ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float diff --git a/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf index 8994bb3f3..149aa8b13 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L1_rtlsdr_realtime.conf @@ -44,7 +44,7 @@ SignalSource.AGC_enabled = false SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;# Please note that the new RTL-SDR Blog V3 dongles ship a < 1 PPM ;# temperature compensated oscillator (TCXO), which is well suited for GNSS @@ -68,7 +68,7 @@ DataTypeAdapter.implementation=Pass_Through ;######### INPUT_FILTER CONFIG ############ InputFilter.implementation=Freq_Xlating_Fir_Filter InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat InputFilter.input_item_type=gr_complex InputFilter.output_item_type=gr_complex InputFilter.taps_item_type=float diff --git a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf index cffb6f9b0..74e1fdbf0 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP1_realtime.conf @@ -39,7 +39,7 @@ SignalSource.subdevice=A:0 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ @@ -73,13 +73,13 @@ InputFilter.sampling_frequency=20000000 InputFilter.IF=-1600000 InputFilter.decimation_factor=1 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat Resampler.item_type=gr_complex Resampler.sample_freq_in=2000000 Resampler.sample_freq_out=2000000 diff --git a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf index a221b7169..9bf551da0 100644 --- a/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_GPS_L2C_USRP_X300_realtime.conf @@ -42,7 +42,7 @@ SignalSource.subdevice=A:0 SignalSource.samples=0 SignalSource.repeat=false SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ @@ -79,12 +79,12 @@ InputFilter.sampling_frequency=4000000 InputFilter.IF=0 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat Resampler.item_type=gr_complex Resampler.sample_freq_in=4000000 Resampler.sample_freq_out=4000000 diff --git a/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf index b49801d10..fe0ca55d2 100644 --- a/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_Galileo_E1_USRP_X300_realtime.conf @@ -27,7 +27,7 @@ SignalSource.gain=50 SignalSource.subdevice=A:0 SignalSource.samples=0 SignalSource.dump=false -SignalSource.dump_filename=../data/signal_source.dat +SignalSource.dump_filename=./signal_source.dat ;######### SIGNAL_CONDITIONER CONFIG ############ @@ -62,7 +62,7 @@ Tracking_1B.order=3; Tracking_1B.early_late_space_chips=0.15; Tracking_1B.very_early_late_space_chips=0.6; Tracking_1B.dump=false -Tracking_1B.dump_filename=../data/veml_tracking_ch_ +Tracking_1B.dump_filename=./veml_tracking_ch_ ;######### TELEMETRY DECODER CONFIG ############ diff --git a/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf index 0c53dedb1..6ed59bd79 100644 --- a/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_Glonass_L1_USRP_realtime.conf @@ -54,7 +54,7 @@ InputFilter0.tw=500000 InputFilter0.IF=-22902000 InputFilter0.sampling_frequency=56000000 InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat ;######### INPUT_FILTER CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter @@ -68,7 +68,7 @@ InputFilter1.tw=500000 InputFilter1.IF=-8580000 InputFilter1.sampling_frequency=56000000 InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat ;######### INPUT_FILTER CONFIG ############ InputFilter2.implementation=Freq_Xlating_Fir_Filter @@ -82,7 +82,7 @@ InputFilter2.tw=500000 InputFilter2.IF=18000000 InputFilter2.sampling_frequency=56000000 InputFilter2.dump=false -InputFilter2.dump_filename=../data/input_filter.dat +InputFilter2.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler0.implementation=Pass_Through diff --git a/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf index 0844dd1da..05ff16b75 100644 --- a/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_Galileo_Beidou_L1_hackrf_realtime.conf @@ -55,7 +55,7 @@ InputFilter0.tw=1000000 InputFilter0.IF=-6322000 InputFilter0.sampling_frequency=20000000 InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat ;######### INPUT_FILTER CONFIG ############ InputFilter1.implementation=Freq_Xlating_Fir_Filter @@ -70,7 +70,7 @@ InputFilter1.tw=1000000 InputFilter1.IF=8000000 InputFilter1.sampling_frequency=20000000 InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat diff --git a/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf b/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf index 61f18e09f..de70827ed 100644 --- a/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf +++ b/conf/RealTime_input/gnss-sdr_multichannel_GPS_L1_USRP_X300_realtime.conf @@ -59,7 +59,7 @@ DataTypeAdapter0.item_type=gr_complex ;######### INPUT_FILTER 0 CONFIG ############ InputFilter0.implementation=Pass_Through InputFilter0.dump=false -InputFilter0.dump_filename=../data/input_filter.dat +InputFilter0.dump_filename=./input_filter.dat InputFilter0.input_item_type=gr_complex InputFilter0.output_item_type=gr_complex @@ -74,7 +74,7 @@ SignalConditioner1.implementation=Pass_Through ;######### INPUT_FILTER 1 CONFIG ############ InputFilter1.implementation=Pass_Through InputFilter1.dump=false -InputFilter1.dump_filename=../data/input_filter.dat +InputFilter1.dump_filename=./input_filter.dat InputFilter1.input_item_type=gr_complex InputFilter1.output_item_type=gr_complex diff --git a/conf/gnss-sdr.conf b/conf/gnss-sdr.conf index 3f4b61766..16cb1e865 100644 --- a/conf/gnss-sdr.conf +++ b/conf/gnss-sdr.conf @@ -68,13 +68,13 @@ InputFilter.grid_density=16 InputFilter.sampling_frequency=4000000 InputFilter.IF=0 InputFilter.dump=false -InputFilter.dump_filename=../data/input_filter.dat +InputFilter.dump_filename=./input_filter.dat ;######### RESAMPLER CONFIG ############ Resampler.implementation=Pass_Through Resampler.dump=false -Resampler.dump_filename=../data/resampler.dat +Resampler.dump_filename=./resampler.dat ;######### CHANNELS GLOBAL CONFIG ############ @@ -113,7 +113,7 @@ Tracking_1C.pll_bw_hz=45.0; Tracking_1C.dll_bw_hz=3.0; Tracking_1C.order=3; Tracking_1C.dump=false -Tracking_1C.dump_filename=../data/epl_tracking_ch_ +Tracking_1C.dump_filename=./epl_tracking_ch_ ;######### TELEMETRY DECODER GPS CONFIG ############ diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index c0932fd6f..320421956 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -121,6 +121,8 @@ All notable changes to GNSS-SDR will be documented in this file. - The empty `build` and `data` folders have been removed. Users can create a building folder using `mkdir build` or by having CMake handle it: `cmake -S . -B build`. + - All default names for dump or input files starting with `../data/` + have been changed to `./`. See the definitions of concepts and metrics at https://gnss-sdr.org/design-forces/ diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index ab2f2606b..cdb5774ba 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -212,7 +212,7 @@ and we will be happy to upload it to the server. You can use a single configuration file for processing different data files, specifying the file to be processed with the --signal_source flag: \verbatim -$ gnss-sdr --config_file=../conf/my_receiver.conf --signal_source=../data/my_captured_data.dat +$ gnss-sdr --config_file=../conf/my_receiver.conf --signal_source=./my_captured_data.dat \endverbatim This will override the SignalSource.filename specified in the configuration file. diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 903a3748c..1efbcfe4d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -57,7 +57,7 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_filename("../data/acquisition.dat"); + const std::string default_dump_filename("./acquisition.dat"); item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 700644227..dab9dcc47 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -48,7 +48,7 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_filename("../data/acquisition.dat"); + const std::string default_dump_filename("./acquisition.dat"); item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index cafbcf33b..16a13e02d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -57,7 +57,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_filename("../data/acquisition.dat"); + const std::string default_dump_filename("./acquisition.dat"); item_type_ = configuration_->property(role + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index fca12dbfe..27a60b479 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -59,7 +59,7 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_filename("../data/acquisition.dat"); + const std::string default_dump_filename("./acquisition.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 5fcb2658c..153412bc0 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -66,7 +66,7 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( dump_(configuration_->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_filename("../data/acquisition.dat"); + const std::string default_dump_filename("./acquisition.dat"); item_type_ = configuration_->property(role_ + ".item_type", default_item_type); dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); 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 ed095a757..24d8eee4e 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 @@ -591,7 +591,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items std::stringstream filename; std::streamsize n = sizeof(float) * (d_fft_size); // noncomplex file write filename.str(""); - filename << "../data/test_statistics_E5a_sat_" + filename << "./test_statistics_E5a_sat_" << d_gnss_synchro->PRN << "_doppler_" << doppler << ".dat"; d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); if (d_sampled_ms > 1) // If integration time > 1 code @@ -694,7 +694,7 @@ int galileo_e5a_noncoherentIQ_acquisition_caf_cc::general_work(int noutput_items std::stringstream filename; std::streamsize n = sizeof(float) * (d_num_doppler_bins); // noncomplex file write filename.str(""); - filename << "../data/test_statistics_E5a_sat_" << d_gnss_synchro->PRN << "_CAF.dat"; + filename << "./test_statistics_E5a_sat_" << d_gnss_synchro->PRN << "_CAF.dat"; d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); d_dump_file.write(reinterpret_cast(d_CAF_vector.data()), n); d_dump_file.close(); 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 8bc915769..b5dc2b0ba 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 @@ -336,7 +336,7 @@ int galileo_pcps_8ms_acquisition_cc::general_work(int noutput_items, std::stringstream filename; std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << 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); 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 34eb3d189..91ce7b3d0 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -263,7 +263,7 @@ float pcps_assisted_acquisition_cc::search_maximum() std::stringstream filename; std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << d_gnss_synchro->Signal[0] << d_gnss_synchro->Signal[1] << "_sat_" << d_gnss_synchro->PRN << "_doppler_" << d_gnss_synchro->Acq_doppler_hz << ".dat"; d_dump_file.open(filename.str().c_str(), std::ios::out | std::ios::binary); 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 ed4ed9ddb..3ad78883c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -352,7 +352,7 @@ int pcps_cccwsr_acquisition_cc::general_work(int noutput_items, std::stringstream filename; std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << 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); 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 5f2fa348c..fbd1b2052 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -429,7 +429,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk() std::stringstream filename; std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << 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); @@ -590,7 +590,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl() std::stringstream filename; std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << 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); 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 fdd6d918a..d54b8085a 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -436,7 +436,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, std::stringstream filename; std::streamsize n = sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << 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); 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 42c131337..75f8325d5 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -342,7 +342,7 @@ int pcps_tong_acquisition_cc::general_work(int noutput_items, std::stringstream filename; std::streamsize n = 2 * sizeof(float) * (d_fft_size); // complex file write filename.str(""); - filename << "../data/test_statistics_" << d_gnss_synchro->System + filename << "./test_statistics_" << d_gnss_synchro->System << "_" << 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); diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index afb062772..b853cebc1 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -35,7 +35,7 @@ ByteToShort::ByteToShort(const ConfigurationInterface* configuration, { const std::string default_input_item_type("byte"); const std::string default_output_item_type("short"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./input_filter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc index 7eb94a519..ad63835ce 100644 --- a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc +++ b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc @@ -32,7 +32,7 @@ CshortToGrComplex::CshortToGrComplex(const ConfigurationInterface* configuration out_streams_(out_streams), dump_(configuration->property(role_ + ".dump", false)) { - const std::string default_dump_filename("../data/data_type_adapter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index 835ec2021..a675a57d5 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -37,7 +37,7 @@ IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, { const std::string default_input_item_type("byte"); const std::string default_output_item_type("lv_8sc_t"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index a79458e5b..7df423095 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -34,7 +34,7 @@ IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, cons { const std::string default_input_item_type("byte"); const std::string default_output_item_type("gr_complex"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index 2420bcd0f..94dbd8afe 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -36,7 +36,7 @@ IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, { const std::string default_input_item_type("byte"); const std::string default_output_item_type("cshort"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 18d8df571..9a86a2a2f 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -34,7 +34,7 @@ IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, { const std::string default_input_item_type("short"); const std::string default_output_item_type("gr_complex"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index 80e1c680a..9f5f546ca 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -36,7 +36,7 @@ IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, { const std::string default_input_item_type("short"); const std::string default_output_item_type("cshort"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index 12cef24ca..92c84645a 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -142,7 +142,7 @@ void FirFilter::init() const std::string default_input_item_type("gr_complex"); const std::string default_output_item_type("gr_complex"); const std::string default_taps_item_type("float"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./input_filter.dat"); const std::string default_filter_type("bandpass"); const std::vector default_bands = {0.0, 0.4, 0.6, 1.0}; const std::vector default_ampl = {1.0, 1.0, 0.0, 0.0}; diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index 1378931c8..ba75c6f67 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -41,7 +41,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu const std::string default_input_item_type("gr_complex"); const std::string default_output_item_type("gr_complex"); const std::string default_taps_item_type("float"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./input_filter.dat"); const double default_intermediate_freq = 0.0; const double default_sampling_freq = 4000000.0; const int default_number_of_taps = 6; diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 8971d2c9d..8732ba4f8 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -39,7 +39,7 @@ PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configura out_streams_(out_streams) { const std::string default_item_type("gr_complex"); - const std::string default_dump_filename("../data/input_filter.dat"); + const std::string default_dump_filename("./input_filter.dat"); const float default_pfa_ = 0.04; const float pfa = configuration->property(role_ + ".pfa", default_pfa_); const int default_length_ = 32; diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index c4f0fd08b..1064166db 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -35,7 +35,7 @@ FifoSignalSource::FifoSignalSource(ConfigurationInterface const* configuration, [[maybe_unused]] Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "Fifo_Signal_Source"s), item_size_(sizeof(gr_complex)), // currenty output item size is always gr_complex - fifo_reader_(FifoReader::make(configuration->property(role + ".filename", "../data/example_capture.dat"s), + fifo_reader_(FifoReader::make(configuration->property(role + ".filename", "./example_capture.dat"s), configuration->property(role + ".sample_type", "ishort"s))), dump_(configuration->property(role + ".dump", false)), dump_filename_(configuration->property(role + ".dump_filename", "./data/signal_source.dat"s)) diff --git a/src/algorithms/signal_source/adapters/file_source_base.cc b/src/algorithms/signal_source/adapters/file_source_base.cc index 7b9efcbc2..aabef306b 100644 --- a/src/algorithms/signal_source/adapters/file_source_base.cc +++ b/src/algorithms/signal_source/adapters/file_source_base.cc @@ -48,8 +48,8 @@ FileSourceBase::FileSourceBase(ConfigurationInterface const* configuration, std: : SignalSourceBase(configuration, role, std::move(impl)), queue_(queue), role_(role), - filename_(configuration->property(role_ + ".filename"s, "../data/example_capture.dat"s)), - dump_filename_(configuration->property(role_ + ".dump_filename"s, "../data/my_capture.dat"s)), + filename_(configuration->property(role_ + ".filename"s, "./example_capture.dat"s)), + dump_filename_(configuration->property(role_ + ".dump_filename"s, "./my_capture.dat"s)), item_type_(configuration->property(role_ + ".item_type"s, std::move(default_item_type))), item_size_(0), header_size_(configuration->property(role_ + ".header_size"s, uint64_t(0))), diff --git a/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc b/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc index 92788ee02..0286c6ea3 100644 --- a/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/file_timestamp_signal_source.cc @@ -34,7 +34,7 @@ FileTimestampSignalSource::FileTimestampSignalSource(const ConfigurationInterfac unsigned int out_streams, Concurrent_Queue* queue) : FileSourceBase(configuration, role, "File_Timestamp_Signal_Source"s, queue, "byte"s), - timestamp_file_(configuration->property(role + ".timestamp_filename"s, "../data/example_capture_timestamp.dat"s)), + timestamp_file_(configuration->property(role + ".timestamp_filename"s, "./example_capture_timestamp.dat"s)), timestamp_clock_offset_ms_(configuration->property(role + ".timestamp_clock_offset_ms"s, 0.0)) { if (in_streams > 0) diff --git a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc index 00f2be229..c92c35433 100644 --- a/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc +++ b/src/algorithms/signal_source/adapters/ion_gsms_signal_source.cc @@ -61,7 +61,7 @@ IONGSMSSignalSource::IONGSMSSignalSource(const ConfigurationInterface* configura Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "ION_GSMS_Signal_Source"s), stream_ids_(parse_comma_list(configuration->property(role + ".streams"s, ""s))), - metadata_filepath_(configuration->property(role + ".metadata_filename"s, "../data/example_capture_metadata.sdrx"s)), + metadata_filepath_(configuration->property(role + ".metadata_filename"s, "./example_capture_metadata.sdrx"s)), in_streams_(in_streams), out_streams_(out_streams) { 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 a9b503c14..1b29d773e 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 @@ -54,8 +54,8 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInte enable_throttle_control_(configuration->property(role + ".enable_throttle_control", false)), endian_swap_(configuration->property(role + ".endian", false)) { - const std::string default_filename("../data/my_capture.dat"); - const std::string default_dump_filename("../data/my_capture_dump.dat"); + const std::string default_filename("./my_capture.dat"); + const std::string default_dump_filename("./my_capture_dump.dat"); filename_ = configuration->property(role + ".filename", default_filename); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 0a893e41c..ad56e7403 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -882,7 +882,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul { std::stringstream filenamepd; filenamepd.str(""); - filenamepd << "../data/test_statistics_" << gnss_synchro.System + filenamepd << "./test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" #if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv"; @@ -908,7 +908,7 @@ TEST_F(GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test, ValidationOfResul { std::stringstream filenamepf; filenamepf.str(""); - filenamepf << "../data/test_statistics_" << gnss_synchro.System + filenamepf << "./test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" #if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_e1_value_CN0_dB_0 << "_dBHz.csv"; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index 33d60383e..ae1224f8f 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -243,7 +243,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1() config->set_property("SignalSource.BW_BB", "0.97"); config->set_property("SignalSource.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/signal_source.dat"); + config->set_property("SignalSource.dump_filename", "./signal_source.dat"); config->set_property("InputFilter.implementation", "Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); @@ -277,7 +277,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_1() config->set_property("Acquisition_5X.doppler_step", "250"); config->set_property("Acquisition_5X.bit_transition_flag", "false"); config->set_property("Acquisition_5X.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/acquisition.dat"); + config->set_property("SignalSource.dump_filename", "./acquisition.dat"); } @@ -313,7 +313,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_2() config->set_property("Acquisition_5X.doppler_step", "250"); config->set_property("Acquisition_5X.bit_transition_flag", "false"); config->set_property("Acquisition_5X.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/acquisition.dat"); + config->set_property("SignalSource.dump_filename", "./acquisition.dat"); } @@ -393,7 +393,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3() config->set_property("SignalSource.BW_BB", "0.97"); config->set_property("SignalSource.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/signal_source.dat"); + config->set_property("SignalSource.dump_filename", "./signal_source.dat"); config->set_property("InputFilter.implementation", "Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); @@ -424,7 +424,7 @@ void GalileoE5aPcpsAcquisitionGSoC2014GensourceTest::config_3() config->set_property("Acquisition_5X.doppler_step", "250"); config->set_property("Acquisition_5X.bit_transition_flag", "false"); config->set_property("Acquisition_5X.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/acquisition.dat"); + config->set_property("SignalSource.dump_filename", "./acquisition.dat"); } diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc index c74b99d29..4ac65eeb8 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc @@ -200,7 +200,7 @@ void GalileoE5bPcpsAcquisitionTest::init() config->set_property("SignalSource.data_flag", "false"); config->set_property("SignalSource.BW_BB", "0.97"); config->set_property("SignalSource.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/signal_source.dat"); + config->set_property("SignalSource.dump_filename", "./signal_source.dat"); config->set_property("InputFilter.implementation", "Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc index 497ced58f..07bc29ca1 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc @@ -200,7 +200,7 @@ void GalileoE6PcpsAcquisitionTest::init() config->set_property("SignalSource.data_flag", "false"); config->set_property("SignalSource.BW_BB", "0.97"); config->set_property("SignalSource.dump", "false"); - config->set_property("SignalSource.dump_filename", "../data/signal_source.dat"); + config->set_property("SignalSource.dump_filename", "./signal_source.dat"); config->set_property("InputFilter.implementation", "Fir_Filter"); config->set_property("InputFilter.input_item_type", "gr_complex"); config->set_property("InputFilter.output_item_type", "gr_complex"); diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index 1dce2a6f8..e2fd892a4 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -849,7 +849,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili { std::stringstream filenamepd; filenamepd.str(""); - filenamepd << "../data/test_statistics_" << gnss_synchro.System + filenamepd << "./test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" #if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv"; @@ -876,7 +876,7 @@ TEST_F(GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test, ValidationOfResultsProbabili { std::stringstream filenamepf; filenamepf.str(""); - filenamepf << "../data/test_statistics_" << gnss_synchro.System + filenamepf << "./test_statistics_" << gnss_synchro.System << "_" << gnss_synchro.Signal << "_sat_" #if USE_GLOG_AND_GFLAGS << gnss_synchro.PRN << "CN0_dB_0_" << FLAGS_value_CN0_dB_0 << "_dBHz.csv"; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc index b5b92999b..bd4e74d7e 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc @@ -72,7 +72,7 @@ void GalileoE1DllPllVemlTrackingInternalTest::init() config->set_property("Tracking_1B.implementation", "Galileo_E1_DLL_PLL_VEML_Tracking"); config->set_property("Tracking_1B.item_type", "gr_complex"); config->set_property("Tracking_1B.dump", "false"); - config->set_property("Tracking_1B.dump_filename", "../data/veml_tracking_ch_"); + config->set_property("Tracking_1B.dump_filename", "./veml_tracking_ch_"); config->set_property("Tracking_1B.early_late_space_chips", "0.15"); config->set_property("Tracking_1B.very_early_late_space_chips", "0.6"); config->set_property("Tracking_1B.pll_bw_hz", "30.0"); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc index 9d17f703a..f13a498bd 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc @@ -78,7 +78,7 @@ void GalileoE5aTrackingTest::init() config->set_property("Tracking_5X.implementation", "Galileo_E5a_DLL_PLL_Tracking"); config->set_property("Tracking_5X.item_type", "gr_complex"); config->set_property("Tracking_5X.dump", "false"); - config->set_property("Tracking_5X.dump_filename", "../data/e5a_tracking_ch_"); + config->set_property("Tracking_5X.dump_filename", "./e5a_tracking_ch_"); config->set_property("Tracking_5X.early_late_space_chips", "0.5"); config->set_property("Tracking_5X.order", "2"); config->set_property("Tracking_5X.pll_bw_hz", "20.0"); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc index 4e69dae2a..8536ece4f 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/galileo_e5b_dll_pll_tracking_test.cc @@ -79,7 +79,7 @@ void GalileoE5bTrackingTest::init() config->set_property("Tracking_7X.implementation", "Galileo_E5b_DLL_PLL_Tracking"); config->set_property("Tracking_7X.item_type", "gr_complex"); config->set_property("Tracking_7X.dump", "false"); - config->set_property("Tracking_7X.dump_filename", "../data/e5b_tracking"); + config->set_property("Tracking_7X.dump_filename", "./e5b_tracking"); config->set_property("Tracking_7X.early_late_space_chips", "0.5"); config->set_property("Tracking_7X.order", "2"); config->set_property("Tracking_7X.pll_bw_hz", "20.0"); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index 43c32314a..995ce58dd 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -144,7 +144,7 @@ void GpsL2MDllPllTrackingTest::init() config->set_property("GNSS-SDR.internal_fs_sps", "5000000"); config->set_property("Tracking_2S.item_type", "gr_complex"); config->set_property("Tracking_2S.dump", "false"); - config->set_property("Tracking_2S.dump_filename", "../data/L2m_tracking_ch_"); + config->set_property("Tracking_2S.dump_filename", "./L2m_tracking_ch_"); config->set_property("Tracking_2S.implementation", "GPS_L2_M_DLL_PLL_Tracking"); config->set_property("Tracking_2S.early_late_space_chips", "0.5"); config->set_property("Tracking_2S.order", "2"); diff --git a/tests/unit-tests/system-parameters/has_decoding_test.cc b/tests/unit-tests/system-parameters/has_decoding_test.cc index 5dc12536f..a93b07da2 100644 --- a/tests/unit-tests/system-parameters/has_decoding_test.cc +++ b/tests/unit-tests/system-parameters/has_decoding_test.cc @@ -33,7 +33,7 @@ // Usage: // ./run_tests --gtest_filter=HAS_Test.Decoder -// ./run_tests --gtest_filter=HAS_Test.Decoder --has_data_test_file=../data/HAS_Messages_sample/encoded/Sample_HAS_Pages_Encoded_20210713_08.txt --start_page_test_file=70 +// ./run_tests --gtest_filter=HAS_Test.Decoder --has_data_test_file=./HAS_Messages_sample/encoded/Sample_HAS_Pages_Encoded_20210713_08.txt --start_page_test_file=70 #if USE_GLOG_AND_GFLAGS DEFINE_string(has_data_test_file, std::string(""), "File containing encoded HAS pages (format: [time sat_id HAS_page_in_hex] in each line)"); From 15e052030b17664d138771d9e83bafb2824e218f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 5 Oct 2024 09:00:03 +0200 Subject: [PATCH 413/499] Remove tests leftovers --- ...leo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc | 2 +- .../acquisition/galileo_e5b_pcps_acquisition_test.cc | 2 +- .../acquisition/galileo_e6_pcps_acquisition_test.cc | 2 +- .../gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index ad56e7403..7614c7dfd 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -306,7 +306,7 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test::config_2() /*Unset this flag to eliminates data logging for the Validation of results probabilities test*/ - dump_test_results = true; + dump_test_results = false; num_of_realizations = 100; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc index 4ac65eeb8..34f0c1de0 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc @@ -222,7 +222,7 @@ void GalileoE5bPcpsAcquisitionTest::init() config->set_property("Acquisition_7X.implementation", "Galileo_E5b_PCPS_Acquisition"); config->set_property("Acquisition_7X.item_type", "gr_complex"); config->set_property("Acquisition_7X.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition_7X.dump", "true"); + config->set_property("Acquisition_7X.dump", "false"); config->set_property("Acquisition_7X.dump_filename", "./acquisition"); config->set_property("Acquisition_7X.threshold", "0.001"); config->set_property("Acquisition_7X.doppler_max", "10000"); diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc index 07bc29ca1..8f433b5d2 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc @@ -222,7 +222,7 @@ void GalileoE6PcpsAcquisitionTest::init() config->set_property("Acquisition_E6.implementation", "Galileo_E6_PCPS_Acquisition"); config->set_property("Acquisition_E6.item_type", "gr_complex"); config->set_property("Acquisition_E6.coherent_integration_time_ms", std::to_string(integration_time_ms)); - config->set_property("Acquisition_E6.dump", "true"); + config->set_property("Acquisition_E6.dump", "false"); config->set_property("Acquisition_E6.dump_filename", "./acquisition"); config->set_property("Acquisition_E6.pfa", "0.01"); config->set_property("Acquisition_E6.doppler_max", "10000"); diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index e2fd892a4..d3d12b6a1 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -396,7 +396,7 @@ void GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test::config_3() /*Unset this flag to eliminates data logging for the Validation of results probabilities test*/ - dump_test_results = true; + dump_test_results = false; num_of_realizations = 1; From 5108f0aa60ac654cf2d20fc1780ca73f606d4336 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 6 Oct 2024 07:52:26 +0200 Subject: [PATCH 414/499] Avoid building failure if the user forgot -DENABLE_FPGA=ON when it was required --- CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c933e908..7535b5c2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3268,10 +3268,15 @@ if(ENABLE_AD9361 OR ENABLE_FMCOMMS2 OR ENABLE_PLUTOSDR) else() message(FATAL_ERROR "libiio is required for building gnss-sdr with -DENABLE_AD9361=ON.") endif() + else() + if(ENABLE_AD9361) + set(ENABLE_FPGA ON) + endif() endif() endif() + ################################################################################ # ION GNSS-SDR Metadata Standard https://sdr.ion.org/ (OPTIONAL) ################################################################################ @@ -3327,6 +3332,7 @@ if(ENABLE_ION) endif() + ##################################################################### # Check signal sources related to FPGA only. ##################################################################### @@ -3368,6 +3374,7 @@ if(ENABLE_MAX2771) file(GLOB_RECURSE SPIDEV_FILE "${TARGET_ROOTFS_PATH}/*/spidev.h") if(EXISTS "${SPIDEV_FILE}") message(STATUS "SPIdev driver found: ${SPIDEV_FILE}") + set(ENABLE_FPGA ON) else() message(STATUS "SPIdev driver not found, its installation is required.") if(ENABLE_PACKAGING) @@ -3399,6 +3406,7 @@ if(ENABLE_DMA_PROXY) file(GLOB_RECURSE DMA_PROXY_FILE "${TARGET_ROOTFS_PATH}/*/dma-proxy.ko") if(EXISTS "${DMA_PROXY_FILE}") message(STATUS "Found dma-proxy.ko file: ${DMA_PROXY_FILE}") + set(ENABLE_FPGA ON) else() if(ENABLE_PACKAGING) set(ENABLE_DMA_PROXY OFF) From 0a0154e1af08b35349e4cfd4da8c77e3d7099222 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 6 Oct 2024 08:14:46 +0200 Subject: [PATCH 415/499] Fix warnings when building benchmarks --- tests/benchmarks/CMakeLists.txt | 2 +- tests/benchmarks/benchmark_detector.cc | 30 +++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt index 31ebf9f82..7d94d9e9b 100644 --- a/tests/benchmarks/CMakeLists.txt +++ b/tests/benchmarks/CMakeLists.txt @@ -112,7 +112,7 @@ endif() add_benchmark(benchmark_atan2 Gnuradio::runtime) add_benchmark(benchmark_copy) add_benchmark(benchmark_crypto core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) -add_benchmark(benchmark_osnma core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) +# add_benchmark(benchmark_osnma core_libs Boost::headers ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_detector core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_preamble core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) add_benchmark(benchmark_reed_solomon core_system_parameters ${EXTRA_BENCHMARK_DEPENDENCIES}) diff --git a/tests/benchmarks/benchmark_detector.cc b/tests/benchmarks/benchmark_detector.cc index 5679e9c3b..61da0f70c 100644 --- a/tests/benchmarks/benchmark_detector.cc +++ b/tests/benchmarks/benchmark_detector.cc @@ -42,9 +42,9 @@ void bm_forloop(benchmark::State& state) std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); + int32_t corr_value = 0; while (state.KeepRunning()) { - int32_t corr_value = 0; for (size_t i = 0; i < d_preamble_samples.size(); i++) { if (d_symbol_history[i] < 0.0) @@ -57,6 +57,10 @@ void bm_forloop(benchmark::State& state) } } } + if (corr_value) + { + // avoidl warning + }; } @@ -73,14 +77,18 @@ void bm_accumulate(benchmark::State& state) std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); + int32_t corr_value = 0; while (state.KeepRunning()) { - int32_t corr_value = 0; corr_value += std::accumulate(d_symbol_history.begin(), d_symbol_history.end(), 0, [&d_preamble_samples, n = 0](float a, float b) mutable { return (b > 0.0 ? a + d_preamble_samples[n++] : a - d_preamble_samples[n++]); }); } + if (corr_value) + { + // avoidl warning + }; } @@ -97,9 +105,9 @@ void bm_inner_product(benchmark::State& state) std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); + int32_t corr_value = 0; while (state.KeepRunning()) { - int32_t corr_value = 0; corr_value += std::inner_product(d_symbol_history.begin(), d_symbol_history.end(), d_preamble_samples.begin(), @@ -111,6 +119,10 @@ void bm_inner_product(benchmark::State& state) #endif [](float a, int32_t b) { return (std::signbit(a) ? -b : b); }); } + if (corr_value) + { + // avoidl warning + }; } @@ -128,9 +140,9 @@ void bm_transform_reduce(benchmark::State& state) std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); + int32_t corr_value = 0; while (state.KeepRunning()) { - int32_t corr_value = 0; corr_value += std::transform_reduce(d_symbol_history.begin(), d_symbol_history.end(), d_preamble_samples.begin(), @@ -138,6 +150,10 @@ void bm_transform_reduce(benchmark::State& state) std::plus<>(), [](auto a, auto b) { return (std::signbit(a) ? -b : b); }); } + if (corr_value) + { + // avoidl warning + }; } #endif @@ -156,9 +172,9 @@ void bm_transform_reduce_policy(benchmark::State& state) std::generate(d_preamble_samples.begin(), d_preamble_samples.end(), [n = 0]() mutable { return (GPS_CA_PREAMBLE_SYMBOLS_STR[n++] == '1' ? 1 : -1); }); + int32_t corr_value = 0; while (state.KeepRunning()) { - int32_t corr_value = 0; corr_value += std::transform_reduce( std::execution::par, d_symbol_history.begin(), @@ -168,6 +184,10 @@ void bm_transform_reduce_policy(benchmark::State& state) std::plus<>(), [](auto a, auto b) { return (std::signbit(a) ? -b : b); }); } + if (corr_value) + { + // avoidl warning + }; } #endif From a5c792f689c88a40dfaf0541c7358db6e9868aa8 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 7 Oct 2024 15:05:32 +0200 Subject: [PATCH 416/499] Workaround for Clang 18 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7535b5c2a..b5bd2ee95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1493,6 +1493,12 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.24 endif() endif() +# Workaround for Clang 18 +if(absl_FOUND AND absl_VERSION AND ("${absl_VERSION}" VERSION_LESS "20240722")) + if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.99")) + add_compile_options(-fclang-abi-compat=17) + endif() +endif() if(NOT absl_FOUND) set(ENABLE_GLOG_AND_GFLAGS ON) From 4c07b71c37008b11a74b3fc302757abd832d2eb3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 7 Oct 2024 17:40:16 +0200 Subject: [PATCH 417/499] Storage-class specifier should be at the beginning of the declaration --- src/core/system_parameters/osnma_data.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/system_parameters/osnma_data.h b/src/core/system_parameters/osnma_data.h index 7e6d03b42..c071c1994 100644 --- a/src/core/system_parameters/osnma_data.h +++ b/src/core/system_parameters/osnma_data.h @@ -229,7 +229,7 @@ public: { } const uint32_t tag_id; - uint32_t static id_counter; + static uint32_t id_counter; uint32_t TOW; uint32_t WN; uint32_t PRNa; From 506d2eefe18a9504a5b1cfd0e4586b799c6adf0b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 7 Oct 2024 17:58:37 +0200 Subject: [PATCH 418/499] Fix for cpplint 2.0 --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ddb7cbc68..0237db215 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -167,8 +167,8 @@ jobs: run: sudo apt-get install python3-pip && sudo pip3 install cpplint - name: run checks run: "find ./src/ ./utils ./tests -iname *.h -o -iname *.cc | xargs cpplint - --filter=-,+build/class,+build/c++14,+build/deprecated,+build/explicit_make_pair,\ - +build/include_what_you_use,+build/printf_format,+build/storage_class,\ + --filter=-,+build/class,+build/c++17,+build/deprecated,+build/explicit_make_pair,\ + +build/printf_format,+build/storage_class,\ +readability/constructors,+readability/namespace,+readability/newline,\ +readability/utf8,+runtime/casting,+runtime/explicit,\ +runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,\ From ef4bf2cf4f5c44b462ec343bee667850dd56e45d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 7 Oct 2024 18:59:55 +0200 Subject: [PATCH 419/499] Fix for cpplint 2.0 --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0237db215..a581109c9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -167,8 +167,8 @@ jobs: run: sudo apt-get install python3-pip && sudo pip3 install cpplint - name: run checks run: "find ./src/ ./utils ./tests -iname *.h -o -iname *.cc | xargs cpplint - --filter=-,+build/class,+build/c++17,+build/deprecated,+build/explicit_make_pair,\ - +build/printf_format,+build/storage_class,\ + --filter=-,+build/class,+build/deprecated,+build/explicit_make_pair,\ + +build/forward_decl,+build/printf_format,+build/storage_class,\ +readability/constructors,+readability/namespace,+readability/newline,\ +readability/utf8,+runtime/casting,+runtime/explicit,\ +runtime/indentation_namespace,+runtime/init,+runtime/invalid_increment,\ From 601b2ee6f2c4e107470cd38abc11ed069ea583b4 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 10 Oct 2024 11:42:19 +0200 Subject: [PATCH 420/499] Make zero padding optional in acquisition when using the FPGA --- .../galileo_e1_pcps_ambiguous_acquisition_fpga.cc | 13 +++++-------- .../adapters/galileo_e5a_pcps_acquisition_fpga.cc | 12 +++++------- .../adapters/galileo_e5b_pcps_acquisition_fpga.cc | 12 +++++------- .../adapters/gps_l1_ca_pcps_acquisition_fpga.cc | 12 +++++------- .../adapters/gps_l2_m_pcps_acquisition_fpga.cc | 11 ++++++++--- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 13 ++++++------- src/algorithms/acquisition/libs/acq_conf_fpga.cc | 6 ++++-- src/algorithms/acquisition/libs/acq_conf_fpga.h | 1 + 8 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 900e7ac91..1610bb3c5 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -81,7 +81,6 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( int32_t tmp2; int32_t local_code; int32_t fft_data; - for (uint32_t PRN = 1; PRN <= GALILEO_E1_NUMBER_OF_CODES; PRN++) { bool cboc = false; // cboc is set to 0 when using the FPGA @@ -100,16 +99,14 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( cboc, PRN, fs_in_, 0, false); } - for (uint32_t s = code_length; s < 2 * code_length; s++) + if (acq_parameters_.enable_zero_padding) { - code[s] = code[s - code_length]; + // Duplicate the code sequence + std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); } - // fill in zero padding - for (uint32_t s = 2 * code_length; s < nsamples_total; s++) - { - code[s] = std::complex(0.0, 0.0); - } + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer fft_if->execute(); // Run the FFT of local code diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 98e8bcf3c..0fa8a554a 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -107,16 +107,14 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0); - for (uint32_t s = code_length; s < 2 * code_length; s++) + if (acq_parameters_.enable_zero_padding) { - code[s] = code[s - code_length]; + // Duplicate the code sequence + std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); } - // fill in zero padding - for (uint32_t s = 2 * code_length; s < nsamples_total; s++) - { - code[s] = std::complex(0.0, 0.0); - } + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer fft_if->execute(); // Run the FFT of local code diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index f7a303f2d..295ba4f23 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -106,16 +106,14 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0); - for (uint32_t s = code_length; s < 2 * code_length; s++) + if (acq_parameters_.enable_zero_padding) { - code[s] = code[s - code_length]; + // Duplicate the code sequence + std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); } - // fill in zero padding - for (uint32_t s = 2 * code_length; s < nsamples_total; s++) - { - code[s] = std::complex(0.0, 0.0); - } + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer fft_if->execute(); // Run the FFT of local code diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 0242062b0..892f2de6a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -87,16 +87,14 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( { gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in_, 0); // generate PRN code - for (uint32_t s = code_length; s < 2 * code_length; s++) + if (acq_parameters_.enable_zero_padding) { - code[s] = code[s - code_length]; + // Duplicate the code sequence + std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); } - // fill in zero padding - for (uint32_t s = 2 * code_length; s < nsamples_total; s++) - { - code[s] = std::complex(0.0, 0.0); - } + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer fft_if->execute(); // Run the FFT of local code diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index e78b1b174..5d7662c59 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -87,11 +87,16 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) { gps_l2c_m_code_gen_complex_sampled(code, PRN, fs_in_); - // fill in zero padding - for (unsigned int s = code_length; s < nsamples_total; s++) + + if (acq_parameters_.enable_zero_padding) { - code[s] = std::complex(0.0, 0.0); + // Duplicate the code sequence + std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); } + + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer fft_if->execute(); // Run the FFT of local code volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 0e379d034..924034987 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -88,16 +88,15 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( { gps_l5i_code_gen_complex_sampled(code, PRN, fs_in_); - for (uint32_t s = code_length; s < 2 * code_length; s++) + if (acq_parameters_.enable_zero_padding) { - code[s] = code[s - code_length]; + // Duplicate the code sequence + std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); } - for (uint32_t s = 2 * code_length; s < nsamples_total; s++) - { - // fill in zero padding - code[s] = std::complex(0.0, 0.0); - } + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer fft_if->execute(); // Run the FFT of local code volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc index 00e47b153..79f02b477 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.cc +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -46,9 +46,11 @@ void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configura // code length in samples code_length = static_cast(std::round(static_cast(fs_in) / (chip_rate / code_length_chips))); + enable_zero_padding = configuration->property(role + ".enable_zero_padding", true); + // The FPGA can only use FFT lengths that are a power of two. - float nbits = ceilf(log2f(static_cast(code_length) * 2.0F)); - samples_per_code = pow(2, nbits); + float factor = enable_zero_padding ? 2.0F : 1.0F; + samples_per_code = pow(2, ceilf(log2f(static_cast(code_length) * factor))); // repeat satellite repeat_satellite = configuration->property(role + ".repeat_satellite", false); diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.h b/src/algorithms/acquisition/libs/acq_conf_fpga.h index 11a2c7856..fd20ad953 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.h +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.h @@ -57,6 +57,7 @@ public: uint32_t samples_per_code{1U}; uint32_t code_length{16000U}; bool make_2_steps{false}; + bool enable_zero_padding{true}; bool repeat_satellite{false}; private: From f27eb85af637cf863228e577dc294315331ab50b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 17 Oct 2024 21:38:13 +0200 Subject: [PATCH 421/499] Add new configuration parameters iq_balance_mode and dc_offset_mode to the Osmosdr_Signal_Source --- docs/CHANGELOG.md | 4 ++++ .../adapters/osmosdr_signal_source.cc | 22 ++++++++++++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 320421956..60a0bdeae 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -53,6 +53,10 @@ All notable changes to GNSS-SDR will be documented in this file. - Added new [`Cshort_To_Gr_Complex`](https://gnss-sdr.org/docs/sp-blocks/data-type-adapter/#implementation-cshort_to_gr_complex) Data Type Adapter implementation. +- The + [Osmosdr_Signal_Source](https://gnss-sdr.org/docs/sp-blocks/signal-source/#implementation-osmosdr_signal_source) + has gained two new optional configuration parameters: `iq_balance_mode` and + `dc_offset_mode`, both of which are set to Automatic by default. ### Improvements in Portability: diff --git a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc index b2f5a6c1f..9071bf22c 100644 --- a/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc +++ b/src/algorithms/signal_source/adapters/osmosdr_signal_source.cc @@ -86,6 +86,23 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura std::cout << "PLL Frequency tune error: " << osmosdr_source_->get_center_freq() - freq_ << " [Hz]...\n"; LOG(INFO) << "PLL Frequency tune error: " << osmosdr_source_->get_center_freq() - freq_ << " [Hz]...\n"; + // Set IQ balance and DC offset modes + // iq balance correction mode: 0 = Off, 1 = Manual, 2 = Automatic + // dc offset correction mode: 0 = Off, 1 = Manual, 2 = Automatic + int iq_balance_mode = configuration->property(role + ".iq_balance_mode", 2); + if (iq_balance_mode < 0 || iq_balance_mode > 2) + { + iq_balance_mode = 2; + } + int dc_offset_mode = configuration->property(role + ".dc_offset_mode", 2); + if (dc_offset_mode < 0 || dc_offset_mode > 2) + { + dc_offset_mode = 2; + } + + osmosdr_source_->set_iq_balance_mode(iq_balance_mode); + osmosdr_source_->set_dc_offset_mode(dc_offset_mode); + // 4. set rx gain if (this->AGC_enabled_ == true) { @@ -128,10 +145,9 @@ OsmosdrSignalSource::OsmosdrSignalSource(const ConfigurationInterface* configura if (if_bw_ > 0.0) { osmosdr_source_->set_bandwidth(if_bw_, 0); + // Get actual bandwidth + std::cout << "Actual Bandwidth: " << osmosdr_source_->get_bandwidth(0) << " [Hz]...\n"; } - - // Get actual bandwidth - std::cout << "Actual Bandwidth: " << osmosdr_source_->get_bandwidth(0) << " [Hz]...\n"; } else { From 949cdde2ea71eb9c326a7dff6e06656ee0597e1e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 29 Oct 2024 11:44:10 +0100 Subject: [PATCH 422/499] Remove temporary file generated at /tmp/file.xxxxxx --- src/algorithms/PVT/libs/kml_printer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/kml_printer.cc b/src/algorithms/PVT/libs/kml_printer.cc index 8a520aec3..6394be27d 100644 --- a/src/algorithms/PVT/libs/kml_printer.cc +++ b/src/algorithms/PVT/libs/kml_printer.cc @@ -319,9 +319,13 @@ Kml_Printer::~Kml_Printer() { std::cerr << e.what() << '\n'; } + errorlib::error_code ec; + if (!fs::remove(fs::path(tmp_file_str), ec)) + { + LOG(INFO) << "Error deleting temporary file"; + } if (!positions_printed) { - errorlib::error_code ec; if (!fs::remove(fs::path(kml_filename), ec)) { LOG(INFO) << "Error deleting temporary KML file"; From 882b2271e4d295d4e62b67f9b8d6cf7180a2c852 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 31 Oct 2024 07:48:47 +0100 Subject: [PATCH 423/499] Bump version of local Matio to 1.5.28 --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5bd2ee95..8e55d3c68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,7 +359,7 @@ set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") -set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.27") +set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.2") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") @@ -2421,6 +2421,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS -DHDF5_USE_STATIC_LIBRARIES=OFF -DMATIO_DEFAULT_FILE_VERSION:STRING=7.3 -DMATIO_MAT73=ON + -DMATIO_BUILD_TESTING=OFF -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/matio BUILD_COMMAND ${CMAKE_COMMAND} "--build" "${GNSSSDR_BINARY_DIR}/matio" From 6a5f80d223d652d4df3a8500d088bc30070b380f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 31 Oct 2024 10:49:22 +0100 Subject: [PATCH 424/499] Remove references to the data folder --- src/algorithms/data_type_adapter/adapters/byte_to_short.cc | 2 +- src/algorithms/input_filter/adapters/beamformer_filter.cc | 2 +- src/algorithms/input_filter/adapters/notch_filter.cc | 2 +- src/algorithms/input_filter/adapters/notch_filter_lite.cc | 2 +- .../resampler/adapters/direct_resampler_conditioner.cc | 2 +- src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index b853cebc1..d25a23f0e 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -35,7 +35,7 @@ ByteToShort::ByteToShort(const ConfigurationInterface* configuration, { const std::string default_input_item_type("byte"); const std::string default_output_item_type("short"); - const std::string default_dump_filename("./input_filter.dat"); + const std::string default_dump_filename("./data_type_adapter.dat"); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index daa8b1ec5..cf124aeb2 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -34,7 +34,7 @@ BeamformerFilter::BeamformerFilter( dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_file("./data/input_filter.dat"); + const std::string default_dump_file("./input_filter.dat"); item_type_ = configuration->property(role + ".item_type", default_item_type); dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index 8e8b93392..840985039 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -36,7 +36,7 @@ NotchFilter::NotchFilter(const ConfigurationInterface* configuration, dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_file("./data/input_filter.dat"); + const std::string default_dump_file("./input_filter.dat"); const float default_pfa = 0.001; const float default_p_c_factor = 0.9; const int default_length_ = 32; diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 42afd1713..75aa1089d 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -37,7 +37,7 @@ NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_file("./data/input_filter.dat"); + const std::string default_dump_file("./input_filter.dat"); const float default_p_c_factor = 0.9; const float default_pfa = 0.001; const float default_samp_freq = 4000000; diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index 57c875742..6b01d3f29 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -43,7 +43,7 @@ DirectResamplerConditioner::DirectResamplerConditioner( dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("short"); - const std::string default_dump_file("./data/signal_conditioner.dat"); + const std::string default_dump_file("./resampler.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); item_type_ = configuration->property(role + ".item_type", default_item_type); diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index 07f0e2b67..b97bc5a50 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -39,7 +39,7 @@ MmseResamplerConditioner::MmseResamplerConditioner( dump_(configuration->property(role + ".dump", false)) { const std::string default_item_type("gr_complex"); - const std::string default_dump_file("./data/signal_conditioner.dat"); + const std::string default_dump_file("./resampler.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); item_type_ = configuration->property(role + ".item_type", default_item_type); From c9d55949dcf7dc47b2b26def9c5f1d5a28a8a951 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 31 Oct 2024 17:35:49 +0100 Subject: [PATCH 425/499] CI: update uraimo/run-on-arch-action --- .github/workflows/volk_gnsssdr_archs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index 6f4e31454..d27294b27 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -45,7 +45,7 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: uraimo/run-on-arch-action@v2.7.1 + - uses: uraimo/run-on-arch-action@v2 name: Build in non-x86 container # continue-on-error: ${{ contains(fromJson('["ppc64le", "s390x"]'), matrix.arch) }} id: build From 3df1237dda821f6dd0750eb5da84575a79b8443d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 1 Nov 2024 22:45:40 +0100 Subject: [PATCH 426/499] Update gsl-lite to 0.42.0 --- docs/CHANGELOG.md | 5 + .../libs/gsl/include/gsl/gsl-lite.hpp | 957 ++++++++++-------- 2 files changed, 561 insertions(+), 401 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 60a0bdeae..9cf6a85ab 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -58,6 +58,11 @@ All notable changes to GNSS-SDR will be documented in this file. has gained two new optional configuration parameters: `iq_balance_mode` and `dc_offset_mode`, both of which are set to Automatic by default. +### Improvements in Maintainability: + +- Updated GSL implementation to v0.42.0. See the + [gsl-lite release](https://github.com/gsl-lite/gsl-lite/releases/tag/v0.42.0). + ### Improvements in Portability: - Fix building against google-glog 0.7.x. diff --git a/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp b/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp index 50ae0af72..4762439a1 100644 --- a/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp +++ b/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp @@ -3,7 +3,7 @@ // For more information see https://github.com/gsl-lite/gsl-lite // // Copyright (c) 2015-2019 Martin Moene -// Copyright (c) 2019-2021 Moritz Beutel +// Copyright (c) 2019-2024 Moritz Beutel // Copyright (c) 2015-2018 Microsoft Corporation. All rights reserved. // // SPDX-License-Identifier: MIT @@ -25,7 +25,7 @@ #include // for move(), forward<>(), swap() #define gsl_lite_MAJOR 0 -#define gsl_lite_MINOR 40 +#define gsl_lite_MINOR 42 #define gsl_lite_PATCH 0 #define gsl_lite_VERSION gsl_STRINGIFY(gsl_lite_MAJOR) "." gsl_STRINGIFY(gsl_lite_MINOR) "." gsl_STRINGIFY(gsl_lite_PATCH) @@ -177,6 +177,15 @@ #endif #define gsl_FEATURE_OWNER_MACRO_() gsl_FEATURE_OWNER_MACRO +// #if defined( gsl_FEATURE_STRING_SPAN ) +// # if ! gsl_CHECK_CFG_TOGGLE_VALUE_( gsl_FEATURE_STRING_SPAN ) +// # pragma message ("invalid configuration value gsl_FEATURE_STRING_SPAN=" gsl_STRINGIFY(gsl_FEATURE_STRING_SPAN) ", must be 0 or 1") +// # endif +// #else +// # define gsl_FEATURE_STRING_SPAN (gsl_CONFIG_DEFAULTS_VERSION == 0) // default +// #endif +// #define gsl_FEATURE_STRING_SPAN_() gsl_FEATURE_STRING_SPAN + #if defined(gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD) #if !gsl_CHECK_CFG_TOGGLE_VALUE_(gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD) #pragma message("invalid configuration value gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD=" gsl_STRINGIFY(gsl_FEATURE_EXPERIMENTAL_RETURN_GUARD) ", must be 0 or 1") @@ -211,7 +220,7 @@ #if !defined(gsl_CONFIG_DEPRECATE_TO_LEVEL) #if gsl_CONFIG_DEFAULTS_VERSION >= 1 -#define gsl_CONFIG_DEPRECATE_TO_LEVEL 6 +#define gsl_CONFIG_DEPRECATE_TO_LEVEL 7 #else #define gsl_CONFIG_DEPRECATE_TO_LEVEL 0 #endif @@ -295,6 +304,15 @@ #endif #define gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION_() gsl_CONFIG_NARROW_THROWS_ON_TRUNCATION +#if defined(gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS) +#if !gsl_CHECK_CFG_TOGGLE_VALUE_(gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS) +#pragma message("invalid configuration value gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS=" gsl_STRINGIFY(gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS) ", must be 0 or 1") +#endif +#else +#define gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS 1 // default +#endif +#define gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS_() gsl_CONFIG_VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS + #if defined(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF) #if !gsl_CHECK_CFG_NO_VALUE_(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF) #pragma message("invalid configuration value gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF=" gsl_STRINGIFY(gsl_CONFIG_CONTRACT_CHECKING_EXPECTS_OFF) "; macro must be defined without value") @@ -468,7 +486,7 @@ #endif #endif -// C++ language version detection (C++20 is speculative): +// C++ language version detection (C++23 is speculative): // Note: VC14.0/1900 (VS2015) lacks too much from C++14. #ifndef gsl_CPLUSPLUS @@ -489,7 +507,8 @@ #define gsl_CPP11_OR_GREATER (gsl_CPLUSPLUS >= 201103L) #define gsl_CPP14_OR_GREATER (gsl_CPLUSPLUS >= 201402L) #define gsl_CPP17_OR_GREATER (gsl_CPLUSPLUS >= 201703L) -#define gsl_CPP20_OR_GREATER (gsl_CPLUSPLUS >= 202000L) +#define gsl_CPP20_OR_GREATER (gsl_CPLUSPLUS >= 202002L) +#define gsl_CPP23_OR_GREATER (gsl_CPLUSPLUS > 202002L) // tentative // C++ language version (represent 98 as 3): @@ -511,6 +530,7 @@ // MSVC++ 14.0 _MSC_VER == 1900 gsl_COMPILER_MSVC_VERSION == 140 (Visual Studio 2015) // MSVC++ 14.1 _MSC_VER >= 1910 gsl_COMPILER_MSVC_VERSION == 141 (Visual Studio 2017) // MSVC++ 14.2 _MSC_VER >= 1920 gsl_COMPILER_MSVC_VERSION == 142 (Visual Studio 2019) +// MSVC++ 14.3 _MSC_VER >= 1930 gsl_COMPILER_MSVC_VERSION == 143 (Visual Studio 2022) #if defined(_MSC_VER) && !defined(__clang__) #define gsl_COMPILER_MSVC_VER (_MSC_VER) @@ -545,7 +565,14 @@ // AppleClang 11.0.3 __apple_build_version__ == 11030032 gsl_COMPILER_APPLECLANG_VERSION == 1103 (Xcode 11.4, 11.4.1, 11.5, 11.6) (LLVM 9.0.0) // AppleClang 12.0.0 __apple_build_version__ == 12000032 gsl_COMPILER_APPLECLANG_VERSION == 1200 (Xcode 12.0–12.4) (LLVM 10.0.0) // AppleClang 12.0.5 __apple_build_version__ == 12050022 gsl_COMPILER_APPLECLANG_VERSION == 1205 (Xcode 12.5) (LLVM 11.1.0) -// AppleClang 13.0.0 __apple_build_version__ == 13000029 gsl_COMPILER_APPLECLANG_VERSION == 1300 (Xcode 13.0) (LLVM 12.0.0) +// AppleClang 13.0.0 __apple_build_version__ == 13000029 gsl_COMPILER_APPLECLANG_VERSION == 1300 (Xcode 13.0–13.2.1) (LLVM 12.0.0) +// AppleClang 13.1.6 __apple_build_version__ == 13160021 gsl_COMPILER_APPLECLANG_VERSION == 1316 (Xcode 13.3–13.4.1) (LLVM 13.0.0) +// AppleClang 14.0.0 __apple_build_version__ == 14000029 gsl_COMPILER_APPLECLANG_VERSION == 1400 (Xcode 14.0–14.2) (LLVM 14.0.0) +// AppleClang 14.0.3 __apple_build_version__ == 14030022 gsl_COMPILER_APPLECLANG_VERSION == 1403 (Xcode 14.3) (LLVM 15.0.0) +// AppleClang 15.0.0 __apple_build_version__ == 15000040 gsl_COMPILER_APPLECLANG_VERSION == 1500 (Xcode 15.0) (LLVM 16.0.0) +// AppleClang 15.0.0 __apple_build_version__ == 15000100 gsl_COMPILER_APPLECLANG_VERSION == 1500 (Xcode 15.1–15.2) (LLVM 16.0.0) +// AppleClang 15.0.0 __apple_build_version__ == 15000309 gsl_COMPILER_APPLECLANG_VERSION == 1500 (Xcode 15.3–15.4) (LLVM 16.0.0) +// AppleClang 16.0.0 __apple_build_version__ == 16000026 gsl_COMPILER_APPLECLANG_VERSION == 1600 (Xcode 16.0) (LLVM 17.0.6) #if defined(__apple_build_version__) #define gsl_COMPILER_APPLECLANG_VERSION gsl_COMPILER_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) @@ -605,7 +632,7 @@ // Presence of wide character support: -#ifdef __DJGPP__ +#if defined(__DJGPP__) || (defined(_LIBCPP_VERSION) && defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)) #define gsl_HAVE_WCHAR 0 #else #define gsl_HAVE_WCHAR 1 @@ -754,6 +781,7 @@ #define gsl_HAVE_ENUM_CLASS_CONSTRUCTION_FROM_UNDERLYING_TYPE_() gsl_HAVE_ENUM_CLASS_CONSTRUCTION_FROM_UNDERLYING_TYPE #define gsl_HAVE_DEDUCTION_GUIDES_() gsl_HAVE_DEDUCTION_GUIDES #define gsl_HAVE_NODISCARD_() gsl_HAVE_NODISCARD +#define gsl_HAVE_MAYBE_UNUSED_() gsl_CPP17_OR_GREATER #define gsl_HAVE_CONSTEXPR_17_() gsl_HAVE_CONSTEXPR_17 // Presence of C++20 language features: @@ -762,6 +790,12 @@ #define gsl_HAVE_CONSTEXPR_20_() gsl_HAVE_CONSTEXPR_20 +// Presence of C++23 language features: + +#define gsl_HAVE_CONSTEXPR_23 gsl_CPP23_OR_GREATER + +#define gsl_HAVE_CONSTEXPR_23_() gsl_HAVE_CONSTEXPR_23 + // Presence of C++ library features: #if gsl_BETWEEN(gsl_COMPILER_ARMCC_VERSION, 1, 600) @@ -771,12 +805,14 @@ #define gsl_STDLIB_CPP14_OR_GREATER 0 #define gsl_STDLIB_CPP17_OR_GREATER 0 #define gsl_STDLIB_CPP20_OR_GREATER 0 +#define gsl_STDLIB_CPP23_OR_GREATER 0 #else #define gsl_STDLIB_CPP98_OR_GREATER gsl_CPP98_OR_GREATER #define gsl_STDLIB_CPP11_OR_GREATER gsl_CPP11_OR_GREATER #define gsl_STDLIB_CPP14_OR_GREATER gsl_CPP14_OR_GREATER #define gsl_STDLIB_CPP17_OR_GREATER gsl_CPP17_OR_GREATER #define gsl_STDLIB_CPP20_OR_GREATER gsl_CPP20_OR_GREATER +#define gsl_STDLIB_CPP23_OR_GREATER gsl_CPP23_OR_GREATER #endif #define gsl_STDLIB_CPP11_100 (gsl_STDLIB_CPP11_OR_GREATER || gsl_COMPILER_MSVC_VER >= 1600) @@ -884,6 +920,12 @@ #define gsl_constexpr20 /*constexpr*/ #endif +#if gsl_HAVE(CONSTEXPR_23) +#define gsl_constexpr23 constexpr +#else +#define gsl_constexpr23 /*constexpr*/ +#endif + #if gsl_HAVE(EXPLICIT) #define gsl_explicit explicit #else @@ -941,6 +983,19 @@ #define gsl_NORETURN #endif +#if gsl_HAVE(MAYBE_UNUSED) +#define gsl_MAYBE_UNUSED [[maybe_unused]] +#if gsl_COMPILER_GNUC_VERSION +// GCC currently ignores the [[maybe_unused]] attribute on data members and warns accordingly (cf. https://stackoverflow.com/a/65633590). +#define gsl_MAYBE_UNUSED_MEMBER +#else // ! gsl_COMPILER_GNUC_VERSION +#define gsl_MAYBE_UNUSED_MEMBER [[maybe_unused]] +#endif // gsl_COMPILER_GNUC_VERSION +#else +#define gsl_MAYBE_UNUSED +#define gsl_MAYBE_UNUSED_MEMBER +#endif + #if gsl_HAVE(DEPRECATED) && !defined(gsl_TESTING_) #define gsl_DEPRECATED [[deprecated]] #define gsl_DEPRECATED_MSG(msg) [[deprecated(msg)]] @@ -963,6 +1018,12 @@ #define gsl_STATIC_ASSERT_(cond, msg) ((void)sizeof(char[1 - 2 * !!(cond)])) #endif +#if _MSC_VER >= 1900 // Visual Studio 2015 and newer, or Clang emulating a corresponding MSVC +#define gsl_EMPTY_BASES_ __declspec(empty_bases) +#else +#define gsl_EMPTY_BASES_ +#endif + #if gsl_HAVE(TYPE_TRAITS) #define gsl_DEFINE_ENUM_BITMASK_OPERATORS_(ENUM) \ @@ -1194,14 +1255,12 @@ using ::__cxxabiv1::__cxa_get_globals; #endif // gsl_FEATURE( EXPERIMENTAL_RETURN_GUARD ) -// MSVC warning suppression macros: +// Warning suppression macros: #if gsl_COMPILER_MSVC_VERSION >= 140 && !gsl_COMPILER_NVCC_VERSION #define gsl_SUPPRESS_MSGSL_WARNING(expr) [[gsl::suppress(expr)]] -#define gsl_SUPPRESS_MSVC_WARNING(code, descr) __pragma(warning(suppress \ - : code)) -#define gsl_DISABLE_MSVC_WARNINGS(codes) __pragma(warning(push)) __pragma(warning(disable \ - : codes)) +#define gsl_SUPPRESS_MSVC_WARNING(code, descr) __pragma(warning(suppress : code)) +#define gsl_DISABLE_MSVC_WARNINGS(codes) __pragma(warning(push)) __pragma(warning(disable : codes)) #define gsl_RESTORE_MSVC_WARNINGS() __pragma(warning(pop)) #else // TODO: define for Clang @@ -1211,25 +1270,45 @@ using ::__cxxabiv1::__cxa_get_globals; #define gsl_RESTORE_MSVC_WARNINGS() #endif -// Suppress the following MSVC GSL warnings: -// - C26432: gsl::c.21 : if you define or delete any default operation in the type '...', define or delete them all -// - C26410: gsl::r.32 : the parameter 'ptr' is a reference to const unique pointer, use const T* or const T& instead -// - C26415: gsl::r.30 : smart pointer parameter 'ptr' is used only to access contained pointer. Use T* or T& instead -// - C26418: gsl::r.36 : shared pointer parameter 'ptr' is not copied or moved. Use T* or T& instead -// - C26472: gsl::t.1 : don't use a static_cast for arithmetic conversions; -// use brace initialization, gsl::narrow_cast or gsl::narrow -// - C26439: gsl::f.6 : special function 'function' can be declared 'noexcept' -// - C26440: gsl::f.6 : function 'function' can be declared 'noexcept' -// - C26455: gsl::f.6 : default constructor may not throw. Declare it 'noexcept' -// - C26473: gsl::t.1 : don't cast between pointer types where the source type and the target type are the same -// - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead -// - C26482: gsl::b.2 : only index into arrays using constant expressions -// - C26446: gdl::b.4 : prefer to use gsl::at() instead of unchecked subscript operator -// - C26490: gsl::t.1 : don't use reinterpret_cast -// - C26487: gsl::l.4 : don't return a pointer '('s result)' that may be invalid -// - C26457: es.48 : (void) should not be used to ignore return values, use 'std::ignore =' instead +// Warning suppressions: -gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 26481 26482 26446 26490 26487 26457) +#if gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" // because of `fail_fast` and `narrowing_error` +#endif // gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION + +#if gsl_COMPILER_GNUC_VERSION +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wuseless-cast" // we use `static_cast<>()` in several places where it is possibly redundant depending on the configuration of the library +#endif // gsl_COMPILER_GNUC_VERSION + +// Suppress the following MSVC GSL warnings: +// - C26432: gsl::c.21 : if you define or delete any default operation in the type '...', define or delete them all +// - C26410: gsl::r.32 : the parameter 'ptr' is a reference to const unique pointer, use const T* or const T& instead +// - C26415: gsl::r.30 : smart pointer parameter 'ptr' is used only to access contained pointer. Use T* or T& instead +// - C26418: gsl::r.36 : shared pointer parameter 'ptr' is not copied or moved. Use T* or T& instead +// - C26472: gsl::t.1 : don't use a static_cast for arithmetic conversions; +// use brace initialization, gsl::narrow_cast or gsl::narrow +// - C26439: gsl::f.6 : special function 'function' can be declared 'noexcept' +// - C26440: gsl::f.6 : function 'function' can be declared 'noexcept' +// - C26455: gsl::f.6 : default constructor may not throw. Declare it 'noexcept' +// - C26473: gsl::t.1 : don't cast between pointer types where the source type and the target type are the same +// - C26481: gsl::b.1 : don't use pointer arithmetic. Use span instead +// - C26482: gsl::b.2 : only index into arrays using constant expressions +// - C26446: gdl::b.4 : prefer to use gsl::at() instead of unchecked subscript operator +// - C26490: gsl::t.1 : don't use reinterpret_cast +// - C26487: gsl::l.4 : don't return a pointer '('s result)' that may be invalid +// - C26434: gsl::c.128 : function 'symbol_1' hides a non-virtual function 'symbol_2' (false positive for compiler-generated functions such as constructors) +// - C26456: gsl::c.128 : operator 'symbol_1' hides a non-virtual operator 'symbol_2' (false positive for compiler-generated operators) +// - C26457: es.48 : (void) should not be used to ignore return values, use 'std::ignore =' instead + +gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 26481 26482 26446 26490 26487 26434 26456 26457) +#if gsl_BETWEEN(gsl_COMPILER_MSVC_VERSION, 110, 140) // VS 2012 and 2013 +#pragma warning(disable : 4127) // conditional expression is constant +#endif // gsl_BETWEEN( gsl_COMPILER_MSVC_VERSION, 110, 140 ) +#if gsl_COMPILER_MSVC_VERSION == 140 // VS 2015 +#pragma warning(disable : 4577) // 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc +#endif // gsl_COMPILER_MSVC_VERSION == 140 namespace gsl { @@ -1242,6 +1321,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + // We implement `equal()` and `lexicographical_compare()` here to avoid having to pull in the header. template bool equal(InputIt1 first1, InputIt1 last1, InputIt2 first2) @@ -1257,7 +1337,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 bool lexicographical_compare(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2) { // Implementation borrowed from https://en.cppreference.com/w/cpp/algorithm/lexicographical_compare. - for (; first1 != last1 && first2 != last2; ++first1, (void)++first2) + for (; first1 != last1 && first2 != last2; ++first1, static_cast(++first2)) { if (*first1 < *first2) return true; if (*first2 < *first1) return false; @@ -1271,6 +1351,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace std11 { + #if gsl_HAVE(ADD_CONST) using std::add_const; @@ -1411,6 +1492,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace std14 { + #if gsl_HAVE(UNIQUE_PTR) #if gsl_HAVE(MAKE_UNIQUE) @@ -1435,6 +1517,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + #if gsl_HAVE(VARIADIC_TEMPLATE) template @@ -1469,6 +1552,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace std17 { + template struct bool_constant : std11::integral_constant { @@ -1527,7 +1611,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr auto - size(T const (&)[N]) gsl_noexcept -> size_t + size(T const (&)[N]) gsl_noexcept->size_t { return N; } @@ -1541,7 +1625,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr auto - data(T (&arr)[N]) gsl_noexcept -> T * + data(T (&arr)[N]) gsl_noexcept->T * { return &arr[0]; } @@ -1562,7 +1646,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD inline gsl_constexpr auto - data(std::initializer_list il) gsl_noexcept -> E const * + data(std::initializer_list il) gsl_noexcept->E const * { return il.begin(); } @@ -1575,6 +1659,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace std20 { + #if gsl_CPP11_100 struct identity @@ -1637,7 +1722,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_constexpr auto - ssize(T const (&)[N]) gsl_noexcept -> std::ptrdiff_t + ssize(T const (&)[N]) gsl_noexcept->std::ptrdiff_t { return std::ptrdiff_t(N); } @@ -1660,8 +1745,16 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } // namespace std20 + // C++23 emulation: + + namespace std23 + { + + } // namespace std23 + namespace detail { + /// for gsl_ENABLE_IF_() /*enum*/ class enabler @@ -1849,7 +1942,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 // GSL.assert: assertions // -#if gsl_HAVE(TYPE_TRAITS) +#if gsl_HAVE(TYPE_TRAITS) && gsl_CONFIG(VALIDATES_UNENFORCED_CONTRACT_EXPRESSIONS) #define gsl_ELIDE_(x) static_assert(::std::is_constructible::value, "argument of contract check must be convertible to bool") #else #define gsl_ELIDE_(x) @@ -1868,7 +1961,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_DEVICE_CODE #if defined(gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME) #if gsl_COMPILER_NVCC_VERSION >= 113 -#define gsl_ASSUME_(x) ((x) ? static_cast(0) : __builtin_unreachable()) +#define gsl_ASSUME_(x) (__builtin_assume(!!(x))) #define gsl_ASSUME_UNREACHABLE_() __builtin_unreachable() #else // unknown device compiler #error gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ASSUME: gsl-lite does not know how to generate UB optimization hints in device code for this compiler; use gsl_CONFIG_DEVICE_UNENFORCED_CONTRACTS_ELIDE instead @@ -2051,6 +2144,8 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + + #if gsl_HAVE(EXCEPTIONS) gsl_NORETURN inline void fail_fast_throw(char const *message) { @@ -2117,6 +2212,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace std11 { + #if gsl_HAVE(UNCAUGHT_EXCEPTIONS) inline unsigned char uncaught_exceptions() gsl_noexcept @@ -2155,55 +2251,148 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { public: explicit final_action(F action) gsl_noexcept - : action_(std::move(action)), + : action_(std::move(action)) +#if gsl_CONFIG_DEFAULTS_VERSION < 1 || !gsl_CPP17_OR_GREATER + , invoke_(true) +#endif { } + // We only provide the move constructor for legacy defaults, or if we cannot rely on C++17 guaranteed copy elision. +#if gsl_CONFIG_DEFAULTS_VERSION < 1 || !gsl_CPP17_OR_GREATER final_action(final_action &&other) gsl_noexcept : action_(std::move(other.action_)), invoke_(other.invoke_) { other.invoke_ = false; } +#endif // gsl_CONFIG_DEFAULTS_VERSION < 1 || ! gsl_CPP17_OR_GREATER - gsl_SUPPRESS_MSGSL_WARNING(f .6) virtual ~final_action() gsl_noexcept + gsl_SUPPRESS_MSGSL_WARNING(f .6) +#if gsl_CONFIG_DEFAULTS_VERSION < 1 // we avoid the unnecessary virtual calls if modern defaults are selected + virtual +#endif + ~final_action() gsl_noexcept { +#if gsl_CONFIG_DEFAULTS_VERSION < 1 || !gsl_CPP17_OR_GREATER if (invoke_) - action_(); +#endif + { + action_(); + } } gsl_is_delete_access : final_action(final_action const &) gsl_is_delete; final_action &operator=(final_action const &) gsl_is_delete; final_action &operator=(final_action &&) gsl_is_delete; +#if gsl_CONFIG_DEFAULTS_VERSION < 1 protected: void dismiss() gsl_noexcept { invoke_ = false; } +#endif // gsl_CONFIG_DEFAULTS_VERSION < 1 private: F action_; - bool invoke_; + gsl_MAYBE_UNUSED_MEMBER bool invoke_; // member is defined unconditionally so as not to have ABI depend on C++ language support }; template - gsl_NODISCARD inline final_action - finally(F const &action) gsl_noexcept + gsl_NODISCARD inline final_action::type> + finally(F && action) gsl_noexcept { - return final_action(action); - } - - template - gsl_NODISCARD inline final_action - finally(F && action) gsl_noexcept - { - return final_action(std::forward(action)); + return final_action::type>(std::forward(action)); } #if gsl_FEATURE(EXPERIMENTAL_RETURN_GUARD) +#if gsl_CONFIG_DEFAULTS_VERSION >= 1 + template + class final_action_return + { + public: + explicit final_action_return(F action) gsl_noexcept + : action_(std::move(action)), + exception_count_(std11::uncaught_exceptions()) + { + } + + // We only provide the move constructor if we cannot rely on C++17 guaranteed copy elision. +#if !gsl_CPP17_OR_GREATER + final_action_return(final_action_return &&other) gsl_noexcept + : action_(std::move(other.action_)), + exception_count_(other.exception_count_) + { + other.exception_count_ = 0xFF; // abuse member as special "no-invoke" marker + } +#endif // ! gsl_CPP17_OR_GREATER + + gsl_SUPPRESS_MSGSL_WARNING(f .6) ~final_action_return() gsl_noexcept + { +#if !gsl_CPP17_OR_GREATER + if (exception_count_ != 0xFF) // abuse member as special "no-invoke" marker +#endif + { + if (std11::uncaught_exceptions() == exception_count_) + { + action_(); + } + } + } + + gsl_is_delete_access : final_action_return(final_action_return const &) gsl_is_delete; + final_action_return &operator=(final_action_return const &) gsl_is_delete; + final_action_return &operator=(final_action_return &&) gsl_is_delete; + + private: + F action_; + unsigned char exception_count_; + }; + template + class final_action_error + { + public: + explicit final_action_error(F action) gsl_noexcept + : action_(std::move(action)), + exception_count_(std11::uncaught_exceptions()) + { + } + + // We only provide the move constructor if we cannot rely on C++17 guaranteed copy elision. +#if !gsl_CPP17_OR_GREATER + final_action_error(final_action_error &&other) gsl_noexcept + : action_(std::move(other.action_)), + exception_count_(other.exception_count_) + { + other.exception_count_ = 0xFF; // abuse member as special "no-invoke" marker + } +#endif // ! gsl_CPP17_OR_GREATER + + gsl_SUPPRESS_MSGSL_WARNING(f .6) ~final_action_error() gsl_noexcept + { +#if !gsl_CPP17_OR_GREATER + if (exception_count_ != 0xFF) // abuse member as special "no-invoke" marker +#endif + { + if (std11::uncaught_exceptions() != exception_count_) + { + action_(); + } + } + } + + gsl_is_delete_access : final_action_error(final_action_error const &) gsl_is_delete; + final_action_error &operator=(final_action_error const &) gsl_is_delete; + final_action_error &operator=(final_action_error &&) gsl_is_delete; + + private: + F action_; + unsigned char exception_count_; + }; +#else // gsl_CONFIG_DEFAULTS_VERSION < 1 template class final_action_return : public final_action { @@ -2233,20 +2422,6 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 unsigned char exception_count; }; - template - gsl_NODISCARD inline final_action_return - on_return(F const &action) gsl_noexcept - { - return final_action_return(action); - } - - template - gsl_NODISCARD inline final_action_return - on_return(F && action) gsl_noexcept - { - return final_action_return(std::forward(action)); - } - template class final_action_error : public final_action { @@ -2275,19 +2450,20 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 private: unsigned char exception_count; }; +#endif // gsl_CONFIG_DEFAULTS_VERSION >= 1 template - gsl_NODISCARD inline final_action_error - on_error(F const &action) gsl_noexcept + gsl_NODISCARD inline final_action_return::type> + on_return(F && action) gsl_noexcept { - return final_action_error(action); + return final_action_return::type>(std::forward(action)); } template - gsl_NODISCARD inline final_action_error - on_error(F && action) gsl_noexcept + gsl_NODISCARD inline final_action_error::type> + on_error(F && action) gsl_noexcept { - return final_action_error(std::forward(action)); + return final_action_error::type>(std::forward(action)); } #endif // gsl_FEATURE( EXPERIMENTAL_RETURN_GUARD ) @@ -2296,7 +2472,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #else // ! gsl_STDLIB_CPP11_110 - class final_action +#if gsl_DEPRECATE_TO_LEVEL(8) + gsl_DEPRECATED_MSG("final_action for pre-C++11 compilers is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 8 ) + class final_action { public: typedef void (*Action)(); @@ -2333,14 +2512,21 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 }; template - inline final_action finally(F const &f) +#if gsl_DEPRECATE_TO_LEVEL(8) + gsl_DEPRECATED_MSG("finally() for pre-C++11 compilers is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 8 ) + inline final_action + finally(F const &f) { - return final_action((f)); + return final_action(f); } #if gsl_FEATURE(EXPERIMENTAL_RETURN_GUARD) - class final_action_return : public final_action +#if gsl_DEPRECATE_TO_LEVEL(8) + gsl_DEPRECATED_MSG("final_action_return for pre-C++11 compilers is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 8 ) + class final_action_return : public final_action { public: explicit final_action_return(Action action) @@ -2362,12 +2548,19 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 }; template - inline final_action_return on_return(F const &action) +#if gsl_DEPRECATE_TO_LEVEL(8) + gsl_DEPRECATED_MSG("on_return() for pre-C++11 compilers is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 8 ) + inline final_action_return + on_return(F const &action) { return final_action_return(action); } - class final_action_error : public final_action +#if gsl_DEPRECATE_TO_LEVEL(8) + gsl_DEPRECATED_MSG("final_action_error for pre-C++11 compilers is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 8 ) + class final_action_error : public final_action { public: explicit final_action_error(Action action) @@ -2389,7 +2582,11 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 }; template - inline final_action_error on_error(F const &action) +#if gsl_DEPRECATE_TO_LEVEL(8) + gsl_DEPRECATED_MSG("on_error() for pre-C++11 compilers is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 8 ) + inline final_action_error + on_error(F const &action) { return final_action_error(action); } @@ -2402,7 +2599,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr T - narrow_cast(U && u) gsl_noexcept + narrow_cast(U && u) gsl_noexcept { return static_cast(std::forward(u)); } @@ -2433,6 +2630,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + template struct is_same_signedness : public std::integral_constant::value == std::is_signed::value> { @@ -2467,14 +2665,14 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #endif template - gsl_NODISCARD -#if !gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) && !defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS) + gsl_NODISCARD gsl_constexpr14 +#if !gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) gsl_api -#endif +#endif // ! gsl_CONFIG( NARROW_THROWS_ON_TRUNCATION ) inline T narrow(U u) { -#if gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) && !gsl_HAVE(EXCEPTIONS) +#if !gsl_HAVE(EXCEPTIONS) && gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) gsl_STATIC_ASSERT_(detail::dependent_false::value, "According to the GSL specification, narrow<>() throws an exception of type narrowing_error on truncation. Therefore " "it cannot be used if exceptions are disabled. Consider using narrow_failfast<>() instead which raises a precondition " @@ -2483,20 +2681,11 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 T t = static_cast(u); - if (static_cast(t) != u) - { -#if gsl_HAVE(EXCEPTIONS) && (gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) || defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS)) - throw narrowing_error(); -#else - std::terminate(); -#endif - } - #if gsl_HAVE(TYPE_TRAITS) #if gsl_COMPILER_NVCC_VERSION || gsl_COMPILER_NVHPC_VERSION - if (!detail::have_same_sign(t, u, detail::is_same_signedness())) + if (static_cast(t) != u || !detail::have_same_sign(t, u, detail::is_same_signedness())) #else - gsl_SUPPRESS_MSVC_WARNING(4127, "conditional expression is constant") if (!detail::is_same_signedness::value && (t < T()) != (u < U())) + gsl_SUPPRESS_MSVC_WARNING(4127, "conditional expression is constant") if (static_cast(t) != u || (!detail::is_same_signedness::value && (t < T()) != (u < U()))) #endif #else // Don't assume T() works: @@ -2505,7 +2694,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 // Suppress: pointless comparison of unsigned integer with zero. #pragma diag_suppress 186 #endif - if ((t < 0) != (u < 0)) + if (static_cast(t) != u || (t < 0) != (u < 0)) #if gsl_COMPILER_NVHPC_VERSION // Restore: pointless comparison of unsigned integer with zero. #pragma diag_default 186 @@ -2513,30 +2702,32 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #endif { -#if gsl_HAVE(EXCEPTIONS) && (gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) || defined(gsl_CONFIG_CONTRACT_VIOLATION_THROWS)) +#if gsl_CONFIG(NARROW_THROWS_ON_TRUNCATION) throw narrowing_error(); -#else +#else // ! gsl_CONFIG( NARROW_THROWS_ON_TRUNCATION ) +#if gsl_DEVICE_CODE + gsl_TRAP_(); +#else // host code std::terminate(); #endif +#endif // gsl_CONFIG( NARROW_THROWS_ON_TRUNCATION ) } return t; } template - gsl_NODISCARD gsl_api inline T + gsl_NODISCARD gsl_api gsl_constexpr14 inline T narrow_failfast(U u) { T t = static_cast(u); - gsl_Expects(static_cast(t) == u); - #if gsl_HAVE(TYPE_TRAITS) #if gsl_COMPILER_NVCC_VERSION || gsl_COMPILER_NVHPC_VERSION - gsl_Expects(::gsl::detail::have_same_sign(t, u, ::gsl::detail::is_same_signedness())); + gsl_Assert(static_cast(t) == u && ::gsl::detail::have_same_sign(t, u, ::gsl::detail::is_same_signedness())); #else gsl_SUPPRESS_MSVC_WARNING(4127, "conditional expression is constant") - gsl_Expects((::gsl::detail::is_same_signedness::value || (t < T()) == (u < U()))); + gsl_Assert(static_cast(t) == u && (::gsl::detail::is_same_signedness::value || (t < T()) == (u < U()))); #endif #else // Don't assume T() works: @@ -2545,7 +2736,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 // Suppress: pointless comparison of unsigned integer with zero. #pragma diag_suppress 186 #endif - gsl_Expects((t < 0) == (u < 0)); + gsl_Assert(static_cast(t) == u && (t < 0) == (u < 0)); #if gsl_COMPILER_NVHPC_VERSION // Restore: pointless comparison of unsigned integer with zero. #pragma diag_default 186 @@ -2615,12 +2806,13 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + // helper class to figure out the pointed-to type of a pointer #if gsl_STDLIB_CPP11_OR_GREATER template struct element_type_helper { - // For types without a member element_type (this will handle raw pointers) + // For types without a member element_type (this could handle typed raw pointers but not `void*`) typedef typename std::remove_reference())>::type type; }; @@ -2637,13 +2829,13 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { typedef typename T::element_type type; }; +#endif // gsl_STDLIB_CPP11_OR_GREATER template struct element_type_helper { typedef T type; }; -#endif // gsl_STDLIB_CPP11_OR_GREATER template struct is_not_null_or_bool_oracle : std11::false_type @@ -2659,7 +2851,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 }; - template + template struct not_null_data; #if gsl_HAVE(MOVE_FORWARD) template @@ -2672,12 +2864,16 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { } - gsl_api gsl_constexpr14 not_null_data(not_null_data &&other) gsl_noexcept + gsl_api gsl_constexpr14 not_null_data(not_null_data &&other) + gsl_noexcept_not_testing // we want to be nothrow-movable despite the assertion : ptr_(std::move(other.ptr_)) { + gsl_Assert(ptr_ != gsl_nullptr); } - gsl_api gsl_constexpr14 not_null_data &operator=(not_null_data &&other) gsl_noexcept + gsl_api gsl_constexpr14 not_null_data &operator=(not_null_data &&other) + gsl_noexcept_not_testing // we want to be nothrow-movable despite the assertion { + gsl_Assert(other.ptr_ != gsl_nullptr || &other == this); ptr_ = std::move(other.ptr_); return *this; } @@ -2685,8 +2881,6 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 gsl_is_delete_access : not_null_data(not_null_data const &) gsl_is_delete; not_null_data &operator=(not_null_data const &) gsl_is_delete; }; -#if gsl_CONFIG_DEFAULTS_VERSION >= 1 -#endif // gsl_CONFIG_DEFAULTS_VERSION >= 1 #endif // gsl_HAVE( MOVE_FORWARD ) template struct not_null_data @@ -2704,12 +2898,16 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { } - gsl_api gsl_constexpr14 not_null_data(not_null_data &&other) gsl_noexcept + gsl_api gsl_constexpr14 not_null_data(not_null_data &&other) + gsl_noexcept_not_testing // we want to be nothrow-movable despite the assertion : ptr_(std::move(other.ptr_)) { + gsl_Assert(ptr_ != gsl_nullptr); } - gsl_api gsl_constexpr14 not_null_data &operator=(not_null_data &&other) gsl_noexcept + gsl_api gsl_constexpr14 not_null_data &operator=(not_null_data &&other) + gsl_noexcept_not_testing // we want to be nothrow-movable despite the assertion { + gsl_Assert(other.ptr_ != gsl_nullptr || &other == this); ptr_ = std::move(other.ptr_); return *this; } @@ -2718,16 +2916,15 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 gsl_api gsl_constexpr14 not_null_data(not_null_data const &other) : ptr_(other.ptr_) { - gsl_Expects(ptr_ != gsl_nullptr); + gsl_Assert(ptr_ != gsl_nullptr); } gsl_api gsl_constexpr14 not_null_data &operator=(not_null_data const &other) { - gsl_Expects(other.ptr_ != gsl_nullptr); + gsl_Assert(other.ptr_ != gsl_nullptr); ptr_ = other.ptr_; return *this; } }; -#if gsl_CONFIG_DEFAULTS_VERSION >= 1 template struct not_null_data { @@ -2738,7 +2935,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { } }; -#endif // gsl_CONFIG_DEFAULTS_VERSION >= 1 + template struct is_copyable #if gsl_HAVE(TYPE_TRAITS) @@ -2759,26 +2956,59 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template struct not_null_accessor; + template + struct not_null_deref + { + typedef typename element_type_helper::type element_type; + + gsl_NODISCARD gsl_api gsl_constexpr14 element_type & + operator*() const + { + return *not_null_accessor::get_checked(static_cast(*this)); + } + }; + template + struct not_null_deref + { + }; + + template + struct is_void : std11::false_type + { + }; + template <> + struct is_void : std11::true_type + { + }; + + template + struct is_void_ptr : is_void::type> + { + }; + } // namespace detail template - class not_null + class + gsl_EMPTY_BASES_ // not strictly needed, but will become necessary if we add more base classes + not_null : public detail::not_null_deref, T, detail::is_void_ptr::value> { private: detail::not_null_data::value> data_; // need to access `not_null::data_` - template - friend class not_null; - template friend struct detail::not_null_accessor; + typedef detail::not_null_accessor accessor; + public: typedef typename detail::element_type_helper::type element_type; #if gsl_HAVE(TYPE_TRAITS) - static_assert(std::is_assignable::type>::type &, std::nullptr_t>::value, "T cannot be assigned nullptr."); + static_assert(!std::is_reference::value, "T may not be a reference type"); + static_assert(!std::is_const::value && !std::is_volatile::value, "T may not be cv-qualified"); + static_assert(std::is_assignable::value, "T cannot be assigned nullptr"); #endif #if gsl_CONFIG(NOT_NULL_EXPLICIT_CTOR) @@ -2848,7 +3078,6 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #endif // gsl_HAVE( MOVE_FORWARD ) #endif // gsl_CONFIG( NOT_NULL_EXPLICIT_CTOR ) - public: #if gsl_HAVE(MOVE_FORWARD) // In Clang 3.x, `is_constructible>, unique_ptr>` tries to instantiate the copy constructor of `unique_ptr<>`, triggering an error. // Note that Apple Clang's `__clang_major__` etc. are different from regular Clang. @@ -2858,9 +3087,8 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 , typename std::enable_if<(std::is_constructible::value && !std::is_convertible::value), int>::type = 0> gsl_api gsl_constexpr14 explicit not_null(not_null other) - : data_(T(std::move(other.data_.ptr_))) + : data_(T(detail::not_null_accessor::get_checked(std::move(other)))) { - gsl_Expects(data_.ptr_ != gsl_nullptr); } template ::value), int>::type = 0> gsl_api gsl_constexpr14 not_null(not_null other) - : data_(T(std::move(other.data_.ptr_))) + : data_(T(detail::not_null_accessor::get_checked(std::move(other)))) { - gsl_Expects(data_.ptr_ != gsl_nullptr); } #else // a.k.a. ! ( gsl_HAVE( TYPE_TRAITS ) && gsl_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG ) && ! gsl_BETWEEN( gsl_COMPILER_CLANG_VERSION, 1, 400 ) && ! gsl_BETWEEN( gsl_COMPILER_APPLECLANG_VERSION, 1, 1001 ) // If type_traits are not available, then we can't distinguish `is_convertible<>` and `is_constructible<>`, so we unconditionally permit implicit construction. template gsl_api gsl_constexpr14 not_null(not_null other) - : data_(T(std::move(other.data_.ptr_))) + : data_(T(detail::not_null_accessor::get_checked(std::move(other)))) { gsl_Expects(data_.ptr_ != gsl_nullptr); } template gsl_api gsl_constexpr14 not_null &operator=(not_null other) { - gsl_Expects(other.data_.ptr_ != gsl_nullptr); - data_.ptr_ = std::move(other.data_.ptr_); + data_.ptr_ = detail::not_null_accessor::get_checked(std::move(other)); return *this; } #endif // gsl_HAVE( TYPE_TRAITS ) && gsl_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG ) && ! gsl_BETWEEN( gsl_COMPILER_CLANG_VERSION, 1, 400 ) && ! gsl_BETWEEN( gsl_COMPILER_APPLECLANG_VERSION, 1, 1001 ) #else // a.k.a. ! gsl_HAVE( MOVE_FORWARD ) template gsl_api gsl_constexpr14 not_null(not_null const &other) - : data_(T(other.data_.ptr_)) + : data_(T(detail::not_null_accessor::get_checked(other))) { - gsl_Expects(data_.ptr_ != gsl_nullptr); } template gsl_api gsl_constexpr14 not_null &operator=(not_null const &other) { - gsl_Expects(other.data_.ptr_ != gsl_nullptr); - data_.ptr_ = other.data_.ptr_; + data_.ptr_ = detail::not_null_accessor::get_checked(other); return *this; } #endif // gsl_HAVE( MOVE_FORWARD ) @@ -2908,23 +3132,20 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 gsl_NODISCARD gsl_api gsl_constexpr14 element_type * get() const { - gsl_Assert(data_.ptr_ != gsl_nullptr); - return data_.ptr_.get(); + return accessor::get_checked(*this).get(); } #else #if gsl_CONFIG(NOT_NULL_GET_BY_CONST_REF) gsl_NODISCARD gsl_api gsl_constexpr14 T const & get() const { - gsl_Assert(data_.ptr_ != gsl_nullptr); - return data_.ptr_; + return accessor::get_checked(*this); } #else gsl_NODISCARD gsl_api gsl_constexpr14 T get() const { - gsl_Assert(data_.ptr_ != gsl_nullptr); - return data_.ptr_; + return accessor::get_checked(*this); } #endif #endif @@ -2971,8 +3192,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 & #endif { - gsl_Assert(data_.ptr_ != gsl_nullptr); - return U(data_.ptr_); + return U(accessor::get_checked(*this)); } #if gsl_HAVE(FUNCTION_REF_QUALIFIER) template () const { - gsl_Assert(data_.ptr_ != gsl_nullptr); - return data_.ptr_; - } - - gsl_NODISCARD gsl_api gsl_constexpr14 element_type & - operator*() const - { - gsl_Assert(data_.ptr_ != gsl_nullptr); - return *data_.ptr_; + return accessor::get_checked(*this); } #if gsl_HAVE(MOVE_FORWARD) // Visual C++ 2013 doesn't generate default move constructors, so we declare them explicitly. gsl_api gsl_constexpr14 not_null(not_null &&other) - gsl_noexcept_not_testing // we want to be nothrow-movable despite the precondition check + gsl_noexcept_not_testing // we want to be nothrow-movable despite the assertion : data_(std::move(other.data_)) { - gsl_Expects(data_.ptr_ != gsl_nullptr); } gsl_api gsl_constexpr14 not_null &operator=(not_null &&other) - gsl_noexcept_not_testing // we want to be nothrow-movable despite the precondition check + gsl_noexcept_not_testing // we want to be nothrow-movable despite the assertion { - gsl_Expects(other.data_.ptr_ != gsl_nullptr || &other == this); data_ = std::move(other.data_); return *this; } @@ -3062,7 +3268,8 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 gsl_api gsl_constexpr20 friend void swap(not_null &lhs, not_null &rhs) gsl_noexcept_not_testing // we want to be nothrow-swappable despite the precondition check { - gsl_Expects(lhs.data_.ptr_ != gsl_nullptr && rhs.data_.ptr_ != gsl_nullptr); + accessor::check(lhs); + accessor::check(rhs); using std::swap; swap(lhs.data_.ptr_, rhs.data_.ptr_); } @@ -3090,174 +3297,6 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 not_null &operator-=(std::ptrdiff_t) gsl_is_delete; void operator[](std::ptrdiff_t) const gsl_is_delete; }; -#if gsl_CONFIG_DEFAULTS_VERSION >= 1 - template - class not_null - { - private: - detail::not_null_data data_; - - // need to access `not_null::data_` - template - friend class not_null; - - template - friend struct detail::not_null_accessor; - - public: - typedef T element_type; - - gsl_api gsl_constexpr14 -#if gsl_CONFIG(NOT_NULL_EXPLICIT_CTOR) - explicit -#endif // gsl_CONFIG( NOT_NULL_EXPLICIT_CTOR ) - not_null(T *other) - : data_(other) - { - gsl_Expects(data_.ptr_ != gsl_nullptr); - } - -#if gsl_HAVE(MOVE_FORWARD) - // In Clang 3.x, `is_constructible>, unique_ptr>` tries to instantiate the copy constructor of `unique_ptr<>`, triggering an error. - // Note that Apple Clang's `__clang_major__` etc. are different from regular Clang. -#if gsl_HAVE(TYPE_TRAITS) && gsl_HAVE(DEFAULT_FUNCTION_TEMPLATE_ARG) && !gsl_BETWEEN(gsl_COMPILER_CLANG_VERSION, 1, 400) && !gsl_BETWEEN(gsl_COMPILER_APPLECLANG_VERSION, 1, 1001) - template ::value && !std::is_convertible::value), int>::type = 0> - gsl_api gsl_constexpr14 explicit not_null(not_null other) - : data_(static_cast(std::move(other.data_.ptr_))) - { - gsl_Expects(data_.ptr_ != gsl_nullptr); - } - - template ::value), int>::type = 0> - gsl_api gsl_constexpr14 not_null(not_null other) - : data_(std::move(other.data_.ptr_)) - { - gsl_Expects(data_.ptr_ != gsl_nullptr); - } -#else // a.k.a. ! ( gsl_HAVE( TYPE_TRAITS ) && gsl_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG ) && ! gsl_BETWEEN( gsl_COMPILER_CLANG_VERSION, 1, 400 ) && ! gsl_BETWEEN( gsl_COMPILER_APPLECLANG_VERSION, 1, 1001 ) - // If type_traits are not available, then we can't distinguish `is_convertible<>` and `is_constructible<>`, so we unconditionally permit implicit construction. - template - gsl_api gsl_constexpr14 not_null(not_null other) - : data_(std::move(other.data_.ptr_)) - { - gsl_Expects(data_.ptr_ != gsl_nullptr); - } - template - gsl_api gsl_constexpr14 not_null &operator=(not_null other) - { - gsl_Expects(other.data_.ptr_ != gsl_nullptr); - data_.ptr_ = std::move(other.data_.ptr_); - return *this; - } -#endif // gsl_HAVE( TYPE_TRAITS ) && gsl_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG ) && ! gsl_BETWEEN( gsl_COMPILER_CLANG_VERSION, 1, 400 ) && ! gsl_BETWEEN( gsl_COMPILER_APPLECLANG_VERSION, 1, 1001 ) -#else // a.k.a. ! gsl_HAVE( MOVE_FORWARD ) - template - gsl_api gsl_constexpr14 not_null(not_null const &other) - : data_(other.data_.ptr_) - { - gsl_Expects(data_.ptr_ != gsl_nullptr); - } - template - gsl_api gsl_constexpr14 not_null &operator=(not_null const &other) - { - gsl_Expects(other.data_.ptr_ != gsl_nullptr); - data_.ptr_ = other.data_.ptr_; - return *this; - } -#endif // gsl_HAVE( MOVE_FORWARD ) - -#if !gsl_CONFIG(TRANSPARENT_NOT_NULL) - gsl_NODISCARD gsl_api gsl_constexpr14 T * - get() const - { - return data_.ptr_; - } -#endif - -#if gsl_HAVE(TYPE_TRAITS) && gsl_HAVE(DEFAULT_FUNCTION_TEMPLATE_ARG) && gsl_HAVE(EXPLICIT) - // explicit conversion operator - template ::value && !std::is_convertible::value && !detail::is_not_null_or_bool_oracle::value), int>::type = 0> - gsl_NODISCARD gsl_api gsl_constexpr14 explicit - operator U() const - { - return U(data_.ptr_); - } - - // implicit conversion operator - template ::value && std::is_convertible::value && !detail::is_not_null_or_bool_oracle::value), int>::type = 0> - gsl_NODISCARD gsl_api gsl_constexpr14 - operator U() const - { - return data_.ptr_; - } -#else // a.k.a. #if !( gsl_HAVE( MOVE_FORWARD ) && gsl_HAVE( TYPE_TRAITS ) && gsl_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG ) && gsl_HAVE( EXPLICIT ) ) - template - gsl_NODISCARD gsl_api gsl_constexpr14 - operator U() const - { - return data_.ptr_; - } -#endif // gsl_HAVE( MOVE_FORWARD ) && gsl_HAVE( TYPE_TRAITS ) && gsl_HAVE( DEFAULT_FUNCTION_TEMPLATE_ARG ) && gsl_HAVE( EXPLICIT ) - - gsl_NODISCARD gsl_api gsl_constexpr14 T * - operator->() const - { - return data_.ptr_; - } - - gsl_NODISCARD gsl_api gsl_constexpr14 element_type & - operator*() const - { - return *data_.ptr_; - } - -#if gsl_HAVE(IS_DEFAULT) - gsl_constexpr14 not_null(not_null const &) = default; - gsl_constexpr14 not_null &operator=(not_null const &) = default; -#endif - - gsl_api gsl_constexpr20 friend void swap(not_null &lhs, not_null &rhs) gsl_noexcept - { - using std::swap; - swap(lhs.data_.ptr_, rhs.data_.ptr_); - } - - gsl_is_delete_access : not_null() gsl_is_delete; - // prevent compilation when initialized with a nullptr or literal 0: -#if gsl_HAVE(NULLPTR) - not_null(std::nullptr_t) gsl_is_delete; - not_null &operator=(std::nullptr_t) gsl_is_delete; -#else - not_null(int) gsl_is_delete; - not_null &operator=(int) gsl_is_delete; -#endif - - // unwanted operators...pointers only point to single objects! - not_null &operator++() gsl_is_delete; - not_null &operator--() gsl_is_delete; - not_null operator++(int) gsl_is_delete; - not_null operator--(int) gsl_is_delete; - not_null &operator+(size_t) gsl_is_delete; - not_null &operator+=(size_t) gsl_is_delete; - not_null &operator-(size_t) gsl_is_delete; - not_null &operator-=(size_t) gsl_is_delete; - not_null &operator+=(std::ptrdiff_t) gsl_is_delete; - not_null &operator-=(std::ptrdiff_t) gsl_is_delete; - void operator[](std::ptrdiff_t) const gsl_is_delete; - }; -#endif // gsl_CONFIG_DEFAULTS_VERSION >= 1 #if gsl_HAVE(DEDUCTION_GUIDES) template not_null(U) -> not_null; @@ -3298,6 +3337,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + template struct as_nullable_helper { @@ -3316,15 +3356,53 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { return std::move(p.data_.ptr_); } + static gsl_api T get_checked(not_null &&p) + { + gsl_Assert(p.data_.ptr_ != gsl_nullptr); + return std::move(p.data_.ptr_); + } #endif static gsl_api T const &get(not_null const &p) gsl_noexcept { return p.data_.ptr_; } + static gsl_api bool is_valid(not_null const &p) gsl_noexcept + { + return p.data_.ptr_ != gsl_nullptr; + } + static gsl_api void check(not_null const &p) + { + gsl_Assert(p.data_.ptr_ != gsl_nullptr); + } + static gsl_api T const &get_checked(not_null const &p) + { + gsl_Assert(p.data_.ptr_ != gsl_nullptr); + return p.data_.ptr_; + } + }; + template + struct not_null_accessor + { + static gsl_api T *const &get(not_null const &p) gsl_noexcept + { + return p.data_.ptr_; + } + static gsl_api bool is_valid(not_null const & /*p*/) gsl_noexcept + { + return true; + } + static gsl_api void check(not_null const & /*p*/) + { + } + static gsl_api T *const &get_checked(not_null const &p) gsl_noexcept + { + return p.data_.ptr_; + } }; namespace no_adl { + #if gsl_HAVE(MOVE_FORWARD) template gsl_NODISCARD gsl_api gsl_constexpr auto as_nullable(T &&p) @@ -3336,9 +3414,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api gsl_constexpr14 T as_nullable(not_null &&p) { - T result = detail::not_null_accessor::get(std::move(p)); - gsl_Expects(result != gsl_nullptr); - return result; + return detail::not_null_accessor::get_checked(std::move(p)); } #else // ! gsl_HAVE( MOVE_FORWARD ) template @@ -3351,28 +3427,14 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 gsl_NODISCARD gsl_api gsl_constexpr14 T const & as_nullable(not_null const &p) { - T const &result = detail::not_null_accessor::get(p); - gsl_Expects(result != gsl_nullptr); - return result; - } - template - gsl_NODISCARD gsl_api gsl_constexpr T * - as_nullable(not_null p) gsl_noexcept - { - return detail::not_null_accessor::get(p); + return detail::not_null_accessor::get_checked(p); } template gsl_NODISCARD gsl_api gsl_constexpr bool is_valid(not_null const &p) { - return detail::not_null_accessor::get(p) != gsl_nullptr; - } - template - gsl_NODISCARD gsl_api gsl_constexpr bool - is_valid(not_null const &) - { - return true; + return detail::not_null_accessor::is_valid(p); } } // namespace no_adl @@ -3390,8 +3452,8 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 gsl_ENABLE_IF_((std::is_constructible::value))> gsl_api gsl_constexpr14 #if gsl_HAVE(MOVE_FORWARD) - not_null_ic(U &&u) - : not_null(std::forward(u)) + not_null_ic(U u) + : not_null(std::move(u)) #else // ! gsl_HAVE( MOVE_FORWARD ) not_null_ic(U const &u) : not_null(u) @@ -3453,6 +3515,14 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 return l == r.operator->(); } + // The C++ Core Guidelines discourage the use of pointer arithmetic, and gsl-lite consequently refrains from defining operators + // for pointer arithmetic or the subscript operator in `not_null<>`. However, comparison of `not_null<>` objects is supported; + // although the standard does not mandate a certain ordering for objects with two exceptions (objects from the same array; + // data members of the same class, as required for `offsetof()`), it does require that `operator<` establishes a total ordering + // of pointers, as implied by https://eel.is/c++draft/expr.rel#5. Among other things, this guarantees that a list of pointers + // can be sorted and searched, or that pointers can be used as a key in a relational container such as `std::map<>`. + // Therefore, we also define relational comparison operators for `not_null<>`. + template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator<(not_null const &l, not_null const &r) @@ -3779,6 +3849,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + template gsl_api gsl_constexpr14 T *endptr(T *data, gsl_CONFIG_SPAN_INDEX_TYPE size) { @@ -4363,6 +4434,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + template gsl_api gsl_constexpr14 inline OI copy_n(II first, N count, OI result) { @@ -4425,14 +4497,14 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr span - make_span(T * first, T * last) + make_span(T * first, T * last) { return span(first, last); } template gsl_NODISCARD inline gsl_constexpr span - make_span(T(&arr)[N]) + make_span(T(&arr)[N]) { return span(gsl_ADDRESSOF(arr[0]), N); } @@ -4441,7 +4513,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD inline gsl_constexpr span - make_span(std::array & arr) + make_span(std::array & arr) { return span(arr); } @@ -4458,8 +4530,8 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ()))> gsl_NODISCARD inline gsl_constexpr auto - make_span(Container & cont) - ->span::type> + make_span(Container & cont) + ->span::type> { return span::type>(cont); } @@ -4476,7 +4548,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template inline span - make_span(std::vector & cont) + make_span(std::vector & cont) { return span(with_container, cont); } @@ -4493,7 +4565,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD inline gsl_constexpr span - make_span(with_container_t, Container & cont) gsl_noexcept + make_span(with_container_t, Container & cont) gsl_noexcept { return span(with_container, cont); } @@ -4510,7 +4582,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if !gsl_DEPRECATE_TO_LEVEL(4) template gsl_DEPRECATED inline span - make_span(Ptr & ptr) + make_span(Ptr & ptr) { return span(ptr); } @@ -4529,7 +4601,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr span - byte_span(T & t) gsl_noexcept + byte_span(T & t) gsl_noexcept { return span(reinterpret_cast(&t), sizeof(T)); } @@ -4543,8 +4615,9 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #endif // gsl_FEATURE_TO_STD( BYTE_SPAN ) + // #if gsl_FEATURE( STRING_SPAN ) // - // basic_string_span: + // basic_string_span: // template @@ -4552,6 +4625,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 namespace detail { + template struct is_basic_string_span_oracle : std11::false_type { @@ -4609,9 +4683,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_HAVE(IS_DEFAULT) gsl_constexpr basic_string_span() gsl_noexcept = default; #else - gsl_api gsl_constexpr basic_string_span() gsl_noexcept - { - } + gsl_api gsl_constexpr basic_string_span() gsl_noexcept {} #endif #if gsl_HAVE(NULLPTR) @@ -4624,24 +4696,35 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #ifdef __CUDACC_RELAXED_CONSTEXPR__ gsl_api #endif // __CUDACC_RELAXED_CONSTEXPR__ - gsl_constexpr - basic_string_span(pointer ptr) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(pointer ptr) : span_(remove_z(ptr, (std::numeric_limits::max)())) { } - gsl_api gsl_constexpr basic_string_span(pointer ptr, index_type count) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_api gsl_constexpr basic_string_span(pointer ptr, index_type count) : span_(ptr, count) { } - gsl_api gsl_constexpr basic_string_span(pointer firstElem, pointer lastElem) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_api gsl_constexpr basic_string_span(pointer firstElem, pointer lastElem) : span_(firstElem, lastElem) { } template - gsl_constexpr basic_string_span(element_type (&arr)[N]) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(element_type (&arr)[N]) : span_(remove_z(gsl_ADDRESSOF(arr[0]), N)) { } @@ -4649,13 +4732,19 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_HAVE(ARRAY) template - gsl_constexpr basic_string_span(std::array::type, N> &arr) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(std::array::type, N> &arr) : span_(remove_z(arr)) { } template - gsl_constexpr basic_string_span(std::array::type, N> const &arr) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(std::array::type, N> const &arr) : span_(remove_z(arr)) { } @@ -4669,7 +4758,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ::value && !detail::is_basic_string_span::value && std::is_convertible::value && std::is_convertible().data())>::value))> - gsl_constexpr basic_string_span(Container &cont) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(Container &cont) : span_((cont)) { } @@ -4679,7 +4771,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ::value && !detail::is_basic_string_span::value && std::is_convertible::value && std::is_convertible().data())>::value))> - gsl_constexpr basic_string_span(Container const &cont) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(Container const &cont) : span_((cont)) { } @@ -4687,13 +4782,19 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #elif gsl_HAVE(UNCONSTRAINED_SPAN_CONTAINER_CTOR) template - gsl_constexpr basic_string_span(Container &cont) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(Container &cont) : span_(cont) { } template - gsl_constexpr basic_string_span(Container const &cont) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(Container const &cont) : span_(cont) { } @@ -4701,7 +4802,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #else template - gsl_api gsl_constexpr basic_string_span(span const &rhs) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_api gsl_constexpr basic_string_span(span const &rhs) : span_(rhs) { } @@ -4711,7 +4815,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_FEATURE_TO_STD(WITH_CONTAINER) template - gsl_constexpr basic_string_span(with_container_t, Container &cont) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span(with_container_t, Container &cont) : span_(with_container, cont) { } @@ -4731,7 +4838,10 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ::pointer, pointer>::value))> - gsl_api gsl_constexpr basic_string_span(basic_string_span const &rhs) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_api gsl_constexpr basic_string_span(basic_string_span const &rhs) : span_(reinterpret_cast(rhs.data()), rhs.length()) // NOLINT { } @@ -4739,22 +4849,31 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_STDLIB_CPP11_120 template ::pointer, pointer>::value))> - gsl_api gsl_constexpr basic_string_span(basic_string_span &&rhs) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_api gsl_constexpr basic_string_span(basic_string_span &&rhs) : span_(reinterpret_cast(rhs.data()), rhs.length()) // NOLINT { } #endif // gsl_STDLIB_CPP11_120 template - gsl_constexpr basic_string_span( - std::basic_string::type, CharTraits, Allocator> &str) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span( + std::basic_string::type, CharTraits, Allocator> &str) : span_(gsl_ADDRESSOF(str[0]), str.length()) { } template - gsl_constexpr basic_string_span( - std::basic_string::type, CharTraits, Allocator> const &str) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_string_span<><> is deprecated; use span<> instead") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_constexpr basic_string_span( + std::basic_string::type, CharTraits, Allocator> const &str) : span_(gsl_ADDRESSOF(str[0]), str.length()) { } @@ -4987,7 +5106,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } #endif -#else //gsl_CONFIG( ALLOWS_NONSTRICT_SPAN_COMPARISON ) +#else // gsl_CONFIG( ALLOWS_NONSTRICT_SPAN_COMPARISON ) template gsl_SUPPRESS_MSGSL_WARNING(stl .1) @@ -5089,6 +5208,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 { return span(reinterpret_cast(spn.data()), spn.size_bytes()); // NOLINT } + // #endif // gsl_FEATURE( STRING_SPAN ) // // String types: @@ -5102,6 +5222,8 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 typedef const wchar_t *cwzstring; #endif + // #if gsl_FEATURE( STRING_SPAN ) + typedef basic_string_span string_span; typedef basic_string_span cstring_span; @@ -5157,6 +5279,7 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic namespace detail { + template void write_padding(Stream &os, std::streamsize n) { @@ -5222,6 +5345,7 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic } #endif // gsl_HAVE( WCHAR ) + // #endif // gsl_FEATURE( STRING_SPAN ) // // ensure_sentinel() @@ -5233,6 +5357,7 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic // namespace detail { + template gsl_constexpr14 static span ensure_sentinel(T *seq, SizeType max = (std::numeric_limits::max)()) { @@ -5265,7 +5390,7 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic template gsl_NODISCARD inline gsl_constexpr14 span - ensure_z(T(&sz)[N]) + ensure_z(T(&sz)[N]) { return ::gsl::ensure_z(gsl_ADDRESSOF(sz[0]), N); } @@ -5274,14 +5399,15 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic template gsl_NODISCARD inline gsl_constexpr14 span::type> - ensure_z(Container & cont) + ensure_z(Container & cont) { return ::gsl::ensure_z(cont.data(), cont.length()); } #endif + // #if gsl_FEATURE( STRING_SPAN ) // - // basic_zstring_span<> - A view of contiguous null-terminated characters, replace (*,len). + // basic_zstring_span<> - A view of contiguous null-terminated characters, replace (*,len). // template @@ -5297,7 +5423,10 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic typedef element_type *czstring_type; typedef basic_string_span string_span_type; - gsl_api gsl_constexpr14 basic_zstring_span(span_type s) +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_zstring_span<> is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_api gsl_constexpr14 basic_zstring_span(span_type s) : span_(s) { // expects a zero-terminated span @@ -5310,9 +5439,7 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic gsl_constexpr14 basic_zstring_span &operator=(basic_zstring_span const &) = default; gsl_constexpr14 basic_zstring_span &operator=(basic_zstring_span &&) = default; #else - gsl_api gsl_constexpr basic_zstring_span(basic_zstring_span const &other) : span_(other.span_) - { - } + gsl_api gsl_constexpr basic_zstring_span(basic_zstring_span const &other) : span_(other.span_) {} gsl_api gsl_constexpr basic_zstring_span &operator=(basic_zstring_span const &other) { span_ = other.span_; @@ -5326,15 +5453,21 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic return false; } - gsl_NODISCARD gsl_api gsl_constexpr string_span_type - as_string_span() const gsl_noexcept +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_zstring_span<> is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + gsl_NODISCARD gsl_api gsl_constexpr string_span_type + as_string_span() const gsl_noexcept { return string_span_type(span_.data(), span_.size() - 1); } - /*gsl_api*/ // currently disabled due to an apparent NVCC bug - gsl_NODISCARD gsl_constexpr string_span_type - ensure_z() const +#if gsl_DEPRECATE_TO_LEVEL(7) + gsl_DEPRECATED_MSG("basic_zstring_span<> is deprecated") +#endif // gsl_DEPRECATE_TO_LEVEL( 7 ) + /*gsl_api*/ // currently disabled due to an apparent NVCC bug + gsl_NODISCARD gsl_constexpr string_span_type + ensure_z() const { return ::gsl::ensure_z(span_.data(), span_.size()); } @@ -5360,6 +5493,7 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic typedef basic_zstring_span wzstring_span; typedef basic_zstring_span cwzstring_span; #endif + // #endif // gsl_FEATURE( STRING_SPAN ) } // namespace gsl @@ -5371,8 +5505,10 @@ inline std::basic_string< typename std::remove_const::type > to_string( basic namespace gsl { + namespace detail { + // // Helper struct for std::hash specializations // @@ -5399,11 +5535,12 @@ struct conditionally_enabled_hash namespace std { + template struct hash<::gsl::not_null> : public ::gsl::detail::conditionally_enabled_hash>::value> { public: - gsl_NODISCARD gsl_constexpr std::size_t + gsl_NODISCARD std::size_t operator()(::gsl::not_null const &v) const // hash function is not `noexcept` because `as_nullable()` has preconditions { @@ -5414,7 +5551,7 @@ template struct hash<::gsl::not_null> { public: - gsl_NODISCARD gsl_constexpr std::size_t + gsl_NODISCARD std::size_t operator()(::gsl::not_null const &v) const gsl_noexcept { return hash()(::gsl::as_nullable(v)); @@ -5425,9 +5562,14 @@ template <> struct hash<::gsl::byte> { public: - gsl_NODISCARD gsl_constexpr std::size_t operator()(::gsl::byte v) const gsl_noexcept + gsl_NODISCARD std::size_t operator()(::gsl::byte v) const gsl_noexcept { +#if gsl_CONFIG_DEFAULTS_VERSION >= 1 + return std::hash{}(::gsl::to_uchar(v)); +#else // gsl_CONFIG_DEFAULTS_VERSION < 1 + // Keep the old hashing algorithm if legacy defaults are used. return ::gsl::to_integer(v); +#endif // gsl_CONFIG_DEFAULTS_VERSION >= 1 } }; @@ -5462,15 +5604,18 @@ public: namespace gsl_lite { + namespace std11 = ::gsl::std11; namespace std14 = ::gsl::std14; namespace std17 = ::gsl::std17; namespace std20 = ::gsl::std20; +namespace std23 = ::gsl::std23; using namespace std11; -//using namespace std14; // contains only make_unique<>(), which is superseded by `gsl::make_unique<>()` +// using namespace std14; // contains only make_unique<>(), which is superseded by `gsl::make_unique<>()` using namespace std17; using namespace std20; +using namespace std23; using namespace ::gsl::detail::no_adl; @@ -5541,6 +5686,7 @@ using ::gsl::span; using ::gsl::as_writeable_bytes; #endif +// # if gsl_FEATURE( STRING_SPAN ) using ::gsl::basic_string_span; using ::gsl::cstring_span; using ::gsl::string_span; @@ -5548,6 +5694,7 @@ using ::gsl::string_span; using ::gsl::basic_zstring_span; using ::gsl::czstring_span; using ::gsl::zstring_span; +// # endif // gsl_FEATURE( STRING_SPAN ) using ::gsl::czstring; using ::gsl::zstring; @@ -5556,8 +5703,10 @@ using ::gsl::zstring; using ::gsl::cwzstring; using ::gsl::wzstring; +// # if gsl_FEATURE( STRING_SPAN ) using ::gsl::cwzstring_span; using ::gsl::wzstring_span; +// # endif // gsl_FEATURE( STRING_SPAN ) #endif // gsl_HAVE( WCHAR ) using ::gsl::ensure_z; @@ -5567,6 +5716,12 @@ using ::gsl::ensure_z; #endif // gsl_FEATURE( GSL_LITE_NAMESPACE ) gsl_RESTORE_MSVC_WARNINGS() +#if gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION +#pragma clang diagnostic pop +#endif // gsl_COMPILER_CLANG_VERSION || gsl_COMPILER_APPLECLANG_VERSION +#if gsl_COMPILER_GNUC_VERSION +#pragma GCC diagnostic pop +#endif // gsl_COMPILER_GNUC_VERSION // #undef internal macros #undef gsl_STATIC_ASSERT_ From 3b513752b317f2bccd4e6a92daed443685f46f18 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 Nov 2024 11:19:30 +0100 Subject: [PATCH 427/499] In HAS data printer, only print Cell Mask when there are bias data --- src/algorithms/PVT/libs/has_simple_printer.cc | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/algorithms/PVT/libs/has_simple_printer.cc b/src/algorithms/PVT/libs/has_simple_printer.cc index e05c55f1f..5bf4ca9c8 100644 --- a/src/algorithms/PVT/libs/has_simple_printer.cc +++ b/src/algorithms/PVT/libs/has_simple_printer.cc @@ -213,26 +213,29 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) } d_has_file << indent << indent << "Cell Mask Availability Flag: " << print_vector(has_data->cell_mask_availability_flag) << '\n'; - for (uint8_t i = 0; i < has_data->Nsys; i++) + if (has_data->header.code_bias_flag == true || has_data->header.phase_bias_flag == true) { - if (has_data->cell_mask_availability_flag[i] == true) + for (uint8_t i = 0; i < has_data->Nsys; i++) { - std::string text; - if (has_data->gnss_id_mask[i] == 0) + if (has_data->cell_mask_availability_flag[i] == true) { - text = "Cell Mask for GPS: "; + std::string text; + if (has_data->gnss_id_mask[i] == 0) + { + text = "Cell Mask for GPS: "; + } + else if (has_data->gnss_id_mask[i] == 2) + { + text = "Cell Mask for Galileo: "; + } + else + { + text = "Cell Mask for Reserved: "; + } + d_has_file << indent << indent << text; + const std::string filler(indent.length() * 2 + text.length(), ' '); + d_has_file << print_matrix(has_data->cell_mask[i], filler); } - else if (has_data->gnss_id_mask[i] == 2) - { - text = "Cell Mask for Galileo: "; - } - else - { - text = "Cell Mask for Reserved: "; - } - d_has_file << indent << indent << text; - const std::string filler(indent.length() * 2 + text.length(), ' '); - d_has_file << print_matrix(has_data->cell_mask[i], filler); } } d_has_file << indent << indent << "Nav message: " << print_vector(has_data->nav_message) << " (0: GPS LNAV or Galileo I/NAV)\n"; From 36b30093e7f897289f67ea0cce566688817cbc13 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 5 Nov 2024 11:56:26 +0100 Subject: [PATCH 428/499] In HAS data printer, provide validity intervals in seconds --- src/algorithms/PVT/libs/has_simple_printer.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/algorithms/PVT/libs/has_simple_printer.cc b/src/algorithms/PVT/libs/has_simple_printer.cc index 5bf4ca9c8..01cb7143d 100644 --- a/src/algorithms/PVT/libs/has_simple_printer.cc +++ b/src/algorithms/PVT/libs/has_simple_printer.cc @@ -245,7 +245,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << '\n'; d_has_file << indent << indent << "Orbit Corrections Block\n"; d_has_file << indent << indent << "-----------------------\n"; - d_has_file << indent << indent << "Validity interval: " << static_cast(has_data->validity_interval_index_orbit_corrections) << '\n'; + d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_orbit_corrections)) << '\n'; d_has_file << indent << indent << "GNSS IOD: " << print_vector(has_data->gnss_iod) << '\n'; d_has_file << indent << indent << "Delta Radial [m]: " << print_vector(has_data->delta_radial, HAS_MSG_DELTA_RADIAL_SCALE_FACTOR) << '\n'; d_has_file << indent << indent << "Delta In-Track [m]: " << print_vector(has_data->delta_in_track, HAS_MSG_DELTA_IN_TRACK_SCALE_FACTOR) << '\n'; @@ -257,7 +257,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << '\n'; d_has_file << indent << indent << "Clock Full-set Corrections Block\n"; d_has_file << indent << indent << "--------------------------------\n"; - d_has_file << indent << indent << "Validity interval: " << static_cast(has_data->validity_interval_index_clock_fullset_corrections) << '\n'; + d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_clock_fullset_corrections)) << '\n'; d_has_file << indent << indent << "Delta Clock Multiplier: " << print_vector(has_data->delta_clock_multiplier) << '\n'; d_has_file << indent << indent << "Delta Clock Correction [m]: " << print_vector(has_data->delta_clock_correction, HAS_MSG_DELTA_CLOCK_SCALE_FACTOR) << '\n'; } @@ -267,7 +267,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << '\n'; d_has_file << indent << indent << "Clock Subset Corrections Block\n"; d_has_file << indent << indent << "------------------------------\n"; - d_has_file << indent << indent << "Validity interval: " << static_cast(has_data->validity_interval_index_clock_subset_corrections) << '\n'; + d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_clock_subset_corrections)) << '\n'; d_has_file << indent << indent << "Nsys_sub: " << static_cast(has_data->Nsys_sub) << '\n'; d_has_file << indent << indent << "GNSS ID: " << print_vector(has_data->gnss_id_clock_subset) << '\n'; d_has_file << indent << indent << "Delta Clock Multiplier: " << print_vector(has_data->delta_clock_multiplier_clock_subset) << '\n'; @@ -313,7 +313,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << '\n'; d_has_file << indent << indent << "Code Bias Block\n"; d_has_file << indent << indent << "---------------\n"; - d_has_file << indent << indent << "Validity interval: " << static_cast(has_data->validity_interval_index_code_bias_corrections) << '\n'; + d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_code_bias_corrections)) << '\n'; const std::string text("Code bias [m]: "); const std::string filler(indent.length() * 2 + text.length(), ' '); d_has_file << indent << indent << text << print_matrix(has_data->code_bias, filler, HAS_MSG_CODE_BIAS_SCALE_FACTOR); @@ -324,7 +324,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << '\n'; d_has_file << indent << indent << "Phase Bias Block\n"; d_has_file << indent << indent << "----------------\n"; - d_has_file << indent << indent << "Validity interval: " << static_cast(has_data->validity_interval_index_phase_bias_corrections) << '\n'; + d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_phase_bias_corrections)) << '\n'; const std::string text("Phase bias [cycles]: "); const std::string filler(indent.length() * 2 + text.length(), ' '); d_has_file << indent << indent << text << print_matrix(has_data->phase_bias, filler, HAS_MSG_PHASE_BIAS_SCALE_FACTOR); From 7cd99e4b2b4157274b35bad8d7b522bdfd55e1e4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 7 Nov 2024 13:02:00 +0100 Subject: [PATCH 429/499] Print IODref in clock correction HAS message --- src/algorithms/PVT/libs/has_simple_printer.cc | 6 +++++- src/core/libs/galileo_e6_has_msg_receiver.cc | 6 ++++++ src/core/libs/galileo_e6_has_msg_receiver.h | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/has_simple_printer.cc b/src/algorithms/PVT/libs/has_simple_printer.cc index 01cb7143d..d57aeb281 100644 --- a/src/algorithms/PVT/libs/has_simple_printer.cc +++ b/src/algorithms/PVT/libs/has_simple_printer.cc @@ -246,7 +246,7 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << indent << indent << "Orbit Corrections Block\n"; d_has_file << indent << indent << "-----------------------\n"; d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_orbit_corrections)) << '\n'; - d_has_file << indent << indent << "GNSS IOD: " << print_vector(has_data->gnss_iod) << '\n'; + d_has_file << indent << indent << "GNSS IODref: " << print_vector(has_data->gnss_iod) << '\n'; d_has_file << indent << indent << "Delta Radial [m]: " << print_vector(has_data->delta_radial, HAS_MSG_DELTA_RADIAL_SCALE_FACTOR) << '\n'; d_has_file << indent << indent << "Delta In-Track [m]: " << print_vector(has_data->delta_in_track, HAS_MSG_DELTA_IN_TRACK_SCALE_FACTOR) << '\n'; d_has_file << indent << indent << "Delta Cross Track [m]: " << print_vector(has_data->delta_cross_track, HAS_MSG_DELTA_CROSS_TRACK_SCALE_FACTOR) << '\n'; @@ -258,6 +258,10 @@ bool Has_Simple_Printer::print_message(const Galileo_HAS_data* const has_data) d_has_file << indent << indent << "Clock Full-set Corrections Block\n"; d_has_file << indent << indent << "--------------------------------\n"; d_has_file << indent << indent << "Validity interval [s]: " << static_cast(has_data->get_validity_interval_s(has_data->validity_interval_index_clock_fullset_corrections)) << '\n'; + if (!has_data->gnss_iod.empty()) + { + d_has_file << indent << indent << "GNSS IODref: " << print_vector(has_data->gnss_iod) << '\n'; + } d_has_file << indent << indent << "Delta Clock Multiplier: " << print_vector(has_data->delta_clock_multiplier) << '\n'; d_has_file << indent << indent << "Delta Clock Correction [m]: " << print_vector(has_data->delta_clock_correction, HAS_MSG_DELTA_CLOCK_SCALE_FACTOR) << '\n'; } diff --git a/src/core/libs/galileo_e6_has_msg_receiver.cc b/src/core/libs/galileo_e6_has_msg_receiver.cc index db0dc3fd7..250e599a4 100644 --- a/src/core/libs/galileo_e6_has_msg_receiver.cc +++ b/src/core/libs/galileo_e6_has_msg_receiver.cc @@ -635,6 +635,7 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body) } } + d_iod_ref_map[std::make_pair(d_HAS_data.header.iod_set_id, d_HAS_data.header.mask_id)] = d_HAS_data.gnss_iod; DLOG(INFO) << debug_print_vector("gnss_iod", d_HAS_data.gnss_iod); DLOG(INFO) << debug_print_vector("delta_radial", d_HAS_data.delta_radial); DLOG(INFO) << debug_print_vector("delta_in_track", d_HAS_data.delta_in_track); @@ -660,6 +661,11 @@ void galileo_e6_has_msg_receiver::read_MT1_body(const std::string& message_body) d_HAS_data.delta_clock_correction[i] = read_has_message_body_int16(message.substr(0, HAS_MSG_DELTA_CLOCK_CORRECTION_LENGTH)); message = std::string(message.begin() + HAS_MSG_DELTA_CLOCK_CORRECTION_LENGTH, message.end()); } + auto ref_it = d_iod_ref_map.find(std::make_pair(d_HAS_data.header.iod_set_id, d_HAS_data.header.mask_id)); + if (ref_it != d_iod_ref_map.end()) + { + d_HAS_data.gnss_iod = ref_it->second; + } DLOG(INFO) << debug_print_vector("delta_clock_multiplier", d_HAS_data.delta_clock_multiplier); DLOG(INFO) << debug_print_vector("delta_clock_correction", d_HAS_data.delta_clock_correction); diff --git a/src/core/libs/galileo_e6_has_msg_receiver.h b/src/core/libs/galileo_e6_has_msg_receiver.h index e564ecdc7..8c42c806b 100644 --- a/src/core/libs/galileo_e6_has_msg_receiver.h +++ b/src/core/libs/galileo_e6_has_msg_receiver.h @@ -28,6 +28,7 @@ #include // for pmt::pmt_t #include #include +#include #include // for std::unique_ptr #include #include // std::pair @@ -108,6 +109,8 @@ private: std::vector d_nsys_in_mask; std::vector> d_nav_message_mask; + std::map, std::vector> d_iod_ref_map; + uint8_t d_current_has_status{}; uint8_t d_current_message_id{}; bool d_new_message{}; From 61fa9ac3f1a47cca16fe358b27a485007f13ac5f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 11 Nov 2024 21:28:30 +0100 Subject: [PATCH 430/499] Bump max CMake version to 3.31 --- CMakeLists.txt | 2 +- .../libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e55d3c68..b759c5fc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.30) +cmake_minimum_required(VERSION 2.8.12...3.31) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index e567eab94..51ad77d57 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.30) +cmake_minimum_required(VERSION 2.8.12...3.31) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel") project(volk_gnsssdr) enable_language(CXX) From 2a7df20a2cb9859b9be8322f8350383364f7d740 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 11 Nov 2024 22:35:00 +0100 Subject: [PATCH 431/499] Report root path and version of Abseil if found --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b759c5fc3..9e78eec3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1477,6 +1477,9 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.24 set_package_properties(absl PROPERTIES DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library (found: v${absl_VERSION})" ) + get_target_property(ABSL_BASE_LIBRARY absl::base INTERFACE_INCLUDE_DIRECTORIES) + get_filename_component(ABSL_ROOT_PATH "${ABSL_BASE_LIBRARY}" DIRECTORY) + message(STATUS "Found Abseil C++ libraries installed at ${ABSL_ROOT_PATH} (found version: v${absl_VERSION})") else() set_package_properties(absl PROPERTIES DESCRIPTION "A collection of C++ library code designed to augment the C++ standard library" From 9f0172db4fc0b141a3c82d1b74c630b15b31269d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 27 Nov 2024 21:32:33 +0100 Subject: [PATCH 432/499] Bump local version of Protocol Buffers to 29.0 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9e78eec3b..a641d4cbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,7 +360,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "28.2") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") From aaa838baecd274e247eaeee5dcae31e83e0ae1ec Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 28 Nov 2024 20:09:55 +0100 Subject: [PATCH 433/499] Bump local version of Google Benchmark to 1.9.1 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a641d4cbe..6ad5e1c20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -365,7 +365,7 @@ set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.0") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.1") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) From 0db72cad96cd53399c8275c47b9f5f57967a2fd1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 29 Nov 2024 13:04:26 +0100 Subject: [PATCH 434/499] Fix warning raised by GCC 14 (-Wfree-nonheap-object) --- src/core/libs/osnma_msg_receiver.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 9e07f998c..1999a0cbb 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1327,13 +1327,8 @@ std::vector osnma_msg_receiver::get_merkle_tree_leaves(const DSM_PKR_me { // build base leaf m_i according to OSNMA SIS ICD v1.1, section 6.2 DSM-PKR Verification std::vector m_i; - const size_t size_npk = dsm_pkr_message.npk.size(); - m_i.reserve(1 + size_npk); - m_i.push_back((dsm_pkr_message.npkt << 4) + dsm_pkr_message.npktid); - for (size_t i = 0; i < size_npk; i++) - { - m_i.push_back(dsm_pkr_message.npk[i]); - } + m_i.push_back(static_cast((dsm_pkr_message.npkt << 4) + dsm_pkr_message.npktid)); + m_i.insert(m_i.end(), dsm_pkr_message.npk.begin(), dsm_pkr_message.npk.end()); return m_i; } From 84e85111c5f51d175528d54690b6c6caa6a12274 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 19 Dec 2024 09:26:19 +0100 Subject: [PATCH 435/499] Tests should fail, not die --- tests/unit-tests/control-plane/control_thread_test.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit-tests/control-plane/control_thread_test.cc b/tests/unit-tests/control-plane/control_thread_test.cc index 9aa6d3620..925ff9e57 100644 --- a/tests/unit-tests/control-plane/control_thread_test.cc +++ b/tests/unit-tests/control-plane/control_thread_test.cc @@ -21,6 +21,7 @@ #include "command_event.h" #include "concurrent_queue.h" #include "control_thread.h" +#include "gnss_sdr_filesystem.h" #include "gnss_sdr_make_unique.h" #include "in_memory_configuration.h" #include @@ -111,6 +112,8 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages /*unused*/) config->set_property("PVT.item_type", "gr_complex"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); + ASSERT_TRUE(fs::exists(file)); + std::shared_ptr control_thread = std::make_shared(config); std::shared_ptr> control_queue = std::make_shared>(); @@ -170,6 +173,8 @@ TEST_F(ControlThreadTest /*unused*/, InstantiateRunControlMessages2 /*unused*/) config->set_property("PVT.item_type", "gr_complex"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); + ASSERT_TRUE(fs::exists(file)); + auto control_thread2 = std::make_unique(config); std::shared_ptr> control_queue2 = std::make_shared>(); @@ -232,6 +237,8 @@ TEST_F(ControlThreadTest /*unused*/, StopReceiverProgrammatically /*unused*/) config->set_property("PVT.item_type", "gr_complex"); config->set_property("GNSS-SDR.internal_fs_sps", "4000000"); + ASSERT_TRUE(fs::exists(file)); + std::shared_ptr control_thread = std::make_shared(config); std::shared_ptr> control_queue = std::make_shared>(); control_thread->set_control_queue(control_queue); From 91584478920ddb9ea52a444fe456390db56ac28a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 20 Dec 2024 22:09:52 +0100 Subject: [PATCH 436/499] Fix linking against Boost 1.87 CI: add boost in homebrew dependencies --- .github/workflows/main.yml | 7 ++--- README.md | 2 +- docs/CHANGELOG.md | 1 + src/algorithms/PVT/libs/CMakeLists.txt | 15 ++++++++++ .../PVT/libs/monitor_ephemeris_udp_sink.cc | 4 +++ .../PVT/libs/monitor_pvt_udp_sink.cc | 4 +++ src/algorithms/PVT/libs/rtcm.h | 29 +++++++++++++++++++ .../gnuradio_blocks/CMakeLists.txt | 8 +++++ .../rtl_tcp_signal_source_c.cc | 8 +++-- src/core/libs/CMakeLists.txt | 8 +++++ src/core/libs/nav_message_udp_sink.cc | 4 +++ src/core/monitor/CMakeLists.txt | 8 +++++ src/core/monitor/gnss_synchro_udp_sink.cc | 4 +++ 13 files changed, 95 insertions(+), 7 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a581109c9..dd27401a5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -59,7 +59,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf + brew install ninja hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf boost pip3 install mako - name: configure run: cmake -S . -B build -GNinja @@ -93,7 +93,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf boost pip3 install mako - name: configure run: cmake -S . -B build -GXcode @@ -143,7 +143,7 @@ jobs: rm /usr/local/bin/python3.1* || true export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew link --overwrite python@3.12 - brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf llvm + brew install ninja pkg-config hdf5 automake armadillo lapack libmatio gnuradio openssl pugixml protobuf llvm boost pip3 install mako ln -s $(brew --prefix llvm)/bin/clang-tidy /usr/local/bin ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin @@ -195,7 +195,6 @@ jobs: - uses: actions/checkout@v4 - name: install dependencies run: | - sudo python -m pip install --upgrade pip sudo pip install cmakelint - name: check CMake scripts run: find . -iname "CMakeLists.txt" -o -iname "*.cmake" | xargs cmakelint --filter=-linelength,-readability/wonkycase diff --git a/README.md b/README.md index 6bad46ab8..9e376a52e 100644 --- a/README.md +++ b/README.md @@ -831,7 +831,7 @@ Install the required dependencies: ``` $ brew update && brew upgrade -$ brew install armadillo cmake hdf5 gnuradio libmatio openssl pkg-config protobuf pugixml +$ brew install armadillo cmake hdf5 gnuradio libmatio openssl pkg-config protobuf pugixml boost $ brew install --cask mactex # when completed, restart Terminal $ brew install graphviz doxygen ¢ pip3 install mako diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9cf6a85ab..89736052b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -105,6 +105,7 @@ All notable changes to GNSS-SDR will be documented in this file. transitioned to the Apache License 2.0, fully compatible with GPL v3.0. Accordingly, the GNSS-SDR building system now looks for OpenSSL in the first place and, if not found, then it looks for GnuTLS as a fallback. +- Allow linking against Boost 1.87.0. ### Reliability diff --git a/src/algorithms/PVT/libs/CMakeLists.txt b/src/algorithms/PVT/libs/CMakeLists.txt index 69283a081..8f89f7033 100644 --- a/src/algorithms/PVT/libs/CMakeLists.txt +++ b/src/algorithms/PVT/libs/CMakeLists.txt @@ -144,6 +144,21 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif() endif() +# Fixes for Boost Asio > 1.86. address::from_string was deprecated in Boost 1.71 +if(Boost_VERSION_STRING VERSION_LESS 1.71.0) + target_compile_definitions(pvt_libs + PRIVATE + -DBOOST_ASIO_USE_FROM_STRING=1 + ) + # resolver::iterator retired in Boost 1.87.0, alternative available since 1.71 + # boost::asio::io_context::post deprecated in 1.84 in favor of boost::asio::post + target_compile_definitions(pvt_libs + PUBLIC + -DBOOST_ASIO_USE_RESOLVER_ITERATOR=1 + -DBOOST_ASIO_USE_IOCONTEXT_POST=1 + ) +endif() + set_property(TARGET pvt_libs APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ ) diff --git a/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc b/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc index f9f48f0bb..d8f7aa89a 100644 --- a/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc +++ b/src/algorithms/PVT/libs/monitor_ephemeris_udp_sink.cc @@ -28,7 +28,11 @@ Monitor_Ephemeris_Udp_Sink::Monitor_Ephemeris_Udp_Sink(const std::vector(port)); +#else + boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::make_address(address, error), boost::lexical_cast(port)); +#endif endpoints.push_back(endpoint); } } diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 1ce2bbd1a..26223d884 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -801,21 +801,38 @@ private: { public: Tcp_Internal_Client(b_io_context& io_context, +#if BOOST_ASIO_USE_RESOLVER_ITERATOR boost::asio::ip::tcp::resolver::iterator endpoint_iterator) : io_context_(io_context), socket_(io_context) { do_connect(std::move(endpoint_iterator)); } +#else + boost::asio::ip::tcp::resolver::results_type endpoints) + : io_context_(io_context), socket_(io_context) + { + do_connect(std::move(endpoints)); + } +#endif inline void close() { +#if BOOST_ASIO_USE_IOCONTEXT_POST io_context_.post([this]() { socket_.close(); }); +#else + boost::asio::post(io_context_, [this]() { socket_.close(); }); +#endif } inline void write(const Rtcm_Message& msg) { +#if BOOST_ASIO_USE_IOCONTEXT_POST io_context_.post( [this, &msg]() { +#else + boost::asio::post(io_context_, + [this, msg]() { +#endif bool write_in_progress = !write_msgs_.empty(); write_msgs_.push_back(msg); if (!write_in_progress) @@ -826,10 +843,17 @@ private: } private: +#if BOOST_ASIO_USE_RESOLVER_ITERATOR inline void do_connect(boost::asio::ip::tcp::resolver::iterator endpoint_iterator) { boost::asio::async_connect(socket_, std::move(endpoint_iterator), [this](boost::system::error_code ec, boost::asio::ip::tcp::resolver::iterator) { +#else + inline void do_connect(boost::asio::ip::tcp::resolver::results_type endpoints) + { + boost::asio::async_connect(socket_, std::move(endpoints), + [this](boost::system::error_code ec, boost::asio::ip::tcp::endpoint) { +#endif if (!ec) { do_read_message(); @@ -893,8 +917,13 @@ private: boost::asio::ip::tcp::resolver resolver(io_context); std::string host("localhost"); std::string port_str = std::to_string(port); +#if BOOST_ASIO_USE_RESOLVER_ITERATOR auto queue_endpoint_iterator = resolver.resolve({host.c_str(), port_str.c_str()}); c = std::make_shared(io_context, queue_endpoint_iterator); +#else + auto endpoints = resolver.resolve(host, port_str); + c = std::make_shared(io_context, endpoints); +#endif } inline void do_read_queue() diff --git a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt index 2eca5157a..b5f993fb1 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/signal_source/gnuradio_blocks/CMakeLists.txt @@ -132,6 +132,14 @@ if(USE_BOOST_BIND_PLACEHOLDERS) ) endif() +# Fix for Boost Asio > 1.86. address::from_string was deprecated in Boost 1.71 +if(Boost_VERSION_STRING VERSION_LESS 1.71.0) + target_compile_definitions(signal_source_gr_blocks + PRIVATE + -DBOOST_ASIO_USE_FROM_STRING=1 + ) +endif() + if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index 9242a640e..dc1a444d6 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -68,9 +68,11 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address, { lookup_[i] = (static_cast(i & 0xff) - 127.4F) * (1.0F / 128.0F); } - - // 2. Set socket options +#if BOOST_ASIO_USE_FROM_STRING ip::address addr = ip::address::from_string(address, ec); +#else + ip::address addr = ip::make_address(address, ec); +#endif if (ec) { std::cout << address << " is not an IP address\n"; @@ -78,6 +80,8 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address, return; } ip::tcp::endpoint ep(addr, port); + + // 2. Set socket options socket_.open(ep.protocol(), ec); // NOLINT(bugprone-unused-return-value) if (ec) { diff --git a/src/core/libs/CMakeLists.txt b/src/core/libs/CMakeLists.txt index cb77ec515..5b6ba902f 100644 --- a/src/core/libs/CMakeLists.txt +++ b/src/core/libs/CMakeLists.txt @@ -170,6 +170,14 @@ if(PMT_USES_BOOST_ANY) ) endif() +# Fix for Boost Asio > 1.86. address::from_string was deprecated in Boost 1.71 +if(Boost_VERSION_STRING VERSION_LESS 1.71.0) + target_compile_definitions(core_libs + PRIVATE + -DBOOST_ASIO_USE_FROM_STRING=1 + ) +endif() + # Do not apply clang-tidy fixes to protobuf generated headers get_filename_component(PROTO_INCLUDE_HEADERS_DIR ${PROTO_HDRS} DIRECTORY) target_include_directories(core_libs diff --git a/src/core/libs/nav_message_udp_sink.cc b/src/core/libs/nav_message_udp_sink.cc index 1beb3aa5f..eaaca49bd 100644 --- a/src/core/libs/nav_message_udp_sink.cc +++ b/src/core/libs/nav_message_udp_sink.cc @@ -30,7 +30,11 @@ Nav_Message_Udp_Sink::Nav_Message_Udp_Sink(const std::vector& addre { for (const auto& address : addresses) { +#if BOOST_ASIO_USE_FROM_STRING boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::address::from_string(address, error), port); +#else + boost::asio::ip::udp::endpoint endpoint(boost::asio::ip::make_address(address, error), port); +#endif endpoints.push_back(endpoint); } serdes_nav = Serdes_Nav_Message(); diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt index cfd2cdab3..8ac8045d1 100644 --- a/src/core/monitor/CMakeLists.txt +++ b/src/core/monitor/CMakeLists.txt @@ -97,6 +97,14 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") endif() endif() +# Fix for Boost Asio > 1.86. address::from_string was deprecated in Boost 1.71 +if(Boost_VERSION_STRING VERSION_LESS 1.71.0) + target_compile_definitions(core_monitor + PRIVATE + -DBOOST_ASIO_USE_FROM_STRING=1 + ) +endif() + set_property(TARGET core_monitor APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/core/monitor/gnss_synchro_udp_sink.cc b/src/core/monitor/gnss_synchro_udp_sink.cc index 45a6e441e..3f9e6a1d1 100644 --- a/src/core/monitor/gnss_synchro_udp_sink.cc +++ b/src/core/monitor/gnss_synchro_udp_sink.cc @@ -38,7 +38,11 @@ Gnss_Synchro_Udp_Sink::Gnss_Synchro_Udp_Sink( for (const auto& port : ports) { boost::asio::ip::udp::endpoint endpoint( +#if BOOST_ASIO_USE_FROM_STRING boost::asio::ip::address::from_string(address, error), +#else + boost::asio::ip::make_address(address, error), +#endif boost::lexical_cast(port)); endpoints.push_back(endpoint); } From 47e3cab802eed3548229508e030b7d25450ddf57 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 20 Dec 2024 22:18:49 +0100 Subject: [PATCH 437/499] Fixes when using Abseil --- tests/system-tests/ttff.cc | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/tests/system-tests/ttff.cc b/tests/system-tests/ttff.cc index 773a9acd3..47e74306f 100644 --- a/tests/system-tests/ttff.cc +++ b/tests/system-tests/ttff.cc @@ -142,7 +142,7 @@ void TtffTest::config_1() #if USE_GLOG_AND_GFLAGS config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(FLAGS_fs_in)); #else - + config->set_property("GNSS-SDR.internal_fs_sps", std::to_string(absl::GetFlag(FLAGS_fs_in))); #endif // Set the assistance system parameters config->set_property("GNSS-SDR.SUPL_gps_ephemeris_server", "supl.google.com"); @@ -165,7 +165,10 @@ void TtffTest::config_1() config->set_property("SignalSource.samples", std::to_string(FLAGS_fs_in * FLAGS_max_measurement_duration)); config->set_property("SignalSource.device_address", FLAGS_device_address); #else - + config->set_property("SignalSource.sampling_frequency", std::to_string(absl::GetFlag(FLAGS_fs_in))); + config->set_property("SignalSource.subdevice", absl::GetFlag(FLAGS_subdevice)); + config->set_property("SignalSource.samples", std::to_string(absl::GetFlag(FLAGS_fs_in) * absl::GetFlag(FLAGS_max_measurement_duration))); + config->set_property("SignalSource.device_address", absl::GetFlag(FLAGS_device_address)); #endif // Set the Signal Conditioner @@ -194,7 +197,7 @@ void TtffTest::config_1() #if USE_GLOG_AND_GFLAGS config->set_property("InputFilter.sampling_frequency", std::to_string(FLAGS_fs_in)); #else - + config->set_property("InputFilter.sampling_frequency", std::to_string(absl::GetFlag(FLAGS_fs_in))); #endif config->set_property("InputFilter.IF", std::to_string(zero)); config->set_property("Resampler.implementation", "Pass_Through"); @@ -204,7 +207,8 @@ void TtffTest::config_1() config->set_property("Resampler.sample_freq_in", std::to_string(FLAGS_fs_in)); config->set_property("Resampler.sample_freq_out", std::to_string(FLAGS_fs_in)); #else - + config->set_property("Resampler.sample_freq_in", std::to_string(absl::GetFlag(FLAGS_fs_in))); + config->set_property("Resampler.sample_freq_out", std::to_string(absl::GetFlag(FLAGS_fs_in))); #endif // Set the number of Channels @@ -277,7 +281,20 @@ void TtffTest::config_2() d_sampling_rate = config2->property("GNSS-SDR.internal_fs_sps", FLAGS_fs_in); config2->set_property("SignalSource.samples", std::to_string(d_sampling_rate * FLAGS_max_measurement_duration)); #else + if (absl::GetFlag(FLAGS_config_file_ttff).empty()) + { + std::string path = std::string(TEST_PATH); + std::string filename = path + "../../conf/gnss-sdr_GPS_L1_USRP_X300_realtime.conf"; + config2 = std::make_shared(filename); + } + else + { + config2 = std::make_shared(absl::GetFlag(FLAGS_config_file_ttff)); + } + int d_sampling_rate; + d_sampling_rate = config2->property("GNSS-SDR.internal_fs_sps", absl::GetFlag(FLAGS_fs_in)); + config2->set_property("SignalSource.samples", std::to_string(d_sampling_rate * absl::GetFlag(FLAGS_max_measurement_duration))); #endif } @@ -495,7 +512,6 @@ TEST_F(TtffTest /*unused*/, ColdStart /*unused*/) std::cout << "Starting measurement " << num_measurements + 1 << " / " << FLAGS_num_measurements << '\n'; #else std::cout << "Starting measurement " << num_measurements + 1 << " / " << absl::GetFlag(FLAGS_num_measurements) << '\n'; - #endif std::chrono::time_point start; std::chrono::time_point end; From cfb56d35d6a0117d2cf2d146827afaec217e46da Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Dec 2024 13:20:00 +0100 Subject: [PATCH 438/499] Replace the System V queues by boost::interprocess --- docs/CHANGELOG.md | 1 + .../PVT/gnuradio_blocks/rtklib_pvt_gs.cc | 61 ++++---- .../PVT/gnuradio_blocks/rtklib_pvt_gs.h | 17 +-- src/core/receiver/control_thread.cc | 132 ++++++++++-------- src/core/receiver/control_thread.h | 7 +- tests/system-tests/ttff.cc | 120 +++++++++------- .../control-plane/control_thread_test.cc | 59 ++++---- 7 files changed, 222 insertions(+), 175 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 89736052b..a3e27ac9a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -106,6 +106,7 @@ All notable changes to GNSS-SDR will be documented in this file. Accordingly, the GNSS-SDR building system now looks for OpenSSL in the first place and, if not found, then it looks for GnuTLS as a fallback. - Allow linking against Boost 1.87.0. +- Replace the System V queues by boost::interprocess, improving portability. ### Reliability diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc index 33db19222..2bc2ae41a 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.cc @@ -77,8 +77,6 @@ #include // for locale #include // for ostringstream #include // for length_error -#include // for IPC_CREAT -#include // for msgctl #include // for std::type_info, typeid #include // for pair @@ -130,6 +128,7 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, : gr::sync_block("rtklib_pvt_gs", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)), gr::io_signature::make(0, 0, 0)), + d_queue_name("gnss_sdr_ttff_message_queue"), d_dump_filename(conf_.dump_filename), d_geohash(std::make_unique()), d_gps_ephemeris_sptr_type_hash_code(typeid(std::shared_ptr).hash_code()), @@ -509,14 +508,26 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, d_eph_udp_sink_ptr = nullptr; } - // Create Sys V message queue + // Create message queue d_first_fix = true; - d_sysv_msg_key = 1101; - const int msgflg = IPC_CREAT | 0666; - if ((d_sysv_msqid = msgget(d_sysv_msg_key, msgflg)) == -1) + const std::size_t max_num_messages = 100; + try { - std::cout << "GNSS-SDR cannot create System V message queues.\n"; - LOG(WARNING) << "The System V message queue is not available. Error: " << errno << " - " << strerror(errno); + // Remove any existing queue with the same name + boost::interprocess::message_queue::remove(d_queue_name.c_str()); + + // Create a new message queue + d_mq = std::make_unique( + boost::interprocess::create_only, // Create a new queue + d_queue_name.c_str(), // Queue name + max_num_messages, // Maximum number of messages + sizeof(double) // Maximum message size + ); + } + + catch (const boost::interprocess::interprocess_exception& e) + { + std::cerr << "Error creating message queue: " << e.what() << std::endl; } // Display time in local time zone @@ -601,9 +612,9 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels, rtklib_pvt_gs::~rtklib_pvt_gs() { DLOG(INFO) << "PVT block destructor called."; - if (d_sysv_msqid != -1) + if (d_mq) { - msgctl(d_sysv_msqid, IPC_RMID, nullptr); + boost::interprocess::message_queue::remove(d_queue_name.c_str()); } try { @@ -1732,21 +1743,19 @@ void rtklib_pvt_gs::clear_ephemeris() } -bool rtklib_pvt_gs::send_sys_v_ttff_msg(d_ttff_msgbuf ttff) const +bool rtklib_pvt_gs::send_ttff_msg(double ttff) const { - if (d_sysv_msqid != -1) + if (d_mq) { - // Fill Sys V message structures - int msgsend_size; - d_ttff_msgbuf msg; - msg.ttff = ttff.ttff; - msgsend_size = sizeof(msg.ttff); - msg.mtype = 1; // default message ID - - // SEND SOLUTION OVER A MESSAGE QUEUE - // non-blocking Sys V message send - msgsnd(d_sysv_msqid, &msg, msgsend_size, IPC_NOWAIT); - return true; + try + { + d_mq->send(&ttff, sizeof(ttff), 0); // Priority 0 + return true; + } + catch (const boost::interprocess::interprocess_exception& e) + { + std::cerr << "Error sending message: " << e.what() << std::endl; + } } return false; } @@ -2389,12 +2398,10 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item } std::cout << " is Lat = " << d_user_pvt_solver->get_latitude() << " [deg], Long = " << d_user_pvt_solver->get_longitude() << " [deg], Height= " << d_user_pvt_solver->get_height() << " [m]\n"; - d_ttff_msgbuf ttff; - ttff.mtype = 1; d_end = std::chrono::system_clock::now(); std::chrono::duration elapsed_seconds = d_end - d_start; - ttff.ttff = elapsed_seconds.count(); - send_sys_v_ttff_msg(ttff); + double ttff = elapsed_seconds.count(); + send_ttff_msg(ttff); d_first_fix = false; } if (d_kml_output_enabled) diff --git a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h index 65f7bd548..b54b3d670 100644 --- a/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h +++ b/src/algorithms/PVT/gnuradio_blocks/rtklib_pvt_gs.h @@ -18,12 +18,14 @@ #define GNSS_SDR_RTKLIB_PVT_GS_H #include "gnss_block_interface.h" +#include "gnss_sdr_make_unique.h" #include "gnss_synchro.h" #include "gnss_time.h" #include "osnma_data.h" #include "rtklib.h" #include #include +#include #include // for sync_block #include // for gr_vector_const_void_star #include // for pmt_t @@ -37,7 +39,6 @@ #include // for std::queue #include // for std::set #include // for string -#include // for key_t #include // for vector /** \addtogroup PVT @@ -166,13 +167,7 @@ private: std::vector split_string(const std::string& s, char delim) const; - typedef struct - { - long mtype; // NOLINT(google-runtime-int) - double ttff; - } d_ttff_msgbuf; - bool send_sys_v_ttff_msg(d_ttff_msgbuf ttff) const; - + bool send_ttff_msg(double ttff) const; bool save_gnss_synchro_map_xml(const std::string& file_name); // debug helper function bool load_gnss_synchro_map_xml(const std::string& file_name); // debug helper function @@ -181,6 +176,8 @@ private: std::shared_ptr d_internal_pvt_solver; std::shared_ptr d_user_pvt_solver; + std::unique_ptr d_mq; + std::unique_ptr d_rp; std::unique_ptr d_kml_dump; std::unique_ptr d_gpx_dump; @@ -195,6 +192,7 @@ private: std::chrono::time_point d_start; std::chrono::time_point d_end; + std::string d_queue_name; std::string d_dump_filename; std::string d_xml_base_path; std::string d_local_time_str; @@ -238,9 +236,6 @@ private: uint64_t d_local_counter_ms; uint64_t d_timestamp_rx_clock_offset_correction_msg_ms; - key_t d_sysv_msg_key; - int d_sysv_msqid; - int32_t d_rinexobs_rate_ms; int32_t d_rtcm_MT1045_rate_ms; // Galileo Broadcast Ephemeris int32_t d_rtcm_MT1019_rate_ms; // GPS Broadcast Ephemeris (orbits) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 52b0b344d..2e6231c91 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -36,34 +36,34 @@ #include "gnss_flowgraph.h" #include "gnss_satellite.h" #include "gnss_sdr_flags.h" -#include "gps_acq_assist.h" // for Gps_Acq_Assist -#include "gps_almanac.h" // for Gps_Almanac -#include "gps_cnav_ephemeris.h" // for Gps_CNAV_Ephemeris -#include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model -#include "gps_ephemeris.h" // for Gps_Ephemeris -#include "gps_iono.h" // for Gps_Iono -#include "gps_utc_model.h" // for Gps_Utc_Model -#include "pvt_interface.h" // for PvtInterface -#include "rtklib.h" // for gtime_t, alm_t -#include "rtklib_conversions.h" // for alm_to_rtklib -#include "rtklib_ephemeris.h" // for alm2pos, eph2pos -#include "rtklib_rtkcmn.h" // for utc2gpst -#include // for interaction with geofunctions -#include // for bad_lexical_cast -#include // for make_any -#include // for find, min -#include // for milliseconds -#include // for floor, fmod, log -#include // for signal, SIGINT -#include // for time_t, gmtime, strftime -#include // for exception -#include // for operator<< -#include // for numeric_limits -#include // for map -#include // for pthread_cancel -#include // for invalid_argument -#include // for IPC_CREAT -#include // for msgctl, msgget +#include "gnss_sdr_make_unique.h" +#include "gps_acq_assist.h" // for Gps_Acq_Assist +#include "gps_almanac.h" // for Gps_Almanac +#include "gps_cnav_ephemeris.h" // for Gps_CNAV_Ephemeris +#include "gps_cnav_utc_model.h" // for Gps_CNAV_Utc_Model +#include "gps_ephemeris.h" // for Gps_Ephemeris +#include "gps_iono.h" // for Gps_Iono +#include "gps_utc_model.h" // for Gps_Utc_Model +#include "pvt_interface.h" // for PvtInterface +#include "rtklib.h" // for gtime_t, alm_t +#include "rtklib_conversions.h" // for alm_to_rtklib +#include "rtklib_ephemeris.h" // for alm2pos, eph2pos +#include "rtklib_rtkcmn.h" // for utc2gpst +#include // for interaction with geofunctions +#include // for message_queue +#include // for bad_lexical_cast +#include // for make_any +#include // for find, min +#include // for milliseconds +#include // for floor, fmod, log +#include // for signal, SIGINT +#include // for time_t, gmtime, strftime +#include // for exception +#include // for operator<< +#include // for numeric_limits +#include // for map +#include // for pthread_cancel +#include // for invalid_argument #if USE_GLOG_AND_GFLAGS #include @@ -197,7 +197,7 @@ void ControlThread::init() supl_mns_ = 0; supl_lac_ = 0; supl_ci_ = 0; - msqid_ = -1; + agnss_ref_location_ = Agnss_Ref_Location(); agnss_ref_time_ = Agnss_Ref_Time(); @@ -273,14 +273,11 @@ void ControlThread::init() ControlThread::~ControlThread() // NOLINT(modernize-use-equals-default) { DLOG(INFO) << "Control Thread destructor called"; - if (msqid_ != -1) - { - msgctl(msqid_, IPC_RMID, nullptr); - } + boost::interprocess::message_queue::remove(control_message_queue_name_.c_str()); - if (sysv_queue_thread_.joinable()) + if (message_queue_thread_.joinable()) { - sysv_queue_thread_.join(); + message_queue_thread_.join(); } if (cmd_interface_thread_.joinable()) @@ -429,7 +426,7 @@ int ControlThread::run() { keyboard_thread_ = std::thread(&ControlThread::keyboard_listener, this); } - sysv_queue_thread_ = std::thread(&ControlThread::sysv_queue_listener, this); + message_queue_thread_ = std::thread(&ControlThread::message_queue_listener, this); // start the telecommand listener thread cmd_interface_.set_pvt(flowgraph_->get_pvt()); @@ -1214,40 +1211,55 @@ void ControlThread::gps_acq_assist_data_collector() const } -void ControlThread::sysv_queue_listener() +void ControlThread::message_queue_listener() { - typedef struct - { - long mtype; // NOLINT(google-runtime-int) required by SysV queue messaging - double stop_message; - } stop_msgbuf; - bool read_queue = true; - stop_msgbuf msg; double received_message = 0.0; - const int msgrcv_size = sizeof(msg.stop_message); - - const key_t key = 1102; - - if ((msqid_ = msgget(key, 0644 | IPC_CREAT)) == -1) + try { - std::cerr << "GNSS-SDR cannot create SysV message queues\n"; - read_queue = false; - } + // Remove any existing queue with the same name + boost::interprocess::message_queue::remove(control_message_queue_name_.c_str()); - while (read_queue && !stop_) - { - if (msgrcv(msqid_, &msg, msgrcv_size, 1, 0) != -1) + // Create a new message queue + auto mq = std::make_unique( + boost::interprocess::create_only, // Create a new queue + control_message_queue_name_.c_str(), // Queue name + 10, // Maximum number of messages + sizeof(double) // Maximum message size + ); + + while (read_queue && !stop_) { - received_message = msg.stop_message; - if ((std::abs(received_message - (-200.0)) < 10 * std::numeric_limits::epsilon())) + unsigned int priority; + std::size_t received_size; + // Receive a message (non-blocking) + if (mq->try_receive(&received_message, sizeof(received_message), received_size, priority)) { - std::cout << "Quit order received, stopping GNSS-SDR !!\n"; - control_queue_->push(pmt::make_any(command_event_make(200, 0))); - read_queue = false; + // Validate the size of the received message + if (received_size == sizeof(double)) + { + if (std::abs(received_message - (-200.0)) < 10 * std::numeric_limits::epsilon()) + { + std::cout << "Quit order received, stopping GNSS-SDR !!\n"; + + // Push the control command to the control queue + control_queue_->push(pmt::make_any(command_event_make(200, 0))); + read_queue = false; + } + } + } + else + { + // No message available, add a small delay to prevent busy-waiting + std::this_thread::sleep_for(std::chrono::milliseconds(200)); } } } + catch (const boost::interprocess::interprocess_exception &e) + { + std::cerr << "Error in message queue listener: " << e.what() << '\n'; + read_queue = false; + } } diff --git a/src/core/receiver/control_thread.h b/src/core/receiver/control_thread.h index b3340e94b..e1b29dcb6 100644 --- a/src/core/receiver/control_thread.h +++ b/src/core/receiver/control_thread.h @@ -160,7 +160,7 @@ private: void telecommand_listener(); void keyboard_listener(); - void sysv_queue_listener(); + void message_queue_listener(); void print_help_at_exit() const; // default filename for assistance data @@ -179,6 +179,8 @@ private: const std::string gal_almanac_default_xml_filename_ = "./gal_almanac.xml"; const std::string gps_almanac_default_xml_filename_ = "./gps_almanac.xml"; + const std::string control_message_queue_name_ = "receiver_control_queue"; + const size_t channel_event_type_hash_code_ = typeid(channel_event_sptr).hash_code(); const size_t command_event_type_hash_code_ = typeid(command_event_sptr).hash_code(); @@ -188,7 +190,7 @@ private: std::thread cmd_interface_thread_; std::thread keyboard_thread_; - std::thread sysv_queue_thread_; + std::thread message_queue_thread_; std::thread gps_acq_assist_data_collector_thread_; #ifdef ENABLE_FPGA @@ -210,7 +212,6 @@ private: unsigned int processed_control_messages_; unsigned int applied_actions_; - int msqid_; bool well_formatted_configuration_; bool conf_file_has_section_; diff --git a/tests/system-tests/ttff.cc b/tests/system-tests/ttff.cc index 47e74306f..3875781e1 100644 --- a/tests/system-tests/ttff.cc +++ b/tests/system-tests/ttff.cc @@ -21,11 +21,13 @@ #include "control_thread.h" #include "file_configuration.h" #include "gnss_flowgraph.h" +#include "gnss_sdr_make_unique.h" #include "gps_acq_assist.h" #include "in_memory_configuration.h" #include #include #include +#include #include #include #include @@ -35,9 +37,6 @@ #include #include #include -#include -#include -#include #include #if USE_GLOG_AND_GFLAGS @@ -79,13 +78,6 @@ Concurrent_Map global_gps_acq_assist_map; std::vector TTFF_v; -typedef struct -{ - long mtype; // required by SysV message - double ttff; -} ttff_msgbuf; - - class TtffTest : public ::testing::Test { public: @@ -301,45 +293,72 @@ void TtffTest::config_2() void receive_msg() { - ttff_msgbuf msg; - ttff_msgbuf msg_stop; - msg_stop.mtype = 1; - msg_stop.ttff = -200.0; - double ttff_msg = 0.0; - int msgrcv_size = sizeof(msg.ttff); - int msqid; - int msqid_stop = -1; - key_t key = 1101; - key_t key_stop = 1102; bool leave = false; while (!leave) { - // wait for the queue to be created - while ((msqid = msgget(key, 0644)) == -1) + // wait for the queues to be created + const std::string queue_name = "gnss_sdr_ttff_message_queue"; + std::unique_ptr d_mq; + bool queue_found = false; + while (!queue_found) { + try + { + // Attempt to open the message queue + d_mq = std::make_unique(boost::interprocess::open_only, queue_name.c_str()); + queue_found = true; // Queue found + } + catch (const boost::interprocess::interprocess_exception &) + { + // Queue not found, wait and retry + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } } - if (msgrcv(msqid, &msg, msgrcv_size, 1, 0) != -1) + const std::string queue_name_stop = "receiver_control_queue"; + std::unique_ptr d_mq_stop; + bool queue_found2 = false; + while (!queue_found2) { - ttff_msg = msg.ttff; - if ((ttff_msg != 0) && (ttff_msg != -1)) + try { - TTFF_v.push_back(ttff_msg); - LOG(INFO) << "Valid Time-To-First-Fix: " << ttff_msg << "[s]"; - // Stop the receiver - while (((msqid_stop = msgget(key_stop, 0644))) == -1) - { - } - double msgsend_size = sizeof(msg_stop.ttff); - msgsnd(msqid_stop, &msg_stop, msgsend_size, IPC_NOWAIT); + // Attempt to open the message queue + d_mq_stop = std::make_unique(boost::interprocess::open_only, queue_name_stop.c_str()); + queue_found2 = true; // Queue found } + catch (const boost::interprocess::interprocess_exception &) + { + // Queue not found, wait and retry + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + } - if (std::abs(ttff_msg - (-1.0)) < 10 * std::numeric_limits::epsilon()) + double received_message; + unsigned int priority; + std::size_t received_size; + // Receive a message (non-blocking) + if (d_mq->try_receive(&received_message, sizeof(received_message), received_size, priority)) + { + // Validate the size of the received message + if (received_size == sizeof(double) && (received_message != 0) && (received_message != -1)) + { + TTFF_v.push_back(received_message); + LOG(INFO) << "Valid Time-To-First-Fix: " << received_message << " [s]"; + // Stop the receiver + double stop_message = -200.0; + d_mq_stop->send(&stop_message, sizeof(stop_message), 0); + } + if (received_size == sizeof(double) && std::abs(received_message - (-1.0)) < 10 * std::numeric_limits::epsilon()) { leave = true; } } + else + { + // No message available, add a small delay to prevent busy-waiting + std::this_thread::sleep_for(std::chrono::milliseconds(200)); + } } } @@ -715,23 +734,26 @@ int main(int argc, char **argv) } // Terminate the queue thread - key_t sysv_msg_key; - int sysv_msqid; - sysv_msg_key = 1101; - int msgflg = IPC_CREAT | 0666; - if ((sysv_msqid = msgget(sysv_msg_key, msgflg)) == -1) + const std::string queue_name = "gnss_sdr_ttff_message_queue"; + std::unique_ptr mq; + bool queue_found = false; + while (!queue_found) { - std::cout << "GNSS-SDR can not create message queues!\n"; - return 1; + try + { + // Attempt to open the message queue + mq = std::make_unique(boost::interprocess::open_only, queue_name.c_str()); + queue_found = true; // Queue found + } + catch (const boost::interprocess::interprocess_exception &) + { + // Queue not found, wait and retry + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } } - ttff_msgbuf msg; - msg.mtype = 1; - msg.ttff = -1; - int msgsend_size; - msgsend_size = sizeof(msg.ttff); - msgsnd(sysv_msqid, &msg, msgsend_size, IPC_NOWAIT); - receive_msg_thread.join(); - msgctl(sysv_msqid, IPC_RMID, nullptr); + double finish = -1.0; + mq->send(&finish, sizeof(finish), 0); + boost::interprocess::message_queue::remove(queue_name.c_str()); #if USE_GLOG_AND_GFLAGS gflags::ShutDownCommandLineFlags(); diff --git a/tests/unit-tests/control-plane/control_thread_test.cc b/tests/unit-tests/control-plane/control_thread_test.cc index 925ff9e57..8ad0100e5 100644 --- a/tests/unit-tests/control-plane/control_thread_test.cc +++ b/tests/unit-tests/control-plane/control_thread_test.cc @@ -26,15 +26,13 @@ #include "in_memory_configuration.h" #include #include +#include #include #include #include #include #include #include -#include -#include -#include #include #include @@ -49,35 +47,46 @@ class ControlThreadTest : public ::testing::Test { public: static int stop_receiver(); - typedef struct - { - long mtype; // required by SysV message - double message; - } message_buffer; }; int ControlThreadTest::stop_receiver() { - message_buffer msg_stop; - msg_stop.mtype = 1; - msg_stop.message = -200.0; - int msqid_stop = -1; - int msgsend_size = sizeof(msg_stop.message); - key_t key_stop = 1102; - - // wait for the receiver control queue to be created - while (((msqid_stop = msgget(key_stop, 0644))) == -1) + const std::string queue_name = "receiver_control_queue"; + std::unique_ptr d_mq; + try { + bool queue_found = false; + + while (!queue_found) + { + try + { + // Attempt to open the message queue + d_mq = std::make_unique(boost::interprocess::open_only, queue_name.c_str()); + queue_found = true; // Queue found + } + catch (const boost::interprocess::interprocess_exception&) + { + // Queue not found, wait and retry + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + } + + + double stop_message = -200.0; + + // Wait for a couple of seconds before sending + std::this_thread::sleep_for(std::chrono::seconds(2)); + // Send the double value + d_mq->send(&stop_message, sizeof(stop_message), 0); // Priority 0 + return 0; + } + catch (const boost::interprocess::interprocess_exception& e) + { + std::cerr << "Failed to send stop message: " << e.what() << std::endl; + return -1; } - - // wait for a couple of seconds - std::this_thread::sleep_for(std::chrono::seconds(2)); - - // Stop the receiver - msgsnd(msqid_stop, &msg_stop, msgsend_size, IPC_NOWAIT); - - return 0; } From 381cf4fb3cd62962018f72bca6c50535baa8d146 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 21 Dec 2024 15:24:46 +0100 Subject: [PATCH 439/499] Fix termination of TTFF test --- tests/system-tests/ttff.cc | 66 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/tests/system-tests/ttff.cc b/tests/system-tests/ttff.cc index 3875781e1..f26c63e88 100644 --- a/tests/system-tests/ttff.cc +++ b/tests/system-tests/ttff.cc @@ -316,24 +316,6 @@ void receive_msg() } } - const std::string queue_name_stop = "receiver_control_queue"; - std::unique_ptr d_mq_stop; - bool queue_found2 = false; - while (!queue_found2) - { - try - { - // Attempt to open the message queue - d_mq_stop = std::make_unique(boost::interprocess::open_only, queue_name_stop.c_str()); - queue_found2 = true; // Queue found - } - catch (const boost::interprocess::interprocess_exception &) - { - // Queue not found, wait and retry - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } - double received_message; unsigned int priority; std::size_t received_size; @@ -347,6 +329,23 @@ void receive_msg() LOG(INFO) << "Valid Time-To-First-Fix: " << received_message << " [s]"; // Stop the receiver double stop_message = -200.0; + const std::string queue_name_stop = "receiver_control_queue"; + std::unique_ptr d_mq_stop; + bool queue_found2 = false; + while (!queue_found2) + { + try + { + // Attempt to open the message queue + d_mq_stop = std::make_unique(boost::interprocess::open_only, queue_name_stop.c_str()); + queue_found2 = true; // Queue found + } + catch (const boost::interprocess::interprocess_exception &) + { + // Queue not found, wait and retry + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + } + } d_mq_stop->send(&stop_message, sizeof(stop_message), 0); } if (received_size == sizeof(double) && std::abs(received_message - (-1.0)) < 10 * std::numeric_limits::epsilon()) @@ -735,24 +734,21 @@ int main(int argc, char **argv) // Terminate the queue thread const std::string queue_name = "gnss_sdr_ttff_message_queue"; - std::unique_ptr mq; - bool queue_found = false; - while (!queue_found) - { - try - { - // Attempt to open the message queue - mq = std::make_unique(boost::interprocess::open_only, queue_name.c_str()); - queue_found = true; // Queue found - } - catch (const boost::interprocess::interprocess_exception &) - { - // Queue not found, wait and retry - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } - } + boost::interprocess::message_queue::remove(queue_name.c_str()); + + // Create a new message queue + auto mq = std::make_unique( + boost::interprocess::create_only, // Create a new queue + queue_name.c_str(), // Queue name + 10, // Maximum number of messages + sizeof(double) // Maximum message size + ); double finish = -1.0; - mq->send(&finish, sizeof(finish), 0); + if (mq) + { + mq->send(&finish, sizeof(finish), 0); + } + receive_msg_thread.join(); boost::interprocess::message_queue::remove(queue_name.c_str()); #if USE_GLOG_AND_GFLAGS From c93f07176aeac78f26aee5f480a0f5004796bafe Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 00:21:11 +0100 Subject: [PATCH 440/499] Fix building in some environments Boost::interprocess seems to need linking against librt.so in some systems --- CMakeLists.txt | 9 +++++++++ src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt | 1 + src/core/receiver/CMakeLists.txt | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ad5e1c20..118a8998a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1084,6 +1084,15 @@ endif() +################################################################################ +# Detect availability of shm_open +################################################################################ +unset(HAVE_SHM_OPEN CACHE) +include(CheckFunctionExists) +check_function_exists(shm_open HAVE_SHM_OPEN) + + + ################################################################################ # volk_gnsssdr module - GNSS-SDR's own VOLK library ################################################################################ diff --git a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt index 1964d1533..f516dea42 100644 --- a/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/PVT/gnuradio_blocks/CMakeLists.txt @@ -21,6 +21,7 @@ endif() target_link_libraries(pvt_gr_blocks PUBLIC algorithms_libs_rtklib + Boost::headers Boost::date_time Gnuradio::pmt Gnuradio::runtime diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index ba945f69b..dde1ba039 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -193,6 +193,13 @@ target_link_libraries(core_receiver Armadillo::armadillo ) +if(NOT HAVE_SHM_OPEN) + find_library(LIBRT_LIBRARY rt) + if(LIBRT_LIBRARY) + target_link_libraries(core_receiver PRIVATE ${LIBRT_LIBRARY}) + endif() +endif() + if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(core_receiver PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(core_receiver PRIVATE -DUSE_GLOG_AND_GFLAGS=1) From fb13f33f65db05cff70c2e1bb1bf7ba51f64f513 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 00:57:13 +0100 Subject: [PATCH 441/499] CI: apply clang-format also to tests and utils folders --- .github/workflows/main.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dd27401a5..5851f58da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -113,13 +113,22 @@ jobs: clang-format: runs-on: ubuntu-latest + strategy: + matrix: + path: + - check: 'src' + exclude: '' + - check: 'tests' + exclude: '' + - check: 'utils' + exclude: '(matlab|scripts|python)' steps: - uses: actions/checkout@v4 - name: run clang-format - uses: jidicula/clang-format-action@v4.11.0 + uses: jidicula/clang-format-action@v4 with: clang-format-version: "15" - check-path: "src" + check-path: ${{ matrix.path }} exclude-regex: '(libs\/gsl\/)|^.*\.(cu|proto)$' clang-tidy: From 094a0adfbe720cdf9330d828b7950f8735afd76f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 00:58:44 +0100 Subject: [PATCH 442/499] CI: apply clang-format also to tests and utils folders --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5851f58da..12fd58cd4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -125,7 +125,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: run clang-format - uses: jidicula/clang-format-action@v4 + uses: jidicula/clang-format-action@v4.14.0 with: clang-format-version: "15" check-path: ${{ matrix.path }} From 09bec373bd370ce0073e2f93b029d9fde4202a2b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 01:04:14 +0100 Subject: [PATCH 443/499] CI: apply clang-format also to tests and utils folders --- .github/workflows/main.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 12fd58cd4..7473c8bd3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -116,12 +116,9 @@ jobs: strategy: matrix: path: - - check: 'src' - exclude: '' - - check: 'tests' - exclude: '' - - check: 'utils' - exclude: '(matlab|scripts|python)' + - 'src' + - 'tests' + - 'utils' steps: - uses: actions/checkout@v4 - name: run clang-format From e90fef3e6b9f5217d38d6984e82333c2fdd3e87d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 01:08:58 +0100 Subject: [PATCH 444/499] CI: try clang-format 19 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7473c8bd3..033b3ff99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -124,7 +124,7 @@ jobs: - name: run clang-format uses: jidicula/clang-format-action@v4.14.0 with: - clang-format-version: "15" + clang-format-version: "19" check-path: ${{ matrix.path }} exclude-regex: '(libs\/gsl\/)|^.*\.(cu|proto)$' From 21a8e8fee01edf8dc065f4db8fa9e7d7dcbe2ea2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 01:14:18 +0100 Subject: [PATCH 445/499] CI: try clang-format 19 --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 033b3ff99..12d2e72ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -126,7 +126,7 @@ jobs: with: clang-format-version: "19" check-path: ${{ matrix.path }} - exclude-regex: '(libs\/gsl\/)|^.*\.(cu|proto)$' + exclude-regex: '(libs\/gsl\/)|(tmpl)|(cpu_features)|^.*\.(cu|proto)$' clang-tidy: runs-on: macos-latest From e805a08ff54903bdd905195a29b72f052df3d26e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 02:02:53 +0100 Subject: [PATCH 446/499] Modernize .clang-format --- .clang-format | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.clang-format b/.clang-format index 57c1b1d78..9a4adcd78 100644 --- a/.clang-format +++ b/.clang-format @@ -10,7 +10,8 @@ AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false AlignEscapedNewlinesLeft: true AlignOperands: true -AlignTrailingComments: true +AlignTrailingComments: + Kind: Always AllowAllParametersOfDeclarationOnNextLine: true AllowShortBlocksOnASingleLine: false AllowShortCaseLabelsOnASingleLine: false From dc55847aeee29432c43076709c4916b5c577eb36 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 22 Dec 2024 02:12:39 +0100 Subject: [PATCH 447/499] Bump local version of Armadillo and Protocol Buffers --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 118a8998a..eac085fc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -356,11 +356,11 @@ set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") ################################################################################ # Versions to download and build (but not to install system-wide) if not found ################################################################################ -set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.0.x") +set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.2.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.2") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") From 700d4403d5a0d4dc6094de9b72cde7c903b0ed93 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 26 Dec 2024 11:18:41 +0100 Subject: [PATCH 448/499] Transition to clang-format 19 --- .clang-format | 251 ++++++++++++-- docs/CHANGELOG.md | 1 + src/algorithms/PVT/libs/an_packet_printer.cc | 4 +- src/algorithms/PVT/libs/rinex_printer.cc | 308 +++++++++--------- src/algorithms/PVT/libs/rtcm.cc | 168 +++++----- src/algorithms/PVT/libs/rtklib_solver.cc | 8 +- ...alileo_e1_pcps_8ms_ambiguous_acquisition.h | 4 +- ...lileo_e1_pcps_ambiguous_acquisition_fpga.h | 2 +- ...leo_e1_pcps_cccwsr_ambiguous_acquisition.h | 2 +- ..._e1_pcps_quicksync_ambiguous_acquisition.h | 2 +- ...lileo_e1_pcps_tong_ambiguous_acquisition.h | 2 +- ...lileo_e5a_noncoherent_iq_acquisition_caf.h | 2 +- .../galileo_e5a_pcps_acquisition_fpga.h | 2 +- .../galileo_e5b_pcps_acquisition_fpga.h | 2 +- .../adapters/glonass_l1_ca_pcps_acquisition.h | 2 +- .../adapters/glonass_l2_ca_pcps_acquisition.h | 2 +- .../gps_l1_ca_pcps_acquisition_fine_doppler.h | 2 +- .../gps_l1_ca_pcps_acquisition_fpga.h | 2 +- .../gps_l1_ca_pcps_assisted_acquisition.h | 4 +- .../gps_l1_ca_pcps_opencl_acquisition.h | 4 +- .../gps_l1_ca_pcps_quicksync_acquisition.h | 2 +- .../gps_l1_ca_pcps_tong_acquisition.h | 2 +- .../adapters/gps_l2_m_pcps_acquisition_fpga.h | 2 +- .../adapters/gps_l5i_pcps_acquisition_fpga.h | 2 +- ...o_e5a_noncoherent_iq_acquisition_caf_cc.cc | 4 +- .../galileo_pcps_8ms_acquisition_cc.cc | 4 +- .../pcps_cccwsr_acquisition_cc.cc | 4 +- .../pcps_opencl_acquisition_cc.cc | 4 +- .../pcps_quicksync_acquisition_cc.cc | 4 +- .../pcps_tong_acquisition_cc.cc | 4 +- src/algorithms/libs/rtklib/rtklib_ppp.cc | 52 +-- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 4 +- src/algorithms/libs/rtklib/rtklib_stream.cc | 8 +- .../apps/volk_gnsssdr_option_helpers.cc | 8 +- .../cpu_features/test/cpuinfo_aarch64_test.cc | 2 +- .../volk_gnsssdr/lib/qa_utils.h | 6 +- .../gr_complex_ip_packet_source.h | 4 +- .../glonass_l1_ca_telemetry_decoder_gs.h | 2 +- .../glonass_l2_ca_telemetry_decoder_gs.h | 2 +- .../sbas_l1_telemetry_decoder_gs.h | 2 +- .../libs/viterbi_decoder_sbas.cc | 2 +- .../tracking/libs/cuda_multicorrelator.h | 2 +- .../tracking/libs/nonlinear_tracking.h | 2 +- src/core/interfaces/gnss_block_interface.h | 6 +- src/core/libs/gnss_sdr_supl_client.cc | 6 +- src/core/libs/osnma_msg_receiver.cc | 2 +- src/core/libs/supl/types/asn_internal.h | 2 +- src/core/libs/supl/types/asn_system.h | 2 +- src/core/libs/supl/types/ber_tlv_tag.h | 2 +- src/core/receiver/control_thread.cc | 44 ++- src/core/receiver/gnss_flowgraph.cc | 48 +-- src/core/receiver/tcp_cmd_interface.cc | 12 +- src/core/system_parameters/GLONASS_L1_L2_CA.h | 7 +- src/core/system_parameters/Galileo_OSNMA.h | 2 +- .../system_parameters/galileo_inav_message.cc | 2 +- tests/common-files/gnuplot_i.h | 2 +- .../libs/spirent_motion_csv_dump_reader.cc | 2 +- tests/unit-tests/arithmetic/fft_speed_test.cc | 3 +- .../observables/hybrid_observables_test.cc | 2 +- .../hybrid_observables_test_fpga.cc | 2 +- .../pvt/rtklib_solver_test.cc | 4 +- .../tracking/cubature_filter_test.cc | 4 +- .../tracking/tracking_pull-in_test.cc | 4 +- .../tracking/tracking_pull-in_test_fpga.cc | 4 +- utils/front-end-cal/front_end_cal.cc | 16 +- utils/rinex-tools/obsdiff.cc | 6 +- 66 files changed, 628 insertions(+), 458 deletions(-) diff --git a/.clang-format b/.clang-format index 9a4adcd78..949f7e5a6 100644 --- a/.clang-format +++ b/.clang-format @@ -1,100 +1,289 @@ # SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2018-2020 Carles Fernandez-Prades +# SPDX-FileCopyrightText: 2018-2024 Carles Fernandez-Prades --- Language: Cpp # BasedOnStyle: Google # More info: https://clang.llvm.org/docs/ClangFormatStyleOptions.html AccessModifierOffset: -4 AlignAfterOpenBracket: DontAlign -AlignConsecutiveAssignments: false -AlignConsecutiveDeclarations: false -AlignEscapedNewlinesLeft: true -AlignOperands: true +AlignArrayOfStructures: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveBitFields: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveDeclarations: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: true +AlignConsecutiveMacros: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveShortCaseStatements: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCaseArrows: false + AlignCaseColons: false +AlignConsecutiveTableGenBreakingDAGArgColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenCondOperatorColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignConsecutiveTableGenDefinitionColons: + Enabled: false + AcrossEmptyLines: false + AcrossComments: false + AlignCompound: false + AlignFunctionPointers: false + PadOperators: false +AlignEscapedNewlines: Left +AlignOperands: Align AlignTrailingComments: - Kind: Always + Kind: Always + OverEmptyLines: 0 +AllowAllArgumentsOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: false +AllowBreakBeforeNoexceptSpecifier: Never +AllowShortBlocksOnASingleLine: Never +AllowShortCaseExpressionOnASingleLine: true AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true +AllowShortEnumsOnASingleLine: true AllowShortFunctionsOnASingleLine: All -AllowShortIfStatementsOnASingleLine: true +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: true AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: true -AlwaysBreakTemplateDeclarations: false +AttributeMacros: + - __capability BinPackArguments: true BinPackParameters: true +BitFieldColonSpacing: Both BraceWrapping: - AfterClass: false - AfterControlStatement: false - AfterEnum: false - AfterFunction: false - AfterNamespace: false - AfterObjCDeclaration: false - AfterStruct: false - AfterUnion: false - BeforeCatch: false - BeforeElse: false - IndentBraces: false + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterExternBlock: true + AfterFunction: true + AfterNamespace: true + AfterObjCDeclaration: true + AfterStruct: true + AfterUnion: true + BeforeCatch: true + BeforeElse: true + BeforeLambdaBody: false + BeforeWhile: true + IndentBraces: true + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakAdjacentStringLiterals: true +BreakAfterAttributes: Leave +BreakAfterJavaFieldAnnotations: false +BreakAfterReturnType: None +BreakArrays: true BreakBeforeBinaryOperators: None +BreakBeforeConceptDeclarations: Always BreakBeforeBraces: GNU +BreakBeforeInlineASMColon: OnlyMultiline BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakFunctionDefinitionParameters: false +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +BreakTemplateDeclarations: MultiLine ColumnLimit: 0 CommentPragmas: '^ IWYU pragma:' -ConstructorInitializerAllOnOneLineOrOnePerLine: true +CompactNamespaces: false ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DerivePointerAlignment: true DisableFormat: false +EmptyLineAfterAccessModifier: Never +EmptyLineBeforeAccessModifier: LogicalBlock ExperimentalAutoDetectBinPacking: false -ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] -IncludeBlocks: Merge +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IfMacros: + - KJ_IF_MAYBE +IncludeBlocks: Merge IncludeCategories: - Regex: '^.*.h"' Priority: 1 + SortPriority: 0 + CaseSensitive: false - Regex: '^.*(benchmark|boost|gflags|glog|gnsssdr|gnuradio|gnsstk|gsl|gtest|pmt|uhd|volk)/' Priority: 2 + SortPriority: 0 + CaseSensitive: false - Regex: '^.*(armadillo|iio|matio|pugixml)' Priority: 2 + SortPriority: 0 + CaseSensitive: false - Regex: '.*' Priority: 3 + SortPriority: 0 + CaseSensitive: false - Regex: '^<.*\.h>' Priority: 4 + SortPriority: 0 + CaseSensitive: false - Regex: '^<.*' Priority: 5 + SortPriority: 0 + CaseSensitive: false +IncludeIsMainRegex: '(Test)?$' +IncludeIsMainSourceRegex: '' +IndentAccessModifiers: false +IndentCaseBlocks: false IndentCaseLabels: false +IndentExternBlock: AfterExternBlock +IndentGotoLabels: true +IndentPPDirectives: None +IndentRequiresClause: true IndentWidth: 4 IndentWrappedFunctionNames: false -KeepEmptyLinesAtTheStartOfBlocks: false +InsertBraces: false +InsertNewlineAtEOF: false +InsertTrailingCommas: None +IntegerLiteralSeparator: + Binary: 0 + BinaryMinDigits: 0 + Decimal: 0 + DecimalMinDigits: 0 + Hex: 0 + HexMinDigits: 0 +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLines: + AtEndOfFile: false + AtStartOfBlock: false + AtStartOfFile: true +LambdaBodyIndentation: Signature +LineEnding: DeriveLF MacroBlockBegin: '' MacroBlockEnd: '' +MainIncludeChar: Quote MaxEmptyLinesToKeep: 2 NamespaceIndentation: None +ObjCBinPackProtocolList: Auto ObjCBlockIndentWidth: 2 +ObjCBreakBeforeNestedBlockParam: true ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: false +PackConstructorInitializers: NextLine +PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakComment: 300 PenaltyBreakFirstLessLess: 120 +PenaltyBreakOpenParenthesis: 0 +PenaltyBreakScopeResolution: 500 PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 PenaltyExcessCharacter: 1000000 +PenaltyIndentedWhitespace: 0 PenaltyReturnTypeOnItsOwnLine: 200 PointerAlignment: Left +PPIndentWidth: -1 +QualifierAlignment: Leave +ReferenceAlignment: Pointer ReflowComments: true -SortIncludes: true +RemoveBracesLLVM: false +RemoveParentheses: Leave +RemoveSemicolon: false +RequiresClausePosition: OwnLine +RequiresExpressionIndentation: OuterScope +SeparateDefinitionBlocks: Leave +ShortNamespaceLines: 1 +SkipMacroDefinitionBody: false +SortIncludes: CaseSensitive +SortJavaStaticImport: Before +SortUsingDeclarations: LexicographicNumeric SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeJsonColon: false SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false +SpaceBeforeParensOptions: + AfterControlStatements: true + AfterForeachMacros: true + AfterFunctionDefinitionName: false + AfterFunctionDeclarationName: false + AfterIfMacros: true + AfterOverloadedOperator: false + AfterPlacementOperator: true + AfterRequiresInClause: false + AfterRequiresInExpression: false + BeforeNonEmptyParentheses: false +SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false +SpaceInEmptyBlock: false SpacesBeforeTrailingComments: 2 -SpacesInAngles: false +SpacesInAngles: Never SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInParentheses: false +SpacesInLineCommentPrefix: + Minimum: 1 + Maximum: -1 +SpacesInParens: Never +SpacesInParensOptions: + ExceptDoubleParentheses: false + InCStyleCasts: false + InConditionalStatements: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false Standard: Auto +StatementAttributeLikeMacros: + - Q_EMIT +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TableGenBreakInsideDAGArg: DontBreak TabWidth: 8 UseTab: Never +VerilogBreakBetweenInstancePorts: true +WhitespaceSensitiveMacros: + - BOOST_PP_STRINGIZE + - CF_SWIFT_NAME + - NS_SWIFT_NAME + - PP_STRINGIZE + - STRINGIZE ... diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a3e27ac9a..5654ecf6b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -62,6 +62,7 @@ All notable changes to GNSS-SDR will be documented in this file. - Updated GSL implementation to v0.42.0. See the [gsl-lite release](https://github.com/gsl-lite/gsl-lite/releases/tag/v0.42.0). +- Code formatting now based on clang-format 19. ### Improvements in Portability: diff --git a/src/algorithms/PVT/libs/an_packet_printer.cc b/src/algorithms/PVT/libs/an_packet_printer.cc index 22d31371b..f14790b4d 100644 --- a/src/algorithms/PVT/libs/an_packet_printer.cc +++ b/src/algorithms/PVT/libs/an_packet_printer.cc @@ -107,8 +107,8 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const const int max_reported_sats = *(&_packet->sats + 1) - _packet->sats; for (gnss_observables_iter = gnss_observables_map.cbegin(); - gnss_observables_iter != gnss_observables_map.cend(); - ++gnss_observables_iter) + gnss_observables_iter != gnss_observables_map.cend(); + ++gnss_observables_iter) { if (gnss_observables_iter->second.Flag_valid_pseudorange) { diff --git a/src/algorithms/PVT/libs/rinex_printer.cc b/src/algorithms/PVT/libs/rinex_printer.cc index 0e4367ea2..6abca2750 100644 --- a/src/algorithms/PVT/libs/rinex_printer.cc +++ b/src/algorithms/PVT/libs/rinex_printer.cc @@ -4942,8 +4942,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map::const_iterator gps_ephemeris_iter; for (gps_ephemeris_iter = eph_map.cbegin(); - gps_ephemeris_iter != eph_map.cend(); - gps_ephemeris_iter++) + gps_ephemeris_iter != eph_map.cend(); + gps_ephemeris_iter++) { // -------- SV / EPOCH / SV CLK const boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_GPS_time(gps_ephemeris_iter->second, gps_ephemeris_iter->second.toc); @@ -5329,8 +5329,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map::const_iterator gps_ephemeris_iter; for (gps_ephemeris_iter = eph_map.cbegin(); - gps_ephemeris_iter != eph_map.cend(); - gps_ephemeris_iter++) + gps_ephemeris_iter != eph_map.cend(); + gps_ephemeris_iter++) { // -------- SV / EPOCH / SV CLK const boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_GPS_time(gps_ephemeris_iter->second, gps_ephemeris_iter->second.toc); @@ -5497,8 +5497,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map::const_iterator galileo_ephemeris_iter; line.clear(); for (galileo_ephemeris_iter = eph_map.cbegin(); - galileo_ephemeris_iter != eph_map.cend(); - galileo_ephemeris_iter++) + galileo_ephemeris_iter != eph_map.cend(); + galileo_ephemeris_iter++) { // -------- SV / EPOCH / SV CLK const boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_Galileo_time(galileo_ephemeris_iter->second, galileo_ephemeris_iter->second.toe); @@ -5688,8 +5688,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map::const_iterator glonass_gnav_ephemeris_iter; for (glonass_gnav_ephemeris_iter = eph_map.cbegin(); - glonass_gnav_ephemeris_iter != eph_map.cend(); - glonass_gnav_ephemeris_iter++) + glonass_gnav_ephemeris_iter != eph_map.cend(); + glonass_gnav_ephemeris_iter++) { // -------- SV / EPOCH / SV CLK const boost::posix_time::ptime p_utc_time = glonass_gnav_ephemeris_iter->second.glot_to_utc(glonass_gnav_ephemeris_iter->second.d_t_b, 0.0); @@ -5933,8 +5933,8 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map::const_iterator bds_ephemeris_iter; for (bds_ephemeris_iter = eph_map.cbegin(); - bds_ephemeris_iter != eph_map.cend(); - bds_ephemeris_iter++) + bds_ephemeris_iter != eph_map.cend(); + bds_ephemeris_iter++) { // -------- SV / EPOCH / SV CLK const boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_BDS_time(bds_ephemeris_iter->second, bds_ephemeris_iter->second.toc); @@ -10278,15 +10278,15 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri int32_t numSatellitesObserved = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { numSatellitesObserved++; } line += Rinex_Printer::rightJustify(std::to_string(numSatellitesObserved), 3); for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const auto satsys = satelliteSystem.find("GLONASS"); if (satsys != satelliteSystem.cend()) @@ -10306,8 +10306,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri out << line << '\n'; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { std::string lineObs; lineObs.clear(); @@ -10392,8 +10392,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri int32_t numSatellitesObserved = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { numSatellitesObserved++; } @@ -10408,8 +10408,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Glonass_Gnav_Ephemeri const auto satsys = satelliteSystem.find("GLONASS"); for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { std::string lineObs; lineObs.clear(); @@ -10574,8 +10574,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -10597,8 +10597,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::set available_glo_prns; std::set::iterator it; for (observables_iter = observablesR1C.cbegin(); - observables_iter != observablesR1C.cend(); - observables_iter++) + observables_iter != observablesR1C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_glo_map.insert(std::pair(prn_, observables_iter->second)); @@ -10610,8 +10610,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesR2C.cbegin(); - observables_iter != observablesR2C.cend(); - observables_iter++) + observables_iter != observablesR2C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_glo_map.insert(std::pair(prn_, observables_iter->second)); @@ -10631,8 +10631,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep // Add list of GPS satellites const auto satsys_gps = satelliteSystem.find("GPS"); for (observables_iter = observablesG1C.cbegin(); - observables_iter != observablesG1C.cend(); - observables_iter++) + observables_iter != observablesG1C.cend(); + observables_iter++) { if (satsys_gps != satelliteSystem.cend()) { @@ -10647,8 +10647,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep // Add list of GLONASS L1 satellites const auto satsys_glo = satelliteSystem.find("GLONASS"); for (observables_iter = observablesR1C.cbegin(); - observables_iter != observablesR1C.cend(); - observables_iter++) + observables_iter != observablesR1C.cend(); + observables_iter++) { if (satsys_glo != satelliteSystem.cend()) { @@ -10662,8 +10662,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } // Add list of GLONASS L2 satellites for (observables_iter = observablesR2C.cbegin(); - observables_iter != observablesR2C.cend(); - observables_iter++) + observables_iter != observablesR2C.cend(); + observables_iter++) { if (satsys_glo != satelliteSystem.cend()) { @@ -10684,8 +10684,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::string s; std::string lineObs; for (observables_iter = observablesG1C.cbegin(); - observables_iter != observablesG1C.cend(); - observables_iter++) + observables_iter != observablesG1C.cend(); + observables_iter++) { lineObs.clear(); @@ -10770,8 +10770,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::pair::iterator, std::multimap::iterator> ret; for (it = available_glo_prns.cbegin(); - it != available_glo_prns.cend(); - it++) + it != available_glo_prns.cend(); + it++) { lineObs.clear(); if (d_version == 3) @@ -10898,8 +10898,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -10921,8 +10921,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g std::set available_glo_prns; std::set::iterator it; for (observables_iter = observablesR1C.cbegin(); - observables_iter != observablesR1C.cend(); - observables_iter++) + observables_iter != observablesR1C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_glo_map.insert(std::pair(prn_, observables_iter->second)); @@ -10934,8 +10934,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g } for (observables_iter = observablesR2C.cbegin(); - observables_iter != observablesR2C.cend(); - observables_iter++) + observables_iter != observablesR2C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_glo_map.insert(std::pair(prn_, observables_iter->second)); @@ -10961,8 +10961,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g const auto satsys_gps = satelliteSystem.find("GPS"); const auto satsys = satelliteSystem.find("GLONASS"); for (observables_iter = observablesG2S.cbegin(); - observables_iter != observablesG2S.cend(); - observables_iter++) + observables_iter != observablesG2S.cend(); + observables_iter++) { lineObs.clear(); @@ -11042,8 +11042,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& g std::pair::iterator, std::multimap::iterator> ret; for (it = available_glo_prns.cbegin(); - it != available_glo_prns.cend(); - it++) + it != available_glo_prns.cend(); + it++) { lineObs.clear(); if (satsys != satelliteSystem.cend()) @@ -11167,8 +11167,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -11190,8 +11190,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga std::set available_glo_prns; std::set::iterator it; for (observables_iter = observablesR1C.cbegin(); - observables_iter != observablesR1C.cend(); - observables_iter++) + observables_iter != observablesR1C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_glo_map.insert(std::pair(prn_, observables_iter->second)); @@ -11202,8 +11202,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga } } for (observables_iter = observablesR2C.cbegin(); - observables_iter != observablesR2C.cend(); - observables_iter++) + observables_iter != observablesR2C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_glo_map.insert(std::pair(prn_, observables_iter->second)); @@ -11231,8 +11231,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga const auto satsys_gal = satelliteSystem.find("Galileo"); const auto satsys = satelliteSystem.find("GLONASS"); for (observables_iter = observablesE1B.cbegin(); - observables_iter != observablesE1B.cend(); - observables_iter++) + observables_iter != observablesE1B.cend(); + observables_iter++) { lineObs.clear(); @@ -11309,8 +11309,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ga std::pair::iterator, std::multimap::iterator> ret; for (it = available_glo_prns.cbegin(); - it != available_glo_prns.cend(); - it++) + it != available_glo_prns.cend(); + it++) { lineObs.clear(); if (satsys_gal != satelliteSystem.cend()) @@ -11439,15 +11439,15 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d int32_t numSatellitesObserved = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { numSatellitesObserved++; } line += Rinex_Printer::rightJustify(std::to_string(numSatellitesObserved), 3); for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const auto satsys = satelliteSystem.find("GPS"); if (satsys != satelliteSystem.cend()) @@ -11467,8 +11467,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d out << line << '\n'; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { std::string lineObs; lineObs.clear(); @@ -11554,8 +11554,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d int32_t numSatellitesObserved = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { numSatellitesObserved++; } @@ -11570,8 +11570,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, d const auto satsys_gps = satelliteSystem.find("GPS"); for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { std::string lineObs; lineObs.clear(); @@ -11685,8 +11685,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e int32_t numSatellitesObserved = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { numSatellitesObserved++; } @@ -11701,8 +11701,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e const auto satsys_gps = satelliteSystem.find("GPS"); for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { std::string lineObs; lineObs.clear(); @@ -11826,8 +11826,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c std::multimap total_mmap; std::multimap::iterator mmap_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -11865,8 +11865,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c std::multimap mmap_aux; mmap_aux = total_mmap; for (mmap_iter = mmap_aux.begin(); - mmap_iter != mmap_aux.end(); - mmap_iter++) + mmap_iter != mmap_aux.end(); + mmap_iter++) { if ((total_mmap.count(mmap_iter->second.PRN)) == 1 && (mmap_iter->second.PRN != 0)) { @@ -11883,8 +11883,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c std::set available_prns; std::set::iterator it; for (observables_iter = observablesL1.cbegin(); - observables_iter != observablesL1.cend(); - observables_iter++) + observables_iter != observablesL1.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; it = available_prns.find(prn_); @@ -11895,8 +11895,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c } for (observables_iter = observablesL2.cbegin(); - observables_iter != observablesL2.cend(); - observables_iter++) + observables_iter != observablesL2.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; it = available_prns.find(prn_); @@ -11907,8 +11907,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c } for (observables_iter = observablesL5.cbegin(); - observables_iter != observablesL5.cend(); - observables_iter++) + observables_iter != observablesL5.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; it = available_prns.find(prn_); @@ -11930,8 +11930,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c const auto satsys_gps = satelliteSystem.find("GPS"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_prns.cbegin(); - it != available_prns.cend(); - it++) + it != available_prns.cend(); + it++) { lineObs.clear(); if (satsys_gps != satelliteSystem.cend()) @@ -12063,8 +12063,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -12096,8 +12096,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep if (found_1B != std::string::npos) { for (observables_iter = observablesE1B.cbegin(); - observables_iter != observablesE1B.cend(); - observables_iter++) + observables_iter != observablesE1B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_map.insert(std::pair(prn_, observables_iter->second)); @@ -12111,8 +12111,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep if (found_E5a != std::string::npos) { for (observables_iter = observablesE5A.cbegin(); - observables_iter != observablesE5A.cend(); - observables_iter++) + observables_iter != observablesE5A.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; it = available_prns.find(prn_); @@ -12136,8 +12136,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep if (found_E5b != std::string::npos) { for (observables_iter = observablesE5B.cbegin(); - observables_iter != observablesE5B.cend(); - observables_iter++) + observables_iter != observablesE5B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; it = available_prns.find(prn_); @@ -12162,8 +12162,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep if (found_E6b != std::string::npos) { for (observables_iter = observablesE6B.cbegin(); - observables_iter != observablesE6B.cend(); - observables_iter++) + observables_iter != observablesE6B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_map.insert(std::pair(prn_, observables_iter->second)); @@ -12187,8 +12187,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep std::pair::iterator, std::multimap::iterator> ret; const auto satsys_gal = satelliteSystem.find("Galileo"); for (it = available_prns.cbegin(); - it != available_prns.cend(); - it++) + it != available_prns.cend(); + it++) { lineObs.clear(); if (satsys_gal != satelliteSystem.cend()) @@ -12311,8 +12311,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -12342,8 +12342,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::set available_gal_prns; std::set::iterator it; for (observables_iter = observablesE1B.cbegin(); - observables_iter != observablesE1B.cend(); - observables_iter++) + observables_iter != observablesE1B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12355,8 +12355,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesE5A.cbegin(); - observables_iter != observablesE5A.cend(); - observables_iter++) + observables_iter != observablesE5A.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12368,8 +12368,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesE5B.cbegin(); - observables_iter != observablesE5B.cend(); - observables_iter++) + observables_iter != observablesE5B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12381,8 +12381,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesE6B.cbegin(); - observables_iter != observablesE6B.cend(); - observables_iter++) + observables_iter != observablesE6B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12411,8 +12411,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep const auto satsys_gal = satelliteSystem.find("Galileo"); for (observables_iter = observablesG1C.cbegin(); - observables_iter != observablesG1C.cend(); - observables_iter++) + observables_iter != observablesG1C.cend(); + observables_iter++) { lineObs.clear(); @@ -12489,8 +12489,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::pair::iterator, std::multimap::iterator> ret; for (it = available_gal_prns.cbegin(); - it != available_gal_prns.cend(); - it++) + it != available_gal_prns.cend(); + it++) { lineObs.clear(); if (satsys_gal != satelliteSystem.cend()) @@ -12614,8 +12614,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -12651,8 +12651,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e std::set available_gps_prns; std::set::iterator it; for (observables_iter = observablesE1B.cbegin(); - observables_iter != observablesE1B.cend(); - observables_iter++) + observables_iter != observablesE1B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12664,8 +12664,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e } for (observables_iter = observablesE5A.cbegin(); - observables_iter != observablesE5A.cend(); - observables_iter++) + observables_iter != observablesE5A.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12677,8 +12677,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e } for (observables_iter = observablesE5B.cbegin(); - observables_iter != observablesE5B.cend(); - observables_iter++) + observables_iter != observablesE5B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12690,8 +12690,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e } for (observables_iter = observablesE6B.cbegin(); - observables_iter != observablesE6B.cend(); - observables_iter++) + observables_iter != observablesE6B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12703,8 +12703,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e } for (observables_iter = observablesG2S.cbegin(); - observables_iter != observablesG2S.cend(); - observables_iter++) + observables_iter != observablesG2S.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gps_map.insert(std::pair(prn_, observables_iter->second)); @@ -12716,8 +12716,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e } for (observables_iter = observablesGL5.cbegin(); - observables_iter != observablesGL5.cend(); - observables_iter++) + observables_iter != observablesGL5.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gps_map.insert(std::pair(prn_, observables_iter->second)); @@ -12746,8 +12746,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e const auto satsys_gps = satelliteSystem.find("GPS"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_gps_prns.cbegin(); - it != available_gps_prns.cend(); - it++) + it != available_gps_prns.cend(); + it++) { lineObs.clear(); if (satsys_gps != satelliteSystem.cend()) @@ -12812,8 +12812,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_CNAV_Ephemeris& e const auto satsys_gal = satelliteSystem.find("Galileo"); for (it = available_gal_prns.cbegin(); - it != available_gal_prns.cend(); - it++) + it != available_gal_prns.cend(); + it++) { lineObs.clear(); if (satsys_gal != satelliteSystem.cend()) @@ -12938,8 +12938,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -12979,8 +12979,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep std::set available_gps_prns; std::set::iterator it; for (observables_iter = observablesE1B.cbegin(); - observables_iter != observablesE1B.cend(); - observables_iter++) + observables_iter != observablesE1B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -12992,8 +12992,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesE5A.cbegin(); - observables_iter != observablesE5A.cend(); - observables_iter++) + observables_iter != observablesE5A.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -13005,8 +13005,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesE5B.cbegin(); - observables_iter != observablesE5B.cend(); - observables_iter++) + observables_iter != observablesE5B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -13018,8 +13018,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesE6B.cbegin(); - observables_iter != observablesE6B.cend(); - observables_iter++) + observables_iter != observablesE6B.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gal_map.insert(std::pair(prn_, observables_iter->second)); @@ -13031,8 +13031,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesG1C.cbegin(); - observables_iter != observablesG1C.cend(); - observables_iter++) + observables_iter != observablesG1C.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gps_map.insert(std::pair(prn_, observables_iter->second)); @@ -13044,8 +13044,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesG2S.cbegin(); - observables_iter != observablesG2S.cend(); - observables_iter++) + observables_iter != observablesG2S.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gps_map.insert(std::pair(prn_, observables_iter->second)); @@ -13057,8 +13057,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep } for (observables_iter = observablesGL5.cbegin(); - observables_iter != observablesGL5.cend(); - observables_iter++) + observables_iter != observablesGL5.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_gps_map.insert(std::pair(prn_, observables_iter->second)); @@ -13087,8 +13087,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep const auto satsys_gps = satelliteSystem.find("GPS"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_gps_prns.cbegin(); - it != available_gps_prns.cend(); - it++) + it != available_gps_prns.cend(); + it++) { lineObs.clear(); if (satsys_gps != satelliteSystem.cend()) @@ -13164,8 +13164,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep const auto satsys_gal = satelliteSystem.find("Galileo"); for (it = available_gal_prns.cbegin(); - it != available_gal_prns.cend(); - it++) + it != available_gal_prns.cend(); + it++) { lineObs.clear(); if (satsys_gal != satelliteSystem.cend()) @@ -13280,8 +13280,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -13303,8 +13303,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris if (found_B1 != std::string::npos) { for (observables_iter = observablesB1I.cbegin(); - observables_iter != observablesB1I.cend(); - observables_iter++) + observables_iter != observablesB1I.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; total_map.insert(std::pair(prn_, observables_iter->second)); @@ -13318,8 +13318,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris if (found_B3 != std::string::npos) { for (observables_iter = observablesB3I.cbegin(); - observables_iter != observablesB3I.cend(); - observables_iter++) + observables_iter != observablesB3I.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; it = available_prns.find(prn_); @@ -13353,8 +13353,8 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris const auto satsys_bds = satelliteSystem.find("Beidou"); std::pair::iterator, std::multimap::iterator> ret; for (it = available_prns.cbegin(); - it != available_prns.cend(); - it++) + it != available_prns.cend(); + it++) { lineObs.clear(); if (satsys_bds != satelliteSystem.cend()) diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 5854b4eb8..0d9bc4b76 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -486,8 +486,8 @@ std::string Rtcm::print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, co std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -501,8 +501,8 @@ std::string Rtcm::print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, co std::string data = header.to_string(); for (observables_iter = observablesL1.cbegin(); - observables_iter != observablesL1.cend(); - observables_iter++) + observables_iter != observablesL1.cend(); + observables_iter++) { const std::bitset<58> content = Rtcm::get_MT1001_sat_content(gps_eph, obs_time, observables_iter->second); data += content.to_string(); @@ -535,8 +535,8 @@ std::string Rtcm::print_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, co std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -550,8 +550,8 @@ std::string Rtcm::print_MT1002(const Gps_Ephemeris& gps_eph, double obs_time, co std::string data = header.to_string(); for (observables_iter = observablesL1.cbegin(); - observables_iter != observablesL1.cend(); - observables_iter++) + observables_iter != observablesL1.cend(); + observables_iter++) { const std::bitset<74> content = Rtcm::get_MT1002_sat_content(gps_eph, obs_time, observables_iter->second); data += content.to_string(); @@ -608,8 +608,8 @@ std::string Rtcm::print_MT1003(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme std::map::const_iterator observables_iter2; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -629,13 +629,13 @@ std::string Rtcm::print_MT1003(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme std::map observablesL1_with_L2; for (observables_iter = observablesL1.cbegin(); - observables_iter != observablesL1.cend(); - observables_iter++) + observables_iter != observablesL1.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; for (observables_iter2 = observablesL2.cbegin(); - observables_iter2 != observablesL2.cend(); - observables_iter2++) + observables_iter2 != observablesL2.cend(); + observables_iter2++) { if (observables_iter2->second.PRN == prn_) { @@ -653,8 +653,8 @@ std::string Rtcm::print_MT1003(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme std::string data = header.to_string(); for (common_observables_iter = common_observables.cbegin(); - common_observables_iter != common_observables.cend(); - common_observables_iter++) + common_observables_iter != common_observables.cend(); + common_observables_iter++) { std::bitset<101> content = Rtcm::get_MT1003_sat_content(ephL1, ephL2, obs_time, common_observables_iter->first, common_observables_iter->second); data += content.to_string(); @@ -717,8 +717,8 @@ std::string Rtcm::print_MT1004(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme std::map::const_iterator observables_iter2; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -738,13 +738,13 @@ std::string Rtcm::print_MT1004(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme std::map observablesL1_with_L2; for (observables_iter = observablesL1.cbegin(); - observables_iter != observablesL1.cend(); - observables_iter++) + observables_iter != observablesL1.cend(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; for (observables_iter2 = observablesL2.cbegin(); - observables_iter2 != observablesL2.cend(); - observables_iter2++) + observables_iter2 != observablesL2.cend(); + observables_iter2++) { if (observables_iter2->second.PRN == prn_) { @@ -762,8 +762,8 @@ std::string Rtcm::print_MT1004(const Gps_Ephemeris& ephL1, const Gps_CNAV_Epheme std::string data = header.to_string(); for (common_observables_iter = common_observables.cbegin(); - common_observables_iter != common_observables.cend(); - common_observables_iter++) + common_observables_iter != common_observables.cend(); + common_observables_iter++) { std::bitset<125> content = Rtcm::get_MT1004_sat_content(ephL1, ephL2, obs_time, common_observables_iter->first, common_observables_iter->second); data += content.to_string(); @@ -1164,8 +1164,8 @@ std::string Rtcm::print_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, d std::map::const_iterator observables_iter; for (observables_iter = observables.begin(); - observables_iter != observables.end(); - observables_iter++) + observables_iter != observables.end(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -1179,8 +1179,8 @@ std::string Rtcm::print_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, d std::string data = header.to_string(); for (observables_iter = observablesL1.begin(); - observables_iter != observablesL1.end(); - observables_iter++) + observables_iter != observablesL1.end(); + observables_iter++) { const std::bitset<64> content = Rtcm::get_MT1009_sat_content(glonass_gnav_eph, obs_time, observables_iter->second); data += content.to_string(); @@ -1213,8 +1213,8 @@ std::string Rtcm::print_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, d std::map::const_iterator observables_iter; for (observables_iter = observables.begin(); - observables_iter != observables.end(); - observables_iter++) + observables_iter != observables.end(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -1228,8 +1228,8 @@ std::string Rtcm::print_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, d std::string data = header.to_string(); for (observables_iter = observablesL1.begin(); - observables_iter != observablesL1.end(); - observables_iter++) + observables_iter != observablesL1.end(); + observables_iter++) { const std::bitset<79> content = Rtcm::get_MT1010_sat_content(glonass_gnav_eph, obs_time, observables_iter->second); data += content.to_string(); @@ -1290,8 +1290,8 @@ std::string Rtcm::print_MT1011(const Glonass_Gnav_Ephemeris& ephL1, const Glonas std::map::const_iterator observables_iter2; for (observables_iter = observables.begin(); - observables_iter != observables.end(); - observables_iter++) + observables_iter != observables.end(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -1311,13 +1311,13 @@ std::string Rtcm::print_MT1011(const Glonass_Gnav_Ephemeris& ephL1, const Glonas std::map observablesL1_with_L2; for (observables_iter = observablesL1.begin(); - observables_iter != observablesL1.end(); - observables_iter++) + observables_iter != observablesL1.end(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; for (observables_iter2 = observablesL2.begin(); - observables_iter2 != observablesL2.end(); - observables_iter2++) + observables_iter2 != observablesL2.end(); + observables_iter2++) { if (observables_iter2->second.PRN == prn_) { @@ -1335,8 +1335,8 @@ std::string Rtcm::print_MT1011(const Glonass_Gnav_Ephemeris& ephL1, const Glonas std::string data = header.to_string(); for (common_observables_iter = common_observables.begin(); - common_observables_iter != common_observables.end(); - common_observables_iter++) + common_observables_iter != common_observables.end(); + common_observables_iter++) { const std::bitset<107> content = Rtcm::get_MT1011_sat_content(ephL1, ephL2, obs_time, common_observables_iter->first, common_observables_iter->second); data += content.to_string(); @@ -1401,8 +1401,8 @@ std::string Rtcm::print_MT1012(const Glonass_Gnav_Ephemeris& ephL1, const Glonas std::map::const_iterator observables_iter2; for (observables_iter = observables.begin(); - observables_iter != observables.end(); - observables_iter++) + observables_iter != observables.end(); + observables_iter++) { const std::string system_(&observables_iter->second.System, 1); const std::string sig_(observables_iter->second.Signal); @@ -1422,13 +1422,13 @@ std::string Rtcm::print_MT1012(const Glonass_Gnav_Ephemeris& ephL1, const Glonas std::map observablesL1_with_L2; for (observables_iter = observablesL1.begin(); - observables_iter != observablesL1.end(); - observables_iter++) + observables_iter != observablesL1.end(); + observables_iter++) { const uint32_t prn_ = observables_iter->second.PRN; for (observables_iter2 = observablesL2.begin(); - observables_iter2 != observablesL2.end(); - observables_iter2++) + observables_iter2 != observablesL2.end(); + observables_iter2++) { if (observables_iter2->second.PRN == prn_) { @@ -1446,8 +1446,8 @@ std::string Rtcm::print_MT1012(const Glonass_Gnav_Ephemeris& ephL1, const Glonas std::string data = header.to_string(); for (common_observables_iter = common_observables.begin(); - common_observables_iter != common_observables.end(); - common_observables_iter++) + common_observables_iter != common_observables.end(); + common_observables_iter++) { const std::bitset<130> content = Rtcm::get_MT1012_sat_content(ephL1, ephL2, obs_time, common_observables_iter->first, common_observables_iter->second); data += content.to_string(); @@ -2387,8 +2387,8 @@ std::string Rtcm::get_MSM_1_content_sat_data(const std::map::iterator it; for (gnss_synchro_iter = observables.cbegin(); - gnss_synchro_iter != observables.cend(); - gnss_synchro_iter++) + gnss_synchro_iter != observables.cend(); + gnss_synchro_iter++) { it = std::find(pos.begin(), pos.end(), 65 - gnss_synchro_iter->second.PRN); if (it == pos.end()) @@ -2420,8 +2420,8 @@ std::string Rtcm::get_MSM_1_content_signal_data(const std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -2529,8 +2529,8 @@ std::string Rtcm::get_MSM_2_content_signal_data(const Gps_Ephemeris& ephNAV, std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -2644,8 +2644,8 @@ std::string Rtcm::get_MSM_3_content_signal_data(const Gps_Ephemeris& ephNAV, std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -2759,8 +2759,8 @@ std::string Rtcm::get_MSM_4_content_sat_data(const std::map::iterator it; for (gnss_synchro_iter = observables.cbegin(); - gnss_synchro_iter != observables.cend(); - gnss_synchro_iter++) + gnss_synchro_iter != observables.cend(); + gnss_synchro_iter++) { it = std::find(pos.begin(), pos.end(), 65 - gnss_synchro_iter->second.PRN); if (it == pos.end()) @@ -2805,8 +2805,8 @@ std::string Rtcm::get_MSM_4_content_signal_data(const Gps_Ephemeris& ephNAV, std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -2924,8 +2924,8 @@ std::string Rtcm::get_MSM_5_content_sat_data(const std::map::iterator it; for (gnss_synchro_iter = observables.cbegin(); - gnss_synchro_iter != observables.cend(); - gnss_synchro_iter++) + gnss_synchro_iter != observables.cend(); + gnss_synchro_iter++) { it = std::find(pos.begin(), pos.end(), 65 - gnss_synchro_iter->second.PRN); if (it == pos.end()) @@ -2975,8 +2975,8 @@ std::string Rtcm::get_MSM_5_content_signal_data(const Gps_Ephemeris& ephNAV, std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -3097,8 +3097,8 @@ std::string Rtcm::get_MSM_6_content_signal_data(const Gps_Ephemeris& ephNAV, std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -3218,8 +3218,8 @@ std::string Rtcm::get_MSM_7_content_signal_data(const Gps_Ephemeris& ephNAV, std::map::const_iterator map_iter; for (map_iter = observables.cbegin(); - map_iter != observables.cend(); - map_iter++) + map_iter != observables.cend(); + map_iter++) { observables_vector.emplace_back(*map_iter); } @@ -3881,8 +3881,8 @@ std::vector> Rtcm::sort_by_PRN_mask(const std:: } has_lower_pos; for (synchro_map_iter = synchro_map.cbegin(); - synchro_map_iter != synchro_map.cend(); - synchro_map_iter++) + synchro_map_iter != synchro_map.cend(); + synchro_map_iter++) { std::pair p(synchro_map_iter->first, synchro_map_iter->second); @@ -3939,8 +3939,8 @@ std::vector> Rtcm::sort_by_signal(const std::ve for (synchro_map_iter = synchro_map.cbegin(); - synchro_map_iter != synchro_map.cend(); - synchro_map_iter++) + synchro_map_iter != synchro_map.cend(); + synchro_map_iter++) { std::pair p(synchro_map_iter->first, synchro_map_iter->second); @@ -4346,8 +4346,8 @@ int32_t Rtcm::set_DF006(const std::map& observables) uint16_t nsats = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { nsats++; } @@ -4606,8 +4606,8 @@ int32_t Rtcm::set_DF035(const std::map& observables) uint16_t nsats = 0; std::map::const_iterator observables_iter; for (observables_iter = observables.begin(); - observables_iter != observables.end(); - observables_iter++) + observables_iter != observables.end(); + observables_iter++) { nsats++; } @@ -5674,8 +5674,8 @@ int32_t Rtcm::set_DF394(const std::map& gnss_synchro) std::map::const_iterator gnss_synchro_iter; uint32_t mask_position; for (gnss_synchro_iter = gnss_synchro.cbegin(); - gnss_synchro_iter != gnss_synchro.cend(); - gnss_synchro_iter++) + gnss_synchro_iter != gnss_synchro.cend(); + gnss_synchro_iter++) { mask_position = 64 - gnss_synchro_iter->second.PRN; DF394.set(mask_position, true); @@ -5695,8 +5695,8 @@ int32_t Rtcm::set_DF395(const std::map& gnss_synchro) std::string sig; uint32_t mask_position; for (gnss_synchro_iter = gnss_synchro.cbegin(); - gnss_synchro_iter != gnss_synchro.cend(); - gnss_synchro_iter++) + gnss_synchro_iter != gnss_synchro.cend(); + gnss_synchro_iter++) { const std::string sig_(gnss_synchro_iter->second.Signal); sig = sig_.substr(0, 2); @@ -5772,8 +5772,8 @@ std::string Rtcm::set_DF396(const std::map& observables) std::vector list_of_signals; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { list_of_sats.push_back(observables_iter->second.PRN); @@ -5826,8 +5826,8 @@ std::string Rtcm::set_DF396(const std::map& observables) { value = false; for (observables_iter = observables.cbegin(); - observables_iter != observables.cend(); - observables_iter++) + observables_iter != observables.cend(); + observables_iter++) { const std::string sig_(observables_iter->second.Signal); sig = sig_.substr(0, 2); diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 35e4d3a9c..433819649 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -933,8 +933,8 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ bool band2 = false; for (gnss_observables_iter = gnss_observables_map.cbegin(); - gnss_observables_iter != gnss_observables_map.cend(); - ++gnss_observables_iter) + gnss_observables_iter != gnss_observables_map.cend(); + ++gnss_observables_iter) { switch (gnss_observables_iter->second.System) { @@ -962,8 +962,8 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ } for (gnss_observables_iter = gnss_observables_map.cbegin(); - gnss_observables_iter != gnss_observables_map.cend(); - ++gnss_observables_iter) // CHECK INCONSISTENCY when combining GLONASS + other system + gnss_observables_iter != gnss_observables_map.cend(); + ++gnss_observables_iter) // CHECK INCONSISTENCY when combining GLONASS + other system { switch (gnss_observables_iter->second.System) { diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h index 7548d1274..9e29e67a8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.h @@ -137,9 +137,9 @@ public: */ void stop_acquisition() override; - void set_state(int state __attribute__((unused))) override{}; + void set_state(int state __attribute__((unused))) override {}; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index b28d63422..cb90f39d5 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -179,7 +179,7 @@ public: /*! * \brief Set resampler latency */ - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: static const uint32_t downsampling_factor_default = 4; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h index ee0e56abb..bcda0172f 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.h @@ -140,7 +140,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: float calculate_threshold(float pfa); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h index 8eb96a5e0..9bfd524c2 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.h @@ -143,7 +143,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: float calculate_threshold(float pfa) const; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h index 7d9245148..786723ea8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.h @@ -143,7 +143,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: float calculate_threshold(float pfa) const; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h index 4a5655080..805799f49 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.h @@ -145,7 +145,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: float calculate_threshold(float pfa) const; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index 14dae0230..ed3716155 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -186,7 +186,7 @@ public: /*! * \brief Set resampler latency */ - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: static const uint32_t downsampling_factor_default = 1; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h index d67bfd4a6..ce8e14e7b 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h @@ -185,7 +185,7 @@ public: /*! * \brief Set resampler latency */ - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: static const uint32_t downsampling_factor_default = 1; diff --git a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h index 7a30d725d..533508fd7 100644 --- a/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l1_ca_pcps_acquisition.h @@ -147,7 +147,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h index 5cce50b40..b8a6adf45 100644 --- a/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h +++ b/src/algorithms/acquisition/adapters/glonass_l2_ca_pcps_acquisition.h @@ -146,7 +146,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: pcps_acquisition_sptr acquisition_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h index c5e27ece5..9288a1ce6 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.h @@ -142,7 +142,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: pcps_acquisition_fine_doppler_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index 2b7bfd3f9..b8eadb373 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -182,7 +182,7 @@ public: /*! * \brief Set Resampler Latency */ - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: static const uint32_t NUM_PRNs = 32; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h index 6a2cfde4c..e5acbed3f 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.h @@ -130,14 +130,14 @@ public: * \brief Restart acquisition algorithm */ void reset() override; - void set_state(int state __attribute__((unused))) override{}; + void set_state(int state __attribute__((unused))) override {}; /*! * \brief Stop running acquisition */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: pcps_assisted_acquisition_cc_sptr acquisition_cc_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h index 331f8c84b..084c0a5c4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_opencl_acquisition.h @@ -131,14 +131,14 @@ public: * \brief Restart acquisition algorithm */ void reset() override; - void set_state(int state __attribute__((unused))) override{}; + void set_state(int state __attribute__((unused))) override {}; /*! * \brief Stop running acquisition */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; inline bool opencl_ready() const { diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h index c148fa6c0..5ae294ae8 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.h @@ -145,7 +145,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: float calculate_threshold(float pfa) const; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h index 336a1f1f9..8cba53e04 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.h @@ -143,7 +143,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: float calculate_threshold(float pfa) const; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 81f4d342c..6ecc0ed41 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -147,7 +147,7 @@ public: */ void stop_acquisition() override; - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: static const uint32_t downsampling_factor_default = 1; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index bf2bfafcf..1a41a35d8 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -182,7 +182,7 @@ public: /*! * \brief Set resampler latency */ - void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override{}; + void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: static const uint32_t NUM_PRNs = 32; 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 24d8eee4e..b9e962959 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 @@ -243,8 +243,8 @@ void galileo_e5a_noncoherentIQ_acquisition_caf_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (int doppler = -d_doppler_max; - doppler <= d_doppler_max; - doppler += d_doppler_step) + doppler <= d_doppler_max; + doppler += d_doppler_step) { d_num_doppler_bins++; } 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 b5dc2b0ba..d684dd7da 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 @@ -161,8 +161,8 @@ void galileo_pcps_8ms_acquisition_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (auto doppler = static_cast(-d_doppler_max); - doppler <= static_cast(d_doppler_max); - doppler += d_doppler_step) + doppler <= static_cast(d_doppler_max); + doppler += d_doppler_step) { d_num_doppler_bins++; } 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 3ad78883c..3e6860517 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_cccwsr_acquisition_cc.cc @@ -166,8 +166,8 @@ void pcps_cccwsr_acquisition_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (auto doppler = static_cast(-d_doppler_max); - doppler <= static_cast(d_doppler_max); - doppler += d_doppler_step) + doppler <= static_cast(d_doppler_max); + doppler += d_doppler_step) { d_num_doppler_bins++; } 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 fbd1b2052..7738a2b9e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_opencl_acquisition_cc.cc @@ -269,8 +269,8 @@ void pcps_opencl_acquisition_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (int doppler = static_cast(-d_doppler_max); - doppler <= static_cast(d_doppler_max); - doppler += d_doppler_step) + doppler <= static_cast(d_doppler_max); + doppler += d_doppler_step) { d_num_doppler_bins++; } 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 d54b8085a..3fee0c12e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -183,8 +183,8 @@ void pcps_quicksync_acquisition_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (auto doppler = static_cast(-d_doppler_max); - doppler <= static_cast(d_doppler_max); - doppler += d_doppler_step) + doppler <= static_cast(d_doppler_max); + doppler += d_doppler_step) { d_num_doppler_bins++; } 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 75f8325d5..dcabf4e22 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_tong_acquisition_cc.cc @@ -171,8 +171,8 @@ void pcps_tong_acquisition_cc::init() // Count the number of bins d_num_doppler_bins = 0; for (auto doppler = static_cast(-d_doppler_max); - doppler <= static_cast(d_doppler_max); - doppler += d_doppler_step) + doppler <= static_cast(d_doppler_max); + doppler += d_doppler_step) { d_num_doppler_bins++; } diff --git a/src/algorithms/libs/rtklib/rtklib_ppp.cc b/src/algorithms/libs/rtklib/rtklib_ppp.cc index ebd7ddc48..2310fcc6f 100644 --- a/src/algorithms/libs/rtklib/rtklib_ppp.cc +++ b/src/algorithms/libs/rtklib/rtklib_ppp.cc @@ -1727,34 +1727,34 @@ int res_ppp(int iter __attribute__((unused)), const obsd_t *obs, int n, const do if (opt->maxinno > 0.0 && fabs(v[nv]) > opt->maxinno && sys != SYS_GLO) { #endif - trace(2, "ppp outlier rejected %s sat=%2d type=%d v=%.3f\n", - time_str(obs[i].time, 0), sat, j, v[nv]); - rtk->ssat[sat - 1].rejc[0]++; - continue; + trace(2, "ppp outlier rejected %s sat=%2d type=%d v=%.3f\n", + time_str(obs[i].time, 0), sat, j, v[nv]); + rtk->ssat[sat - 1].rejc[0]++; + continue; + } + if (j == 0) + { + rtk->ssat[sat - 1].vsat[0] = 1; + } + nv++; } - if (j == 0) - { - rtk->ssat[sat - 1].vsat[0] = 1; - } - nv++; } -} -for (i = 0; i < nv; i++) - { - for (j = 0; j < nv; j++) - { - R[i + j * nv] = i == j ? var[i] : 0.0; - } - } -trace(5, "x=\n"); -tracemat(5, x, 1, nx, 8, 3); -trace(5, "v=\n"); -tracemat(5, v, 1, nv, 8, 3); -trace(5, "H=\n"); -tracemat(5, H, nx, nv, 8, 3); -trace(5, "R=\n"); -tracemat(5, R, nv, nv, 8, 5); -return nv; + for (i = 0; i < nv; i++) + { + for (j = 0; j < nv; j++) + { + R[i + j * nv] = i == j ? var[i] : 0.0; + } + } + trace(5, "x=\n"); + tracemat(5, x, 1, nx, 8, 3); + trace(5, "v=\n"); + tracemat(5, v, 1, nv, 8, 3); + trace(5, "H=\n"); + tracemat(5, H, nx, nv, 8, 3); + trace(5, "R=\n"); + tracemat(5, R, nv, nv, 8, 5); + return nv; } diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 736928e51..5bc43b8e9 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1777,9 +1777,7 @@ gtime_t timeget() { gtime_t time; double ep[6] = {}; - struct timeval tv - { - }; + struct timeval tv{}; struct tm *tt; if (!gettimeofday(&tv, nullptr) && (tt = gmtime(&tv.tv_sec))) diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index 3cb647ad6..f363525d6 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -87,9 +87,7 @@ serial_t *openserial(const char *path, int mode, char *msg) const speed_t bs[] = { B300, B600, B1200, B2400, B4800, B9600, B19200, B38400, B57600, B115200, B230400}; - struct termios ios - { - }; + struct termios ios{}; int rw = 0; tracet(3, "openserial: path=%s mode=%d\n", path, mode); @@ -1104,9 +1102,7 @@ void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg) /* accept client connection --------------------------------------------------*/ int accsock(tcpsvr_t *tcpsvr, char *msg) { - struct sockaddr_in addr - { - }; + struct sockaddr_in addr{}; socket_t sock; socklen_t len = sizeof(addr); int i; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_option_helpers.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_option_helpers.cc index f88da8bd7..9d6f16a7f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_option_helpers.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_option_helpers.cc @@ -111,8 +111,8 @@ void option_list::parse(int argc, char** argv) for (int arg_number = 0; arg_number < argc; ++arg_number) { for (std::vector::iterator this_option = d_internal_list.begin(); - this_option != d_internal_list.end(); - this_option++) + this_option != d_internal_list.end(); + this_option++) { int int_val = INT_MIN; if (this_option->longform == std::string(argv[arg_number]) || @@ -254,8 +254,8 @@ void option_list::help() std::cout << d_program_name << std::endl; std::cout << " -h [ --help ] \t\tdisplay this help message" << std::endl; for (std::vector::iterator this_option = d_internal_list.begin(); - this_option != d_internal_list.end(); - this_option++) + this_option != d_internal_list.end(); + this_option++) { std::string help_line(" "); if (this_option->shortform == "-") diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc index e69c5ef78..637cb676b 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc @@ -137,7 +137,7 @@ TEST_F(CpuidAarch64Test, Aarch64FeaturesEnum) const char* last_name = GetAarch64FeaturesEnumName(AARCH64_LAST_); EXPECT_STREQ(last_name, "unknown_feature"); for (int i = static_cast(AARCH64_FP); - i != static_cast(AARCH64_LAST_); ++i) + i != static_cast(AARCH64_LAST_); ++i) { const auto feature = static_cast(i); const char* name = GetAarch64FeaturesEnumName(feature); diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.h index 1bfd1c991..766f24c0e 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.h @@ -70,7 +70,7 @@ private: public: // ctor volk_gnsssdr_test_params_t(float tol, lv_32fc_t scalar, unsigned int vlen, unsigned int iter, - bool benchmark_mode, std::string kernel_regex) : _tol(tol), _scalar(scalar), _vlen(vlen), _iter(iter), _benchmark_mode(benchmark_mode), _kernel_regex(std::move(kernel_regex)){}; + bool benchmark_mode, std::string kernel_regex) : _tol(tol), _scalar(scalar), _vlen(vlen), _iter(iter), _benchmark_mode(benchmark_mode), _kernel_regex(std::move(kernel_regex)) {}; // setters void set_tol(float tol) { _tol = tol; }; void set_scalar(lv_32fc_t scalar) { _scalar = scalar; }; @@ -104,10 +104,10 @@ public: volk_gnsssdr_test_params_t test_parameters() { return _test_parameters; }; // normal ctor volk_gnsssdr_test_case_t(volk_gnsssdr_func_desc_t desc, void (*kernel_ptr)(), std::string name, - volk_gnsssdr_test_params_t test_parameters) : _desc(desc), _kernel_ptr(kernel_ptr), _name(std::move(name)), _test_parameters(std::move(test_parameters)), _puppet_master_name("NULL"){}; + volk_gnsssdr_test_params_t test_parameters) : _desc(desc), _kernel_ptr(kernel_ptr), _name(std::move(name)), _test_parameters(std::move(test_parameters)), _puppet_master_name("NULL") {}; // ctor for puppets volk_gnsssdr_test_case_t(volk_gnsssdr_func_desc_t desc, void (*kernel_ptr)(), std::string name, - std::string puppet_master_name, volk_gnsssdr_test_params_t test_parameters) : _desc(desc), _kernel_ptr(kernel_ptr), _name(std::move(name)), _test_parameters(std::move(test_parameters)), _puppet_master_name(std::move(puppet_master_name)){}; + std::string puppet_master_name, volk_gnsssdr_test_params_t test_parameters) : _desc(desc), _kernel_ptr(kernel_ptr), _name(std::move(name)), _test_parameters(std::move(test_parameters)), _puppet_master_name(std::move(puppet_master_name)) {}; }; /************************************************ 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 a7d37b5a0..711632f21 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 @@ -84,9 +84,7 @@ private: boost::thread *d_pcap_thread; // boost::mutex d_mutex; - struct sockaddr_in si_me - { - }; + struct sockaddr_in si_me{}; std::string d_src_device; std::string d_origin_address; pcap_t *descr; // ethernet pcap device descriptor 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 e6b22ba2a..df679916e 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 @@ -62,7 +62,7 @@ public: ~glonass_l1_ca_telemetry_decoder_gs() override; //!< Class destructor void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_channel(int32_t channel); //!< Set receiver's channel - inline void reset(){}; + inline void reset() {}; /*! * \brief This is where all signal processing takes place 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 fb3a93c38..3a0455d30 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 @@ -60,7 +60,7 @@ public: ~glonass_l2_ca_telemetry_decoder_gs() override; //!< Class destructor void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_channel(int32_t channel); //!< Set receiver's channel - inline void reset(){}; + inline void reset() {}; /*! * \brief This is where all signal processing takes place 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 6e436b6b6..86fd2dfb6 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 @@ -57,7 +57,7 @@ public: ~sbas_l1_telemetry_decoder_gs() override; void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN void set_channel(int32_t channel); //!< Set receiver's channel - inline void reset(){}; + inline void reset() {}; /*! * \brief This is where all signal processing takes place diff --git a/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc b/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc index 0eafce0f8..02c27e28b 100644 --- a/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc +++ b/src/algorithms/telemetry_decoder/libs/viterbi_decoder_sbas.cc @@ -277,7 +277,7 @@ int Viterbi_Decoder_Sbas::do_tb_and_decode(int traceback_length, int requested_d VLOG(BLOCK) << "overstep_length=" << overstep_length; for (it = d_trellis_paths.begin() + traceback_length; - it < d_trellis_paths.begin() + traceback_length + overstep_length; ++it) + it < d_trellis_paths.begin() + traceback_length + overstep_length; ++it) { state = it->get_anchestor_state_of_current_state(state); } diff --git a/src/algorithms/tracking/libs/cuda_multicorrelator.h b/src/algorithms/tracking/libs/cuda_multicorrelator.h index e23c698ef..561adf2df 100644 --- a/src/algorithms/tracking/libs/cuda_multicorrelator.h +++ b/src/algorithms/tracking/libs/cuda_multicorrelator.h @@ -46,7 +46,7 @@ struct GPU_Complex { float r; float i; - CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex(){}; + CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex() {}; CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex(float a, float b) : r(a), i(b) {} CUDA_CALLABLE_MEMBER_DEVICE float magnitude2(void) { return r * r + i * i; } CUDA_CALLABLE_MEMBER_DEVICE GPU_Complex operator*(const GPU_Complex& a) diff --git a/src/algorithms/tracking/libs/nonlinear_tracking.h b/src/algorithms/tracking/libs/nonlinear_tracking.h index f00671f8d..f70b753a0 100644 --- a/src/algorithms/tracking/libs/nonlinear_tracking.h +++ b/src/algorithms/tracking/libs/nonlinear_tracking.h @@ -46,7 +46,7 @@ class ModelFunction { public: - ModelFunction(){}; + ModelFunction() {}; virtual arma::vec operator()(const arma::vec& input) = 0; virtual ~ModelFunction() = default; }; diff --git a/src/core/interfaces/gnss_block_interface.h b/src/core/interfaces/gnss_block_interface.h index 0a2de5d6e..4004752c7 100644 --- a/src/core/interfaces/gnss_block_interface.h +++ b/src/core/interfaces/gnss_block_interface.h @@ -83,7 +83,7 @@ public: assert(RF_channel >= 0); if (RF_channel == 0) { - }; // avoid unused param warning + }; // avoid unused param warning return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0; } virtual gr::basic_block_sptr get_right_block(int RF_channel) @@ -91,14 +91,14 @@ public: assert(RF_channel >= 0); if (RF_channel == 0) { - }; // avoid unused param warning + }; // avoid unused param warning return nullptr; // added to support raw array access (non pure virtual to allow left unimplemented)= 0; } /*! * \brief Start the flow of samples if needed. */ - virtual void start(){}; + virtual void start() {}; }; diff --git a/src/core/libs/gnss_sdr_supl_client.cc b/src/core/libs/gnss_sdr_supl_client.cc index 86ec16658..a1f779e72 100644 --- a/src/core/libs/gnss_sdr_supl_client.cc +++ b/src/core/libs/gnss_sdr_supl_client.cc @@ -871,9 +871,9 @@ bool Gnss_Sdr_Supl_Client::read_gal_almanac_from_gsa(const std::string& file_nam return false; } for (pugi::xml_node almanac : doc.child("signalData") - .child("body") - .child("Almanacs") - .children("svAlmanac")) + .child("body") + .child("Almanacs") + .children("svAlmanac")) { Galileo_Almanac gal_alm; try diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 1999a0cbb..7b9fae13d 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -206,7 +206,7 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg) } process_osnma_message(nma_msg); - } // OSNMA frame received + } // OSNMA frame received else if (msg_type_hash_code == typeid(std::shared_ptr>).hash_code()) // Navigation data bits for OSNMA received { const auto inav_data = wht::any_cast>>(pmt::any_ref(msg)); diff --git a/src/core/libs/supl/types/asn_internal.h b/src/core/libs/supl/types/asn_internal.h index 20edeab1a..8f921edd1 100644 --- a/src/core/libs/supl/types/asn_internal.h +++ b/src/core/libs/supl/types/asn_internal.h @@ -19,7 +19,7 @@ extern "C" { #endif -// clang-format off + // clang-format off /* Environment version might be used to avoid running with the old library */ #define ASN1C_ENVIRONMENT_VERSION 922 /* Compile-time version */ int get_asn1c_environment_version(void); /* Run-time version */ diff --git a/src/core/libs/supl/types/asn_system.h b/src/core/libs/supl/types/asn_system.h index 0b462b6eb..a6fa3ef8d 100644 --- a/src/core/libs/supl/types/asn_system.h +++ b/src/core/libs/supl/types/asn_system.h @@ -29,7 +29,7 @@ /* To avoid linking with ws2_32.lib, here's the definition of ntohl() */ #define sys_ntohl(l) \ ((((l) << 24) & 0xff000000) | (((l) << 16) & 0xff0000) | \ - (((l) << 8) & 0xff00) | ((l)&0xff)) + (((l) << 8) & 0xff00) | ((l) & 0xff)) #ifdef _MSC_VER /* MSVS.Net */ #ifndef __cplusplus diff --git a/src/core/libs/supl/types/ber_tlv_tag.h b/src/core/libs/supl/types/ber_tlv_tag.h index fc0208c3e..25614de23 100644 --- a/src/core/libs/supl/types/ber_tlv_tag.h +++ b/src/core/libs/supl/types/ber_tlv_tag.h @@ -22,7 +22,7 @@ extern "C" /* * Tag class is encoded together with tag value for optimization purposes. */ -#define BER_TAG_CLASS(tag) ((tag)&0x3) +#define BER_TAG_CLASS(tag) ((tag) & 0x3) #define BER_TAG_VALUE(tag) ((tag) >> 2) #define BER_TLV_CONSTRUCTED(tagptr) \ (((*(const uint8_t *)tagptr) & 0x20) ? 1 : 0) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 2e6231c91..9a265254d 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -244,9 +244,7 @@ void ControlThread::init() else { // fill agnss_ref_time_ - struct tm tm - { - }; + struct tm tm{}; if (strptime(ref_time_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) != nullptr) { agnss_ref_time_.seconds = timegm(&tm); @@ -560,8 +558,8 @@ bool ControlThread::read_assistance_from_XML() { std::map::const_iterator gps_eph_iter; for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.cbegin(); - gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend(); - gps_eph_iter++) + gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend(); + gps_eph_iter++) { std::cout << "From XML file: Read NAV ephemeris for satellite " << Gnss_Satellite("GPS", gps_eph_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gps_eph_iter->second); @@ -590,8 +588,8 @@ bool ControlThread::read_assistance_from_XML() { std::map::const_iterator gps_alm_iter; for (gps_alm_iter = supl_client_ephemeris_.gps_almanac_map.cbegin(); - gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.cend(); - gps_alm_iter++) + gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.cend(); + gps_alm_iter++) { std::cout << "From XML file: Read GPS almanac for satellite " << Gnss_Satellite("GPS", gps_alm_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gps_alm_iter->second); @@ -608,8 +606,8 @@ bool ControlThread::read_assistance_from_XML() { std::map::const_iterator gal_eph_iter; for (gal_eph_iter = supl_client_ephemeris_.gal_ephemeris_map.cbegin(); - gal_eph_iter != supl_client_ephemeris_.gal_ephemeris_map.cend(); - gal_eph_iter++) + gal_eph_iter != supl_client_ephemeris_.gal_ephemeris_map.cend(); + gal_eph_iter++) { std::cout << "From XML file: Read ephemeris for satellite " << Gnss_Satellite("Galileo", gal_eph_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gal_eph_iter->second); @@ -638,8 +636,8 @@ bool ControlThread::read_assistance_from_XML() { std::map::const_iterator gal_alm_iter; for (gal_alm_iter = supl_client_ephemeris_.gal_almanac_map.cbegin(); - gal_alm_iter != supl_client_ephemeris_.gal_almanac_map.cend(); - gal_alm_iter++) + gal_alm_iter != supl_client_ephemeris_.gal_almanac_map.cend(); + gal_alm_iter++) { std::cout << "From XML file: Read Galileo almanac for satellite " << Gnss_Satellite("Galileo", gal_alm_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gal_alm_iter->second); @@ -655,8 +653,8 @@ bool ControlThread::read_assistance_from_XML() { std::map::const_iterator gps_cnav_eph_iter; for (gps_cnav_eph_iter = supl_client_ephemeris_.gps_cnav_ephemeris_map.cbegin(); - gps_cnav_eph_iter != supl_client_ephemeris_.gps_cnav_ephemeris_map.cend(); - gps_cnav_eph_iter++) + gps_cnav_eph_iter != supl_client_ephemeris_.gps_cnav_ephemeris_map.cend(); + gps_cnav_eph_iter++) { std::cout << "From XML file: Read CNAV ephemeris for satellite " << Gnss_Satellite("GPS", gps_cnav_eph_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gps_cnav_eph_iter->second); @@ -680,8 +678,8 @@ bool ControlThread::read_assistance_from_XML() { std::map::const_iterator glo_gnav_eph_iter; for (glo_gnav_eph_iter = supl_client_ephemeris_.glonass_gnav_ephemeris_map.cbegin(); - glo_gnav_eph_iter != supl_client_ephemeris_.glonass_gnav_ephemeris_map.cend(); - glo_gnav_eph_iter++) + glo_gnav_eph_iter != supl_client_ephemeris_.glonass_gnav_ephemeris_map.cend(); + glo_gnav_eph_iter++) { std::cout << "From XML file: Read GLONASS GNAV ephemeris for satellite " << Gnss_Satellite("GLONASS", glo_gnav_eph_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(glo_gnav_eph_iter->second); @@ -809,8 +807,8 @@ void ControlThread::assist_GNSS() { std::map::const_iterator gps_eph_iter; for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.cbegin(); - gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend(); - gps_eph_iter++) + gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend(); + gps_eph_iter++) { std::cout << "SUPL: Received ephemeris data for satellite " << Gnss_Satellite("GPS", gps_eph_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gps_eph_iter->second); @@ -846,8 +844,8 @@ void ControlThread::assist_GNSS() { std::map::const_iterator gps_alm_iter; for (gps_alm_iter = supl_client_ephemeris_.gps_almanac_map.cbegin(); - gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.cend(); - gps_alm_iter++) + gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.cend(); + gps_alm_iter++) { std::cout << "SUPL: Received almanac data for satellite " << Gnss_Satellite("GPS", gps_alm_iter->second.PRN) << '\n'; const std::shared_ptr tmp_obj = std::make_shared(gps_alm_iter->second); @@ -900,8 +898,8 @@ void ControlThread::assist_GNSS() { std::map::const_iterator gps_acq_iter; for (gps_acq_iter = supl_client_acquisition_.gps_acq_map.cbegin(); - gps_acq_iter != supl_client_acquisition_.gps_acq_map.cend(); - gps_acq_iter++) + gps_acq_iter != supl_client_acquisition_.gps_acq_map.cend(); + gps_acq_iter++) { std::cout << "SUPL: Received acquisition assistance data for satellite " << Gnss_Satellite("GPS", gps_acq_iter->second.PRN) << '\n'; global_gps_acq_assist_map.write(gps_acq_iter->second.PRN, gps_acq_iter->second); @@ -1046,9 +1044,7 @@ std::vector> ControlThread::get_visible_sats(time std::vector visible_gps; std::vector visible_gal; const std::shared_ptr pvt_ptr = flowgraph_->get_pvt(); - struct tm tstruct - { - }; + struct tm tstruct{}; char buf[80]; tstruct = *gmtime(&rx_utc_time); strftime(buf, sizeof(buf), "%d/%m/%Y %H:%M:%S ", &tstruct); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 785672670..4ecbb3522 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -2485,8 +2485,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create GPS L1 C/A signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); - available_gnss_prn_iter != available_gps_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_gps_prn.cend(); + available_gnss_prn_iter++) { available_GPS_1C_signals_.emplace_back( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), @@ -2498,8 +2498,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create GPS L2C M signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); - available_gnss_prn_iter != available_gps_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_gps_prn.cend(); + available_gnss_prn_iter++) { available_GPS_2S_signals_.emplace_back( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), @@ -2511,8 +2511,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create GPS L5 signals for (available_gnss_prn_iter = available_gps_prn.cbegin(); - available_gnss_prn_iter != available_gps_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_gps_prn.cend(); + available_gnss_prn_iter++) { available_GPS_L5_signals_.emplace_back( Gnss_Satellite(std::string("GPS"), *available_gnss_prn_iter), @@ -2524,8 +2524,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create SBAS L1 C/A signals for (available_gnss_prn_iter = available_sbas_prn.cbegin(); - available_gnss_prn_iter != available_sbas_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_sbas_prn.cend(); + available_gnss_prn_iter++) { available_SBAS_1C_signals_.emplace_back( Gnss_Satellite(std::string("SBAS"), *available_gnss_prn_iter), @@ -2537,8 +2537,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create the list of Galileo E1B signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); - available_gnss_prn_iter != available_galileo_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_galileo_prn.cend(); + available_gnss_prn_iter++) { available_GAL_1B_signals_.emplace_back( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), @@ -2550,8 +2550,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create the list of Galileo E5a signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); - available_gnss_prn_iter != available_galileo_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_galileo_prn.cend(); + available_gnss_prn_iter++) { available_GAL_5X_signals_.emplace_back( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), @@ -2563,8 +2563,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create the list of Galileo E5b signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); - available_gnss_prn_iter != available_galileo_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_galileo_prn.cend(); + available_gnss_prn_iter++) { available_GAL_7X_signals_.emplace_back( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), @@ -2576,8 +2576,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create the list of Galileo E6 signals for (available_gnss_prn_iter = available_galileo_prn.cbegin(); - available_gnss_prn_iter != available_galileo_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_galileo_prn.cend(); + available_gnss_prn_iter++) { available_GAL_E6_signals_.emplace_back( Gnss_Satellite(std::string("Galileo"), *available_gnss_prn_iter), @@ -2589,8 +2589,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create the list of GLONASS L1 C/A signals for (available_gnss_prn_iter = available_glonass_prn.cbegin(); - available_gnss_prn_iter != available_glonass_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_glonass_prn.cend(); + available_gnss_prn_iter++) { available_GLO_1G_signals_.emplace_back( Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter), @@ -2602,8 +2602,8 @@ void GNSSFlowgraph::set_signals_list() { // Loop to create the list of GLONASS L2 C/A signals for (available_gnss_prn_iter = available_glonass_prn.cbegin(); - available_gnss_prn_iter != available_glonass_prn.cend(); - available_gnss_prn_iter++) + available_gnss_prn_iter != available_glonass_prn.cend(); + available_gnss_prn_iter++) { available_GLO_2G_signals_.emplace_back( Gnss_Satellite(std::string("Glonass"), *available_gnss_prn_iter), @@ -2615,8 +2615,8 @@ void GNSSFlowgraph::set_signals_list() { // 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++) + available_gnss_prn_iter != available_beidou_prn.cend(); + available_gnss_prn_iter++) { available_BDS_B1_signals_.emplace_back( Gnss_Satellite(std::string("Beidou"), *available_gnss_prn_iter), @@ -2628,8 +2628,8 @@ void GNSSFlowgraph::set_signals_list() { // 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++) + available_gnss_prn_iter != available_beidou_prn.cend(); + available_gnss_prn_iter++) { available_BDS_B3_signals_.emplace_back( Gnss_Satellite(std::string("Beidou"), *available_gnss_prn_iter), diff --git a/src/core/receiver/tcp_cmd_interface.cc b/src/core/receiver/tcp_cmd_interface.cc index 587aa99fb..713c3e726 100644 --- a/src/core/receiver/tcp_cmd_interface.cc +++ b/src/core/receiver/tcp_cmd_interface.cc @@ -146,9 +146,7 @@ std::string TcpCmdInterface::status(const std::vector &commandLine &course_over_ground_deg, &UTC_time) == true) { - struct tm tstruct - { - }; + struct tm tstruct{}; std::array buf1{}; tstruct = *gmtime(&UTC_time); strftime(buf1.data(), buf1.size(), "%d/%m/%Y %H:%M:%S", &tstruct); @@ -179,9 +177,7 @@ std::string TcpCmdInterface::hotstart(const std::vector &commandLin if (commandLine.size() > 5) { // Read commandline time parameter - struct tm tm - { - }; + struct tm tm{}; const std::string tmp_str = commandLine.at(1) + commandLine.at(2); if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) { @@ -227,9 +223,7 @@ std::string TcpCmdInterface::warmstart(const std::vector &commandLi if (commandLine.size() > 5) { // Read commandline time parameter - struct tm tm - { - }; + struct tm tm{}; const std::string tmp_str = commandLine.at(1) + commandLine.at(2); if (strptime(tmp_str.c_str(), "%d/%m/%Y %H:%M:%S", &tm) == nullptr) { diff --git a/src/core/system_parameters/GLONASS_L1_L2_CA.h b/src/core/system_parameters/GLONASS_L1_L2_CA.h index 042754742..0194e78db 100644 --- a/src/core/system_parameters/GLONASS_L1_L2_CA.h +++ b/src/core/system_parameters/GLONASS_L1_L2_CA.h @@ -87,10 +87,9 @@ constexpr int32_t GLONASS_CA_NBR_SATS = 24; // STRING DATA WITHOUT PREAMBLE constexpr int32_t GLONASS_L1_CA_HISTORY_DEEP = 100; // NAVIGATION MESSAGE DEMODULATION AND DECODING -#define GLONASS_GNAV_PREAMBLE \ - { \ - 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0 \ - } +#define GLONASS_GNAV_PREAMBLE \ + { \ + 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0} constexpr double GLONASS_GNAV_PREAMBLE_DURATION_S = 0.300; constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_BITS = 30; constexpr int32_t GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS = 300; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index b394781cd..2b9146cc0 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -173,7 +173,7 @@ public: const std::vector& s2_) : msg(msg_), nt(nt_), sequence1(s1_), - sequence2(s2_){}; + sequence2(s2_) {}; uint8_t msg{}; uint8_t nt{}; std::vector sequence1; diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index fc6945818..7f0ef6252 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -208,7 +208,7 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even flag_CRC_test = false; } } // end of CRC checksum control - } // end if (page_string.at(0)=='1') + } // end if (page_string.at(0)=='1') else { page_Even = page_string.substr(0, 114); diff --git a/tests/common-files/gnuplot_i.h b/tests/common-files/gnuplot_i.h index 04b7e3458..783674802 100644 --- a/tests/common-files/gnuplot_i.h +++ b/tests/common-files/gnuplot_i.h @@ -2095,7 +2095,7 @@ inline bool Gnuplot::get_program_path() // scan list for Gnuplot program files for (std::list::const_iterator i = ls.begin(); - i != ls.end(); ++i) + i != ls.end(); ++i) { tmp = (*i) + "/" + Gnuplot::m_sGNUPlotFileName; #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) diff --git a/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc b/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc index dc88d9e7b..66a73d6df 100644 --- a/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc +++ b/tests/system-tests/libs/spirent_motion_csv_dump_reader.cc @@ -97,7 +97,7 @@ bool Spirent_Motion_Csv_Dump_Reader::read_csv_obs() line, boost::escaped_list_separator('\\', ',', '\"')); for (boost::tokenizer>::iterator i( tk.begin()); - i != tk.end(); ++i) + i != tk.end(); ++i) { try { diff --git a/tests/unit-tests/arithmetic/fft_speed_test.cc b/tests/unit-tests/arithmetic/fft_speed_test.cc index 6c3d28690..e2282f2ed 100644 --- a/tests/unit-tests/arithmetic/fft_speed_test.cc +++ b/tests/unit-tests/arithmetic/fft_speed_test.cc @@ -37,8 +37,7 @@ TEST(FFTSpeedTest, ArmadilloVSGNURadioExecutionTime) unsigned int fft_sizes[19] = {16, 25, 32, 45, 64, 95, 128, 195, 256, 325, 512, 785, 1024, 1503, 2048, 3127, 4096, 6349, 8192}; double d_execution_time; EXPECT_NO_THROW( - for (unsigned int fft_size - : fft_sizes) { + for (unsigned int fft_size : fft_sizes) { d_fft_size = fft_size; auto d_gr_fft = gnss_fft_fwd_make_unique(d_fft_size); arma::arma_rng::set_seed_random(); diff --git a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index f7540e0c0..f66aeed57 100644 --- a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -1816,7 +1816,7 @@ bool HybridObservablesTest::ReadRinexObs(std::vector* obs_vec, Gnss_S } } } // end while - } // End of 'try' block + } // End of 'try' block catch (const gnsstk::FFStreamError& e) { std::cout << e; diff --git a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc index c466a277b..f16c45004 100644 --- a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc +++ b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test_fpga.cc @@ -1871,7 +1871,7 @@ bool HybridObservablesTestFpga::ReadRinexObs(std::vector* obs_vec, Gn } } } // end while - } // End of 'try' block + } // End of 'try' block catch (const gnsstk::FFStreamError& e) { diff --git a/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc b/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc index fe2aa27af..cebd4615c 100644 --- a/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc +++ b/tests/unit-tests/signal-processing-blocks/pvt/rtklib_solver_test.cc @@ -398,8 +398,8 @@ TEST(RTKLibSolverTest, test1) { std::map::const_iterator gps_eph_iter; for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.cbegin(); - gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend(); - gps_eph_iter++) + gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.cend(); + gps_eph_iter++) { std::cout << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first << '\n'; std::shared_ptr tmp_obj = std::make_shared(gps_eph_iter->second); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc index 2c78fa743..ff73bd1c4 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/cubature_filter_test.cc @@ -25,7 +25,7 @@ class TransitionModel : public ModelFunction { public: - explicit TransitionModel(const arma::mat& kf_F) : coeff_mat(kf_F){}; + explicit TransitionModel(const arma::mat& kf_F) : coeff_mat(kf_F) {}; arma::vec operator()(const arma::vec& input) override { return coeff_mat * input; }; private: @@ -35,7 +35,7 @@ private: class MeasurementModel : public ModelFunction { public: - explicit MeasurementModel(const arma::mat& kf_H) : coeff_mat(kf_H){}; + explicit MeasurementModel(const arma::mat& kf_H) : coeff_mat(kf_H) {}; arma::vec operator()(const arma::vec& input) override { return coeff_mat * input; }; private: diff --git a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index d5a28ffa9..4241b7b6f 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -1282,8 +1282,8 @@ TEST_F(TrackingPullInTest, ValidationOfResults) } } } // end plot - } // end acquisition Delay errors loop - } // end acquisition Doppler errors loop + } // end acquisition Delay errors loop + } // end acquisition Doppler errors loop pull_in_results_v_v.push_back(pull_in_results_v); } // end CN0 LOOP diff --git a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index a2f27204e..351ef8e26 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -1433,8 +1433,8 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults) } } } // end plot - } // end acquisition Delay errors loop - } // end acquisition Doppler errors loop + } // end acquisition Delay errors loop + } // end acquisition Doppler errors loop pull_in_results_v_v.push_back(pull_in_results_v); } // end CN0 LOOP diff --git a/utils/front-end-cal/front_end_cal.cc b/utils/front-end-cal/front_end_cal.cc index dc26ab2a3..e74a8556e 100644 --- a/utils/front-end-cal/front_end_cal.cc +++ b/utils/front-end-cal/front_end_cal.cc @@ -56,8 +56,8 @@ bool FrontEndCal::read_assistance_from_XML() { std::map::iterator gps_eph_iter; for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.begin(); - gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end(); - gps_eph_iter++) + gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end(); + gps_eph_iter++) { std::cout << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first << '\n'; LOG(INFO) << "SUPL: Read XML Ephemeris for GPS SV " << gps_eph_iter->first; @@ -134,8 +134,8 @@ int FrontEndCal::Get_SUPL_Assist() { std::map::iterator gps_eph_iter; for (gps_eph_iter = supl_client_ephemeris_.gps_ephemeris_map.begin(); - gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end(); - gps_eph_iter++) + gps_eph_iter != supl_client_ephemeris_.gps_ephemeris_map.end(); + gps_eph_iter++) { LOG(INFO) << "SUPL: Received Ephemeris for GPS SV " << gps_eph_iter->first; std::cout << "SUPL: Received Ephemeris for GPS SV " << gps_eph_iter->first << '\n'; @@ -163,8 +163,8 @@ int FrontEndCal::Get_SUPL_Assist() { std::map::iterator gps_alm_iter; for (gps_alm_iter = supl_client_ephemeris_.gps_almanac_map.begin(); - gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.end(); - gps_alm_iter++) + gps_alm_iter != supl_client_ephemeris_.gps_almanac_map.end(); + gps_alm_iter++) { LOG(INFO) << "SUPL: Received Almanac for GPS SV " << gps_alm_iter->first; std::cout << "SUPL: Received Almanac for GPS SV " << gps_alm_iter->first << '\n'; @@ -199,8 +199,8 @@ int FrontEndCal::Get_SUPL_Assist() { std::map::iterator gps_acq_iter; for (gps_acq_iter = supl_client_acquisition_.gps_acq_map.begin(); - gps_acq_iter != supl_client_acquisition_.gps_acq_map.end(); - gps_acq_iter++) + gps_acq_iter != supl_client_acquisition_.gps_acq_map.end(); + gps_acq_iter++) { LOG(INFO) << "SUPL: Received Acquisition assistance for GPS SV " << gps_acq_iter->first; std::cout << "SUPL: Received Acquisition assistance for GPS SV " << gps_acq_iter->first << '\n'; diff --git a/utils/rinex-tools/obsdiff.cc b/utils/rinex-tools/obsdiff.cc index 1b2cd1fc3..d9f04d929 100644 --- a/utils/rinex-tools/obsdiff.cc +++ b/utils/rinex-tools/obsdiff.cc @@ -249,7 +249,7 @@ std::map ReadRinexObs(const std::string& rinex_file, char system } } } // end while - } // End of 'try' block + } // End of 'try' block catch (const gnsstk::FFStreamError& e) { std::cout << e; @@ -1408,8 +1408,8 @@ double compute_rx_clock_error(const std::string& rinex_nav_filename, const std:: rx_clock_error_s = raimSolver.Solution(3) / gnsstk::C_MPS; break; } // End of 'if( raimSolver.isValid() )' - } // End of 'if( rod.epochFlag == 0 || rod.epochFlag == 1 )' - } // End of 'while( roffs >> rod )' + } // End of 'if( rod.epochFlag == 0 || rod.epochFlag == 1 )' + } // End of 'while( roffs >> rod )' } catch (const gnsstk::FFStreamError& e) { From 6d006418962c90ff5868c2b839d26c3ce0333862 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 26 Dec 2024 11:38:07 +0100 Subject: [PATCH 449/499] Transition to clang-format 19 --- .../libs/gsl/include/gsl/gsl-lite.hpp | 50 +++++++++---------- src/algorithms/libs/opencl/cl.hpp | 6 +-- .../cpu_features/src/string_view.c | 2 +- .../tmpl/volk_gnsssdr_cpu.tmpl.old.c | 4 +- .../libs/supl/asn-rrlp/converter-sample.c | 4 +- src/core/libs/supl/asn-supl/GeneralizedTime.c | 33 ++++++------ src/core/libs/supl/types/INTEGER.c | 2 +- src/core/libs/supl/types/OCTET_STRING.c | 7 ++- src/core/libs/supl/types/ber_tlv_length.c | 2 +- src/core/libs/supl/types/ber_tlv_tag.c | 2 +- src/core/libs/supl/types/constr_SEQUENCE.c | 6 +-- src/core/libs/supl/types/xer_support.c | 2 +- 12 files changed, 58 insertions(+), 62 deletions(-) diff --git a/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp b/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp index 4762439a1..e4ed24221 100644 --- a/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp +++ b/src/algorithms/libs/gsl/include/gsl/gsl-lite.hpp @@ -1611,7 +1611,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr auto - size(T const (&)[N]) gsl_noexcept->size_t + size(T const (&)[N]) gsl_noexcept -> size_t { return N; } @@ -1625,7 +1625,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_api inline gsl_constexpr auto - data(T (&arr)[N]) gsl_noexcept->T * + data(T (&arr)[N]) gsl_noexcept -> T * { return &arr[0]; } @@ -1646,7 +1646,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD inline gsl_constexpr auto - data(std::initializer_list il) gsl_noexcept->E const * + data(std::initializer_list il) gsl_noexcept -> E const * { return il.begin(); } @@ -1722,7 +1722,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD gsl_constexpr auto - ssize(T const (&)[N]) gsl_noexcept->std::ptrdiff_t + ssize(T const (&)[N]) gsl_noexcept -> std::ptrdiff_t { return std::ptrdiff_t(N); } @@ -2269,7 +2269,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } #endif // gsl_CONFIG_DEFAULTS_VERSION < 1 || ! gsl_CPP17_OR_GREATER - gsl_SUPPRESS_MSGSL_WARNING(f .6) + gsl_SUPPRESS_MSGSL_WARNING(f.6) #if gsl_CONFIG_DEFAULTS_VERSION < 1 // we avoid the unnecessary virtual calls if modern defaults are selected virtual #endif @@ -2330,7 +2330,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } #endif // ! gsl_CPP17_OR_GREATER - gsl_SUPPRESS_MSGSL_WARNING(f .6) ~final_action_return() gsl_noexcept + gsl_SUPPRESS_MSGSL_WARNING(f.6) ~final_action_return() gsl_noexcept { #if !gsl_CPP17_OR_GREATER if (exception_count_ != 0xFF) // abuse member as special "no-invoke" marker @@ -2371,7 +2371,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } #endif // ! gsl_CPP17_OR_GREATER - gsl_SUPPRESS_MSGSL_WARNING(f .6) ~final_action_error() gsl_noexcept + gsl_SUPPRESS_MSGSL_WARNING(f.6) ~final_action_error() gsl_noexcept { #if !gsl_CPP17_OR_GREATER if (exception_count_ != 0xFF) // abuse member as special "no-invoke" marker @@ -3496,21 +3496,21 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator==(not_null const &l, not_null const &r) - gsl_RETURN_DECLTYPE_(l.operator->() == r.operator->()) + gsl_RETURN_DECLTYPE_(l.operator-> () == r.operator->()) { return l.operator->() == r.operator->(); } template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator==(not_null const &l, U const &r) - gsl_RETURN_DECLTYPE_(l.operator->() == r) + gsl_RETURN_DECLTYPE_(l.operator-> () == r) { return l.operator->() == r; } template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator==(T const &l, not_null const &r) - gsl_RETURN_DECLTYPE_(l == r.operator->()) + gsl_RETURN_DECLTYPE_(l == r.operator-> ()) { return l == r.operator->(); } @@ -3526,21 +3526,21 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator<(not_null const &l, not_null const &r) - gsl_RETURN_DECLTYPE_(l.operator->() < r.operator->()) + gsl_RETURN_DECLTYPE_(l.operator-> () < r.operator->()) { return l.operator->() < r.operator->(); } template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator<(not_null const &l, U const &r) - gsl_RETURN_DECLTYPE_(l.operator->() < r) + gsl_RETURN_DECLTYPE_(l.operator-> () < r) { return l.operator->() < r; } template gsl_NODISCARD inline gsl_api gsl_constexpr gsl_TRAILING_RETURN_TYPE_(bool) operator<(T const &l, not_null const &r) - gsl_RETURN_DECLTYPE_(l < r.operator->()) + gsl_RETURN_DECLTYPE_(l < r.operator-> ()) { return l < r.operator->(); } @@ -4357,7 +4357,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_CONFIG(ALLOWS_NONSTRICT_SPAN_COMPARISON) template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr bool operator==(span const &l, span const &r) { @@ -4365,7 +4365,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr bool operator<(span const &l, span const &r) { @@ -4375,7 +4375,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #else // a.k.a. !gsl_CONFIG( ALLOWS_NONSTRICT_SPAN_COMPARISON ) template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr bool operator==(span const &l, span const &r) { @@ -4383,7 +4383,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr bool operator<(span const &l, span const &r) { @@ -4531,7 +4531,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ()))> gsl_NODISCARD inline gsl_constexpr auto make_span(Container & cont) - ->span::type> + -> span::type> { return span::type>(cont); } @@ -4539,7 +4539,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ()))> gsl_NODISCARD inline gsl_constexpr auto make_span(Container const &cont) - ->span::type> + -> span::type> { return span::type>(cont); } @@ -5062,7 +5062,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #if gsl_CONFIG(ALLOWS_NONSTRICT_SPAN_COMPARISON) template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr14 bool operator==(basic_string_span const &l, U const &u) gsl_noexcept { @@ -5072,7 +5072,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr14 bool operator<(basic_string_span const &l, U const &u) gsl_noexcept { @@ -5085,7 +5085,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ::value))> - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr14 bool operator==(U const &u, basic_string_span const &r) gsl_noexcept { @@ -5096,7 +5096,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 template ::value))> - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr14 bool operator<(U const &u, basic_string_span const &r) gsl_noexcept { @@ -5109,7 +5109,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 #else // gsl_CONFIG( ALLOWS_NONSTRICT_SPAN_COMPARISON ) template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr14 bool operator==(basic_string_span const &l, basic_string_span const &r) gsl_noexcept { @@ -5117,7 +5117,7 @@ gsl_DISABLE_MSVC_WARNINGS(26432 26410 26415 26418 26472 26439 26440 26455 26473 } template - gsl_SUPPRESS_MSGSL_WARNING(stl .1) + gsl_SUPPRESS_MSGSL_WARNING(stl.1) gsl_NODISCARD inline gsl_constexpr14 bool operator<(basic_string_span const &l, basic_string_span const &r) gsl_noexcept { diff --git a/src/algorithms/libs/opencl/cl.hpp b/src/algorithms/libs/opencl/cl.hpp index 5b07e0091..b2c467e04 100644 --- a/src/algorithms/libs/opencl/cl.hpp +++ b/src/algorithms/libs/opencl/cl.hpp @@ -2588,7 +2588,7 @@ public: return ::clUnloadPlatformCompiler(object_); } #endif // #if defined(CL_VERSION_1_2) -}; // class Platform +}; // class Platform /** * Deprecated APIs for 1.2 @@ -4745,9 +4745,9 @@ public: //! \brief Default constructor - initializes to nullptr. #if defined(CL_VERSION_1_2) - BufferRenderGL() : ImageGL(){}; + BufferRenderGL() : ImageGL() {}; #else // #if defined(CL_VERSION_1_2) - BufferRenderGL() : Image2DGL(){}; + BufferRenderGL() : Image2DGL() {}; #endif // #if defined(CL_VERSION_1_2) /*! \brief Constructor from cl_mem - takes ownership. diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/string_view.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/string_view.c index 3e8b8b8a5..e56055d1f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/string_view.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/string_view.c @@ -119,7 +119,7 @@ static int ParsePositiveNumberWithBase(const StringView view, int base) int result = 0; StringView remainder = view; for (; remainder.size; - remainder = CpuFeatures_StringView_PopFront(remainder, 1)) + remainder = CpuFeatures_StringView_PopFront(remainder, 1)) { const int value = HexValue(CpuFeatures_StringView_Front(remainder)); if (value < 0 || value >= base) return -1; diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.old.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.old.c index ab3de6694..58f506c7e 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.old.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.old.c @@ -36,9 +36,7 @@ struct VOLK_CPU volk_gnsssdr_cpu; static inline unsigned long long _xgetbv(unsigned int index) { unsigned int eax, edx; - __VOLK_ASM __VOLK_VOLATILE("xgetbv" - : "=a"(eax), "=d"(edx) - : "c"(index)); + __VOLK_ASM __VOLK_VOLATILE("xgetbv" : "=a"(eax), "=d"(edx) : "c"(index)); return ((unsigned long long)edx << 32) | eax; } #define __xgetbv() _xgetbv(0) diff --git a/src/core/libs/supl/asn-rrlp/converter-sample.c b/src/core/libs/supl/asn-rrlp/converter-sample.c index 5723cb1d2..bfed937c9 100644 --- a/src/core/libs/supl/asn-rrlp/converter-sample.c +++ b/src/core/libs/supl/asn-rrlp/converter-sample.c @@ -721,8 +721,8 @@ static void *data_decode_from_file(asn_TYPE_descriptor_t *pduType, FILE *file, rval.consumed = 0; for (tolerate_eof = 1; /* Allow EOF first time buffer is non-empty */ - (rd = fread(fbuf, 1, fbuf_size, file)) || feof(file) == 0 || - (tolerate_eof && DynamicBuffer.length);) + (rd = fread(fbuf, 1, fbuf_size, file)) || feof(file) == 0 || + (tolerate_eof && DynamicBuffer.length);) { int ecbits = 0; /* Extra consumed bits in case of PER */ uint8_t *i_bptr; diff --git a/src/core/libs/supl/asn-supl/GeneralizedTime.c b/src/core/libs/supl/asn-supl/GeneralizedTime.c index 235a215a2..54a2eb5fa 100644 --- a/src/core/libs/supl/asn-supl/GeneralizedTime.c +++ b/src/core/libs/supl/asn-supl/GeneralizedTime.c @@ -147,8 +147,7 @@ static long GMTOFF(struct tm a) } \ while (0); \ } \ - while (0) \ - ; + while (0); #ifdef _EMULATE_TIMEGM static time_t timegm(struct tm *tm) @@ -428,21 +427,21 @@ time_t asn_GT2time_frac(const GeneralizedTime_t *st, int *frac_value, memset(&tm_s, 0, sizeof(tm_s)); #undef B2F #undef B2T -#define B2F(var) \ - do \ - { \ - unsigned ch = *buf; \ - if (ch < 0x30 || ch > 0x39) \ - { \ - errno = EINVAL; \ - return -1; \ - } \ - else \ - { \ - (var) = (var)*10 + (ch - 0x30); \ - buf++; \ - } \ - } \ +#define B2F(var) \ + do \ + { \ + unsigned ch = *buf; \ + if (ch < 0x30 || ch > 0x39) \ + { \ + errno = EINVAL; \ + return -1; \ + } \ + else \ + { \ + (var) = (var) * 10 + (ch - 0x30); \ + buf++; \ + } \ + } \ while (0) #define B2T(var) B2F(tm_s.var) diff --git a/src/core/libs/supl/types/INTEGER.c b/src/core/libs/supl/types/INTEGER.c index 86d014599..c8d0291d2 100644 --- a/src/core/libs/supl/types/INTEGER.c +++ b/src/core/libs/supl/types/INTEGER.c @@ -294,7 +294,7 @@ static int INTEGER__compar_enum2value(const void *kp, const void *am) /* Compare strings */ for (ptr = key->start, end = key->stop, name = el->enum_name; ptr < end; - ptr++, name++) + ptr++, name++) { if (*ptr != *name) { diff --git a/src/core/libs/supl/types/OCTET_STRING.c b/src/core/libs/supl/types/OCTET_STRING.c index 140ecc5ad..1866de1ef 100644 --- a/src/core/libs/supl/types/OCTET_STRING.c +++ b/src/core/libs/supl/types/OCTET_STRING.c @@ -775,10 +775,9 @@ static struct OCTET_STRING__xer_escape_table_s char *string; int size; } OCTET_STRING__xer_escape_table[] = { -#define OSXET(s) \ - { \ - s, sizeof(s) - 1 \ - } +#define OSXET(s) \ + { \ + s, sizeof(s) - 1} OSXET("\074\156\165\154\057\076"), /* */ OSXET("\074\163\157\150\057\076"), /* */ OSXET("\074\163\164\170\057\076"), /* */ diff --git a/src/core/libs/supl/types/ber_tlv_length.c b/src/core/libs/supl/types/ber_tlv_length.c index 3d2d79be2..547ccef2c 100644 --- a/src/core/libs/supl/types/ber_tlv_length.c +++ b/src/core/libs/supl/types/ber_tlv_length.c @@ -45,7 +45,7 @@ ssize_t ber_fetch_length(int _is_constructed, const void *bufptr, size_t size, oct &= 0x7F; /* Leave only the 7 LS bits */ for (len = 0, buf++, skipped = 1; oct && (++skipped <= size); - buf++, oct--) + buf++, oct--) { len = (len << 8) | *buf; if (len < 0 || (len >> ((8 * sizeof(len)) - 8) && oct > 1)) diff --git a/src/core/libs/supl/types/ber_tlv_tag.c b/src/core/libs/supl/types/ber_tlv_tag.c index 47ac813df..154975f14 100644 --- a/src/core/libs/supl/types/ber_tlv_tag.c +++ b/src/core/libs/supl/types/ber_tlv_tag.c @@ -34,7 +34,7 @@ ssize_t ber_fetch_tag(const void *ptr, size_t size, ber_tlv_tag_t *tag_r) * The MSB is 0 if it is the last octet of the tag. */ for (val = 0, ptr = ((const char *)ptr) + 1, skipped = 2; skipped <= size; - ptr = ((const char *)ptr) + 1, skipped++) + ptr = ((const char *)ptr) + 1, skipped++) { unsigned int oct = *(const uint8_t *)ptr; if (oct & 0x80) diff --git a/src/core/libs/supl/types/constr_SEQUENCE.c b/src/core/libs/supl/types/constr_SEQUENCE.c index 62101bc55..1c64bc773 100644 --- a/src/core/libs/supl/types/constr_SEQUENCE.c +++ b/src/core/libs/supl/types/constr_SEQUENCE.c @@ -216,7 +216,7 @@ asn_dec_rval_t SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, * step = ( * 2 + ). */ for (edx = (ctx->step >> 1); edx < td->elements_count; - edx++, ctx->step = (ctx->step & ~1) + 2) + edx++, ctx->step = (ctx->step & ~1) + 2) { void *memb_ptr; /* Pointer to the member */ void **memb_ptr2; /* Pointer to that pointer */ @@ -1518,7 +1518,7 @@ asn_dec_rval_t SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, /* Fill DEFAULT members in extensions */ for (edx = specs->roms_count; edx < specs->roms_count + specs->aoms_count; - edx++) + edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void **memb_ptr2; /* Pointer to member pointer */ @@ -1700,7 +1700,7 @@ asn_enc_rval_t SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, td->elements_count, specs->ext_before); for (edx = 0; edx < ((specs->ext_after < 0) ? td->elements_count : specs->ext_before - 1); - edx++) + edx++) { asn_TYPE_member_t *elm = &td->elements[edx]; void *memb_ptr; /* Pointer to the member */ diff --git a/src/core/libs/supl/types/xer_support.c b/src/core/libs/supl/types/xer_support.c index e920bfabc..23375eb33 100644 --- a/src/core/libs/supl/types/xer_support.c +++ b/src/core/libs/supl/types/xer_support.c @@ -248,7 +248,7 @@ ssize_t pxml_parse(int *stateContext, const void *xmlbuf, size_t size, } break; } /* switch(*ptr) */ - } /* for() */ + } /* for() */ /* * Flush the partially processed chunk, state permitting. From a48e0fee234e065b46a666abc2f138d876c1ed54 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 26 Dec 2024 20:35:07 +0100 Subject: [PATCH 450/499] CI: Use Python 3.13 --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 12d2e72ec..e98da271c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -211,7 +211,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -250,7 +250,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install dependencies run: | python -m pip install --upgrade pip @@ -268,7 +268,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install dependencies run: | python -m pip install --upgrade pip From 6757adf8d560614dbcb4a1d099a83e2d0aed2224 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 29 Dec 2024 22:38:55 +0100 Subject: [PATCH 451/499] Safer copy constructor and copy assignment operator for Gnss_Satellite Fix clang-tidy bugprone-exception-escape warnings --- src/core/system_parameters/gnss_satellite.cc | 37 ++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index 7a13616e1..2867a36da 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -78,11 +78,22 @@ bool operator==(const Gnss_Satellite& sat1, const Gnss_Satellite& sat2) // Copy constructor Gnss_Satellite::Gnss_Satellite(const Gnss_Satellite& other) noexcept - : system(other.system), - block(other.block), - PRN(other.PRN), + : PRN(other.PRN), rf_link(other.rf_link) { + try + { + system = other.system; + block = other.block; + } + catch (...) + { + // Handle failure by creating a valid but empty object + system.clear(); + block.clear(); + PRN = 0; + rf_link = 0; + } } @@ -92,10 +103,22 @@ Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite& rhs) noexcept // Only do assignment if RHS is a different object from this. if (this != &rhs) { - this->system = rhs.system; - this->block = rhs.block; - this->PRN = rhs.PRN; - this->rf_link = rhs.rf_link; + try + { + // Copy strings first + std::string tmp_system = rhs.system; + std::string tmp_block = rhs.block; + + // If we get here, string copies succeeded + system = std::move(tmp_system); + block = std::move(tmp_block); + PRN = rhs.PRN; + rf_link = rhs.rf_link; + } + catch (...) + { + // Keep object in valid state by not modifying it + } } return *this; } From deb127e177654435294322f6f2c2cec2b0b6a952 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 29 Dec 2024 23:59:27 +0100 Subject: [PATCH 452/499] Pass big parameter by reference --- src/algorithms/PVT/libs/rtcm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/algorithms/PVT/libs/rtcm.h b/src/algorithms/PVT/libs/rtcm.h index 26223d884..0d7996590 100644 --- a/src/algorithms/PVT/libs/rtcm.h +++ b/src/algorithms/PVT/libs/rtcm.h @@ -831,7 +831,7 @@ private: [this, &msg]() { #else boost::asio::post(io_context_, - [this, msg]() { + [this, &msg]() { #endif bool write_in_progress = !write_msgs_.empty(); write_msgs_.push_back(msg); From acae99cb5c300c85d3ef6b9c3c0d85c54c40cb7d Mon Sep 17 00:00:00 2001 From: joebre Date: Wed, 15 Jan 2025 14:02:04 +0100 Subject: [PATCH 453/499] gps almanac decoding Signed-off-by: joebre --- .../gps_l1_ca_telemetry_decoder_gs.cc | 13 ++- src/core/system_parameters/GPS_L1_CA.h | 23 ++++++ .../gps_navigation_message.cc | 79 ++++++++++++++++++- .../gps_navigation_message.h | 23 +++++- 4 files changed, 131 insertions(+), 7 deletions(-) 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 62bbf6bfa..ba4c6d688 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 @@ -396,10 +396,19 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe(double cn0, bool flag_inver const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_utc_model()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); } + if (d_nav.almanac_validation() == true) + { + const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_almanac()); + this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); + } break; case 5: - // get almanac (if available) - // TODO: implement almanac reader in navigation_message + if (d_nav.almanac_validation() == true) + { + const std::shared_ptr tmp_obj = std::make_shared(d_nav.get_almanac()); + this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); + } + break; default: break; } diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 842dbbf3b..8d4415d51 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -226,6 +226,29 @@ const std::vector> HEALTH_SV23({{253, 6}}); const std::vector> HEALTH_SV24({{259, 6}}); +// Almanac +const std::vector> ALM_ECC({{69, 16}}); +constexpr double ALM_ECC_LSB = TWO_N21; +const std::vector> ALM_TOA({{91, 8}}); +constexpr int32_t ALM_TOA_LSB = static_cast(TWO_P12); +const std::vector> ALM_DELTAI({{99, 16}}); +constexpr double ALM_DELTAI_LSB = TWO_N19; +const std::vector> ALM_OMEGADOT({{121, 16}}); +constexpr double ALM_OMEGADOT_LSB = TWO_N38; +const std::vector> ALM_SVHEALTH({{137, 8}}); +const std::vector> ALM_SQUAREA({{151, 24}}); +constexpr double ALM_SQUAREA_LSB = TWO_N11; +const std::vector> ALM_OMEGAZERO({{181, 24}}); +constexpr double ALM_OMEGAZERO_LSB = TWO_N23; +const std::vector> ALM_OMEGA({{211, 24}}); +constexpr double ALM_OMEGA_LSB = TWO_N23; +const std::vector> ALM_MZERO({{241, 24}}); +constexpr double ALM_MZERO_LSB = TWO_N23; + +const std::vector> ALM_AF0({{271, 8}, {290, 3}}); +constexpr double ALM_AF0_LSB = TWO_N20; +const std::vector> ALM_AF1({{279, 11}}); +constexpr double ALM_AF1_LSB = TWO_N38; /** \} */ /** \} */ #endif // GNSS_SDR_GPS_L1_CA_H diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index b17458da7..622b14c26 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -201,9 +201,31 @@ int32_t Gps_Navigation_Message::subframe_decoder(const char* subframe) SV_page = static_cast(read_navigation_unsigned(subframe_bits, SV_PAGE)); if (SV_page > 24 && SV_page < 33) // Page 4 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200M) { - //! \TODO read almanac if (SV_data_ID != 0) { + a_M_0 = static_cast(read_navigation_signed(subframe_bits, ALM_MZERO)); + a_M_0 = a_M_0 * ALM_MZERO_LSB; + a_ecc = static_cast(read_navigation_unsigned(subframe_bits, ALM_ECC)); + a_ecc = a_ecc *ALM_ECC_LSB; + a_sqrtA = static_cast(read_navigation_unsigned(subframe_bits, ALM_SQUAREA)); + a_sqrtA = a_sqrtA *ALM_SQUAREA_LSB; + a_OMEGA_0 = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGAZERO)); + a_OMEGA_0 = a_OMEGA_0 * ALM_OMEGAZERO_LSB; + a_omega = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGA)); + a_omega = a_omega * ALM_OMEGA_LSB; + a_OMEGAdot = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGADOT)); + a_OMEGAdot = a_OMEGAdot *ALM_OMEGADOT_LSB; + a_delta_i = static_cast(read_navigation_signed(subframe_bits, ALM_DELTAI)); + a_delta_i = a_delta_i * ALM_DELTAI_LSB; + a_af0 = static_cast(read_navigation_signed(subframe_bits, ALM_AF0)); + a_af0 = a_af0 * ALM_AF0_LSB; + a_af1 = static_cast(read_navigation_signed(subframe_bits, ALM_AF1)); + a_af1 = a_af1* ALM_AF1_LSB; + a_PRN = SV_page; + i_Toa = static_cast(read_navigation_unsigned(subframe_bits, ALM_TOA)); + i_Toa = i_Toa * ALM_TOA_LSB; + + flag_almanac_valid = true ; } } @@ -276,11 +298,34 @@ int32_t Gps_Navigation_Message::subframe_decoder(const char* subframe) b_antispoofing_flag = read_navigation_bool(subframe_bits, ANTI_SPOOFING_FLAG); SV_data_ID_5 = static_cast(read_navigation_unsigned(subframe_bits, SV_DATA_ID)); SV_page_5 = static_cast(read_navigation_unsigned(subframe_bits, SV_PAGE)); - if (SV_page_5 < 25) + if ((SV_page_5 > 0) && (SV_page_5 < 25)) { - //! \TODO read almanac if (SV_data_ID_5 != 0) { + a_M_0 = static_cast(read_navigation_signed(subframe_bits, ALM_MZERO)); + a_M_0 = a_M_0 * ALM_MZERO_LSB; + a_ecc = static_cast(read_navigation_unsigned(subframe_bits, ALM_ECC)); + a_ecc = a_ecc *ALM_ECC_LSB; + a_sqrtA = static_cast(read_navigation_unsigned(subframe_bits, ALM_SQUAREA)); + a_sqrtA = a_sqrtA *ALM_SQUAREA_LSB; + a_OMEGA_0 = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGAZERO)); + a_OMEGA_0 = a_OMEGA_0 * ALM_OMEGAZERO_LSB; + a_omega = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGA)); + a_omega = a_omega * ALM_OMEGA_LSB; + a_OMEGAdot = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGADOT)); + a_OMEGAdot = a_OMEGAdot *ALM_OMEGADOT_LSB; + a_delta_i = static_cast(read_navigation_signed(subframe_bits, ALM_DELTAI)); + a_delta_i = a_delta_i * ALM_DELTAI_LSB; + a_af0 = static_cast(read_navigation_signed(subframe_bits, ALM_AF0)); + a_af0 = a_af0 * ALM_AF0_LSB; + a_af1 = static_cast(read_navigation_signed(subframe_bits, ALM_AF1)); + a_af1 = a_af1* ALM_AF1_LSB; + a_PRN = SV_page_5; + i_Toa = static_cast(read_navigation_unsigned(subframe_bits, ALM_TOA)); + i_Toa = i_Toa * ALM_TOA_LSB; + SV_Health = static_cast(read_navigation_unsigned(subframe_bits, ALM_SVHEALTH)); + flag_almanac_valid = true; + } } if (SV_page_5 == 51) // Page 25 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200M) @@ -288,6 +333,7 @@ int32_t Gps_Navigation_Message::subframe_decoder(const char* subframe) i_Toa = static_cast(read_navigation_unsigned(subframe_bits, T_OA)); i_Toa = i_Toa * T_OA_LSB; i_WN_A = static_cast(read_navigation_unsigned(subframe_bits, WN_A)); + flag_almanac_week_valid = true; almanacHealth[1] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV1)); almanacHealth[2] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV2)); almanacHealth[3] = static_cast(read_navigation_unsigned(subframe_bits, HEALTH_SV3)); @@ -435,6 +481,27 @@ Gps_Ephemeris Gps_Navigation_Message::get_ephemeris() const } +Gps_Almanac Gps_Navigation_Message::get_almanac() +{ + Gps_Almanac almanac; + almanac.SV_health = SV_Health; + almanac.PRN = a_PRN; + almanac.delta_i = a_delta_i; + almanac.toa = i_Toa; + almanac.WNa = i_WN_A; + almanac.M_0 = a_M_0; + almanac.ecc = a_ecc; + almanac.sqrtA = a_sqrtA; + almanac.OMEGA_0 = a_OMEGA_0; + almanac.omega = a_omega; + almanac.OMEGAdot = a_OMEGAdot; + almanac.af0 = a_af0; + almanac.af1 = a_af1; + flag_almanac_valid = false; + return almanac; +} + + Gps_Iono Gps_Navigation_Message::get_iono() { Gps_Iono iono; @@ -490,3 +557,9 @@ bool Gps_Navigation_Message::satellite_validation() } return flag_data_valid; } + + +bool Gps_Navigation_Message::almanac_validation() +{ + return flag_almanac_valid && (i_WN_A > 0); +} diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 16e8b2a9f..22f09c7e5 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -22,6 +22,7 @@ #include "GPS_L1_CA.h" #include "gps_ephemeris.h" +#include "gps_almanac.h" #include "gps_iono.h" #include "gps_utc_model.h" #include @@ -61,7 +62,12 @@ public: Gps_Iono get_iono(); /*! - * \brief Obtain a GPS UTC model parameters class filled with current SV data + * \brief Obtain a GPS almanac class filled with current SV data + */ + Gps_Almanac get_almanac(); + + /*! + * \brief Obtain a GPS Almanac model parameters class filled with current SV data */ Gps_Utc_Model get_utc_model(); @@ -133,6 +139,7 @@ public: } bool satellite_validation(); + bool almanac_validation(); private: uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; @@ -194,6 +201,17 @@ private: // Almanac int32_t i_Toa{}; // Almanac reference time [s] int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced + int32_t SV_Health{}; // Almanac SV healt + uint32_t a_PRN; // Almanac PRN + double a_delta_i{}; // Inclination Angle at Reference Time (relative to i_0 = 0.30 semi-circles) + double a_M_0{}; // Mean Anomaly at Reference Time [semi-circles] + double a_ecc{}; // Eccentricity [dimensionless] + double a_sqrtA{}; // Square Root of the Semi-Major Axis [sqrt(m)] + double a_OMEGA_0{}; // Longitude of Ascending Node of Orbit Plane at Weekly Epoch [semi-circles] + double a_omega{}; // Argument of Perigee [semi-cicles] + double a_OMEGAdot{}; // Rate of Right Ascension [semi-circles/s] + double a_af0{}; // Coefficient 0 of code phase offset model [s] + double a_af1{}; // Coefficient 1 of code phase offset model [s/s] // satellite identification info int32_t i_channel_ID{}; @@ -224,7 +242,8 @@ private: bool b_valid_ephemeris_set_flag{}; // flag indicating that this ephemeris set have passed the validation check bool flag_iono_valid{}; // If set, it indicates that the ionospheric parameters are filled (page 18 has arrived and decoded) bool flag_utc_model_valid{}; // If set, it indicates that the UTC model parameters are filled - + bool flag_almanac_valid{}; // If set, it indicates that the almanac is filled + bool flag_almanac_week_valid{}; // If set, it indicates that the almanac week is valid /* If true, enhanced level of integrity assurance. * * If false, indicates that the conveying signal is provided with the legacy level of integrity assurance. From 4b2e5661cfcc3c4485f2bbca0c7cb5b54c21e320 Mon Sep 17 00:00:00 2001 From: joebre Date: Tue, 21 Jan 2025 15:50:01 +0100 Subject: [PATCH 454/499] clang-formt Signed-off-by: joebre --- src/core/system_parameters/GPS_L1_CA.h | 2 +- .../gps_navigation_message.cc | 61 +++++++++---------- .../gps_navigation_message.h | 6 +- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/core/system_parameters/GPS_L1_CA.h b/src/core/system_parameters/GPS_L1_CA.h index 8d4415d51..1f9866d48 100644 --- a/src/core/system_parameters/GPS_L1_CA.h +++ b/src/core/system_parameters/GPS_L1_CA.h @@ -226,7 +226,7 @@ const std::vector> HEALTH_SV23({{253, 6}}); const std::vector> HEALTH_SV24({{259, 6}}); -// Almanac +// Almanac const std::vector> ALM_ECC({{69, 16}}); constexpr double ALM_ECC_LSB = TWO_N21; const std::vector> ALM_TOA({{91, 8}}); diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index 622b14c26..bdae760dd 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -203,29 +203,29 @@ int32_t Gps_Navigation_Message::subframe_decoder(const char* subframe) { if (SV_data_ID != 0) { - a_M_0 = static_cast(read_navigation_signed(subframe_bits, ALM_MZERO)); - a_M_0 = a_M_0 * ALM_MZERO_LSB; - a_ecc = static_cast(read_navigation_unsigned(subframe_bits, ALM_ECC)); - a_ecc = a_ecc *ALM_ECC_LSB; + a_M_0 = static_cast(read_navigation_signed(subframe_bits, ALM_MZERO)); + a_M_0 = a_M_0 * ALM_MZERO_LSB; + a_ecc = static_cast(read_navigation_unsigned(subframe_bits, ALM_ECC)); + a_ecc = a_ecc * ALM_ECC_LSB; a_sqrtA = static_cast(read_navigation_unsigned(subframe_bits, ALM_SQUAREA)); - a_sqrtA = a_sqrtA *ALM_SQUAREA_LSB; + a_sqrtA = a_sqrtA * ALM_SQUAREA_LSB; a_OMEGA_0 = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGAZERO)); a_OMEGA_0 = a_OMEGA_0 * ALM_OMEGAZERO_LSB; a_omega = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGA)); a_omega = a_omega * ALM_OMEGA_LSB; a_OMEGAdot = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGADOT)); - a_OMEGAdot = a_OMEGAdot *ALM_OMEGADOT_LSB; + a_OMEGAdot = a_OMEGAdot * ALM_OMEGADOT_LSB; a_delta_i = static_cast(read_navigation_signed(subframe_bits, ALM_DELTAI)); a_delta_i = a_delta_i * ALM_DELTAI_LSB; a_af0 = static_cast(read_navigation_signed(subframe_bits, ALM_AF0)); - a_af0 = a_af0 * ALM_AF0_LSB; + a_af0 = a_af0 * ALM_AF0_LSB; a_af1 = static_cast(read_navigation_signed(subframe_bits, ALM_AF1)); - a_af1 = a_af1* ALM_AF1_LSB; + a_af1 = a_af1 * ALM_AF1_LSB; a_PRN = SV_page; i_Toa = static_cast(read_navigation_unsigned(subframe_bits, ALM_TOA)); i_Toa = i_Toa * ALM_TOA_LSB; - - flag_almanac_valid = true ; + + flag_almanac_valid = true; } } @@ -302,30 +302,29 @@ int32_t Gps_Navigation_Message::subframe_decoder(const char* subframe) { if (SV_data_ID_5 != 0) { - a_M_0 = static_cast(read_navigation_signed(subframe_bits, ALM_MZERO)); - a_M_0 = a_M_0 * ALM_MZERO_LSB; - a_ecc = static_cast(read_navigation_unsigned(subframe_bits, ALM_ECC)); - a_ecc = a_ecc *ALM_ECC_LSB; + a_M_0 = static_cast(read_navigation_signed(subframe_bits, ALM_MZERO)); + a_M_0 = a_M_0 * ALM_MZERO_LSB; + a_ecc = static_cast(read_navigation_unsigned(subframe_bits, ALM_ECC)); + a_ecc = a_ecc * ALM_ECC_LSB; a_sqrtA = static_cast(read_navigation_unsigned(subframe_bits, ALM_SQUAREA)); - a_sqrtA = a_sqrtA *ALM_SQUAREA_LSB; + a_sqrtA = a_sqrtA * ALM_SQUAREA_LSB; a_OMEGA_0 = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGAZERO)); a_OMEGA_0 = a_OMEGA_0 * ALM_OMEGAZERO_LSB; a_omega = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGA)); a_omega = a_omega * ALM_OMEGA_LSB; a_OMEGAdot = static_cast(read_navigation_signed(subframe_bits, ALM_OMEGADOT)); - a_OMEGAdot = a_OMEGAdot *ALM_OMEGADOT_LSB; + a_OMEGAdot = a_OMEGAdot * ALM_OMEGADOT_LSB; a_delta_i = static_cast(read_navigation_signed(subframe_bits, ALM_DELTAI)); a_delta_i = a_delta_i * ALM_DELTAI_LSB; a_af0 = static_cast(read_navigation_signed(subframe_bits, ALM_AF0)); - a_af0 = a_af0 * ALM_AF0_LSB; + a_af0 = a_af0 * ALM_AF0_LSB; a_af1 = static_cast(read_navigation_signed(subframe_bits, ALM_AF1)); - a_af1 = a_af1* ALM_AF1_LSB; + a_af1 = a_af1 * ALM_AF1_LSB; a_PRN = SV_page_5; i_Toa = static_cast(read_navigation_unsigned(subframe_bits, ALM_TOA)); i_Toa = i_Toa * ALM_TOA_LSB; SV_Health = static_cast(read_navigation_unsigned(subframe_bits, ALM_SVHEALTH)); flag_almanac_valid = true; - } } if (SV_page_5 == 51) // Page 25 (from Table 20-V. Data IDs and SV IDs in Subframes 4 and 5, IS-GPS-200M) @@ -482,21 +481,21 @@ Gps_Ephemeris Gps_Navigation_Message::get_ephemeris() const Gps_Almanac Gps_Navigation_Message::get_almanac() -{ +{ Gps_Almanac almanac; almanac.SV_health = SV_Health; almanac.PRN = a_PRN; - almanac.delta_i = a_delta_i; + almanac.delta_i = a_delta_i; almanac.toa = i_Toa; - almanac.WNa = i_WN_A; - almanac.M_0 = a_M_0; - almanac.ecc = a_ecc; - almanac.sqrtA = a_sqrtA; - almanac.OMEGA_0 = a_OMEGA_0; - almanac.omega = a_omega; - almanac.OMEGAdot = a_OMEGAdot; - almanac.af0 = a_af0; - almanac.af1 = a_af1; + almanac.WNa = i_WN_A; + almanac.M_0 = a_M_0; + almanac.ecc = a_ecc; + almanac.sqrtA = a_sqrtA; + almanac.OMEGA_0 = a_OMEGA_0; + almanac.omega = a_omega; + almanac.OMEGAdot = a_OMEGAdot; + almanac.af0 = a_af0; + almanac.af1 = a_af1; flag_almanac_valid = false; return almanac; } @@ -561,5 +560,5 @@ bool Gps_Navigation_Message::satellite_validation() bool Gps_Navigation_Message::almanac_validation() { - return flag_almanac_valid && (i_WN_A > 0); + return flag_almanac_valid && (i_WN_A > 0); } diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 22f09c7e5..9860778fb 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -21,8 +21,8 @@ #include "GPS_L1_CA.h" -#include "gps_ephemeris.h" #include "gps_almanac.h" +#include "gps_ephemeris.h" #include "gps_iono.h" #include "gps_utc_model.h" #include @@ -199,8 +199,8 @@ private: double d_A_f2{}; // Coefficient 2 of code phase offset model [s/s^2] // Almanac - int32_t i_Toa{}; // Almanac reference time [s] - int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced + int32_t i_Toa{}; // Almanac reference time [s] + int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced int32_t SV_Health{}; // Almanac SV healt uint32_t a_PRN; // Almanac PRN double a_delta_i{}; // Inclination Angle at Reference Time (relative to i_0 = 0.30 semi-circles) From b82332cd336766493b98a90c7fbaed6cd875be9d Mon Sep 17 00:00:00 2001 From: joebre Date: Tue, 21 Jan 2025 17:22:32 +0100 Subject: [PATCH 455/499] clang-tiday fix Signed-off-by: joebre --- src/core/system_parameters/gps_navigation_message.cc | 2 +- src/core/system_parameters/gps_navigation_message.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/system_parameters/gps_navigation_message.cc b/src/core/system_parameters/gps_navigation_message.cc index bdae760dd..2dfcc84fe 100644 --- a/src/core/system_parameters/gps_navigation_message.cc +++ b/src/core/system_parameters/gps_navigation_message.cc @@ -558,7 +558,7 @@ bool Gps_Navigation_Message::satellite_validation() } -bool Gps_Navigation_Message::almanac_validation() +bool Gps_Navigation_Message::almanac_validation() const { return flag_almanac_valid && (i_WN_A > 0); } diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index 9860778fb..eee9717b2 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -139,7 +139,7 @@ public: } bool satellite_validation(); - bool almanac_validation(); + bool almanac_validation() const; private: uint64_t read_navigation_unsigned(const std::bitset& bits, const std::vector>& parameter) const; From 25b18614059cb7b86befc5ff5a6b43a54bafdbf9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 22 Jan 2025 22:14:33 +0100 Subject: [PATCH 456/499] Improve report of Homebrew / Macports detection Improve Boost finding if using Macports Update changelog Bump Pugixml local version to 1.15 and Protocol Buffers to 29.3 --- CMakeLists.txt | 27 ++++++++++++++++--- cmake/Modules/DetectMacOSVersion.cmake | 18 +++++++++++++ docs/CHANGELOG.md | 1 + .../osnma/osnma_msg_receiver_test.cc | 2 ++ 4 files changed, 45 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eac085fc9..ab80858d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -360,8 +360,8 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.2.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.2") -set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.14") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.3") +set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.15") set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") @@ -752,6 +752,18 @@ endif() if(UNIX AND EXISTS "/usr/lib64") list(APPEND BOOST_LIBRARYDIR "/usr/lib64") # Fedora 64-bit fix endif() +if(NOT BOOST_ROOT) + # Workaround for Macports + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND (${DETECT_MACPORTS} EQUAL 0)) + if(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.81") + set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.81") + elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.76") + set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.76") + elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.71") + set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.71") + endif() + endif() +endif() # Boost_ADDITIONAL_VERSIONS is only used internally by cmake to know the # formation of newer versions. No need to increase, not used anymore since newer # Boost provides its own CMake configuration files. @@ -771,7 +783,10 @@ if(CMAKE_VERSION VERSION_LESS 3.30) find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS} REQUIRED) else() find_package(Boost ${GNSSSDR_BOOST_MIN_VERSION} COMPONENTS ${BOOST_COMPONENTS}) - if(NOT Boost_FOUND) + if(Boost_FOUND) + get_filename_component(BOOST_PREFIX ${Boost_INCLUDE_DIRS} DIRECTORY) + message(STATUS "Found Boost v${Boost_VERSION_STRING} at ${BOOST_PREFIX}") + else() message(STATUS "Trying deprecated FindBoost Module ...") if(POLICY CMP0167) cmake_policy(SET CMP0167 OLD) @@ -3696,6 +3711,12 @@ else() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") message(STATUS "Building on ${MACOS_DISTRIBUTION}") + if(${DETECT_MACPORTS} EQUAL 0) + message(STATUS "Found Macports v${MACPORTS_VERSION} installed at ${MACPORTS_PREFIX}") + endif() + if(${DETECT_HOMEBREW} EQUAL 0) + message(STATUS "Found Homebrew v${HOMEBREW_VERSION} installed at ${HOMEBREW_PREFIX}") + endif() endif() endif() message(STATUS "CMake version: ${CMAKE_VERSION}") diff --git a/cmake/Modules/DetectMacOSVersion.cmake b/cmake/Modules/DetectMacOSVersion.cmake index ac986ba6d..c66491c94 100644 --- a/cmake/Modules/DetectMacOSVersion.cmake +++ b/cmake/Modules/DetectMacOSVersion.cmake @@ -77,3 +77,21 @@ endif() if(NOT MACOS_DISTRIBUTION) set(MACOS_DISTRIBUTION "macOS (Unknown version)") endif() + +# Detect if MacPorts is installed on this system; if so, return base path and version +execute_process(COMMAND which port RESULT_VARIABLE DETECT_MACPORTS OUTPUT_VARIABLE MACPORTS_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) +if(${DETECT_MACPORTS} EQUAL 0) + # "/opt/local/bin/port", so we get the parent directory + get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY) + # "/opt/local/bin", so we get the parent directory + get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY) + execute_process(COMMAND port version RESULT_VARIABLE DETECT_MACPORTS_VERSION OUTPUT_VARIABLE MACPORTS_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" MACPORTS_VERSION "${MACPORTS_VERSION}") +endif() + +# Detect if Homebrew is installed on this system; if so, return base path and version +execute_process(COMMAND brew --prefix RESULT_VARIABLE DETECT_HOMEBREW OUTPUT_VARIABLE HOMEBREW_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) +if(${DETECT_HOMEBREW} EQUAL 0) + execute_process(COMMAND brew --version RESULT_VARIABLE DETECT_HOMEBREW_VERSION OUTPUT_VARIABLE HOMEBREW_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" HOMEBREW_VERSION "${HOMEBREW_VERSION}") +endif() \ No newline at end of file diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5654ecf6b..6eb22c242 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -57,6 +57,7 @@ All notable changes to GNSS-SDR will be documented in this file. [Osmosdr_Signal_Source](https://gnss-sdr.org/docs/sp-blocks/signal-source/#implementation-osmosdr_signal_source) has gained two new optional configuration parameters: `iq_balance_mode` and `dc_offset_mode`, both of which are set to Automatic by default. +- Implemented missing GPS almanac decoding. ### Improvements in Maintainability: diff --git a/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc b/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc index 7bbdd4e16..3031a399a 100644 --- a/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc +++ b/tests/unit-tests/signal-processing-blocks/osnma/osnma_msg_receiver_test.cc @@ -21,8 +21,10 @@ #include "osnma_helper.h" #include "osnma_msg_receiver.h" #include +#include #include #include +#include #include #include From 274fdfd6b75d5b2ce36246faf1ca1c5a4ebbb4f9 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 22 Jan 2025 22:39:42 +0100 Subject: [PATCH 457/499] Fix CMake logic --- CMakeLists.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ab80858d1..c3a68f4da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -754,13 +754,15 @@ if(UNIX AND EXISTS "/usr/lib64") endif() if(NOT BOOST_ROOT) # Workaround for Macports - if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND (${DETECT_MACPORTS} EQUAL 0)) - if(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.81") - set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.81") - elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.76") - set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.76") - elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.71") - set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.71") + if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(${DETECT_MACPORTS} EQUAL 0) + if(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.81") + set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.81") + elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.76") + set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.76") + elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.71") + set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.71") + endif() endif() endif() endif() From bd0d19a24bb544ad7c291baffaa45351bcb2c309 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 23 Jan 2025 22:32:35 +0100 Subject: [PATCH 458/499] Fix low-impact performance inefficiency defects detected by Coverity Scan 2024.6 Reduce defect noise so other defects are easier spotted --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 19 +++++----- src/algorithms/PVT/libs/rtcm.cc | 8 ++-- src/algorithms/PVT/libs/rtklib_solver.cc | 2 +- ...lileo_e1_pcps_8ms_ambiguous_acquisition.cc | 4 +- ...eo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 4 +- ...e1_pcps_quicksync_ambiguous_acquisition.cc | 4 +- ...ileo_e1_pcps_tong_ambiguous_acquisition.cc | 4 +- ...ileo_e5a_noncoherent_iq_acquisition_caf.cc | 4 +- ...gps_l1_ca_pcps_acquisition_fine_doppler.cc | 2 +- .../gps_l1_ca_pcps_assisted_acquisition.cc | 2 +- .../gps_l1_ca_pcps_quicksync_acquisition.cc | 2 +- .../gps_l1_ca_pcps_tong_acquisition.cc | 2 +- .../gnuradio_blocks/pcps_acquisition.cc | 2 +- .../adapters/byte_to_short.cc | 4 +- .../adapters/cshort_to_grcomplex.cc | 2 +- .../adapters/ibyte_to_cbyte.cc | 5 ++- .../adapters/ibyte_to_complex.cc | 5 ++- .../adapters/ibyte_to_cshort.cc | 5 ++- .../adapters/ishort_to_complex.cc | 5 ++- .../adapters/ishort_to_cshort.cc | 5 ++- .../adapters/beamformer_filter.cc | 5 ++- .../input_filter/adapters/fir_filter.cc | 12 +++--- .../adapters/freq_xlating_fir_filter.cc | 12 +++--- .../input_filter/adapters/notch_filter.cc | 5 ++- .../adapters/notch_filter_lite.cc | 5 ++- .../adapters/pulse_blanking_filter.cc | 4 +- src/algorithms/libs/pass_through.cc | 3 +- .../volk_gnsssdr/apps/volk_gnsssdr_profile.cc | 2 +- .../volk_gnsssdr/lib/qa_utils.cc | 6 +-- .../adapters/hybrid_observables.cc | 3 +- .../adapters/direct_resampler_conditioner.cc | 5 ++- .../adapters/mmse_resampler_conditioner.cc | 5 ++- .../adapters/signal_generator.cc | 4 +- .../adapters/custom_udp_signal_source.cc | 11 +++--- .../adapters/labsat_signal_source.cc | 7 ++-- .../multichannel_file_signal_source.cc | 2 +- .../adapters/rtl_tcp_signal_source.cc | 6 +-- .../spir_gss6450_file_signal_source.cc | 4 +- .../adapters/sbas_l1_telemetry_decoder.cc | 3 +- .../telemetry_decoder/libs/tlm_conf.cc | 5 ++- .../galileo_e1_tcp_connector_tracking.cc | 4 +- .../glonass_l1_ca_dll_pll_c_aid_tracking.cc | 5 ++- .../glonass_l1_ca_dll_pll_tracking.cc | 5 ++- .../glonass_l2_ca_dll_pll_c_aid_tracking.cc | 5 ++- .../glonass_l2_ca_dll_pll_tracking.cc | 5 ++- .../adapters/gps_l1_ca_gaussian_tracking.cc | 5 ++- .../gps_l1_ca_tcp_connector_tracking.cc | 4 +- src/core/receiver/control_thread.cc | 10 ++--- src/core/receiver/file_configuration.cc | 38 +++++++++---------- src/core/receiver/gnss_block_factory.cc | 6 +-- src/core/receiver/in_memory_configuration.cc | 18 ++++----- src/core/system_parameters/gnss_almanac.cc | 5 ++- src/core/system_parameters/gnss_ephemeris.cc | 5 ++- .../gps_navigation_message.h | 2 +- .../adapter/adapter_test.cc | 5 ++- 55 files changed, 173 insertions(+), 148 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index 529c330f3..cc6460adb 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -27,6 +27,7 @@ #include "pvt_conf.h" // for Pvt_Conf #include "rtklib_rtkpos.h" // for rtkfree, rtkinit #include // for std::cout +#include // for std::move #if USE_GLOG_AND_GFLAGS #include #else @@ -62,7 +63,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, const std::string default_rtcm_dump_devname("/dev/pts/1"); DLOG(INFO) << "role " << role; pvt_output_parameters.dump = configuration->property(role + ".dump", false); - pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); + pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); pvt_output_parameters.dump_mat = configuration->property(role + ".dump_mat", true); pvt_output_parameters.rtk_trace_level = configuration->property(role + ".rtk_trace_level"s, 0); @@ -87,7 +88,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // NMEA Printer settings pvt_output_parameters.flag_nmea_tty_port = configuration->property(role + ".flag_nmea_tty_port", false); - pvt_output_parameters.nmea_dump_filename = configuration->property(role + ".nmea_dump_filename", default_nmea_dump_filename); + pvt_output_parameters.nmea_dump_filename = configuration->property(role + ".nmea_dump_filename", std::move(default_nmea_dump_filename)); pvt_output_parameters.nmea_dump_devname = configuration->property(role + ".nmea_dump_devname", default_nmea_dump_devname); // RINEX version @@ -126,7 +127,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, #endif // RTCM Printer settings pvt_output_parameters.flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false); - pvt_output_parameters.rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname); + pvt_output_parameters.rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", std::move(default_rtcm_dump_devname)); pvt_output_parameters.flag_rtcm_server = configuration->property(role + ".flag_rtcm_server", false); pvt_output_parameters.rtcm_tcp_port = configuration->property(role + ".rtcm_tcp_port", 2101); pvt_output_parameters.rtcm_station_id = configuration->property(role + ".rtcm_station_id", 1234); @@ -157,7 +158,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Advanced Nativation Protocol Printer settings pvt_output_parameters.an_output_enabled = configuration->property(role + ".an_output_enabled", pvt_output_parameters.an_output_enabled); - pvt_output_parameters.an_dump_devname = configuration->property(role + ".an_dump_devname", default_nmea_dump_devname); + pvt_output_parameters.an_dump_devname = configuration->property(role + ".an_dump_devname", std::move(default_nmea_dump_devname)); if (pvt_output_parameters.an_output_enabled && pvt_output_parameters.flag_nmea_tty_port) { if (pvt_output_parameters.nmea_dump_devname == pvt_output_parameters.an_dump_devname) @@ -496,7 +497,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Settings 1 int positioning_mode = -1; const std::string default_pos_mode("Single"); - const std::string positioning_mode_str = configuration->property(role + ".positioning_mode", default_pos_mode); // (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h + const std::string positioning_mode_str = configuration->property(role + ".positioning_mode", std::move(default_pos_mode)); // (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h if (positioning_mode_str == "Single") { positioning_mode = PMODE_SINGLE; @@ -581,7 +582,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, } const std::string default_iono_model("OFF"); - const std::string iono_model_str = configuration->property(role + ".iono_model", default_iono_model); /* (IONOOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ + const std::string iono_model_str = configuration->property(role + ".iono_model", std::move(default_iono_model)); /* (IONOOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ int iono_model = -1; if (iono_model_str == "OFF") { @@ -620,7 +621,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, const std::string default_trop_model("OFF"); int trop_model = -1; - const std::string trop_model_str = configuration->property(role + ".trop_model", default_trop_model); /* (TROPOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ + const std::string trop_model_str = configuration->property(role + ".trop_model", std::move(default_trop_model)); /* (TROPOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ if (trop_model_str == "OFF") { trop_model = TROPOPT_OFF; @@ -698,7 +699,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Settings 2 const std::string default_gps_ar("Continuous"); - const std::string integer_ambiguity_resolution_gps_str = configuration->property(role + ".AR_GPS", default_gps_ar); /* Integer Ambiguity Resolution mode for GPS (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */ + const std::string integer_ambiguity_resolution_gps_str = configuration->property(role + ".AR_GPS", std::move(default_gps_ar)); /* Integer Ambiguity Resolution mode for GPS (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */ int integer_ambiguity_resolution_gps = -1; if (integer_ambiguity_resolution_gps_str == "OFF") { @@ -882,7 +883,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, pvt_output_parameters.xml_output_path = configuration->property(role + ".xml_output_path", default_output_path); pvt_output_parameters.nmea_output_file_path = configuration->property(role + ".nmea_output_file_path", default_output_path); pvt_output_parameters.rtcm_output_file_path = configuration->property(role + ".rtcm_output_file_path", default_output_path); - pvt_output_parameters.has_output_file_path = configuration->property(role + ".has_output_file_path", default_output_path); + pvt_output_parameters.has_output_file_path = configuration->property(role + ".has_output_file_path", std::move(default_output_path)); // Read PVT MONITOR Configuration pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false); diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 0d9bc4b76..57b90d5e9 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -3342,7 +3342,7 @@ std::vector Rtcm::print_IGM01(const Galileo_HAS_data& has_data) { rtcm_message_queue->push(message); } - msgs.push_back(message); + msgs.push_back(std::move(message)); } return msgs; } @@ -3366,7 +3366,7 @@ std::vector Rtcm::print_IGM02(const Galileo_HAS_data& has_data) { rtcm_message_queue->push(message); } - msgs.push_back(message); + msgs.push_back(std::move(message)); } return msgs; } @@ -3390,7 +3390,7 @@ std::vector Rtcm::print_IGM03(const Galileo_HAS_data& has_data) { rtcm_message_queue->push(message); } - msgs.push_back(message); + msgs.push_back(std::move(message)); } return msgs; } @@ -3416,7 +3416,7 @@ std::vector Rtcm::print_IGM05(const Galileo_HAS_data& has_data) { rtcm_message_queue->push(message); } - msgs.push_back(message); + msgs.push_back(std::move(message)); } } return msgs; diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 433819649..c4aba97c2 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -311,7 +311,7 @@ bool Rtklib_Solver::save_matfile() const // WRITE MAT FILE mat_t *matfp; matvar_t *matvar; - std::string filename = dump_filename; + std::string filename = std::move(dump_filename); filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index 1efbcfe4d..f327dac91 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -58,10 +58,10 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); + dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index dab9dcc47..4ff5201f1 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -49,10 +49,10 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); + dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 16a13e02d..930e7c948 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -58,10 +58,10 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role + ".item_type", default_item_type); + item_type_ = configuration_->property(role + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); + dump_filename_ = configuration_->property(role + ".dump_filename", std::move(default_dump_filename)); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index 27a60b479..fc9eef727 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -63,10 +63,10 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( DLOG(INFO) << "role " << role_; - item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); + dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); if (sampled_ms_ % 4 != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index 153412bc0..baabd31f0 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -67,8 +67,8 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role_ + ".item_type", default_item_type); - dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); + item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index f119a60c4..3ad727b0f 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -53,7 +53,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( std::string default_dump_filename = "./acquisition.mat"; Acq_Conf acq_parameters = Acq_Conf(); - item_type_ = configuration->property(role_ + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 0bd82c2dc..0801d6f87 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -51,7 +51,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); - item_type_ = configuration->property(role_ + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 9fd146be2..4c1c94d20 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -59,7 +59,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; - item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index 63efcab00..b5788ac8a 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -63,7 +63,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( DLOG(INFO) << "role " << role_; - item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 569319d1c..fa379e8e0 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -145,7 +145,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) { const std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); - d_dump_filename = dump_filename_; + d_dump_filename = std::move(dump_filename_); } else { diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index d25a23f0e..1f1d9cc63 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -39,8 +39,8 @@ ByteToShort::ByteToShort(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); gr_char_to_short_ = gr::blocks::char_to_short::make(); diff --git a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc index ad63835ce..1a9c83ec0 100644 --- a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc +++ b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc @@ -36,7 +36,7 @@ CshortToGrComplex::CshortToGrComplex(const ConfigurationInterface* configuration DLOG(INFO) << "role " << role_; - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); cshort_to_gr_complex_ = make_cshort_to_gr_complex(); DLOG(INFO) << "data_type_adapter_(" << cshort_to_gr_complex_->unique_id() << ")"; diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index a675a57d5..035d416bb 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -18,6 +18,7 @@ #include "ibyte_to_cbyte.h" #include "configuration_interface.h" #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -41,8 +42,8 @@ IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index 7df423095..dda4fbfd9 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -16,6 +16,7 @@ #include "ibyte_to_complex.h" #include "configuration_interface.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -38,8 +39,8 @@ IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, cons DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); gr_interleaved_char_to_complex_ = gr::blocks::interleaved_char_to_complex::make(); diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index 94dbd8afe..1a6d185f1 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -18,6 +18,7 @@ #include "ibyte_to_cshort.h" #include "configuration_interface.h" #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -40,8 +41,8 @@ IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); interleaved_byte_to_complex_short_ = make_interleaved_byte_to_complex_short(); diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 9a86a2a2f..4a850038f 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -16,6 +16,7 @@ #include "ishort_to_complex.h" #include "configuration_interface.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -38,8 +39,8 @@ IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make(); diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index 9f5f546ca..27c740657 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -18,6 +18,7 @@ #include "ishort_to_cshort.h" #include "configuration_interface.h" #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -40,8 +41,8 @@ IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); interleaved_short_to_complex_short_ = make_interleaved_short_to_complex_short(); diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index cf124aeb2..54603143a 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -18,6 +18,7 @@ #include "beamformer.h" #include "configuration_interface.h" #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -35,8 +36,8 @@ BeamformerFilter::BeamformerFilter( { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./input_filter.dat"); - item_type_ = configuration->property(role + ".item_type", default_item_type); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index 92c84645a..2f8cf042d 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -153,14 +153,14 @@ void FirFilter::init() const int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps); const unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands); - const std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); + const std::string filter_type = config_->property(role_ + ".filter_type", std::move(default_filter_type)); const int grid_density = config_->property(role_ + ".grid_density", default_grid_density); - input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type); - output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type); - taps_item_type_ = config_->property(role_ + ".taps_item_type", default_taps_item_type); + input_item_type_ = config_->property(role_ + ".input_item_type", std::move(default_input_item_type)); + output_item_type_ = config_->property(role_ + ".output_item_type", std::move(default_output_item_type)); + taps_item_type_ = config_->property(role_ + ".taps_item_type", std::move(default_taps_item_type)); dump_ = config_->property(role_ + ".dump", false); - dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename); + dump_filename_ = config_->property(role_ + ".dump_filename", std::move(default_dump_filename)); std::vector bands; std::vector ampl; @@ -194,7 +194,7 @@ void FirFilter::init() // It calculates the optimal (in the Chebyshev/minimax sense) FIR filter // impulse response given a set of band edges, the desired response on // those bands, and the weight given to the error in those bands. - const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); + const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, std::move(filter_type), grid_density); taps_ = std::vector(taps_d.begin(), taps_d.end()); } diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index ba75c6f67..a55e48155 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -55,12 +55,12 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu const int number_of_taps = configuration->property(role_ + ".number_of_taps", default_number_of_taps); const unsigned int number_of_bands = configuration->property(role_ + ".number_of_bands", default_number_of_bands); - const std::string filter_type = configuration->property(role_ + ".filter_type", default_filter_type); + const std::string filter_type = configuration->property(role_ + ".filter_type", std::move(default_filter_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); - output_item_type_ = configuration->property(role_ + ".output_item_type", default_output_item_type); - taps_item_type_ = configuration->property(role_ + ".taps_item_type", default_taps_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); + output_item_type_ = configuration->property(role_ + ".output_item_type", std::move(default_output_item_type)); + taps_item_type_ = configuration->property(role_ + ".taps_item_type", std::move(default_taps_item_type)); intermediate_freq_ = configuration->property(role_ + ".IF", default_intermediate_freq); sampling_freq_ = configuration->property(role_ + ".sampling_frequency", default_sampling_freq); decimation_factor_ = configuration->property(role_ + ".decimation_factor", default_decimation_factor); @@ -97,7 +97,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu } const int grid_density = configuration->property(role_ + ".grid_density", default_grid_density); - const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); + const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, std::move(filter_type), grid_density); taps_ = std::vector(taps_d.begin(), taps_d.end()); } else diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index 840985039..9762072f1 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -19,6 +19,7 @@ #include "configuration_interface.h" #include "notch_cc.h" #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -49,8 +50,8 @@ NotchFilter::NotchFilter(const ConfigurationInterface* configuration, const int n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est); const int n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 75aa1089d..72aa08b94 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -20,6 +20,7 @@ #include "notch_lite_cc.h" #include #include // for max +#include #if USE_GLOG_AND_GFLAGS #include @@ -53,8 +54,8 @@ NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, const int n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est); const int n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); - item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); int n_segments_coeff = static_cast((samp_freq / coeff_rate) / static_cast(length_)); n_segments_coeff = std::max(1, n_segments_coeff); diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index 8732ba4f8..f452eb7fa 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -52,8 +52,8 @@ PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configura const double if_aux = configuration->property(role_ + ".if", default_if); const double if_ = configuration->property(role_ + ".IF", if_aux); - dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); - item_type_ = configuration->property(role_ + ".item_type", default_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); dump_ = configuration->property(role_ + ".dump", false); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index 714b5cd27..0e68f85c3 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -22,6 +22,7 @@ #include #include // for int8_t #include // for operator<< +#include #if USE_GLOG_AND_GFLAGS #include @@ -39,7 +40,7 @@ Pass_Through::Pass_Through(const ConfigurationInterface* configuration, inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)) { const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role + ".item_type", default_item_type); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); if (item_type_ == "float") { diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc index 2c52adf65..8710f2966 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/apps/volk_gnsssdr_profile.cc @@ -236,7 +236,7 @@ void read_results(std::vector *results, std::string kernel_result.config_name = std::string(single_kernel_result[0]); kernel_result.best_arch_u = std::string(single_kernel_result[1]); kernel_result.best_arch_a = std::string(single_kernel_result[2]); - results->push_back(kernel_result); + results->push_back(std::move(kernel_result)); } } } diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc index 9c961cee0..f94058dd6 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc @@ -237,7 +237,7 @@ std::vector split_signature(const std::string &protokernel_signatur } } // Get the last one to the end of the string - signature_tokens.push_back(token); + signature_tokens.push_back(std::move(token)); return signature_tokens; } @@ -262,7 +262,7 @@ static void get_signatures_from_name(std::vector &inputsig, std::string token = toked[token_index]; try { - type = volk_gnsssdr_type_from_string(token); + type = volk_gnsssdr_type_from_string(std::move(token)); if (side == SIDE_NAME) side = SIDE_OUTPUT; // if this is the first one after the name... if (side == SIDE_INPUT) @@ -627,7 +627,7 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, memcpy(arch_inbuff, inbuffs[j], vlen * inputsig[j].size * (inputsig[j].is_complex ? 2 : 1)); arch_buffs.push_back(arch_inbuff); } - test_data.push_back(arch_buffs); + test_data.push_back(std::move(arch_buffs)); } std::vector both_sigs; diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index 7a434f5df..e04be0681 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -20,6 +20,7 @@ #include "gnss_sdr_flags.h" #include "obs_conf.h" #include // for operator<< +#include #if USE_GLOG_AND_GFLAGS #include @@ -37,7 +38,7 @@ HybridObservables::HybridObservables(const ConfigurationInterface* configuration dump_mat_(configuration->property(role + ".dump_mat", true)) { const std::string default_dump_filename("./observables.dat"); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); Obs_Conf conf{}; conf.dump = dump_; diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index 6b01d3f29..4ffb449e8 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -25,6 +25,7 @@ #include #include #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -46,8 +47,8 @@ DirectResamplerConditioner::DirectResamplerConditioner( const std::string default_dump_file("./resampler.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - item_type_ = configuration->property(role + ".item_type", default_item_type); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index b97bc5a50..ae592c2f9 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #if USE_GLOG_AND_GFLAGS @@ -42,8 +43,8 @@ MmseResamplerConditioner::MmseResamplerConditioner( const std::string default_dump_file("./resampler.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - item_type_ = configuration->property(role + ".item_type", default_item_type); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index c5d745689..260861fbb 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -47,8 +47,8 @@ SignalGenerator::SignalGenerator(const ConfigurationInterface* configuration, const std::string default_system("G"); const std::string default_signal("1C"); - item_type_ = configuration->property(role + ".item_type", default_item_type); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); const unsigned int fs_in = configuration->property("SignalSource.fs_hz", static_cast(4e6)); const bool data_flag = configuration->property("SignalSource.data_flag", false); 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 8a96c375d..2caaec9b2 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -19,6 +19,7 @@ #include "configuration_interface.h" #include "gnss_sdr_string_literals.h" #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -45,20 +46,20 @@ CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* confi // DUMP PARAMETERS const std::string default_dump_file("./data/signal_source.dat"); const std::string default_item_type("gr_complex"); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); // network PARAMETERS const std::string default_capture_device("eth0"); const std::string default_address("127.0.0.1"); const int default_port = 1234; - const std::string address = configuration->property(role + ".origin_address", default_address); - std::string capture_device = configuration->property(role + ".capture_device", default_capture_device); + const std::string address = configuration->property(role + ".origin_address", std::move(default_address)); + std::string capture_device = configuration->property(role + ".capture_device", std::move(default_capture_device)); int port = configuration->property(role + ".port", default_port); int payload_bytes = configuration->property(role + ".payload_bytes", 1024); const std::string default_sample_type("cbyte"); - const std::string sample_type = configuration->property(role + ".sample_type", default_sample_type); - item_type_ = configuration->property(role + ".item_type", default_item_type); + const std::string sample_type = configuration->property(role + ".sample_type", std::move(default_sample_type)); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(capture_device, address, diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 227e0a246..459e21a89 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -20,6 +20,7 @@ #include "labsat23_source.h" #include #include +#include #if USE_GLOG_AND_GFLAGS #include @@ -43,12 +44,12 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati const std::string default_item_type("gr_complex"); const std::string default_dump_file("./labsat_output.dat"); item_type_ = configuration->property(role + ".item_type", default_item_type); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); const int64_t sampling_frequency_deprecated = configuration->property(role + ".sampling_frequency", static_cast(16368000)); const int64_t throttle_frequency_sps = configuration->property(role + ".throttle_frequency_sps", static_cast(sampling_frequency_deprecated)); - std::string channels_to_read = configuration->property(role + ".selected_channel", default_item_type); + std::string channels_to_read = configuration->property(role + ".selected_channel", std::move(default_item_type)); std::stringstream ss(channels_to_read); int found; while (ss.good()) @@ -69,7 +70,7 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati } const std::string default_filename("./example_capture.LS3"); - filename_ = configuration->property(role + ".filename", default_filename); + filename_ = configuration->property(role + ".filename", std::move(default_filename)); const bool digital_io_enabled = configuration->property(role + ".digital_io_enabled", false); 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 84271beea..b41e34617 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc @@ -54,7 +54,7 @@ MultichannelFileSignalSource::MultichannelFileSignalSource(const ConfigurationIn filename_vec_.push_back(configuration->property(role + ".filename" + std::to_string(n), default_filename)); } - item_type_ = configuration->property(role + ".item_type", default_item_type); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); repeat_ = configuration->property(role + ".repeat", false); enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); 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 2e5849eb5..01e4f37b7 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -55,13 +55,13 @@ RtlTcpSignalSource::RtlTcpSignalSource(const ConfigurationInterface* configurati // DUMP PARAMETERS const std::string default_dump_file("./data/signal_source.dat"); const std::string default_item_type("gr_complex"); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); // rtl_tcp PARAMETERS const std::string default_address("127.0.0.1"); const int16_t default_port = 1234; - item_type_ = configuration->property(role + ".item_type", default_item_type); - address_ = configuration->property(role + ".address", default_address); + item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + address_ = configuration->property(role + ".address", std::move(default_address)); port_ = configuration->property(role + ".port", default_port); if (item_type_ == "short") 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 1b29d773e..0cfc1eba4 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 @@ -56,8 +56,8 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInte { const std::string default_filename("./my_capture.dat"); const std::string default_dump_filename("./my_capture_dump.dat"); - filename_ = configuration->property(role + ".filename", default_filename); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); + filename_ = configuration->property(role + ".filename", std::move(default_filename)); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); const int64_t bytes_seek = configuration->property(role + ".bytes_to_skip", static_cast(65536)); const double sample_size_byte = static_cast(adc_bits_) / 4.0; diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 334e934ea..901e10c80 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -18,6 +18,7 @@ #include "sbas_l1_telemetry_decoder.h" #include "configuration_interface.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -35,7 +36,7 @@ SbasL1TelemetryDecoder::SbasL1TelemetryDecoder( dump_(configuration->property(role + ".dump", false)) { const std::string default_dump_filename("./navigation.dat"); - dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); + dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); // make telemetry decoder object telemetry_decoder_ = sbas_l1_make_telemetry_decoder_gs(satellite_, dump_); // TODO fix me DLOG(INFO) << "role " << role; diff --git a/src/algorithms/telemetry_decoder/libs/tlm_conf.cc b/src/algorithms/telemetry_decoder/libs/tlm_conf.cc index cf4a248c9..d3a1ae733 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_conf.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_conf.cc @@ -16,19 +16,20 @@ */ #include "tlm_conf.h" +#include void Tlm_Conf::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role) { const std::string default_dumpname("telemetry"); - dump_filename = configuration->property(role + ".dump_filename", default_dumpname); + dump_filename = configuration->property(role + ".dump_filename", std::move(default_dumpname)); dump = configuration->property(role + ".dump", false); dump_mat = configuration->property(role + ".dump_mat", dump); remove_dat = configuration->property(role + ".remove_dat", false); dump_crc_stats = configuration->property(role + ".dump_crc_stats", false); const std::string default_crc_stats_dumpname("telemetry_crc_stats"); - dump_crc_stats_filename = configuration->property(role + ".dump_crc_stats_filename", default_crc_stats_dumpname); + dump_crc_stats_filename = configuration->property(role + ".dump_crc_stats_filename", std::move(default_crc_stats_dumpname)); enable_navdata_monitor = configuration->property("NavDataMonitor.enable_monitor", false); if (configuration->property("Channels_1B.count", 0) > 0) { diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index fc79e02ab..bd66e5c3c 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -46,7 +46,7 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -79,7 +79,7 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( float very_early_late_space_chips = configuration->property(role_ + ".very_early_late_space_chips", static_cast(0.5)); size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index c31149afb..f048166d0 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -27,6 +27,7 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -48,7 +49,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role_ + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -83,7 +84,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 6a8faf31b..3c60624be 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -26,6 +26,7 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -47,7 +48,7 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -78,7 +79,7 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( #endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 19350ce18..3bef9b6f5 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -25,6 +25,7 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -46,7 +47,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role_ + ".item_type", default_item_type); + item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -81,7 +82,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index f5b6f2325..a5dbc3fc4 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -24,6 +24,7 @@ #include "GLONASS_L1_L2_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -45,7 +46,7 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -75,7 +76,7 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( #endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc index 3b501dcbc..85088e9af 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc @@ -28,6 +28,7 @@ #include "GPS_L1_CA.h" #include "configuration_interface.h" #include "gnss_sdr_flags.h" +#include #if USE_GLOG_AND_GFLAGS #include @@ -49,7 +50,7 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); int order = configuration->property(role_ + ".order", 2); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); @@ -68,7 +69,7 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( #endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); bool bce_run = configuration->property(role_ + ".bce_run", false); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index 887dbdbc5..7ffa6ff5c 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -46,14 +46,14 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", default_item_type); + std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); + std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); const auto vector_length = static_cast(std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index 9a265254d..d6ddf4c6c 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -142,7 +142,7 @@ ControlThread::ControlThread() std::string pvt_impl = configuration_->property("PVT.implementation", empty_implementation); conf_has_pvt_ = !pvt_impl.empty(); - std::string obs_impl = configuration_->property("Observables.implementation", empty_implementation); + std::string obs_impl = configuration_->property("Observables.implementation", std::move(empty_implementation)); conf_has_observables_ = !obs_impl.empty(); well_formatted_configuration_ = conf_file_has_section_ && conf_file_has_mandatory_globals_ && conf_has_signal_sources_ && conf_has_observables_ && conf_has_pvt_; @@ -747,8 +747,8 @@ void ControlThread::assist_GNSS() std::cout << "SUPL RRLP GPS assistance enabled!\n"; const std::string default_acq_server("supl.google.com"); const std::string default_eph_server("supl.google.com"); - supl_client_ephemeris_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_server", default_acq_server); - supl_client_acquisition_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_server", default_eph_server); + supl_client_ephemeris_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_server", std::move(default_acq_server)); + supl_client_acquisition_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_server", std::move(default_eph_server)); supl_client_ephemeris_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_port", 7275); supl_client_acquisition_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_port", 7275); supl_mcc_ = configuration_->property("GNSS-SDR.SUPL_MCC", 244); @@ -756,8 +756,8 @@ void ControlThread::assist_GNSS() const std::string default_lac("0x59e2"); const std::string default_ci("0x31b0"); - const std::string supl_lac_s = configuration_->property("GNSS-SDR.SUPL_LAC", default_lac); - const std::string supl_ci_s = configuration_->property("GNSS-SDR.SUPL_CI", default_ci); + const std::string supl_lac_s = configuration_->property("GNSS-SDR.SUPL_LAC", std::move(default_lac)); + const std::string supl_ci_s = configuration_->property("GNSS-SDR.SUPL_CI", std::move(default_ci)); try { supl_lac_ = std::stoi(supl_lac_s, nullptr, 0); diff --git a/src/core/receiver/file_configuration.cc b/src/core/receiver/file_configuration.cc index 4bee6ae75..a76d8b8de 100644 --- a/src/core/receiver/file_configuration.cc +++ b/src/core/receiver/file_configuration.cc @@ -75,7 +75,7 @@ std::string FileConfiguration::property(std::string property_name, std::string d { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), std::move(default_value)); } return ini_reader_->Get("GNSS-SDR", property_name, default_value); } @@ -85,10 +85,10 @@ bool FileConfiguration::property(std::string property_name, bool default_value) { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -96,10 +96,10 @@ int64_t FileConfiguration::property(std::string property_name, int64_t default_v { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -107,10 +107,10 @@ uint64_t FileConfiguration::property(std::string property_name, uint64_t default { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -118,10 +118,10 @@ int FileConfiguration::property(std::string property_name, int default_value) co { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -129,10 +129,10 @@ unsigned int FileConfiguration::property(std::string property_name, unsigned int { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -140,10 +140,10 @@ uint16_t FileConfiguration::property(std::string property_name, uint16_t default { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -151,10 +151,10 @@ int16_t FileConfiguration::property(std::string property_name, int16_t default_v { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -162,10 +162,10 @@ float FileConfiguration::property(std::string property_name, float default_value { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } @@ -173,10 +173,10 @@ double FileConfiguration::property(std::string property_name, double default_val { if (overrided_->is_present(property_name)) { - return overrided_->property(property_name, default_value); + return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 1635aa5f5..12ee51285 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -337,7 +337,7 @@ std::unique_ptr GNSSBlockFactory::GetSignalConditioner( std::unique_ptr GNSSBlockFactory::GetObservables(const ConfigurationInterface* configuration) { const std::string empty_implementation; - std::string implementation = configuration->property("Observables.implementation", empty_implementation); + std::string implementation = configuration->property("Observables.implementation", std::move(empty_implementation)); LOG(INFO) << "Getting Observables with implementation " << implementation; if (implementation.find("_Observables") == std::string::npos) { @@ -372,7 +372,7 @@ std::unique_ptr GNSSBlockFactory::GetObservables(const Confi std::unique_ptr GNSSBlockFactory::GetPVT(const ConfigurationInterface* configuration) { const std::string empty_implementation; - std::string implementation = configuration->property("PVT.implementation", empty_implementation); + std::string implementation = configuration->property("PVT.implementation", std::move(empty_implementation)); LOG(INFO) << "Getting PVT with implementation " << implementation; if (implementation.find("_PVT") == std::string::npos) { @@ -428,7 +428,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel( // Automatically detect input data type const std::string default_item_type("gr_complex"); std::string acq_item_type = configuration->property("Acquisition_" + signal + appendix1 + item_prop, default_item_type); - std::string trk_item_type = configuration->property("Tracking_" + signal + appendix2 + item_prop, default_item_type); + std::string trk_item_type = configuration->property("Tracking_" + signal + appendix2 + item_prop, std::move(default_item_type)); if (acq_item_type != trk_item_type) { std::cerr << "Configuration error: Acquisition and Tracking blocks must have the same input data type!\n"; diff --git a/src/core/receiver/in_memory_configuration.cc b/src/core/receiver/in_memory_configuration.cc index b3cde9946..5f864fcdd 100644 --- a/src/core/receiver/in_memory_configuration.cc +++ b/src/core/receiver/in_memory_configuration.cc @@ -47,63 +47,63 @@ std::string InMemoryConfiguration::property(std::string property_name, std::stri bool InMemoryConfiguration::property(std::string property_name, bool default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } int64_t InMemoryConfiguration::property(std::string property_name, int64_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } uint64_t InMemoryConfiguration::property(std::string property_name, uint64_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } int32_t InMemoryConfiguration::property(std::string property_name, int32_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } uint32_t InMemoryConfiguration::property(std::string property_name, uint32_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } uint16_t InMemoryConfiguration::property(std::string property_name, uint16_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } int16_t InMemoryConfiguration::property(std::string property_name, int16_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } float InMemoryConfiguration::property(std::string property_name, float default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } double InMemoryConfiguration::property(std::string property_name, double default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), empty), default_value); + return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); } diff --git a/src/core/system_parameters/gnss_almanac.cc b/src/core/system_parameters/gnss_almanac.cc index 923416832..03080cd1a 100644 --- a/src/core/system_parameters/gnss_almanac.cc +++ b/src/core/system_parameters/gnss_almanac.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include double Gnss_Almanac::check_t(double time) const @@ -72,12 +73,12 @@ double Gnss_Almanac::predicted_doppler(double rx_time_s, const std::vector pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]}; const std::vector vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]}; - std::vector x_sr = pos_sat; + std::vector x_sr = std::move(pos_sat); std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus()); // pos_sat - pos_rx const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm - std::vector v_sr = vel_sat; + std::vector v_sr = std::move(vel_sat); std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus()); // vel_sat - vel_rx const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr; diff --git a/src/core/system_parameters/gnss_ephemeris.cc b/src/core/system_parameters/gnss_ephemeris.cc index d95d14a28..e6231357e 100644 --- a/src/core/system_parameters/gnss_ephemeris.cc +++ b/src/core/system_parameters/gnss_ephemeris.cc @@ -22,6 +22,7 @@ #include #include #include +#include #include @@ -68,12 +69,12 @@ double Gnss_Ephemeris::predicted_doppler(double rx_time_s, const std::vector pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]}; const std::vector vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]}; - std::vector x_sr = pos_sat; + std::vector x_sr = std::move(pos_sat); std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus()); // pos_sat - pos_rx const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm - std::vector v_sr = vel_sat; + std::vector v_sr = std::move(vel_sat); std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus()); // vel_sat - vel_rx const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr; diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index eee9717b2..cb31c9518 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -202,7 +202,7 @@ private: int32_t i_Toa{}; // Almanac reference time [s] int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced int32_t SV_Health{}; // Almanac SV healt - uint32_t a_PRN; // Almanac PRN + uint32_t a_PRN{}; // Almanac PRN double a_delta_i{}; // Inclination Angle at Reference Time (relative to i_0 = 0.30 semi-circles) double a_M_0{}; // Mean Anomaly at Reference Time [semi-circles] double a_ecc{}; // Eccentricity [dimensionless] diff --git a/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc b/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc index f4c6aaa44..7eb3bc891 100644 --- a/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc +++ b/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -59,10 +60,10 @@ DataTypeAdapter::DataTypeAdapter() std::array input_shorts{2, 23, -1, 127, -127, 0, 255, 255}; const std::vector input_data_bytes_(input_bytes.data(), input_bytes.data() + input_bytes.size() / sizeof(int8_t)); - input_data_bytes = input_data_bytes_; + input_data_bytes = std::move(input_data_bytes_); const std::vector input_data_shorts_(input_shorts.data(), input_shorts.data() + input_shorts.size() / sizeof(int16_t)); - input_data_shorts = input_data_shorts_; + input_data_shorts = std::move(input_data_shorts_); } From 4c99d1c605f416e7b527447a99797cd5372157c2 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 23 Jan 2025 23:16:08 +0100 Subject: [PATCH 459/499] Fix volk_gnsssdr_profile --- .../libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc index f94058dd6..278b63348 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc @@ -262,7 +262,7 @@ static void get_signatures_from_name(std::vector &inputsig, std::string token = toked[token_index]; try { - type = volk_gnsssdr_type_from_string(std::move(token)); + type = volk_gnsssdr_type_from_string(token); if (side == SIDE_NAME) side = SIDE_OUTPUT; // if this is the first one after the name... if (side == SIDE_INPUT) @@ -527,8 +527,8 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, std::vector *results, std::string puppet_master_name) { - return run_volk_gnsssdr_tests(desc, manual_func, name, test_params.tol(), test_params.scalar(), - test_params.vlen(), test_params.iter(), results, puppet_master_name, + return run_volk_gnsssdr_tests(desc, manual_func, std::move(name), test_params.tol(), test_params.scalar(), + test_params.vlen(), test_params.iter(), results, std::move(puppet_master_name), test_params.benchmark_mode()); } @@ -627,7 +627,7 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, memcpy(arch_inbuff, inbuffs[j], vlen * inputsig[j].size * (inputsig[j].is_complex ? 2 : 1)); arch_buffs.push_back(arch_inbuff); } - test_data.push_back(std::move(arch_buffs)); + test_data.push_back(arch_buffs); } std::vector both_sigs; From b9c834acba8dabcb124ae1f78f64761f831858ce Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 00:41:06 +0100 Subject: [PATCH 460/499] Revert unnecessary moves --- src/algorithms/PVT/adapters/rtklib_pvt.cc | 18 +++++++++--------- src/algorithms/PVT/libs/rtklib_solver.cc | 2 +- ...alileo_e1_pcps_8ms_ambiguous_acquisition.cc | 4 ++-- ...leo_e1_pcps_cccwsr_ambiguous_acquisition.cc | 4 ++-- ..._e1_pcps_quicksync_ambiguous_acquisition.cc | 4 ++-- ...lileo_e1_pcps_tong_ambiguous_acquisition.cc | 4 ++-- ...lileo_e5a_noncoherent_iq_acquisition_caf.cc | 4 ++-- .../gps_l1_ca_pcps_acquisition_fine_doppler.cc | 2 +- .../gps_l1_ca_pcps_assisted_acquisition.cc | 2 +- .../gps_l1_ca_pcps_quicksync_acquisition.cc | 2 +- .../gps_l1_ca_pcps_tong_acquisition.cc | 2 +- .../gnuradio_blocks/pcps_acquisition.cc | 2 +- .../adapters/byte_to_short.cc | 4 ++-- .../adapters/cshort_to_grcomplex.cc | 2 +- .../adapters/ibyte_to_cbyte.cc | 4 ++-- .../adapters/ibyte_to_complex.cc | 4 ++-- .../adapters/ibyte_to_cshort.cc | 4 ++-- .../adapters/ishort_to_complex.cc | 4 ++-- .../adapters/ishort_to_cshort.cc | 4 ++-- .../input_filter/adapters/beamformer_filter.cc | 4 ++-- .../input_filter/adapters/fir_filter.cc | 12 ++++++------ .../adapters/freq_xlating_fir_filter.cc | 12 ++++++------ .../input_filter/adapters/notch_filter.cc | 4 ++-- .../input_filter/adapters/notch_filter_lite.cc | 4 ++-- .../adapters/pulse_blanking_filter.cc | 4 ++-- src/algorithms/libs/pass_through.cc | 2 +- .../observables/adapters/hybrid_observables.cc | 2 +- .../adapters/direct_resampler_conditioner.cc | 4 ++-- .../adapters/mmse_resampler_conditioner.cc | 4 ++-- .../adapters/signal_generator.cc | 4 ++-- .../adapters/custom_udp_signal_source.cc | 10 +++++----- .../adapters/labsat_signal_source.cc | 6 +++--- .../multichannel_file_signal_source.cc | 2 +- .../adapters/rtl_tcp_signal_source.cc | 6 +++--- .../spir_gss6450_file_signal_source.cc | 4 ++-- .../adapters/sbas_l1_telemetry_decoder.cc | 2 +- .../telemetry_decoder/libs/tlm_conf.cc | 4 ++-- .../galileo_e1_tcp_connector_tracking.cc | 4 ++-- .../glonass_l1_ca_dll_pll_c_aid_tracking.cc | 4 ++-- .../adapters/glonass_l1_ca_dll_pll_tracking.cc | 4 ++-- .../glonass_l2_ca_dll_pll_c_aid_tracking.cc | 4 ++-- .../adapters/glonass_l2_ca_dll_pll_tracking.cc | 4 ++-- .../adapters/gps_l1_ca_gaussian_tracking.cc | 4 ++-- .../gps_l1_ca_tcp_connector_tracking.cc | 4 ++-- src/core/receiver/control_thread.cc | 10 +++++----- src/core/receiver/file_configuration.cc | 18 +++++++++--------- src/core/receiver/gnss_block_factory.cc | 6 +++--- src/core/receiver/in_memory_configuration.cc | 18 +++++++++--------- src/core/system_parameters/gnss_almanac.cc | 4 ++-- src/core/system_parameters/gnss_ephemeris.cc | 4 ++-- .../adapter/adapter_test.cc | 4 ++-- 51 files changed, 129 insertions(+), 129 deletions(-) diff --git a/src/algorithms/PVT/adapters/rtklib_pvt.cc b/src/algorithms/PVT/adapters/rtklib_pvt.cc index cc6460adb..51b3977a1 100644 --- a/src/algorithms/PVT/adapters/rtklib_pvt.cc +++ b/src/algorithms/PVT/adapters/rtklib_pvt.cc @@ -63,7 +63,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, const std::string default_rtcm_dump_devname("/dev/pts/1"); DLOG(INFO) << "role " << role; pvt_output_parameters.dump = configuration->property(role + ".dump", false); - pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); + pvt_output_parameters.dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); pvt_output_parameters.dump_mat = configuration->property(role + ".dump_mat", true); pvt_output_parameters.rtk_trace_level = configuration->property(role + ".rtk_trace_level"s, 0); @@ -88,7 +88,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // NMEA Printer settings pvt_output_parameters.flag_nmea_tty_port = configuration->property(role + ".flag_nmea_tty_port", false); - pvt_output_parameters.nmea_dump_filename = configuration->property(role + ".nmea_dump_filename", std::move(default_nmea_dump_filename)); + pvt_output_parameters.nmea_dump_filename = configuration->property(role + ".nmea_dump_filename", default_nmea_dump_filename); pvt_output_parameters.nmea_dump_devname = configuration->property(role + ".nmea_dump_devname", default_nmea_dump_devname); // RINEX version @@ -127,7 +127,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, #endif // RTCM Printer settings pvt_output_parameters.flag_rtcm_tty_port = configuration->property(role + ".flag_rtcm_tty_port", false); - pvt_output_parameters.rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", std::move(default_rtcm_dump_devname)); + pvt_output_parameters.rtcm_dump_devname = configuration->property(role + ".rtcm_dump_devname", default_rtcm_dump_devname); pvt_output_parameters.flag_rtcm_server = configuration->property(role + ".flag_rtcm_server", false); pvt_output_parameters.rtcm_tcp_port = configuration->property(role + ".rtcm_tcp_port", 2101); pvt_output_parameters.rtcm_station_id = configuration->property(role + ".rtcm_station_id", 1234); @@ -158,7 +158,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Advanced Nativation Protocol Printer settings pvt_output_parameters.an_output_enabled = configuration->property(role + ".an_output_enabled", pvt_output_parameters.an_output_enabled); - pvt_output_parameters.an_dump_devname = configuration->property(role + ".an_dump_devname", std::move(default_nmea_dump_devname)); + pvt_output_parameters.an_dump_devname = configuration->property(role + ".an_dump_devname", default_nmea_dump_devname); if (pvt_output_parameters.an_output_enabled && pvt_output_parameters.flag_nmea_tty_port) { if (pvt_output_parameters.nmea_dump_devname == pvt_output_parameters.an_dump_devname) @@ -497,7 +497,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Settings 1 int positioning_mode = -1; const std::string default_pos_mode("Single"); - const std::string positioning_mode_str = configuration->property(role + ".positioning_mode", std::move(default_pos_mode)); // (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h + const std::string positioning_mode_str = configuration->property(role + ".positioning_mode", default_pos_mode); // (PMODE_XXX) see src/algorithms/libs/rtklib/rtklib.h if (positioning_mode_str == "Single") { positioning_mode = PMODE_SINGLE; @@ -582,7 +582,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, } const std::string default_iono_model("OFF"); - const std::string iono_model_str = configuration->property(role + ".iono_model", std::move(default_iono_model)); /* (IONOOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ + const std::string iono_model_str = configuration->property(role + ".iono_model", default_iono_model); /* (IONOOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ int iono_model = -1; if (iono_model_str == "OFF") { @@ -621,7 +621,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, const std::string default_trop_model("OFF"); int trop_model = -1; - const std::string trop_model_str = configuration->property(role + ".trop_model", std::move(default_trop_model)); /* (TROPOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ + const std::string trop_model_str = configuration->property(role + ".trop_model", default_trop_model); /* (TROPOPT_XXX) see src/algorithms/libs/rtklib/rtklib.h */ if (trop_model_str == "OFF") { trop_model = TROPOPT_OFF; @@ -699,7 +699,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, // Settings 2 const std::string default_gps_ar("Continuous"); - const std::string integer_ambiguity_resolution_gps_str = configuration->property(role + ".AR_GPS", std::move(default_gps_ar)); /* Integer Ambiguity Resolution mode for GPS (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */ + const std::string integer_ambiguity_resolution_gps_str = configuration->property(role + ".AR_GPS", default_gps_ar); /* Integer Ambiguity Resolution mode for GPS (0:off,1:continuous,2:instantaneous,3:fix and hold,4:ppp-ar) */ int integer_ambiguity_resolution_gps = -1; if (integer_ambiguity_resolution_gps_str == "OFF") { @@ -883,7 +883,7 @@ Rtklib_Pvt::Rtklib_Pvt(const ConfigurationInterface* configuration, pvt_output_parameters.xml_output_path = configuration->property(role + ".xml_output_path", default_output_path); pvt_output_parameters.nmea_output_file_path = configuration->property(role + ".nmea_output_file_path", default_output_path); pvt_output_parameters.rtcm_output_file_path = configuration->property(role + ".rtcm_output_file_path", default_output_path); - pvt_output_parameters.has_output_file_path = configuration->property(role + ".has_output_file_path", std::move(default_output_path)); + pvt_output_parameters.has_output_file_path = configuration->property(role + ".has_output_file_path", default_output_path); // Read PVT MONITOR Configuration pvt_output_parameters.monitor_enabled = configuration->property(role + ".enable_monitor", false); diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index c4aba97c2..433819649 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -311,7 +311,7 @@ bool Rtklib_Solver::save_matfile() const // WRITE MAT FILE mat_t *matfp; matvar_t *matvar; - std::string filename = std::move(dump_filename); + std::string filename = dump_filename; filename.erase(filename.length() - 4, 4); filename.append(".mat"); matfp = Mat_CreateVer(filename.c_str(), nullptr, MAT_FT_MAT73); diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc index f327dac91..1efbcfe4d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_8ms_ambiguous_acquisition.cc @@ -58,10 +58,10 @@ GalileoE1Pcps8msAmbiguousAcquisition::GalileoE1Pcps8msAmbiguousAcquisition( { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc index 4ff5201f1..dab9dcc47 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_cccwsr_ambiguous_acquisition.cc @@ -49,10 +49,10 @@ GalileoE1PcpsCccwsrAmbiguousAcquisition::GalileoE1PcpsCccwsrAmbiguousAcquisition { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 930e7c948..16a13e02d 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -58,10 +58,10 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role + ".item_type", std::move(default_item_type)); + item_type_ = configuration_->property(role + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc index fc9eef727..27a60b479 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_tong_ambiguous_acquisition.cc @@ -63,10 +63,10 @@ GalileoE1PcpsTongAmbiguousAcquisition::GalileoE1PcpsTongAmbiguousAcquisition( DLOG(INFO) << "role " << role_; - item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 4000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); if (sampled_ms_ % 4 != 0) { diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc index baabd31f0..153412bc0 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_noncoherent_iq_acquisition_caf.cc @@ -67,8 +67,8 @@ GalileoE5aNoncoherentIQAcquisitionCaf::GalileoE5aNoncoherentIQAcquisitionCaf( { const std::string default_item_type("gr_complex"); const std::string default_dump_filename("./acquisition.dat"); - item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); - dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); + dump_filename_ = configuration_->property(role_ + ".dump_filename", default_dump_filename); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 32000000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc index 3ad727b0f..f119a60c4 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fine_doppler.cc @@ -53,7 +53,7 @@ GpsL1CaPcpsAcquisitionFineDoppler::GpsL1CaPcpsAcquisitionFineDoppler( std::string default_dump_filename = "./acquisition.mat"; Acq_Conf acq_parameters = Acq_Conf(); - item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); acq_parameters.fs_in = fs_in_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc index 0801d6f87..0bd82c2dc 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_assisted_acquisition.cc @@ -51,7 +51,7 @@ GpsL1CaPcpsAssistedAcquisition::GpsL1CaPcpsAssistedAcquisition( const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); - item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc index 4c1c94d20..9fd146be2 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_quicksync_acquisition.cc @@ -59,7 +59,7 @@ GpsL1CaPcpsQuickSyncAcquisition::GpsL1CaPcpsQuickSyncAcquisition( { const std::string default_item_type("gr_complex"); std::string default_dump_filename = "./data/acquisition.dat"; - item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc index b5788ac8a..63efcab00 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_tong_acquisition.cc @@ -63,7 +63,7 @@ GpsL1CaPcpsTongAcquisition::GpsL1CaPcpsTongAcquisition( DLOG(INFO) << "role " << role_; - item_type_ = configuration_->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration_->property(role_ + ".item_type", default_item_type); int64_t fs_in_deprecated = configuration_->property("GNSS-SDR.internal_fs_hz", 2048000); fs_in_ = configuration_->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); dump_filename_ = configuration_->property(role_ + ".dump_filename", std::move(default_dump_filename)); diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index fa379e8e0..569319d1c 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -145,7 +145,7 @@ pcps_acquisition::pcps_acquisition(const Acq_Conf& conf_) { const std::string dump_filename_ = d_dump_filename.substr(d_dump_filename.find_last_of('/') + 1); dump_path = d_dump_filename.substr(0, d_dump_filename.find_last_of('/')); - d_dump_filename = std::move(dump_filename_); + d_dump_filename = dump_filename_; } else { diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc index 1f1d9cc63..d25a23f0e 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.cc +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.cc @@ -39,8 +39,8 @@ ByteToShort::ByteToShort(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); gr_char_to_short_ = gr::blocks::char_to_short::make(); diff --git a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc index 1a9c83ec0..ad63835ce 100644 --- a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc +++ b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.cc @@ -36,7 +36,7 @@ CshortToGrComplex::CshortToGrComplex(const ConfigurationInterface* configuration DLOG(INFO) << "role " << role_; - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); cshort_to_gr_complex_ = make_cshort_to_gr_complex(); DLOG(INFO) << "data_type_adapter_(" << cshort_to_gr_complex_->unique_id() << ")"; diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc index 035d416bb..df7322761 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cbyte.cc @@ -42,8 +42,8 @@ IbyteToCbyte::IbyteToCbyte(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); ibyte_to_cbyte_ = make_interleaved_byte_to_complex_byte(); diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc index dda4fbfd9..7682f4405 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_complex.cc @@ -39,8 +39,8 @@ IbyteToComplex::IbyteToComplex(const ConfigurationInterface* configuration, cons DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); gr_interleaved_char_to_complex_ = gr::blocks::interleaved_char_to_complex::make(); diff --git a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc index 1a6d185f1..5e37d724b 100644 --- a/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ibyte_to_cshort.cc @@ -41,8 +41,8 @@ IbyteToCshort::IbyteToCshort(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); interleaved_byte_to_complex_short_ = make_interleaved_byte_to_complex_short(); diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc index 4a850038f..e18d61015 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_complex.cc @@ -39,8 +39,8 @@ IshortToComplex::IshortToComplex(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); gr_interleaved_short_to_complex_ = gr::blocks::interleaved_short_to_complex::make(); diff --git a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc index 27c740657..717d7064d 100644 --- a/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc +++ b/src/algorithms/data_type_adapter/adapters/ishort_to_cshort.cc @@ -41,8 +41,8 @@ IshortToCshort::IshortToCshort(const ConfigurationInterface* configuration, DLOG(INFO) << "role " << role_; - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); interleaved_short_to_complex_short_ = make_interleaved_short_to_complex_short(); diff --git a/src/algorithms/input_filter/adapters/beamformer_filter.cc b/src/algorithms/input_filter/adapters/beamformer_filter.cc index 54603143a..b3efdee03 100644 --- a/src/algorithms/input_filter/adapters/beamformer_filter.cc +++ b/src/algorithms/input_filter/adapters/beamformer_filter.cc @@ -36,8 +36,8 @@ BeamformerFilter::BeamformerFilter( { const std::string default_item_type("gr_complex"); const std::string default_dump_file("./input_filter.dat"); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") { diff --git a/src/algorithms/input_filter/adapters/fir_filter.cc b/src/algorithms/input_filter/adapters/fir_filter.cc index 2f8cf042d..92c84645a 100644 --- a/src/algorithms/input_filter/adapters/fir_filter.cc +++ b/src/algorithms/input_filter/adapters/fir_filter.cc @@ -153,14 +153,14 @@ void FirFilter::init() const int number_of_taps = config_->property(role_ + ".number_of_taps", default_number_of_taps); const unsigned int number_of_bands = config_->property(role_ + ".number_of_bands", default_number_of_bands); - const std::string filter_type = config_->property(role_ + ".filter_type", std::move(default_filter_type)); + const std::string filter_type = config_->property(role_ + ".filter_type", default_filter_type); const int grid_density = config_->property(role_ + ".grid_density", default_grid_density); - input_item_type_ = config_->property(role_ + ".input_item_type", std::move(default_input_item_type)); - output_item_type_ = config_->property(role_ + ".output_item_type", std::move(default_output_item_type)); - taps_item_type_ = config_->property(role_ + ".taps_item_type", std::move(default_taps_item_type)); + input_item_type_ = config_->property(role_ + ".input_item_type", default_input_item_type); + output_item_type_ = config_->property(role_ + ".output_item_type", default_output_item_type); + taps_item_type_ = config_->property(role_ + ".taps_item_type", default_taps_item_type); dump_ = config_->property(role_ + ".dump", false); - dump_filename_ = config_->property(role_ + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = config_->property(role_ + ".dump_filename", default_dump_filename); std::vector bands; std::vector ampl; @@ -194,7 +194,7 @@ void FirFilter::init() // It calculates the optimal (in the Chebyshev/minimax sense) FIR filter // impulse response given a set of band edges, the desired response on // those bands, and the weight given to the error in those bands. - const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, std::move(filter_type), grid_density); + const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); taps_ = std::vector(taps_d.begin(), taps_d.end()); } diff --git a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc index a55e48155..ba75c6f67 100644 --- a/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc +++ b/src/algorithms/input_filter/adapters/freq_xlating_fir_filter.cc @@ -55,12 +55,12 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu const int number_of_taps = configuration->property(role_ + ".number_of_taps", default_number_of_taps); const unsigned int number_of_bands = configuration->property(role_ + ".number_of_bands", default_number_of_bands); - const std::string filter_type = configuration->property(role_ + ".filter_type", std::move(default_filter_type)); + const std::string filter_type = configuration->property(role_ + ".filter_type", default_filter_type); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); - input_item_type_ = configuration->property(role_ + ".input_item_type", std::move(default_input_item_type)); - output_item_type_ = configuration->property(role_ + ".output_item_type", std::move(default_output_item_type)); - taps_item_type_ = configuration->property(role_ + ".taps_item_type", std::move(default_taps_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + input_item_type_ = configuration->property(role_ + ".input_item_type", default_input_item_type); + output_item_type_ = configuration->property(role_ + ".output_item_type", default_output_item_type); + taps_item_type_ = configuration->property(role_ + ".taps_item_type", default_taps_item_type); intermediate_freq_ = configuration->property(role_ + ".IF", default_intermediate_freq); sampling_freq_ = configuration->property(role_ + ".sampling_frequency", default_sampling_freq); decimation_factor_ = configuration->property(role_ + ".decimation_factor", default_decimation_factor); @@ -97,7 +97,7 @@ FreqXlatingFirFilter::FreqXlatingFirFilter(const ConfigurationInterface* configu } const int grid_density = configuration->property(role_ + ".grid_density", default_grid_density); - const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, std::move(filter_type), grid_density); + const std::vector taps_d = gr::filter::pm_remez(number_of_taps - 1, bands, ampl, error_w, filter_type, grid_density); taps_ = std::vector(taps_d.begin(), taps_d.end()); } else diff --git a/src/algorithms/input_filter/adapters/notch_filter.cc b/src/algorithms/input_filter/adapters/notch_filter.cc index 9762072f1..b84c8833d 100644 --- a/src/algorithms/input_filter/adapters/notch_filter.cc +++ b/src/algorithms/input_filter/adapters/notch_filter.cc @@ -50,8 +50,8 @@ NotchFilter::NotchFilter(const ConfigurationInterface* configuration, const int n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est); const int n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + item_type_ = configuration->property(role + ".item_type", default_item_type); DLOG(INFO) << "role " << role_; if (item_type_ == "gr_complex") diff --git a/src/algorithms/input_filter/adapters/notch_filter_lite.cc b/src/algorithms/input_filter/adapters/notch_filter_lite.cc index 72aa08b94..c6b4ab8d7 100644 --- a/src/algorithms/input_filter/adapters/notch_filter_lite.cc +++ b/src/algorithms/input_filter/adapters/notch_filter_lite.cc @@ -54,8 +54,8 @@ NotchFilterLite::NotchFilterLite(const ConfigurationInterface* configuration, const int n_segments_est = configuration->property(role + ".segments_est", default_n_segments_est); const int n_segments_reset = configuration->property(role + ".segments_reset", default_n_segments_reset); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); + item_type_ = configuration->property(role + ".item_type", default_item_type); int n_segments_coeff = static_cast((samp_freq / coeff_rate) / static_cast(length_)); n_segments_coeff = std::max(1, n_segments_coeff); diff --git a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc index f452eb7fa..8732ba4f8 100644 --- a/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc +++ b/src/algorithms/input_filter/adapters/pulse_blanking_filter.cc @@ -52,8 +52,8 @@ PulseBlankingFilter::PulseBlankingFilter(const ConfigurationInterface* configura const double if_aux = configuration->property(role_ + ".if", default_if); const double if_ = configuration->property(role_ + ".IF", if_aux); - dump_filename_ = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); - item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); + dump_filename_ = configuration->property(role_ + ".dump_filename", default_dump_filename); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); dump_ = configuration->property(role_ + ".dump", false); DLOG(INFO) << "role " << role_; diff --git a/src/algorithms/libs/pass_through.cc b/src/algorithms/libs/pass_through.cc index 0e68f85c3..0c2a17fa3 100644 --- a/src/algorithms/libs/pass_through.cc +++ b/src/algorithms/libs/pass_through.cc @@ -40,7 +40,7 @@ Pass_Through::Pass_Through(const ConfigurationInterface* configuration, inverted_spectrum(configuration->property(role + ".inverted_spectrum", false)) { const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + item_type_ = configuration->property(role + ".item_type", default_item_type); if (item_type_ == "float") { diff --git a/src/algorithms/observables/adapters/hybrid_observables.cc b/src/algorithms/observables/adapters/hybrid_observables.cc index e04be0681..ae28766ea 100644 --- a/src/algorithms/observables/adapters/hybrid_observables.cc +++ b/src/algorithms/observables/adapters/hybrid_observables.cc @@ -38,7 +38,7 @@ HybridObservables::HybridObservables(const ConfigurationInterface* configuration dump_mat_(configuration->property(role + ".dump_mat", true)) { const std::string default_dump_filename("./observables.dat"); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); Obs_Conf conf{}; conf.dump = dump_; diff --git a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc index 4ffb449e8..444f1ed19 100644 --- a/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/direct_resampler_conditioner.cc @@ -47,8 +47,8 @@ DirectResamplerConditioner::DirectResamplerConditioner( const std::string default_dump_file("./resampler.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); diff --git a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc index ae592c2f9..09dafa8b6 100644 --- a/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc +++ b/src/algorithms/resampler/adapters/mmse_resampler_conditioner.cc @@ -43,8 +43,8 @@ MmseResamplerConditioner::MmseResamplerConditioner( const std::string default_dump_file("./resampler.dat"); const double fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000.0); const double fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); sample_freq_in_ = configuration->property(role_ + ".sample_freq_in", 4000000.0); sample_freq_out_ = configuration->property(role_ + ".sample_freq_out", fs_in); diff --git a/src/algorithms/signal_generator/adapters/signal_generator.cc b/src/algorithms/signal_generator/adapters/signal_generator.cc index 260861fbb..c5d745689 100644 --- a/src/algorithms/signal_generator/adapters/signal_generator.cc +++ b/src/algorithms/signal_generator/adapters/signal_generator.cc @@ -47,8 +47,8 @@ SignalGenerator::SignalGenerator(const ConfigurationInterface* configuration, const std::string default_system("G"); const std::string default_signal("1C"); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + item_type_ = configuration->property(role + ".item_type", default_item_type); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); const unsigned int fs_in = configuration->property("SignalSource.fs_hz", static_cast(4e6)); const bool data_flag = configuration->property("SignalSource.data_flag", false); 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 2caaec9b2..705ef2bb9 100644 --- a/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/custom_udp_signal_source.cc @@ -46,20 +46,20 @@ CustomUDPSignalSource::CustomUDPSignalSource(const ConfigurationInterface* confi // DUMP PARAMETERS const std::string default_dump_file("./data/signal_source.dat"); const std::string default_item_type("gr_complex"); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); // network PARAMETERS const std::string default_capture_device("eth0"); const std::string default_address("127.0.0.1"); const int default_port = 1234; - const std::string address = configuration->property(role + ".origin_address", std::move(default_address)); - std::string capture_device = configuration->property(role + ".capture_device", std::move(default_capture_device)); + const std::string address = configuration->property(role + ".origin_address", default_address); + std::string capture_device = configuration->property(role + ".capture_device", default_capture_device); int port = configuration->property(role + ".port", default_port); int payload_bytes = configuration->property(role + ".payload_bytes", 1024); const std::string default_sample_type("cbyte"); - const std::string sample_type = configuration->property(role + ".sample_type", std::move(default_sample_type)); - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + const std::string sample_type = configuration->property(role + ".sample_type", default_sample_type); + item_type_ = configuration->property(role + ".item_type", default_item_type); udp_gnss_rx_source_ = Gr_Complex_Ip_Packet_Source::make(capture_device, address, diff --git a/src/algorithms/signal_source/adapters/labsat_signal_source.cc b/src/algorithms/signal_source/adapters/labsat_signal_source.cc index 459e21a89..75bd7dc54 100644 --- a/src/algorithms/signal_source/adapters/labsat_signal_source.cc +++ b/src/algorithms/signal_source/adapters/labsat_signal_source.cc @@ -44,12 +44,12 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati const std::string default_item_type("gr_complex"); const std::string default_dump_file("./labsat_output.dat"); item_type_ = configuration->property(role + ".item_type", default_item_type); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); const int64_t sampling_frequency_deprecated = configuration->property(role + ".sampling_frequency", static_cast(16368000)); const int64_t throttle_frequency_sps = configuration->property(role + ".throttle_frequency_sps", static_cast(sampling_frequency_deprecated)); - std::string channels_to_read = configuration->property(role + ".selected_channel", std::move(default_item_type)); + std::string channels_to_read = configuration->property(role + ".selected_channel", default_item_type); std::stringstream ss(channels_to_read); int found; while (ss.good()) @@ -70,7 +70,7 @@ LabsatSignalSource::LabsatSignalSource(const ConfigurationInterface* configurati } const std::string default_filename("./example_capture.LS3"); - filename_ = configuration->property(role + ".filename", std::move(default_filename)); + filename_ = configuration->property(role + ".filename", default_filename); const bool digital_io_enabled = configuration->property(role + ".digital_io_enabled", false); 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 b41e34617..84271beea 100644 --- a/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc +++ b/src/algorithms/signal_source/adapters/multichannel_file_signal_source.cc @@ -54,7 +54,7 @@ MultichannelFileSignalSource::MultichannelFileSignalSource(const ConfigurationIn filename_vec_.push_back(configuration->property(role + ".filename" + std::to_string(n), default_filename)); } - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); + item_type_ = configuration->property(role + ".item_type", default_item_type); repeat_ = configuration->property(role + ".repeat", false); enable_throttle_control_ = configuration->property(role + ".enable_throttle_control", false); 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 01e4f37b7..2e5849eb5 100644 --- a/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc +++ b/src/algorithms/signal_source/adapters/rtl_tcp_signal_source.cc @@ -55,13 +55,13 @@ RtlTcpSignalSource::RtlTcpSignalSource(const ConfigurationInterface* configurati // DUMP PARAMETERS const std::string default_dump_file("./data/signal_source.dat"); const std::string default_item_type("gr_complex"); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_file)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_file); // rtl_tcp PARAMETERS const std::string default_address("127.0.0.1"); const int16_t default_port = 1234; - item_type_ = configuration->property(role + ".item_type", std::move(default_item_type)); - address_ = configuration->property(role + ".address", std::move(default_address)); + item_type_ = configuration->property(role + ".item_type", default_item_type); + address_ = configuration->property(role + ".address", default_address); port_ = configuration->property(role + ".port", default_port); if (item_type_ == "short") 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 0cfc1eba4..1b29d773e 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 @@ -56,8 +56,8 @@ SpirGSS6450FileSignalSource::SpirGSS6450FileSignalSource(const ConfigurationInte { const std::string default_filename("./my_capture.dat"); const std::string default_dump_filename("./my_capture_dump.dat"); - filename_ = configuration->property(role + ".filename", std::move(default_filename)); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); + filename_ = configuration->property(role + ".filename", default_filename); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); const int64_t bytes_seek = configuration->property(role + ".bytes_to_skip", static_cast(65536)); const double sample_size_byte = static_cast(adc_bits_) / 4.0; diff --git a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc index 901e10c80..4fdd9a18d 100644 --- a/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc +++ b/src/algorithms/telemetry_decoder/adapters/sbas_l1_telemetry_decoder.cc @@ -36,7 +36,7 @@ SbasL1TelemetryDecoder::SbasL1TelemetryDecoder( dump_(configuration->property(role + ".dump", false)) { const std::string default_dump_filename("./navigation.dat"); - dump_filename_ = configuration->property(role + ".dump_filename", std::move(default_dump_filename)); + dump_filename_ = configuration->property(role + ".dump_filename", default_dump_filename); // make telemetry decoder object telemetry_decoder_ = sbas_l1_make_telemetry_decoder_gs(satellite_, dump_); // TODO fix me DLOG(INFO) << "role " << role; diff --git a/src/algorithms/telemetry_decoder/libs/tlm_conf.cc b/src/algorithms/telemetry_decoder/libs/tlm_conf.cc index d3a1ae733..cb520a978 100644 --- a/src/algorithms/telemetry_decoder/libs/tlm_conf.cc +++ b/src/algorithms/telemetry_decoder/libs/tlm_conf.cc @@ -23,13 +23,13 @@ void Tlm_Conf::SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role) { const std::string default_dumpname("telemetry"); - dump_filename = configuration->property(role + ".dump_filename", std::move(default_dumpname)); + dump_filename = configuration->property(role + ".dump_filename", default_dumpname); dump = configuration->property(role + ".dump", false); dump_mat = configuration->property(role + ".dump_mat", dump); remove_dat = configuration->property(role + ".remove_dat", false); dump_crc_stats = configuration->property(role + ".dump_crc_stats", false); const std::string default_crc_stats_dumpname("telemetry_crc_stats"); - dump_crc_stats_filename = configuration->property(role + ".dump_crc_stats_filename", std::move(default_crc_stats_dumpname)); + dump_crc_stats_filename = configuration->property(role + ".dump_crc_stats_filename", default_crc_stats_dumpname); enable_navdata_monitor = configuration->property("NavDataMonitor.enable_monitor", false); if (configuration->property("Channels_1B.count", 0) > 0) { diff --git a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc index bd66e5c3c..fc79e02ab 100644 --- a/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/galileo_e1_tcp_connector_tracking.cc @@ -46,7 +46,7 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -79,7 +79,7 @@ GalileoE1TcpConnectorTracking::GalileoE1TcpConnectorTracking( float very_early_late_space_chips = configuration->property(role_ + ".very_early_late_space_chips", static_cast(0.5)); size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GALILEO_E1_CODE_CHIP_RATE_CPS / GALILEO_E1_B_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc index f048166d0..c8835db47 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_c_aid_tracking.cc @@ -49,7 +49,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -84,7 +84,7 @@ GlonassL1CaDllPllCAidTracking::GlonassL1CaDllPllCAidTracking( float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc index 3c60624be..12deb5f90 100644 --- a/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l1_ca_dll_pll_tracking.cc @@ -48,7 +48,7 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -79,7 +79,7 @@ GlonassL1CaDllPllTracking::GlonassL1CaDllPllTracking( #endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L1_CA_CODE_RATE_CPS / GLONASS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc index 3bef9b6f5..4150a4ad5 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_c_aid_tracking.cc @@ -47,7 +47,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - item_type_ = configuration->property(role_ + ".item_type", std::move(default_item_type)); + item_type_ = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -82,7 +82,7 @@ GlonassL2CaDllPllCAidTracking::GlonassL2CaDllPllCAidTracking( float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc index a5dbc3fc4..e145f2867 100644 --- a/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc +++ b/src/algorithms/tracking/adapters/glonass_l2_ca_dll_pll_tracking.cc @@ -46,7 +46,7 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); @@ -76,7 +76,7 @@ GlonassL2CaDllPllTracking::GlonassL2CaDllPllTracking( #endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GLONASS_L2_CA_CODE_RATE_CPS / GLONASS_L2_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc index 85088e9af..f9b5f70c9 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_gaussian_tracking.cc @@ -50,7 +50,7 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int order = configuration->property(role_ + ".order", 2); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); @@ -69,7 +69,7 @@ GpsL1CaGaussianTracking::GpsL1CaGaussianTracking( #endif float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); bool bce_run = configuration->property(role_ + ".bce_run", false); diff --git a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc index 7ffa6ff5c..887dbdbc5 100644 --- a/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc +++ b/src/algorithms/tracking/adapters/gps_l1_ca_tcp_connector_tracking.cc @@ -46,14 +46,14 @@ GpsL1CaTcpConnectorTracking::GpsL1CaTcpConnectorTracking( { // ################# CONFIGURATION PARAMETERS ######################## const std::string default_item_type("gr_complex"); - std::string item_type = configuration->property(role_ + ".item_type", std::move(default_item_type)); + std::string item_type = configuration->property(role_ + ".item_type", default_item_type); int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); bool dump = configuration->property(role_ + ".dump", false); float early_late_space_chips = configuration->property(role_ + ".early_late_space_chips", static_cast(0.5)); size_t port_ch0 = configuration->property(role_ + ".port_ch0", 2060); const std::string default_dump_filename("./track_ch"); - std::string dump_filename = configuration->property(role_ + ".dump_filename", std::move(default_dump_filename)); + std::string dump_filename = configuration->property(role_ + ".dump_filename", default_dump_filename); const auto vector_length = static_cast(std::round(fs_in / (GPS_L1_CA_CODE_RATE_CPS / GPS_L1_CA_CODE_LENGTH_CHIPS))); // ################# MAKE TRACKING GNURadio object ################### diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index d6ddf4c6c..9a265254d 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -142,7 +142,7 @@ ControlThread::ControlThread() std::string pvt_impl = configuration_->property("PVT.implementation", empty_implementation); conf_has_pvt_ = !pvt_impl.empty(); - std::string obs_impl = configuration_->property("Observables.implementation", std::move(empty_implementation)); + std::string obs_impl = configuration_->property("Observables.implementation", empty_implementation); conf_has_observables_ = !obs_impl.empty(); well_formatted_configuration_ = conf_file_has_section_ && conf_file_has_mandatory_globals_ && conf_has_signal_sources_ && conf_has_observables_ && conf_has_pvt_; @@ -747,8 +747,8 @@ void ControlThread::assist_GNSS() std::cout << "SUPL RRLP GPS assistance enabled!\n"; const std::string default_acq_server("supl.google.com"); const std::string default_eph_server("supl.google.com"); - supl_client_ephemeris_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_server", std::move(default_acq_server)); - supl_client_acquisition_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_server", std::move(default_eph_server)); + supl_client_ephemeris_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_server", default_acq_server); + supl_client_acquisition_.server_name = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_server", default_eph_server); supl_client_ephemeris_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_ephemeris_port", 7275); supl_client_acquisition_.server_port = configuration_->property("GNSS-SDR.SUPL_gps_acquisition_port", 7275); supl_mcc_ = configuration_->property("GNSS-SDR.SUPL_MCC", 244); @@ -756,8 +756,8 @@ void ControlThread::assist_GNSS() const std::string default_lac("0x59e2"); const std::string default_ci("0x31b0"); - const std::string supl_lac_s = configuration_->property("GNSS-SDR.SUPL_LAC", std::move(default_lac)); - const std::string supl_ci_s = configuration_->property("GNSS-SDR.SUPL_CI", std::move(default_ci)); + const std::string supl_lac_s = configuration_->property("GNSS-SDR.SUPL_LAC", default_lac); + const std::string supl_ci_s = configuration_->property("GNSS-SDR.SUPL_CI", default_ci); try { supl_lac_ = std::stoi(supl_lac_s, nullptr, 0); diff --git a/src/core/receiver/file_configuration.cc b/src/core/receiver/file_configuration.cc index a76d8b8de..4f873f1d4 100644 --- a/src/core/receiver/file_configuration.cc +++ b/src/core/receiver/file_configuration.cc @@ -88,7 +88,7 @@ bool FileConfiguration::property(std::string property_name, bool default_value) return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -99,7 +99,7 @@ int64_t FileConfiguration::property(std::string property_name, int64_t default_v return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -110,7 +110,7 @@ uint64_t FileConfiguration::property(std::string property_name, uint64_t default return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -121,7 +121,7 @@ int FileConfiguration::property(std::string property_name, int default_value) co return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -132,7 +132,7 @@ unsigned int FileConfiguration::property(std::string property_name, unsigned int return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -143,7 +143,7 @@ uint16_t FileConfiguration::property(std::string property_name, uint16_t default return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -154,7 +154,7 @@ int16_t FileConfiguration::property(std::string property_name, int16_t default_v return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -165,7 +165,7 @@ float FileConfiguration::property(std::string property_name, float default_value return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } @@ -176,7 +176,7 @@ double FileConfiguration::property(std::string property_name, double default_val return overrided_->property(std::move(property_name), default_value); } const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } diff --git a/src/core/receiver/gnss_block_factory.cc b/src/core/receiver/gnss_block_factory.cc index 12ee51285..1635aa5f5 100644 --- a/src/core/receiver/gnss_block_factory.cc +++ b/src/core/receiver/gnss_block_factory.cc @@ -337,7 +337,7 @@ std::unique_ptr GNSSBlockFactory::GetSignalConditioner( std::unique_ptr GNSSBlockFactory::GetObservables(const ConfigurationInterface* configuration) { const std::string empty_implementation; - std::string implementation = configuration->property("Observables.implementation", std::move(empty_implementation)); + std::string implementation = configuration->property("Observables.implementation", empty_implementation); LOG(INFO) << "Getting Observables with implementation " << implementation; if (implementation.find("_Observables") == std::string::npos) { @@ -372,7 +372,7 @@ std::unique_ptr GNSSBlockFactory::GetObservables(const Confi std::unique_ptr GNSSBlockFactory::GetPVT(const ConfigurationInterface* configuration) { const std::string empty_implementation; - std::string implementation = configuration->property("PVT.implementation", std::move(empty_implementation)); + std::string implementation = configuration->property("PVT.implementation", empty_implementation); LOG(INFO) << "Getting PVT with implementation " << implementation; if (implementation.find("_PVT") == std::string::npos) { @@ -428,7 +428,7 @@ std::unique_ptr GNSSBlockFactory::GetChannel( // Automatically detect input data type const std::string default_item_type("gr_complex"); std::string acq_item_type = configuration->property("Acquisition_" + signal + appendix1 + item_prop, default_item_type); - std::string trk_item_type = configuration->property("Tracking_" + signal + appendix2 + item_prop, std::move(default_item_type)); + std::string trk_item_type = configuration->property("Tracking_" + signal + appendix2 + item_prop, default_item_type); if (acq_item_type != trk_item_type) { std::cerr << "Configuration error: Acquisition and Tracking blocks must have the same input data type!\n"; diff --git a/src/core/receiver/in_memory_configuration.cc b/src/core/receiver/in_memory_configuration.cc index 5f864fcdd..b3cde9946 100644 --- a/src/core/receiver/in_memory_configuration.cc +++ b/src/core/receiver/in_memory_configuration.cc @@ -47,63 +47,63 @@ std::string InMemoryConfiguration::property(std::string property_name, std::stri bool InMemoryConfiguration::property(std::string property_name, bool default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } int64_t InMemoryConfiguration::property(std::string property_name, int64_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } uint64_t InMemoryConfiguration::property(std::string property_name, uint64_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } int32_t InMemoryConfiguration::property(std::string property_name, int32_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } uint32_t InMemoryConfiguration::property(std::string property_name, uint32_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } uint16_t InMemoryConfiguration::property(std::string property_name, uint16_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } int16_t InMemoryConfiguration::property(std::string property_name, int16_t default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } float InMemoryConfiguration::property(std::string property_name, float default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } double InMemoryConfiguration::property(std::string property_name, double default_value) const { const std::string empty; - return converter_->convert(property(std::move(property_name), std::move(empty)), default_value); + return converter_->convert(property(std::move(property_name), empty), default_value); } diff --git a/src/core/system_parameters/gnss_almanac.cc b/src/core/system_parameters/gnss_almanac.cc index 03080cd1a..66ae631f6 100644 --- a/src/core/system_parameters/gnss_almanac.cc +++ b/src/core/system_parameters/gnss_almanac.cc @@ -73,12 +73,12 @@ double Gnss_Almanac::predicted_doppler(double rx_time_s, const std::vector pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]}; const std::vector vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]}; - std::vector x_sr = std::move(pos_sat); + std::vector x_sr = pos_sat; std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus()); // pos_sat - pos_rx const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm - std::vector v_sr = std::move(vel_sat); + std::vector v_sr = vel_sat; std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus()); // vel_sat - vel_rx const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr; diff --git a/src/core/system_parameters/gnss_ephemeris.cc b/src/core/system_parameters/gnss_ephemeris.cc index e6231357e..e49bf8b81 100644 --- a/src/core/system_parameters/gnss_ephemeris.cc +++ b/src/core/system_parameters/gnss_ephemeris.cc @@ -69,12 +69,12 @@ double Gnss_Ephemeris::predicted_doppler(double rx_time_s, const std::vector pos_sat = {sat_pos_vel[0], sat_pos_vel[1], sat_pos_vel[2]}; const std::vector vel_sat = {sat_pos_vel[3], sat_pos_vel[4], sat_pos_vel[5]}; - std::vector x_sr = std::move(pos_sat); + std::vector x_sr = pos_sat; std::transform(x_sr.begin(), x_sr.end(), pos_rx.begin(), x_sr.begin(), std::minus()); // pos_sat - pos_rx const double norm_x_sr = std::sqrt(std::inner_product(x_sr.begin(), x_sr.end(), x_sr.begin(), 0.0)); // Euclidean norm - std::vector v_sr = std::move(vel_sat); + std::vector v_sr = vel_sat; std::transform(v_sr.begin(), v_sr.end(), vel_rx.begin(), v_sr.begin(), std::minus()); // vel_sat - vel_rx const double radial_vel = std::inner_product(v_sr.begin(), v_sr.end(), x_sr.begin(), 0.0) / norm_x_sr; diff --git a/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc b/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc index 7eb3bc891..6aa9d5358 100644 --- a/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc +++ b/tests/unit-tests/signal-processing-blocks/adapter/adapter_test.cc @@ -60,10 +60,10 @@ DataTypeAdapter::DataTypeAdapter() std::array input_shorts{2, 23, -1, 127, -127, 0, 255, 255}; const std::vector input_data_bytes_(input_bytes.data(), input_bytes.data() + input_bytes.size() / sizeof(int8_t)); - input_data_bytes = std::move(input_data_bytes_); + input_data_bytes = input_data_bytes_; const std::vector input_data_shorts_(input_shorts.data(), input_shorts.data() + input_shorts.size() / sizeof(int16_t)); - input_data_shorts = std::move(input_data_shorts_); + input_data_shorts = input_data_shorts_; } From 58c2178f989747f297297fc77d3c48c0f0d182ec Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 10:32:09 +0100 Subject: [PATCH 461/499] CI: remove parallel builds --- .github/workflows/volk_gnsssdr_archs.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index d27294b27..d4fae37da 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -69,8 +69,7 @@ jobs: cd /volk_gnsssdr cd testing cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/ - echo "Build with $(nproc) thread(s)" - make -j$(nproc) + make ./apps/volk_gnsssdr-config-info --alignment ./apps/volk_gnsssdr-config-info --avail-machines ./apps/volk_gnsssdr-config-info --all-machines From c29b85a82a8bdcf3375657cab45050187c511edf Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 12:18:45 +0100 Subject: [PATCH 462/499] Update cpu_features to Dec24 --- .../volk_gnsssdr/cpu_features/CMakeLists.txt | 8 +------ .../include/cpu_features_macros.h | 12 +++++++---- ..._freebsd.c => hwcaps_freebsd_or_openbsd.c} | 6 +++--- .../cpu_features/src/impl_aarch64_cpuid.c | 10 ++++----- ...sd.c => impl_aarch64_freebsd_or_openbsd.c} | 6 +++--- .../src/utils/list_cpu_features.c | 6 +++++- .../cpu_features/test/CMakeLists.txt | 4 ++-- .../cpu_features/test/cpuinfo_aarch64_test.cc | 21 ++++++++----------- 8 files changed, 35 insertions(+), 38 deletions(-) rename src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/{hwcaps_freebsd.c => hwcaps_freebsd_or_openbsd.c} (85%) rename src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/{impl_aarch64_freebsd.c => impl_aarch64_freebsd_or_openbsd.c} (86%) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt index 7e7f7b90b..354ea80fe 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt @@ -3,12 +3,6 @@ cmake_minimum_required(VERSION 3.13) -# option() honors normal variables. -# see: https://cmake.org/cmake/help/git-stage/policy/CMP0077.html -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif() - project(CpuFeatures VERSION 0.9.0 LANGUAGES C) set(CMAKE_C_STANDARD 99) @@ -151,7 +145,7 @@ if(UNIX) add_library(unix_based_hardware_detection OBJECT ${PROJECT_SOURCE_DIR}/include/internal/hwcaps.h ${PROJECT_SOURCE_DIR}/src/hwcaps_linux_or_android.c - ${PROJECT_SOURCE_DIR}/src/hwcaps_freebsd.c + ${PROJECT_SOURCE_DIR}/src/hwcaps_freebsd_or_openbsd.c ${PROJECT_SOURCE_DIR}/src/hwcaps.c ) setup_include_and_definitions(unix_based_hardware_detection) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h index b595a22f2..020c3d09f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpu_features_macros.h @@ -4,7 +4,6 @@ #ifndef CPU_FEATURES_INCLUDE_CPU_FEATURES_MACROS_H_ #define CPU_FEATURES_INCLUDE_CPU_FEATURES_MACROS_H_ -#include //////////////////////////////////////////////////////////////////////////////// // Architectures //////////////////////////////////////////////////////////////////////////////// @@ -85,6 +84,10 @@ #define CPU_FEATURES_OS_FREEBSD #endif +#if defined(__OpenBSD__) +#define CPU_FEATURES_OS_OPENBSD +#endif + #if defined(__ANDROID__) #define CPU_FEATURES_OS_ANDROID #endif @@ -226,14 +229,15 @@ #endif // defined(CPU_FEATURES_ARCH_X86) +#if defined(CPU_FEATURES_ARCH_ANY_ARM) // Note: MSVC targeting ARM does not define `__ARM_NEON` but Windows on ARM // requires it. In that case we force NEON detection. -#if defined(__ARM_NEON) || \ - (defined(CPU_FEATURES_COMPILER_MSC) && defined(CPU_FEATURES_ARCH_ANY_ARM)) +#if defined(__ARM_NEON) || defined(CPU_FEATURES_COMPILER_MSC) #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 1 #else #define CPU_FEATURES_COMPILED_ANY_ARM_NEON 0 -#endif +#endif // defined(__ARM_NEON) || defined(CPU_FEATURES_COMPILER_MSC) +#endif // defined(CPU_FEATURES_ARCH_ANY_ARM) #if defined(CPU_FEATURES_ARCH_MIPS) #if defined(__mips_msa) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/hwcaps_freebsd.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/hwcaps_freebsd_or_openbsd.c similarity index 85% rename from src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/hwcaps_freebsd.c rename to src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/hwcaps_freebsd_or_openbsd.c index 34c29e7ae..8756c4c30 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/hwcaps_freebsd.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/hwcaps_freebsd_or_openbsd.c @@ -3,7 +3,7 @@ #include "cpu_features_macros.h" -#ifdef CPU_FEATURES_OS_FREEBSD +#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) #include "internal/hwcaps.h" @@ -38,8 +38,8 @@ const char *CpuFeatures_GetPlatformPointer(void) { return NULL; } const char *CpuFeatures_GetBasePlatformPointer(void) { return NULL; } #else -#error "FreeBSD needs support for elf_aux_info" +#error "FreeBSD / OpenBSD needs support for elf_aux_info" #endif // HAVE_STRONG_ELF_AUX_INFO #endif // CPU_FEATURES_TEST -#endif // CPU_FEATURES_OS_FREEBSD \ No newline at end of file +#endif // CPU_FEATURES_OS_FREEBSD || CPU_FEATURES_OS_OPENBSD \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c index 5ae3a1df7..d6245a127 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c @@ -4,8 +4,8 @@ #include "cpu_features_macros.h" #ifdef CPU_FEATURES_ARCH_AARCH64 -#if (defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_LINUX) || \ - defined(CPU_FEATURES_OS_ANDROID)) +#if (defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) || \ + defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)) #if (defined(CPU_FEATURES_COMPILER_GCC) || defined(CPU_FEATURES_COMPILER_CLANG)) #include "internal/cpuid_aarch64.h" @@ -16,9 +16,7 @@ uint64_t GetMidrEl1(void) { uint64_t midr_el1; - // clang-format off __asm("mrs %0, MIDR_EL1" : "=r"(midr_el1)); - // clang-format on return midr_el1; } #endif // CPU_FEATURES_MOCK_CPUID_AARCH64 @@ -27,6 +25,6 @@ uint64_t GetMidrEl1(void) #error "Unsupported compiler, aarch64 cpuid requires either GCC or Clang." #endif // (defined(CPU_FEATURES_COMPILER_GCC) || // defined(CPU_FEATURES_COMPILER_CLANG)) -#endif // (defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_LINUX) - // || defined(CPU_FEATURES_OS_ANDROID)) +#endif // (defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) + // || defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_ANDROID)) #endif // CPU_FEATURES_ARCH_AARCH64 \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_freebsd.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_freebsd_or_openbsd.c similarity index 86% rename from src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_freebsd.c rename to src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_freebsd_or_openbsd.c index 7360da790..3a63c35fc 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_freebsd.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_freebsd_or_openbsd.c @@ -4,7 +4,7 @@ #include "cpu_features_macros.h" #ifdef CPU_FEATURES_ARCH_AARCH64 -#ifdef CPU_FEATURES_OS_FREEBSD +#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) #include "cpuinfo_aarch64.h" #include "internal/cpuid_aarch64.h" @@ -35,5 +35,5 @@ Aarch64Info GetAarch64Info(void) return info; } -#endif // CPU_FEATURES_OS_FREEBSD -#endif // CPU_FEATURES_ARCH_AARCH64 +#endif // CPU_FEATURES_OS_FREEBSD || CPU_FEATURES_OS_OPENBSD +#endif // CPU_FEATURES_ARCH_AARCH64 \ No newline at end of file diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c index fdbb1ba51..a559b4d78 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/utils/list_cpu_features.c @@ -148,7 +148,11 @@ static Node* CreatePrintfString(const char* format, ...) const int written = vsnprintf(ptr, gBumpAllocator.size, format, arglist); va_end(arglist); if (written < 0 || written >= (int)gBumpAllocator.size) internal_error(); - return CreateConstantString((char*)BA_Bump(written)); + // `vsnprintf` does not set `\0` when no characters are to be written. + if (written == 0) *ptr = '\0'; + // `vsnprintf` returns the number of printed characters excluding `\0`. + const int null_terminated_written = written + 1; + return CreateConstantString((char*)BA_Bump(null_terminated_written)); } // Adds a string node. diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt index 71ae6527c..01a67a026 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/CMakeLists.txt @@ -28,7 +28,7 @@ target_link_libraries(stack_line_reader_for_test string_view filesystem_for_test add_library(all_libraries ../src/hwcaps.c ../src/hwcaps_linux_or_android.c - ../src/hwcaps_freebsd.c + ../src/hwcaps_freebsd_or_openbsd.c ../src/stack_line_reader.c) target_link_libraries(all_libraries hwcaps_for_testing stack_line_reader string_view) @@ -84,7 +84,7 @@ if(PROCESSOR_IS_AARCH64) ../src/impl_aarch64_linux_or_android.c ../src/impl_aarch64_windows.c ../src/impl_aarch64_macos_or_iphone.c - ../src/impl_aarch64_freebsd.c + ../src/impl_aarch64_freebsd_or_openbsd.c ) if(APPLE) target_compile_definitions(cpuinfo_aarch64_test PUBLIC CPU_FEATURES_MOCK_SYSCTL_AARCH64) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc index 637cb676b..c3f0dfc71 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_aarch64_test.cc @@ -9,15 +9,15 @@ #if defined(CPU_FEATURES_OS_WINDOWS) #include "internal/windows_utils.h" #endif // CPU_FEATURES_OS_WINDOWS -#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_LINUX) +#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) || defined(CPU_FEATURES_OS_LINUX) #include "internal/cpuid_aarch64.h" -#endif // defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_LINUX) +#endif // defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) || defined(CPU_FEATURES_OS_LINUX) namespace cpu_features { class FakeCpuAarch64 { -#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_LINUX) +#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) || defined(CPU_FEATURES_OS_LINUX) public: uint64_t GetMidrEl1() const { return _midr_el1; } @@ -87,11 +87,8 @@ static FakeCpuAarch64& cpu() } // Define OS dependent mock functions -#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_LINUX) -extern "C" uint64_t GetMidrEl1(void) -{ - return cpu().GetMidrEl1(); -} +#if defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) || defined(CPU_FEATURES_OS_LINUX) +extern "C" uint64_t GetMidrEl1(void) { return cpu().GetMidrEl1(); } #elif defined(CPU_FEATURES_OS_MACOS) extern "C" bool GetDarwinSysCtlByName(const char* name) { @@ -148,7 +145,7 @@ TEST_F(CpuidAarch64Test, Aarch64FeaturesEnum) } // AT_HWCAP tests -#if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_FREEBSD) +#if defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) TEST_F(CpuidAarch64Test, FromHardwareCap) { ResetHwcaps(); @@ -218,7 +215,7 @@ TEST_F(CpuidAarch64Test, FromHardwareCap2) EXPECT_FALSE(info.features.dgh); EXPECT_FALSE(info.features.rng); } -#endif // defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_FREEBSD) +#endif // defined(CPU_FEATURES_OS_LINUX) || defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) // OS dependent tests #if defined(CPU_FEATURES_OS_LINUX) @@ -431,7 +428,7 @@ TEST_F(CpuidAarch64Test, WINDOWS_AARCH64_RPI4) EXPECT_FALSE(info.features.jscvt); EXPECT_FALSE(info.features.lrcpc); } -#elif defined(CPU_FEATURES_OS_FREEBSD) +#elif defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) TEST_F(CpuidAarch64Test, MrsMidrEl1_RPI4) { ResetHwcaps(); @@ -465,4 +462,4 @@ TEST_F(CpuidAarch64Test, MrsMidrEl1_RPI4) } #endif // CPU_FEATURES_OS_FREEBSD } // namespace -} // namespace cpu_features +} // namespace cpu_features \ No newline at end of file From da85c916057de519f337cd4d2fb138d4483eb8d6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 12:23:26 +0100 Subject: [PATCH 463/499] Add missing include --- .../volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c index d6245a127..92386cdcd 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_aarch64_cpuid.c @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include "cpu_features_macros.h" +#include #ifdef CPU_FEATURES_ARCH_AARCH64 #if (defined(CPU_FEATURES_OS_FREEBSD) || defined(CPU_FEATURES_OS_OPENBSD) || \ From 71aac10577065ce3bd8e6f45cf3d054ba05750ab Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 12:46:35 +0100 Subject: [PATCH 464/499] CI: pin volk_gnsssdr tests to Ubuntu 22.04 --- .github/workflows/volk_gnsssdr_archs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index d4fae37da..567dfb1e9 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -16,7 +16,7 @@ on: jobs: build-ubuntu-non-x86: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 name: ${{ matrix.distro }} ${{ matrix.arch }} ${{ matrix.compiler.name }} # Run steps on a matrix of archs. From 56692ca75bef2e367df5c43ef45b407c2e130abd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 14:20:38 +0100 Subject: [PATCH 465/499] Fix building with Clang >=18 and abseil --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c3a68f4da..fd1a87c03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1522,8 +1522,8 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.24 endif() endif() -# Workaround for Clang 18 -if(absl_FOUND AND absl_VERSION AND ("${absl_VERSION}" VERSION_LESS "20240722")) +# Workaround for Clang 18+ +if(absl_FOUND) if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.99")) add_compile_options(-fclang-abi-compat=17) endif() From 4ac58ccb004be62baf027bb8b670e76a944d6b5b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 24 Jan 2025 15:08:15 +0100 Subject: [PATCH 466/499] Fix ENABLE_OWN_ABSEIL when using clang --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd1a87c03..7347a78f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1523,7 +1523,7 @@ if(NOT CMAKE_VERSION VERSION_LESS 3.24 endif() # Workaround for Clang 18+ -if(absl_FOUND) +if(absl_FOUND AND NOT ENABLE_OWN_ABSEIL) if((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "17.99")) add_compile_options(-fclang-abi-compat=17) endif() From 810958822072436d70b945c36ed25448eb02a756 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 14:30:19 +0100 Subject: [PATCH 467/499] volk_gnsssdr: add RISC-V vector extension detection --- .../cmake/Checks/check-rvv-intrinsics.c | 13 +++++ .../volk_gnsssdr/gen/archs.xml | 47 +++++++++++++++++++ .../volk_gnsssdr/gen/archs_old.xml | 19 ++++++++ .../volk_gnsssdr/gen/machines.xml | 16 +++++++ .../volk_gnsssdr/lib/CMakeLists.txt | 19 ++++++++ .../volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.c | 2 +- 6 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Checks/check-rvv-intrinsics.c diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Checks/check-rvv-intrinsics.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Checks/check-rvv-intrinsics.c new file mode 100644 index 000000000..ba98fc574 --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Checks/check-rvv-intrinsics.c @@ -0,0 +1,13 @@ +/* + * GNSS-SDR is a Global Navigation Satellite System software-defined receiver. + * This file is part of GNSS-SDR. + * + * SPDX-FileCopyrightText: 2025 C. Fernandez-Prades cfernandez(at)cttc.es + * SPDX-License-Identifier: BSD-3-Clause + */ + +#if (__riscv_v_intrinsic >= 1000000 || __clang_major__ >= 18 || __GNUC__ >= 14) +int main() { return 0; } +#else +#error "rvv intrinsics aren't supported" +#endif diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs.xml b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs.xml index 35d33f174..b05e1057b 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs.xml +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs.xml @@ -175,4 +175,51 @@ 64 + + + + + tmpl/ currently assumes that every arch.name starting with "rv" requires + RVV intrinsics + + + There is currently no mechanism in RISC-V to append extensions, + so each arch needs to specify all of them, and the order needs in the + machine definition needs to be from the fewest to the most extensions. + Fortunately, this maps quite well to the profiles concept. + + + + -march=rv64gcv + -march=rv64gcv + + + + + -march=rv64gcv + -march=rv64gcv + + It's unclear how performance portable segmented load/stores are, so the + default rvv implementations avoid using them. + This is a pseudo arch for separate segmented load/store implementations, + and is expected to never be used standalone without "rvv". + + + + + google/cpu_features currently doesn't support these extensions and profiles. + + + + + diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs_old.xml b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs_old.xml index 13dcea3d4..f7f23f059 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs_old.xml +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/archs_old.xml @@ -293,4 +293,23 @@ 64 + + + + + -march=rv64gcv + -march=rv64gcv + + + + -march=rv64gcv + -march=rv64gcv + + It's unclear how performance portable segmented load/stores are, so the + default rvv implementations avoid using them. + This is a pseudo arch for separate segmented load/store implementations, + and is expected to never be used standalone without "rvv". + + + diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/machines.xml b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/machines.xml index 1c2917313..ee6bd3ea5 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/machines.xml +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/gen/machines.xml @@ -31,6 +31,22 @@ generic 32|64| mmx| sse sse2 sse3 ssse3 orc| + +generic riscv64 orc| + + + +generic riscv64 rvv rvvseg orc| + + + + + + generic 32|64| mmx| sse sse2 sse3 sse4_a popcount orc| diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 6296881d0..5ab23bf57 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -103,12 +103,27 @@ execute_process( OUTPUT_VARIABLE arch_flag_lines OUTPUT_STRIP_TRAILING_WHITESPACE ) +try_compile( + HAVE_RVV_INTRINSICS + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/cmake/Checks/check-rvv-intrinsics.c +) +if(HAVE_RVV_INTRINSICS) + message(STATUS "Checking RVV intrinsics - found") +else() + message(STATUS "Checking RVV intrinsics - not found") +endif() + macro(check_arch arch_name) set(flags ${ARGN}) set(have_${arch_name} TRUE) + string(SUBSTRING "${arch_name}" 0 2 arch_prefix) foreach(flag ${flags}) if(MSVC AND (${flag} STREQUAL "/arch:SSE2" OR ${flag} STREQUAL "/arch:SSE")) # SSE/SSE2 is supported in MSVC since VS 2005 but flag not available when compiling 64-bit so do not check + elseif("${arch_prefix}" STREQUAL "rv" AND NOT HAVE_RVV_INTRINSICS) + message(STATUS "Skipping ${arch_name} due to missing RVV intrinsics support") + set(have_${arch_name} FALSE) else() include(CheckCXXCompilerFlag) set(have_flag have${flag}) @@ -275,6 +290,10 @@ if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86) endif() endif() +if(NOT ${CMAKE_SYSTEM_PROCESSOR} MATCHES "^riscv64$") + overrule_arch(riscv64 "machine is not riscv64") +endif() + ######################################################################## # done overrules! print the result ######################################################################## diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.c index c089e8625..856364923 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr_cpu.tmpl.c @@ -61,7 +61,7 @@ static int i_can_has_${arch.name} (void) { #if defined(CPU_FEATURES_ARCH_S390X) if (GetS390XInfo().features.${check} == 0){ return 0; } #endif - %elif "riscv" in arch.name: + %elif "riscv" in arch.name or arch.name[:2] == "rv": #if defined(CPU_FEATURES_ARCH_RISCV) if (GetRiscvInfo().features.${check} == 0){ return 0; } #endif From 8adc2b26c2c4e3b45f8d840a195a23f1a16cd3d3 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 14:31:46 +0100 Subject: [PATCH 468/499] Avoid potential division by zero --- src/algorithms/PVT/libs/rtcm.cc | 37 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/algorithms/PVT/libs/rtcm.cc b/src/algorithms/PVT/libs/rtcm.cc index 57b90d5e9..37dd0d664 100644 --- a/src/algorithms/PVT/libs/rtcm.cc +++ b/src/algorithms/PVT/libs/rtcm.cc @@ -6006,32 +6006,37 @@ int32_t Rtcm::set_DF401(const Gnss_Synchro& gnss_synchro) { lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ; } - if ((sig == "2S") && (sys == "G")) + else if ((sig == "2S") && (sys == "G")) { lambda = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ; } - if ((sig == "5X") && (sys == "E")) + else if ((sig == "5X") && (sys == "E")) { lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5A_FREQ_HZ; } - if ((sig == "1B") && (sys == "E")) + else if ((sig == "1B") && (sys == "E")) { lambda = SPEED_OF_LIGHT_M_S / GALILEO_E1_FREQ_HZ; } - if ((sig == "7X") && (sys == "E")) + else if ((sig == "7X") && (sys == "E")) { lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5B_FREQ_HZ; } - if ((sig == "1C") && (sys == "R")) + else if ((sig == "1C") && (sys == "R")) { lambda = SPEED_OF_LIGHT_M_S / ((GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN)))); } - if ((sig == "2C") && (sys == "R")) + else if ((sig == "2C") && (sys == "R")) { // TODO Need to add slot number and freq number to gnss_syncro lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L2_CA_FREQ_HZ); } - + else + { + // should not happen + LOG(WARNING) << "Unknown signal in the generation of RTCM message DF401"; + lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ; + } double phrng_m = (gnss_synchro.Carrier_phase_rads / TWO_PI) * lambda - rough_range_m; /* Subtract phase - pseudorange integer cycle offset */ @@ -6182,31 +6187,37 @@ int32_t Rtcm::set_DF406(const Gnss_Synchro& gnss_synchro) { lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ; } - if ((sig_ == "2S") && (sys_ == "G")) + else if ((sig_ == "2S") && (sys_ == "G")) { lambda = SPEED_OF_LIGHT_M_S / GPS_L2_FREQ_HZ; } - if ((sig_ == "5X") && (sys_ == "E")) + else if ((sig_ == "5X") && (sys_ == "E")) { lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5A_FREQ_HZ; } - if ((sig_ == "1B") && (sys_ == "E")) + else if ((sig_ == "1B") && (sys_ == "E")) { lambda = SPEED_OF_LIGHT_M_S / GALILEO_E1_FREQ_HZ; } - if ((sig_ == "7X") && (sys_ == "E")) + else if ((sig_ == "7X") && (sys_ == "E")) { lambda = SPEED_OF_LIGHT_M_S / GALILEO_E5B_FREQ_HZ; } - if ((sig_ == "1C") && (sys_ == "R")) + else if ((sig_ == "1C") && (sys_ == "R")) { lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L1_CA_FREQ_HZ + (GLONASS_L1_CA_DFREQ_HZ * GLONASS_PRN.at(gnss_synchro.PRN))); } - if ((sig_ == "2C") && (sys_ == "R")) + else if ((sig_ == "2C") && (sys_ == "R")) { // TODO Need to add slot number and freq number to gnss syncro lambda = SPEED_OF_LIGHT_M_S / (GLONASS_L2_CA_FREQ_HZ); } + else + { + // should not happen + LOG(WARNING) << "Unknown signal in the generation of RTCM message DF406"; + lambda = SPEED_OF_LIGHT_M_S / GPS_L1_FREQ_HZ; + } phrng_m = (gnss_synchro.Carrier_phase_rads / TWO_PI) * lambda - rough_range_m; /* Subtract phase - pseudorange integer cycle offset */ From 003bb82765a48df092e0d660d74f4cfac58c4baa Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 14:56:52 +0100 Subject: [PATCH 469/499] Avoid potential division by zero --- .../gnuradio_blocks/hybrid_observables_gs.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc index 48a1b1c14..340c29fda 100644 --- a/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc +++ b/src/algorithms/observables/gnuradio_blocks/hybrid_observables_gs.cc @@ -612,7 +612,7 @@ void hybrid_observables_gs::set_tag_timestamp_in_sdr_timeframe(const std::vector // to an absolute GPS TOW samplestamp associated with the current set of pseudoranges if (!d_TimeChannelTagTimestamps.empty()) { - double fs = 0; + double fs = 0.0; std::vector::const_iterator it; for (it = data.begin(); it != data.end(); it++) { @@ -622,21 +622,24 @@ void hybrid_observables_gs::set_tag_timestamp_in_sdr_timeframe(const std::vector break; } } - + if (fs < 1.0) + { + return; + } double delta_rxtime_to_tag; GnssTime current_tag; do { current_tag = d_TimeChannelTagTimestamps.front(); delta_rxtime_to_tag = (static_cast(rx_clock) / fs) - current_tag.rx_time; // delta time relative to receiver's start time - if (delta_rxtime_to_tag >= 0) + if (delta_rxtime_to_tag >= 0.0) { d_TimeChannelTagTimestamps.pop(); } } - while (delta_rxtime_to_tag >= 0.1 and !d_TimeChannelTagTimestamps.empty()); + while (delta_rxtime_to_tag >= 0.1 && !d_TimeChannelTagTimestamps.empty()); - if (delta_rxtime_to_tag >= 0 and delta_rxtime_to_tag <= 0.1) + if (delta_rxtime_to_tag >= 0.0 && delta_rxtime_to_tag <= 0.1) { // std::cout << "[Time ch][" << delta_rxtime_to_tag // << "] OBS RX TimeTag Week: " << current_tag.week From e1fc5b49dff87c5ea46bd8b907f0f46513ecf83a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 15:19:44 +0100 Subject: [PATCH 470/499] Avoid potential division by zero --- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 21 +++++++++++++++++-- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 21 +++++++++++++++++-- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 21 +++++++++++++++++-- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 21 +++++++++++++++++-- 4 files changed, 76 insertions(+), 8 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 5a1eed229..9a4f3fc40 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -872,9 +873,25 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); + float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); + aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index c67786201..dcf986bd9 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -874,9 +875,25 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); + float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); + aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 5c433346e..48a5228bd 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -867,9 +868,25 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); + float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); + aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index 6c8b65c20..a16fb4581 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -871,9 +872,25 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - tmp_float = static_cast(1.0 / (d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S)); + float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); - tmp_float = static_cast(1.0 / (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S)); + aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); + if (std::fabs(aux) > std::numeric_limits::epsilon()) + { + tmp_float = 1.0 / aux; + } + else + { + tmp_float = 0.0; + } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // DLL commands tmp_float = static_cast(d_code_error_chips_Ti * CURRENT_INTEGRATION_TIME_S); From 19324814e2c71764637afeaa327cfaaaa75a9dbc Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 16:40:26 +0100 Subject: [PATCH 471/499] Avoid potential division by zero --- .../gnuradio_blocks/dll_pll_veml_tracking.cc | 5 ++- .../dll_pll_veml_tracking_fpga.cc | 5 ++- .../tracking/gnuradio_blocks/kf_tracking.cc | 16 +++++-- .../tracking/libs/lock_detectors.cc | 45 +++++++++++++++++-- 4 files changed, 62 insertions(+), 9 deletions(-) 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 803d1e7c6..1f87fcc8d 100644 --- a/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/dll_pll_veml_tracking.cc @@ -1256,7 +1256,10 @@ void dll_pll_veml_tracking::update_tracking_vars() } tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); - d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples; + if (tmp_samples >= 1.0) + { + d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples; + } } } // remnant code phase [chips] 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 96b28be18..275892172 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 @@ -879,7 +879,10 @@ void dll_pll_veml_tracking_fpga::update_tracking_vars() } tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); - d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples; + if (tmp_samples >= 1.0) + { + d_code_phase_rate_step_chips = (tmp_cp2 - tmp_cp1) / tmp_samples; + } } } // remnant code phase [chips] diff --git a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc index 838dbab85..27a264096 100644 --- a/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc +++ b/src/algorithms/tracking/gnuradio_blocks/kf_tracking.cc @@ -453,9 +453,14 @@ kf_tracking::kf_tracking(const Kf_Conf &conf_) d_code_samples_per_chip = 0U; d_symbols_per_bit = 0; } - - d_beta = d_code_chip_rate / d_signal_carrier_freq; - + if (d_signal_carrier_freq > 1.0) + { + d_beta = d_code_chip_rate / d_signal_carrier_freq; + } + else + { + d_beta = 0.0; + } // Initialization of local code replica // Get space for a vector with the sinboc(1,1) replica sampled 2x/chip d_tracking_code.resize(2 * d_code_length_chips, 0.0); @@ -1280,7 +1285,10 @@ void kf_tracking::update_tracking_vars() } tmp_cp1 /= static_cast(d_trk_parameters.smoother_length); tmp_cp2 /= static_cast(d_trk_parameters.smoother_length); - d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples; + if (tmp_samples >= 1.0) + { + d_carrier_phase_rate_step_rad = (tmp_cp2 - tmp_cp1) / tmp_samples; + } d_x_old_old(3) = d_carrier_phase_rate_step_rad * d_trk_parameters.fs_in / TWO_PI; } } diff --git a/src/algorithms/tracking/libs/lock_detectors.cc b/src/algorithms/tracking/libs/lock_detectors.cc index 7fa08690b..1fc080abe 100644 --- a/src/algorithms/tracking/libs/lock_detectors.cc +++ b/src/algorithms/tracking/libs/lock_detectors.cc @@ -34,6 +34,7 @@ #include "lock_detectors.h" #include +#include /* * Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator: @@ -57,6 +58,11 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i float SNR_dB_Hz = 0.0; float Psig = 0.0; float Ptot = 0.0; + const float epsilon = std::numeric_limits::epsilon(); + if (length == 0 || coh_integration_time_s <= epsilon) + { + return -100.0; + } for (int i = 0; i < length; i++) { Psig += std::abs(Prompt_buffer[i].real()); @@ -65,7 +71,15 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i Psig /= static_cast(length); Psig = Psig * Psig; Ptot /= static_cast(length); - SNR = Psig / (Ptot - Psig); + float aux = Ptot - Psig; + if (aux > epsilon) + { + SNR = Psig / aux; + } + else + { + return -100.0; + } SNR_dB_Hz = 10.0F * std::log10(SNR) - 10.0F * std::log10(coh_integration_time_s); return SNR_dB_Hz; } @@ -96,6 +110,11 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ float m_4 = 0.0; float aux; const auto n = static_cast(length); + const float epsilon = std::numeric_limits::epsilon(); + if (length == 0 || coh_integration_time_s <= epsilon) + { + return -100.0; + } for (int i = 0; i < length; i++) { Psig += std::abs(Prompt_buffer[i].real()); @@ -108,13 +127,29 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ m_2 /= n; m_4 /= n; aux = std::sqrt(2.0F * m_2 * m_2 - m_4); + float denominator; if (std::isnan(aux)) { - SNR_aux = Psig / (m_2 - Psig); + denominator = m_2 - Psig; + if (std::abs(denominator) <= epsilon) + { + return -100.0; + } + SNR_aux = Psig / denominator; } else { - SNR_aux = aux / (m_2 - aux); + denominator = m_2 - aux; + if (std::abs(denominator) <= epsilon) + { + return -100.0; + } + SNR_aux = aux / denominator; + } + + if (SNR_aux <= epsilon) + { + return -100.0; } SNR_dB_Hz = 10.0F * std::log10(SNR_aux) - 10.0F * std::log10(coh_integration_time_s); @@ -144,5 +179,9 @@ float carrier_lock_detector(const gr_complex* Prompt_buffer, int length) } NBP = tmp_sum_I * tmp_sum_I + tmp_sum_Q * tmp_sum_Q; NBD = tmp_sum_I * tmp_sum_I - tmp_sum_Q * tmp_sum_Q; + if (NBP < std::numeric_limits::epsilon()) + { + return 0.0; + } return NBD / NBP; } From 5f1eea4d08e8fd3ba9c0653db78f68b11e527c08 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 16:53:37 +0100 Subject: [PATCH 472/499] Avoid potential division by zero --- .../acquisition/gnuradio_blocks/pcps_acquisition.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc index 569319d1c..231d3ee18 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition.cc @@ -37,6 +37,7 @@ #include #include // for floor, fmod, rint, ceil #include +#include #include #if USE_GLOG_AND_GFLAGS @@ -529,7 +530,10 @@ float pcps_acquisition::max_to_input_power_statistic(uint32_t& indext, int32_t& { doppler = static_cast(d_doppler_center_step_two + (static_cast(index_doppler) - static_cast(floor(d_num_doppler_bins_step2 / 2.0))) * d_acq_parameters.doppler_step2); } - + if (d_input_power < std::numeric_limits::epsilon()) + { + return 0.0; + } return grid_maximum / d_input_power; } From 777a987b5f59c73143921e735165e1dcbb4f2c4f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 27 Jan 2025 18:14:05 +0100 Subject: [PATCH 473/499] Make clang-tidy happy --- .../gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- .../gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- .../gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 2 +- .../gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index 9a4f3fc40..acc3f4561 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -873,7 +873,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); if (std::fabs(aux) > std::numeric_limits::epsilon()) { tmp_float = 1.0 / aux; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index dcf986bd9..9f0eec285 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -875,7 +875,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); if (std::fabs(aux) > std::numeric_limits::epsilon()) { tmp_float = 1.0 / aux; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 48a5228bd..139d97a8b 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -868,7 +868,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); if (std::fabs(aux) > std::numeric_limits::epsilon()) { tmp_float = 1.0 / aux; diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index a16fb4581..5d09ca933 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -872,7 +872,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at tmp_float = static_cast(d_code_freq_chips); d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands - float aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); + auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); if (std::fabs(aux) > std::numeric_limits::epsilon()) { tmp_float = 1.0 / aux; From 11a77ee9183ff9a659c242b0aaea46adf00f0c97 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 29 Jan 2025 00:00:07 +0100 Subject: [PATCH 474/499] Improve zero detection --- src/algorithms/tracking/libs/lock_detectors.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/algorithms/tracking/libs/lock_detectors.cc b/src/algorithms/tracking/libs/lock_detectors.cc index 1fc080abe..b82420ae8 100644 --- a/src/algorithms/tracking/libs/lock_detectors.cc +++ b/src/algorithms/tracking/libs/lock_detectors.cc @@ -59,13 +59,13 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i float Psig = 0.0; float Ptot = 0.0; const float epsilon = std::numeric_limits::epsilon(); - if (length == 0 || coh_integration_time_s <= epsilon) + if (length == 0 || coh_integration_time_s < epsilon) { return -100.0; } for (int i = 0; i < length; i++) { - Psig += std::abs(Prompt_buffer[i].real()); + Psig += std::fabs(Prompt_buffer[i].real()); Ptot += Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real(); } Psig /= static_cast(length); @@ -117,7 +117,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ } for (int i = 0; i < length; i++) { - Psig += std::abs(Prompt_buffer[i].real()); + Psig += std::fabs(Prompt_buffer[i].real()); aux = Prompt_buffer[i].imag() * Prompt_buffer[i].imag() + Prompt_buffer[i].real() * Prompt_buffer[i].real(); m_2 += aux; m_4 += (aux * aux); @@ -131,7 +131,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ if (std::isnan(aux)) { denominator = m_2 - Psig; - if (std::abs(denominator) <= epsilon) + if (std::fabs(denominator) < epsilon) { return -100.0; } @@ -140,14 +140,14 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ else { denominator = m_2 - aux; - if (std::abs(denominator) <= epsilon) + if (std::fabs(denominator) < epsilon) { return -100.0; } SNR_aux = aux / denominator; } - if (SNR_aux <= epsilon) + if (std::fabs(SNR_aux) < epsilon) { return -100.0; } From 8e4dcd08bec1848dbf3574c8c01b7af19ce1f638 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 8 Feb 2025 09:03:52 +0100 Subject: [PATCH 475/499] Make lighter comparisons --- ...glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc | 5 ++--- ...glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc | 5 ++--- ...glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc | 5 ++--- ...glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc | 5 ++--- .../tracking/libs/lock_detectors.cc | 22 +++++++------------ 5 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc index acc3f4561..1e7b6adad 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_cc.cc @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include @@ -874,7 +873,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } @@ -884,7 +883,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc index 9f0eec285..ab4a59b65 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l1_ca_dll_pll_c_aid_tracking_sc.cc @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include @@ -876,7 +875,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } @@ -886,7 +885,7 @@ int glonass_l1_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc index 139d97a8b..dcc2de0da 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_cc.cc @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -869,7 +868,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } @@ -879,7 +878,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_cc::general_work(int noutput_items __at } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } diff --git a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc index 5d09ca933..7592e3918 100644 --- a/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc +++ b/src/algorithms/tracking/gnuradio_blocks/glonass_l2_ca_dll_pll_c_aid_tracking_sc.cc @@ -36,7 +36,6 @@ #include #include #include -#include #include #include #include @@ -873,7 +872,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); // PLL commands auto aux = static_cast(d_carr_phase_error_secs_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } @@ -883,7 +882,7 @@ int glonass_l2_ca_dll_pll_c_aid_tracking_sc::general_work(int noutput_items __at } d_dump_file.write(reinterpret_cast(&tmp_float), sizeof(float)); aux = (d_code_error_filt_chips_Ti * CURRENT_INTEGRATION_TIME_S); - if (std::fabs(aux) > std::numeric_limits::epsilon()) + if (aux != 0.0) { tmp_float = 1.0 / aux; } diff --git a/src/algorithms/tracking/libs/lock_detectors.cc b/src/algorithms/tracking/libs/lock_detectors.cc index b82420ae8..0399ea531 100644 --- a/src/algorithms/tracking/libs/lock_detectors.cc +++ b/src/algorithms/tracking/libs/lock_detectors.cc @@ -34,7 +34,6 @@ #include "lock_detectors.h" #include -#include /* * Signal-to-Noise (SNR) (\f$\rho\f$) estimator using the Signal-to-Noise Variance (SNV) estimator: @@ -58,8 +57,7 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i float SNR_dB_Hz = 0.0; float Psig = 0.0; float Ptot = 0.0; - const float epsilon = std::numeric_limits::epsilon(); - if (length == 0 || coh_integration_time_s < epsilon) + if (length == 0 || coh_integration_time_s == 0.0) { return -100.0; } @@ -72,14 +70,11 @@ float cn0_svn_estimator(const gr_complex* Prompt_buffer, int length, float coh_i Psig = Psig * Psig; Ptot /= static_cast(length); float aux = Ptot - Psig; - if (aux > epsilon) - { - SNR = Psig / aux; - } - else + if (aux == 0.0) { return -100.0; } + SNR = Psig / aux; SNR_dB_Hz = 10.0F * std::log10(SNR) - 10.0F * std::log10(coh_integration_time_s); return SNR_dB_Hz; } @@ -110,8 +105,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ float m_4 = 0.0; float aux; const auto n = static_cast(length); - const float epsilon = std::numeric_limits::epsilon(); - if (length == 0 || coh_integration_time_s <= epsilon) + if (length == 0 || coh_integration_time_s == 0.0) { return -100.0; } @@ -131,7 +125,7 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ if (std::isnan(aux)) { denominator = m_2 - Psig; - if (std::fabs(denominator) < epsilon) + if (denominator == 0) { return -100.0; } @@ -140,14 +134,14 @@ float cn0_m2m4_estimator(const gr_complex* Prompt_buffer, int length, float coh_ else { denominator = m_2 - aux; - if (std::fabs(denominator) < epsilon) + if (denominator == 0) { return -100.0; } SNR_aux = aux / denominator; } - if (std::fabs(SNR_aux) < epsilon) + if (SNR_aux == 0) { return -100.0; } @@ -179,7 +173,7 @@ float carrier_lock_detector(const gr_complex* Prompt_buffer, int length) } NBP = tmp_sum_I * tmp_sum_I + tmp_sum_Q * tmp_sum_Q; NBD = tmp_sum_I * tmp_sum_I - tmp_sum_Q * tmp_sum_Q; - if (NBP < std::numeric_limits::epsilon()) + if (NBP == 0) { return 0.0; } From 00e5b2b4ec36a5d39586b8248bd1d2d72793f9a1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 8 Feb 2025 09:07:04 +0100 Subject: [PATCH 476/499] Bump Googletest to 1.16.0 --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7347a78f1..f333a5231 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2010-2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2010-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause ################################################################################ @@ -362,7 +362,7 @@ set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.3") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.15") -set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") +set(GNSSSDR_GTEST_LOCAL_VERSION "1.16.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.1") @@ -404,6 +404,9 @@ if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13" OR set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "21.12") endif() +if(CMAKE_VERSION VERSION_LESS "3.16") + set(GNSSSDR_GTEST_LOCAL_VERSION "1.15.2") +endif() if(CMAKE_VERSION VERSION_LESS "3.13" OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3.1) OR (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)) @@ -756,9 +759,7 @@ if(NOT BOOST_ROOT) # Workaround for Macports if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${DETECT_MACPORTS} EQUAL 0) - if(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.81") - set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.81") - elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.76") + if(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.76") set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.76") elseif(EXISTS "${MACPORTS_PREFIX}/libexec/boost/1.71") set(BOOST_ROOT "${MACPORTS_PREFIX}/libexec/boost/1.71") From 3355f810c6feb45982c69ec951025ca52e98759c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 8 Feb 2025 09:13:58 +0100 Subject: [PATCH 477/499] Update README.md file --- README.md | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9e376a52e..98321b9f9 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ SPDX-License-Identifier: GPL-3.0-or-later ) [comment]: # ( -SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades +SPDX-FileCopyrightText: 2011-2025 Carles Fernandez-Prades ) @@ -386,9 +386,9 @@ $ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/Linux $ sudo yum install lapack-devel blas-devel # For Fedora/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux -$ wget https://sourceforge.net/projects/arma/files/armadillo-14.0.0.tar.xz -$ tar xvfz armadillo-14.0.0.tar.xz -$ cd armadillo-14.0.0 +$ wget https://sourceforge.net/projects/arma/files/armadillo-14.2.3.tar.xz +$ tar xvfz armadillo-14.2.3.tar.xz +$ cd armadillo-14.2.3 $ cmake . $ make $ sudo make install @@ -446,9 +446,9 @@ $ sudo pacman -S openssl # For Arch Linux #### Install [Matio](https://github.com/tbeu/matio "Matio's Homepage"), MATLAB MAT file I/O library ``` -$ wget https://github.com/tbeu/matio/releases/download/v1.5.26/matio-1.5.27.tar.gz -$ tar xvfz matio-1.5.27.tar.gz -$ cd matio-1.5.27 +$ wget https://github.com/tbeu/matio/releases/download/v1.5.28/matio-1.5.28.tar.gz +$ tar xvfz matio-1.5.28.tar.gz +$ cd matio-1.5.28 $ ./configure $ make $ sudo make install @@ -475,9 +475,9 @@ For more options, please check the #### Install [Pugixml](https://pugixml.org/ "Pugixml's Homepage"), a light-weight C++ XML processing library ``` -$ wget https://github.com/zeux/pugixml/releases/download/v1.14/pugixml-1.14.tar.gz -$ tar xvfz pugixml-1.14.tar.gz -$ cd pugixml-1.14 +$ wget https://github.com/zeux/pugixml/releases/download/v1.14/pugixml-1.15.tar.gz +$ tar xvfz pugixml-1.15.tar.gz +$ cd pugixml-1.15 $ mkdir build && cd build $ cmake .. $ make @@ -488,8 +488,8 @@ $ sudo ldconfig #### Download [GoogleTest](https://github.com/google/googletest "Googletest Homepage") ``` -$ wget https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip -$ unzip v1.15.2.zip +$ wget https://github.com/google/googletest/archive/refs/tags/v1.16.0.zip +$ unzip v1.16.0.zip ``` Please **DO NOT build or install** Google Test. Every user needs to compile @@ -513,10 +513,10 @@ downloaded resides. Just type in your terminal (or add it to your `$HOME/.bashrc` file for a permanent solution) the following line: ``` -export GTEST_DIR=/home/username/googletest-1.15.2 +export GTEST_DIR=/home/username/googletest-1.16.0 ``` -changing `/home/username/googletest-1.15.2` by the actual path where you +changing `/home/username/googletest-1.16.0` by the actual path where you unpacked Google Test. If the CMake script does not find that folder, or the environment variable is not defined, or the source code is not installed by a package, then it will download a fresh copy of the Google Test source code and @@ -793,7 +793,7 @@ $ sudo port upgrade outdated $ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml openssl3 $ sudo port install gnuradio +uhd +grc +zeromq $ sudo port install boost matio libad9361-iio libiio -$ sudo port install py311-mako +$ sudo port install py313-mako $ sudo port install doxygen +docs ``` @@ -813,7 +813,7 @@ $ port select --list python and you can activate a certain version by typing: ``` -$ sudo port select --set python python311 +$ sudo port select --set python python313 ``` ### Homebrew From a9688ddad54dac38dcc6880d606263133a8dc979 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 8 Feb 2025 09:28:34 +0100 Subject: [PATCH 478/499] CI: Fix clang-tidy job --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e98da271c..613d7fde2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -155,7 +155,7 @@ jobs: ln -s $(brew --prefix llvm)/bin/clang-apply-replacements /usr/local/bin ln -s $(brew --prefix llvm)/bin/run-clang-tidy.py /usr/local/bin - name: Prepare run - run: cmake -S . -B build && cmake --build build --target volk_gnsssdr_module gtest-1.15.2 core_monitor core_libs pvt_libs + run: cmake -S . -B build && cmake --build build --target volk_gnsssdr_module gtest-1.16.0 core_monitor core_libs pvt_libs - name: run clang-tidy run: cd build && /opt/homebrew/opt/llvm/bin/run-clang-tidy -fix - name: check From 32e7dc03aeaa877168d73da6813d206c8c600971 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 10 Feb 2025 13:20:14 +0100 Subject: [PATCH 479/499] Fix typos detected by codespell --- ...tichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf | 2 +- .../Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf | 2 +- ...channel_all_in_one_Flexiband_bin_file_III_1b.conf | 2 +- conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf | 2 +- conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf | 2 +- docs/CHANGELOG.md | 10 +++++----- docs/doxygen/other/main_page.dox | 6 +++--- src/algorithms/PVT/libs/monitor_pvt.h | 2 +- src/algorithms/PVT/libs/rtklib_solver.cc | 4 ++-- ...alileo_e1_pcps_quicksync_ambiguous_acquisition.cc | 2 +- .../adapters/gps_l2_m_pcps_acquisition_fpga.cc | 2 +- .../pcps_acquisition_fine_doppler_cc.cc | 2 +- .../gnuradio_blocks/pcps_assisted_acquisition_cc.cc | 2 +- .../gnuradio_blocks/pcps_quicksync_acquisition_cc.cc | 2 +- .../conditioner/adapters/signal_conditioner.cc | 6 +++--- .../data_type_adapter/adapters/byte_to_short.h | 2 +- .../data_type_adapter/adapters/cshort_to_grcomplex.h | 2 +- .../input_filter/gnuradio_blocks/notch_cc.cc | 2 +- src/algorithms/libs/rtklib/rtklib.h | 6 +++--- src/algorithms/libs/rtklib/rtklib_rtcm3.cc | 2 +- src/algorithms/libs/rtklib/rtklib_rtkcmn.cc | 8 ++++---- src/algorithms/libs/rtklib/rtklib_rtkcmn.h | 4 ++-- src/algorithms/libs/rtklib/rtklib_rtkpos.cc | 2 +- src/algorithms/libs/rtklib/rtklib_sbas.cc | 2 +- src/algorithms/libs/rtklib/rtklib_sbas.h | 2 +- src/algorithms/libs/rtklib/rtklib_solution.cc | 2 +- src/algorithms/libs/rtklib/rtklib_stream.cc | 2 +- src/algorithms/libs/rtklib/rtklib_tides.cc | 12 ++++++------ .../volk_gnsssdr/cpu_features/CMakeLists.txt | 2 +- .../volk_gnsssdr/cpu_features/include/cpuinfo_ppc.h | 4 ++-- .../volk_gnsssdr/cpu_features/include/cpuinfo_x86.h | 2 +- .../cpu_features/ndk_compat/cpu-features.h | 2 +- .../volk_gnsssdr/cpu_features/src/impl_ppc_linux.c | 2 +- .../cpu_features/test/cpuinfo_mips_test.cc | 2 +- .../volk_gnsssdr/lib/volk_gnsssdr_malloc.c | 2 +- .../direct_resampler_conditioner_cc.h | 2 +- .../signal_source/adapters/fifo_signal_source.cc | 2 +- .../signal_source/adapters/fmcomms2_signal_source.h | 2 +- .../signal_source/adapters/plutosdr_signal_source.h | 2 +- .../gnuradio_blocks/rtl_tcp_signal_source_c.cc | 2 +- .../gnuradio_blocks/rtl_tcp_signal_source_c.h | 2 +- .../signal_source/libs/fpga_dynamic_bit_selection.cc | 2 +- .../signal_source/libs/ion_gsms_chunk_data.cc | 2 +- src/algorithms/signal_source/libs/pps_samplestamp.h | 2 +- .../adapters/gps_l1_ca_telemetry_decoder.h | 2 +- .../gnuradio_blocks/galileo_telemetry_decoder_gs.cc | 4 ++-- .../adapters/galileo_e5a_dll_pll_tracking_fpga.cc | 2 +- src/algorithms/tracking/libs/bayesian_estimation.h | 2 +- src/core/libs/gnss_crypto.cc | 8 ++++---- src/core/libs/osnma_msg_receiver.cc | 4 ++-- src/core/receiver/gnss_flowgraph.cc | 4 ++-- src/core/receiver/gnss_flowgraph.h | 2 +- src/core/system_parameters/GPS_CNAV.h | 2 +- src/core/system_parameters/Galileo_CNAV.h | 4 ++-- src/core/system_parameters/Galileo_FNAV.h | 2 +- src/core/system_parameters/Galileo_INAV.h | 4 ++-- src/core/system_parameters/Galileo_OSNMA.h | 4 ++-- src/core/system_parameters/galileo_has_data.h | 2 +- src/core/system_parameters/galileo_inav_message.cc | 2 +- .../glonass_gnav_navigation_message.cc | 2 +- .../system_parameters/gps_cnav_navigation_message.cc | 4 ++-- src/core/system_parameters/gps_navigation_message.h | 2 +- src/core/system_parameters/reed_solomon.h | 2 +- src/main/main.cc | 2 +- .../acquisition/acq_performance_test.cc | 2 +- .../acquisition/beidou_b1i_pcps_acquisition_test.cc | 2 +- .../acquisition/beidou_b3i_pcps_acquisition_test.cc | 2 +- ...1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc | 2 +- ...eo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc | 2 +- ...alileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc | 2 +- .../galileo_e1_pcps_ambiguous_acquisition_test.cc | 2 +- ...cps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc | 2 +- ..._quicksync_ambiguous_acquisition_gsoc2014_test.cc | 2 +- ..._pcps_tong_ambiguous_acquisition_gsoc2013_test.cc | 2 +- ...o_e5a_pcps_acquisition_gsoc2014_gensource_test.cc | 2 +- .../acquisition/galileo_e5b_pcps_acquisition_test.cc | 2 +- .../acquisition/galileo_e6_pcps_acquisition_test.cc | 2 +- .../glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc | 2 +- .../glonass_l1_ca_pcps_acquisition_test.cc | 2 +- .../glonass_l2_ca_pcps_acquisition_test.cc | 2 +- .../gps_l1_ca_pcps_acquisition_gsoc2013_test.cc | 2 +- .../acquisition/gps_l1_ca_pcps_acquisition_test.cc | 2 +- ...ps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc | 2 +- ...l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc | 2 +- .../gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc | 2 +- .../acquisition/gps_l2_m_pcps_acquisition_test.cc | 2 +- .../libs/acquisition_msg_rx.h | 2 +- .../observables/hybrid_observables_test.cc | 4 ++-- .../gps_l1_ca_telemetry_decoder_test.cc | 4 ++-- .../tracking/cpu_multicorrelator_real_codes_test.cc | 4 ++-- .../tracking/cpu_multicorrelator_test.cc | 4 ++-- .../glonass_l1_ca_dll_pll_c_aid_tracking_test.cc | 2 +- .../tracking/glonass_l1_ca_dll_pll_tracking_test.cc | 2 +- .../tracking/gps_l1_ca_dll_pll_tracking_test.cc | 2 +- .../tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc | 2 +- .../tracking/gps_l1_ca_gaussian_tracking_test.cc | 2 +- .../tracking/gps_l2_m_dll_pll_tracking_test.cc | 2 +- .../tracking/gpu_multicorrelator_test.cc | 2 +- .../tracking/tracking_pull-in_test.cc | 2 +- .../tracking/tracking_pull-in_test_fpga.cc | 2 +- .../system-parameters/has_decoding_test.cc | 2 +- utils/front-end-cal/main.cc | 2 +- utils/matlab/libs/geoFunctions/satpos.m | 2 +- utils/nav-listener/nav_msg_udp_listener.cc | 2 +- utils/rinex2assist/README.md | 2 +- 105 files changed, 140 insertions(+), 140 deletions(-) diff --git a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf index 7b5609ada..4017609f5 100644 --- a/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/GPS/gnss-sdr_multichannel_GPS_L2_M_Flexiband_bin_file_III_1b.conf @@ -271,7 +271,7 @@ Acquisition_5X.doppler_max=5000 Acquisition_5X.doppler_step=125 Acquisition_5X.bit_transition_flag=false Acquisition_5X.max_dwells=1 -Acquisition_5X.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 +Acquisition_5X.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 Acquisition_5X.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. Acquisition_5X.dump=false Acquisition_5X.dump_filename=./acq_dump.dat diff --git a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf index 75dd5981a..a6fb901ed 100644 --- a/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf +++ b/conf/File_input/Galileo/gnss-sdr_Galileo_E5a_IFEN_CTTC.conf @@ -111,7 +111,7 @@ Acquisition_5X.doppler_max=10000 Acquisition_5X.doppler_step=250 Acquisition_5X.bit_transition_flag=false Acquisition_5X.max_dwells=1 -Acquisition_5X.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 +Acquisition_5X.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 Acquisition_5X.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. Acquisition_5X.dump=false Acquisition_5X.dump_filename=./acq_dump.dat diff --git a/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf index ebff509e6..14e813a27 100644 --- a/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf +++ b/conf/File_input/MultiCons/gnss-sdr_multichannel_all_in_one_Flexiband_bin_file_III_1b.conf @@ -266,7 +266,7 @@ Acquisition_5X.doppler_max=5000 Acquisition_5X.doppler_step=125 Acquisition_5X.bit_transition_flag=false Acquisition_5X.max_dwells=1 -Acquisition_5X.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 +Acquisition_5X.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 Acquisition_5X.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. Acquisition_5X.dump=false Acquisition_5X.dump_filename=./acq_dump.dat diff --git a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf index ef553d655..423bd7358 100644 --- a/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf +++ b/conf/Nsr_input/gnss-sdr_GPS_L1_nsr_gauss.conf @@ -77,7 +77,7 @@ InputFilter.dump_filename=./input_filter.dat ;#The following options are used in the filter design of Fir_Filter and Freq_Xlating_Fir_Filter implementation. ;#These options are based on parameters of gnuradio's function: gr_remez. ;#These function calculates the optimal (in the Chebyshev/minimax sense) FIR filter inpulse -;#reponse given a set of band edges, the desired reponse on those bands, +;#response given a set of band edges, the desired response on those bands, ;#and the weight given to the error in those bands. ;#input_item_type: Type and resolution for input signal samples. Use only gr_complex in this version. diff --git a/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf index 699640977..0e46e98b2 100644 --- a/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf +++ b/conf/Other/gnss-sdr_GPS_L1_nsr_twobit_packed.conf @@ -40,7 +40,7 @@ SignalSource.item_type=byte ; endian. If it is big endian then the second byte should be output ; first in each short. ; SignalSource.big_endian_items=false -; big_endian_bytes: true if the most signficiant two bits in the byte +; big_endian_bytes: true if the most significant two bits in the byte ; are the first two to be output. SignalSource.big_endian_bytes=false ; sample_type: one of 'real' 'iq' or 'qi' diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 6eb22c242..34896899e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -219,7 +219,7 @@ https://gnss-sdr.org/design-forces/ user pressing Ctrl+C, or another user application sending an interruption signal). - The estimated CN0 value is now printed in the terminal when navigation data is - succesfully decoded. + successfully decoded. - Fixed GPS navigation message satellite validation. - Latitude and longitude are now reported in the terminal with six decimal places (the sixth decimal place worths up to 0.11 m), instead of the @@ -303,22 +303,22 @@ https://gnss-sdr.org/design-forces/ - Fixed linking against libunwind when the glog library is built locally. - The configuration options at building time `-DENABLE_OWN_GLOG`, `-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON` - and `OFF` without the need to start from an empty buiding folder. + and `OFF` without the need to start from an empty building folder. - Improved CMake handling of the spdlog library used by GNU Radio >= 3.10. - Make use of the C++20 standard if the environment allows for it. - Improved passing of compiler flags to `volk_gnsssdr` if the corresponding environment variables are defined. This fixes warnings in some packaging systems. - Improved support for the RISC-V architecture. -- Test files are now donwloaded at configuration time instead of being included +- Test files are now downloaded at configuration time instead of being included in the source tree. This allows for a smaller package and fixes Lintian `very-long-line-length-in-source-file` warnings since those files were not recognized as binaries. The configuration flag `-DENABLE_PACKAGING=ON` passed to CMake deactivates file downloading. - The `ENABLE_GENERIC_ARCH` building option was removed, simplifying the process - of buiding the software in non-x86 processor architectures. + of building the software in non-x86 processor architectures. - If the Protocol Buffers dependency is not found, it is downloaded, built and - statically linked at buiding time. If CMake >= 3.13 and the + statically linked at building time. If CMake >= 3.13 and the [Abseil C++ libraries](https://github.com/abseil/abseil-cpp) >= 20230117 are installed on your system, Protocol Buffers v22.2 will be used. If those requirements are not met, Protocol Buffers v21.4 will be used instead diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index cdb5774ba..b9c16742a 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -154,7 +154,7 @@ $ make doc from the building folder. In both cases, Doxygen will generate HTML documentation that can be retrieved pointing your browser of preference to gnss-sdr/docs/html/index.html. -There are two more extra targets available. In the buiding folder: +There are two more extra targets available. In the building folder: \verbatim $ make doc-clean \endverbatim @@ -186,7 +186,7 @@ If you checked out GNSS-SDR some days ago, it is possible that some developer ha $ git checkout next $ git pull https://github.com/gnss-sdr/gnss-sdr next \endverbatim -Before rebuiling the source code, it is safe (and recommended) to remove the remainders of old builds: +Before rebuilding the source code, it is safe (and recommended) to remove the remainders of old builds: \verbatim $ cd $ sudo make uninstall ; if you installed it before @@ -633,7 +633,7 @@ More papers related to GNSS-SDR are available at the gnss-sdr/install folder, running ./gnss-sdr, and see how the file is processed. Please ask the Developer Team for a signal sample if you need one, and they will do their best ;-) diff --git a/src/algorithms/PVT/libs/monitor_pvt.h b/src/algorithms/PVT/libs/monitor_pvt.h index e70f681de..863d8c004 100644 --- a/src/algorithms/PVT/libs/monitor_pvt.h +++ b/src/algorithms/PVT/libs/monitor_pvt.h @@ -72,7 +72,7 @@ public: // Course Over Ground (COG) [deg] double cog; - // Galileo HAS status: 1- HAS messages decoded and applied, 0 - HAS not avaliable + // Galileo HAS status: 1- HAS messages decoded and applied, 0 - HAS not available uint32_t galhas_status; // NUMBER OF VALID SATS diff --git a/src/algorithms/PVT/libs/rtklib_solver.cc b/src/algorithms/PVT/libs/rtklib_solver.cc index 433819649..08dcaa2ec 100644 --- a/src/algorithms/PVT/libs/rtklib_solver.cc +++ b/src/algorithms/PVT/libs/rtklib_solver.cc @@ -1606,7 +1606,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ ecef2pos(pvt_sol.rr, pos.data()); ecef2enu(pos.data(), &pvt_sol.rr[3], enuv.data()); this->set_speed_over_ground(norm_rtk(enuv.data(), 2)); - double new_cog = -9999.0; // COG not estimated due to insuficient velocity + double new_cog = -9999.0; // COG not estimated due to insufficient velocity if (ground_speed_ms >= 1.0) { new_cog = atan2(enuv[0], enuv[1]) * R2D; @@ -1696,7 +1696,7 @@ bool Rtklib_Solver::get_PVT(const std::map &gnss_observables_ // Course Over Ground (cog) [deg] d_monitor_pvt.cog = new_cog; - // Galileo HAS status: 1- HAS messages decoded and applied, 0 - HAS not avaliable + // Galileo HAS status: 1- HAS messages decoded and applied, 0 - HAS not available if (d_has_obs_corr_map.empty()) { d_monitor_pvt.galhas_status = 0; diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc index 16a13e02d..0e207b800 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_quicksync_ambiguous_acquisition.cc @@ -84,7 +84,7 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::GalileoE1PcpsQuickSyncAmbiguousAcqui DLOG(INFO) << "role " << role; /*Calculate the folding factor value based on the formula described in the paper. This may be a bug, but acquisition also work by variying the folding factor at va- - lues different that the expressed in the paper. In adition, it is important to point + lues different that the expressed in the paper. In addition, it is important to point out that by making the folding factor smaller we were able to get QuickSync work with Galileo. Future work should be directed to test this assumption statistically.*/ diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 5d7662c59..79a652358 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -227,7 +227,7 @@ void GpsL2MPcpsAcquisitionFpga::disconnect(gr::top_block_sptr top_block) if (top_block) { /* top_block is not null */ }; - // Nothing to diconnect + // Nothing to disconnect } 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 e51f9711b..0efa83fa7 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 @@ -466,7 +466,7 @@ int pcps_acquisition_fine_doppler_cc::general_work(int noutput_items, * TODO: High sensitivity acquisition algorithm: * State Machine: * S0. StandBy. If d_active==1 -> S1 - * S1. ComputeGrid. Perform the FFT acqusition doppler and delay grid. + * S1. ComputeGrid. Perform the FFT acquisition doppler and delay grid. * Accumulate the search grid matrix (#doppler_bins x #fft_size) * Compare maximum to threshold and decide positive or negative * If T>=gamma -> S4 else 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 91ce7b3d0..c6957957e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_assisted_acquisition_cc.cc @@ -338,7 +338,7 @@ int pcps_assisted_acquisition_cc::general_work(int noutput_items, * State Machine: * S0. StandBy. If d_active==1 -> S1 * S1. GetAssist. Define search grid with assistance information. Reset grid matrix -> S2 - * S2. ComputeGrid. Perform the FFT acqusition doppler and delay grid. + * S2. ComputeGrid. Perform the FFT acquisition doppler and delay grid. * Accumulate the search grid matrix (#doppler_bins x #fft_size) * Compare maximum to threshold and decide positive or negative * If T>=gamma -> S4 else 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 3fee0c12e..4966efb70 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_quicksync_acquisition_cc.cc @@ -319,7 +319,7 @@ int pcps_quicksync_acquisition_cc::general_work(int noutput_items, for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) { // Ensure that the signal is going to start with all samples - // at zero. This is done to avoid over acumulation when performing + // at zero. This is done to avoid over accumulation when performing // the folding process to be stored in d_fft_if->get_inbuf() d_signal_folded = std::vector(d_fft_size, lv_cmake(0.0F, 0.0F)); std::copy(d_signal_folded.data(), d_signal_folded.data() + d_fft_size, d_fft_if->get_inbuf()); diff --git a/src/algorithms/conditioner/adapters/signal_conditioner.cc b/src/algorithms/conditioner/adapters/signal_conditioner.cc index 421871708..0c3519ce6 100644 --- a/src/algorithms/conditioner/adapters/signal_conditioner.cc +++ b/src/algorithms/conditioner/adapters/signal_conditioner.cc @@ -63,7 +63,7 @@ void SignalConditioner::connect(gr::top_block_sptr top_block) if (in_filt_->item_size() == 0) { - throw std::invalid_argument("itemsize mismatch: Invalid input/ouput data type configuration for the InputFilter"); + throw std::invalid_argument("itemsize mismatch: Invalid input/output data type configuration for the InputFilter"); } const size_t data_type_adapter_output_size = data_type_adapt_->get_right_block()->output_signature()->sizeof_stream_item(0); @@ -73,12 +73,12 @@ void SignalConditioner::connect(gr::top_block_sptr top_block) if (data_type_adapter_output_size != input_filter_input_size) { - throw std::invalid_argument("itemsize mismatch: Invalid input/ouput data type configuration for the DataTypeAdapter/InputFilter connection"); + throw std::invalid_argument("itemsize mismatch: Invalid input/output data type configuration for the DataTypeAdapter/InputFilter connection"); } if (input_filter_output_size != resampler_input_size) { - throw std::invalid_argument("itemsize mismatch: Invalid input/ouput data type configuration for the Input Filter/Resampler connection"); + throw std::invalid_argument("itemsize mismatch: Invalid input/output data type configuration for the Input Filter/Resampler connection"); } top_block->connect(data_type_adapt_->get_right_block(), 0, in_filt_->get_left_block(), 0); diff --git a/src/algorithms/data_type_adapter/adapters/byte_to_short.h b/src/algorithms/data_type_adapter/adapters/byte_to_short.h index cd31891e7..13fef0e79 100644 --- a/src/algorithms/data_type_adapter/adapters/byte_to_short.h +++ b/src/algorithms/data_type_adapter/adapters/byte_to_short.h @@ -27,7 +27,7 @@ * Classes for data type conversion * \{ */ /** \addtogroup Data_type_adapters data_type_adapters - * Wrap GNU Radio data tyope adapter blocks with a GNSSBlockInterface + * Wrap GNU Radio data type adapter blocks with a GNSSBlockInterface * \{ */ diff --git a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h index 324211f7d..219158dce 100644 --- a/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h +++ b/src/algorithms/data_type_adapter/adapters/cshort_to_grcomplex.h @@ -27,7 +27,7 @@ * Classes for data type conversion * \{ */ /** \addtogroup Data_type_adapters data_type_adapters - * Wrap GNU Radio data tyope adapter blocks with a GNSSBlockInterface + * Wrap GNU Radio data type adapter blocks with a GNSSBlockInterface * \{ */ diff --git a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc index 8a4982b1b..c662427bd 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc +++ b/src/algorithms/input_filter/gnuradio_blocks/notch_cc.cc @@ -43,7 +43,7 @@ Notch::Notch(float pfa, pfa_(pfa), noise_pow_est_(0.0), length_(length), // Set the number of samples per segment - n_deg_fred_(2 * length), // Number of dregrees of freedom, + n_deg_fred_(2 * length), // Number of degrees of freedom, n_segments_(0), n_segments_est_(n_segments_est), // Set the number of segments for noise power estimation n_segments_reset_(n_segments_reset), // Set the period (in segments) when the noise power is estimated diff --git a/src/algorithms/libs/rtklib/rtklib.h b/src/algorithms/libs/rtklib/rtklib.h index b5658641e..4d33cad0b 100644 --- a/src/algorithms/libs/rtklib/rtklib.h +++ b/src/algorithms/libs/rtklib/rtklib.h @@ -374,7 +374,7 @@ typedef struct typedef struct { /* observation data */ - int n, nmax; /* number of obervation data/allocated */ + int n, nmax; /* number of observation data/allocated */ obsd_t *data; /* observation data records */ } obs_t; @@ -664,7 +664,7 @@ typedef struct double deph[3]; /* delta orbit {radial,along,cross} (m) */ double ddeph[3]; /* dot delta orbit {radial,along,cross} (m/s) */ double dclk[3]; /* delta clock {c0,c1,c2} (m,m/s,m/s^2) */ - double hrclk; /* high-rate clock corection (m) */ + double hrclk; /* high-rate clock correction (m) */ float cbias[MAXCODE]; /* code biases (m) */ double pbias[MAXCODE]; /* phase biases (m) */ float stdpb[MAXCODE]; /* std-dev of phase biases (m) */ @@ -1159,7 +1159,7 @@ typedef struct typedef struct -{ /* tcp cilent type */ +{ /* tcp client type */ tcp_t svr; /* tcp server control */ int toinact; /* inactive timeout (ms) (0:no timeout) */ int tirecon; /* reconnect interval (ms) (0:no reconnect) */ diff --git a/src/algorithms/libs/rtklib/rtklib_rtcm3.cc b/src/algorithms/libs/rtklib/rtklib_rtcm3.cc index afed31c1f..c7f7e3632 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtcm3.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtcm3.cc @@ -3825,7 +3825,7 @@ int decode_msm7(rtcm_t *rtcm, int sys) i += 10; } for (j = 0; j < ncell; j++) - { /* half-cycle amiguity */ + { /* half-cycle ambiguity */ half[j] = getbitu(rtcm->buff, i, 1); i += 1; } diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc index 5bc43b8e9..1ef558bc5 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.cc @@ -1116,7 +1116,7 @@ void cross3(const double *a, const double *b, double *c) /* normalize 3d vector --------------------------------------------------------- * normalize 3d vector * args : double *a I vector a (3 x 1) - * double *b O normlized vector (3 x 1) || b || = 1 + * double *b O normalized vector (3 x 1) || b || = 1 * return : status (1:ok,0:error) *-----------------------------------------------------------------------------*/ int normv3(const double *a, double *b) @@ -1233,7 +1233,7 @@ int solve(const char *tr, const double *A, const double *Y, int n, * double *y I (weighted) measurements (m x 1) * int n,m I number of parameters and measurements (n <= m) * double *x O estmated parameters (n x 1) - * double *Q O esimated parameters covariance matrix (n x n) + * double *Q O estimated parameters covariance matrix (n x n) * return : status (0:ok,0>:error) * notes : for weighted least square, replace A and y by A*w and w*y (w=W^(1/2)) * matirix stored by column-major order (fortran convention) @@ -1907,7 +1907,7 @@ int read_leaps_usno(FILE *fp) * return : status (1:ok,0:error) * notes : The leap second table should be as follows or leapsec.dat provided * by USNO. - * (1) The records in the table file cosist of the following fields: + * (1) The records in the table file consist of the following fields: * year month day hour min sec UTC-GPST(s) * (2) The date and time indicate the start UTC time for the UTC-GPST * (3) The date and time should be descending order. @@ -4588,7 +4588,7 @@ double ionppp(const double *pos, const double *azel, double re, double tropmodel(gtime_t time __attribute__((unused)), const double *pos, const double *azel, double humi) { - const double temp0 = 15.0; /* temparature at sea level */ + const double temp0 = 15.0; /* temperature at sea level */ double hgt; double pres; double temp; diff --git a/src/algorithms/libs/rtklib/rtklib_rtkcmn.h b/src/algorithms/libs/rtklib/rtklib_rtkcmn.h index d606d4d4e..14caedd99 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkcmn.h +++ b/src/algorithms/libs/rtklib/rtklib_rtkcmn.h @@ -31,14 +31,14 @@ * References : * [1] IS-GPS-200M, Navstar GPS Space Segment/Navigation User Interfaces, * May, 2021 - * [2] RTCA/DO-229C, Minimum operational performanc standards for global + * [2] RTCA/DO-229C, Minimum operational performance standards for global * positioning system/wide area augmentation system airborne equipment, * RTCA inc, November 28, 2001 * [3] M.Rothacher, R.Schmid, ANTEX: The Antenna Exchange Format Version 1.4, * 15 September, 2010 * [4] A.Gelb ed., Applied Optimal Estimation, The M.I.T Press, 1974 * [5] A.E.Niell, Global mapping functions for the atmosphere delay at radio - * wavelengths, Jounal of geophysical research, 1996 + * wavelengths, Journal of geophysical research, 1996 * [6] W.Gurtner and L.Estey, RINEX The Receiver Independent Exchange Format * Version 3.00, November 28, 2007 * [7] J.Kouba, A Guide to using International GNSS Service (IGS) products, diff --git a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc index 8c31aec6b..136e9d0f8 100644 --- a/src/algorithms/libs/rtklib/rtklib_rtkpos.cc +++ b/src/algorithms/libs/rtklib/rtklib_rtkpos.cc @@ -58,7 +58,7 @@ static gtime_t time_stat = {0, 0}; /* rtk status file time */ * args : char *file I rtk status file * int level I rtk status level (0: off) * return : status (1:ok,0:error) - * notes : file can constain time keywords (%Y,%y,%m...) defined in reppath(). + * notes : file can contain time keywords (%Y,%y,%m...) defined in reppath(). * The time to replace keywords is based on UTC of CPU time. * output : solution status file record format * diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.cc b/src/algorithms/libs/rtklib/rtklib_sbas.cc index deebafd7a..313ba06d4 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.cc +++ b/src/algorithms/libs/rtklib/rtklib_sbas.cc @@ -29,7 +29,7 @@ * * * References : - * [1] RTCA/DO-229C, Minimum operational performanc standards for global + * [1] RTCA/DO-229C, Minimum operational performance standards for global * positioning system/wide area augmentation system airborne equipment, * RTCA inc, November 28, 2001 * [2] IS-QZSS v.1.1, Quasi-Zenith Satellite System Navigation Service diff --git a/src/algorithms/libs/rtklib/rtklib_sbas.h b/src/algorithms/libs/rtklib/rtklib_sbas.h index 7d108cca6..ae9ff1232 100644 --- a/src/algorithms/libs/rtklib/rtklib_sbas.h +++ b/src/algorithms/libs/rtklib/rtklib_sbas.h @@ -29,7 +29,7 @@ * * * References : - * [1] RTCA/DO-229C, Minimum operational performanc standards for global + * [1] RTCA/DO-229C, Minimum operational performance standards for global * positioning system/wide area augmentation system airborne equipment, * RTCA inc, November 28, 2001 * [2] IS-QZSS v.1.1, Quasi-Zenith Satellite System Navigation Service diff --git a/src/algorithms/libs/rtklib/rtklib_solution.cc b/src/algorithms/libs/rtklib/rtklib_solution.cc index 17ad78ead..609456d4b 100644 --- a/src/algorithms/libs/rtklib/rtklib_solution.cc +++ b/src/algorithms/libs/rtklib/rtklib_solution.cc @@ -2383,7 +2383,7 @@ void outprcopt(FILE *fp, const prcopt_t *opt) /* output solution header ------------------------------------------------------ - * output solution heade to file + * output solution header to file * args : FILE *fp I output file pointer * solopt_t *opt I solution options * return : none diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index f363525d6..d4ee0324b 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -299,7 +299,7 @@ int openfile_(file_t *file, gtime_t time, char *msg) { file->tick_f = 0; } - /* adust time to read playback file */ + /* adjust time to read playback file */ timeset(file->time); } else diff --git a/src/algorithms/libs/rtklib/rtklib_tides.cc b/src/algorithms/libs/rtklib/rtklib_tides.cc index 4c2f1d6a2..5adedf45c 100644 --- a/src/algorithms/libs/rtklib/rtklib_tides.cc +++ b/src/algorithms/libs/rtklib/rtklib_tides.cc @@ -281,12 +281,12 @@ void tide_pole(gtime_t tut, const double *pos, const double *erpv, * 8: elimate permanent deformation * double *erp I earth rotation parameters (NULL: not used) * double *odisp I ocean loading parameters (NULL: not used) - * odisp[0+i*6]: consituent i amplitude radial(m) - * odisp[1+i*6]: consituent i amplitude west (m) - * odisp[2+i*6]: consituent i amplitude south (m) - * odisp[3+i*6]: consituent i phase radial (deg) - * odisp[4+i*6]: consituent i phase west (deg) - * odisp[5+i*6]: consituent i phase south (deg) + * odisp[0+i*6]: constituent i amplitude radial(m) + * odisp[1+i*6]: constituent i amplitude west (m) + * odisp[2+i*6]: constituent i amplitude south (m) + * odisp[3+i*6]: constituent i phase radial (deg) + * odisp[4+i*6]: constituent i phase west (deg) + * odisp[5+i*6]: constituent i phase south (deg) * (i=0:M2,1:S2,2:N2,3:K2,4:K1,5:O1,6:P1,7:Q1, * 8:Mf,9:Mm,10:Ssa) * double *dr O displacement by earth tides (ecef) (m) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt index 354ea80fe..fb4a99a78 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/CMakeLists.txt @@ -48,7 +48,7 @@ option(BUILD_SHARED_LIBS "Build library as shared." OFF) # Force PIC on unix when building shared libs # see: https://en.wikipedia.org/wiki/Position-independent_code if(BUILD_SHARED_LIBS AND UNIX) - option(CMAKE_POSITION_INDEPENDENT_CODE "Build with Position Independant Code." ON) + option(CMAKE_POSITION_INDEPENDENT_CODE "Build with Position Independent Code." ON) endif() include(CheckIncludeFile) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_ppc.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_ppc.h index 455192aa8..a41224290 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_ppc.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_ppc.h @@ -93,7 +93,7 @@ typedef enum PPC_HAS_MMU, /* Memory management unit */ PPC_HAS_4xxMAC, PPC_UNIFIED_CACHE, /* Unified instruction and data cache */ - PPC_HAS_SPE, /* Signal processing extention unit */ + PPC_HAS_SPE, /* Signal processing extension unit */ PPC_HAS_EFP_SINGLE, /* SPE single precision fpu */ PPC_HAS_EFP_DOUBLE, /* SPE double precision fpu */ PPC_NO_TB, /* No timebase */ @@ -110,7 +110,7 @@ typedef enum PPC_POWER6_EXT, PPC_ARCH_2_06, /* ISA 2.06 - POWER7 */ PPC_HAS_VSX, /* Vector-scalar extension */ - PPC_PSERIES_PERFMON_COMPAT, /* Set of backwards compatibile performance + PPC_PSERIES_PERFMON_COMPAT, /* Set of backwards compatible performance monitoring events */ PPC_TRUE_LE, PPC_PPC_LE, diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h index 8bc36d143..4c2687ebb 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/include/cpuinfo_x86.h @@ -116,7 +116,7 @@ typedef struct // Calls cpuid and returns an initialized X86info. X86Info GetX86Info(void); -// Returns cache hierarchy informations. +// Returns cache hierarchy information. // Can call cpuid multiple times. CacheInfo GetX86CacheInfo(void); diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/ndk_compat/cpu-features.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/ndk_compat/cpu-features.h index 791b05ffd..a2415cb65 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/ndk_compat/cpu-features.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/ndk_compat/cpu-features.h @@ -165,7 +165,7 @@ extern uint64_t android_getCpuFeatures(void); * This flag implies -mfpu=neon-vfpv4. * * -mcpu=iwmmxt - * Allows the use of iWMMXt instrinsics with GCC. + * Allows the use of iWMMXt intrinsics with GCC. * * IMPORTANT NOTE: These flags should only be tested when * android_getCpuFamily() returns ANDROID_CPU_FAMILY_ARM, i.e. this is a diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c index 9ac6a6107..3db3d27b2 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/src/impl_ppc_linux.c @@ -129,7 +129,7 @@ PPCInfo GetPPCInfo(void) { /* * On Power feature flags aren't currently in cpuinfo so we only look at - * the auxilary vector. + * the auxiliary vector. */ PPCInfo info = kEmptyPPCInfo; const HardwareCapabilities hwcaps = CpuFeatures_GetHardwareCapabilities(); diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc index bcad73616..8808e0e8b 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cpu_features/test/cpuinfo_mips_test.cc @@ -116,7 +116,7 @@ TEST(CpuinfoMipsTest, Goldfish) auto& fs = GetEmptyFilesystem(); fs.CreateFile("/proc/cpuinfo", R"(system type : MIPS-Goldfish Hardware : goldfish -Revison : 1 +Revision : 1 processor : 0 cpu model : MIPS 24Kc V0.0 FPU V0.0 BogoMIPS : 1042.02 diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c index 4712f8561..83f5c505a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/volk_gnsssdr_malloc.c @@ -40,7 +40,7 @@ void *volk_gnsssdr_malloc(size_t size, size_t alignment) return NULL; } // Tweak size to satisfy ASAN (the GCC address sanitizer). - // Calling 'volk_gnsssdr_malloc' might therefor result in the allocation of more memory than + // Calling 'volk_gnsssdr_malloc' might therefore result in the allocation of more memory than // requested for correct alignment. Any allocation size change here will in general not // impact the end result since initial size alignment is required either way. if (size % alignment) diff --git a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h index 0eb081643..69069fefa 100644 --- a/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h +++ b/src/algorithms/resampler/gnuradio_blocks/direct_resampler_conditioner_cc.h @@ -8,7 +8,7 @@ * This block takes in a signal stream and performs direct resampling. * The theory behind this block can be found in Chapter 7.5 of the following * book: - * R. Lyons, Undestanding Digital Signal Processing, 3rd ed., Pearson Education, + * R. Lyons, Understanding Digital Signal Processing, 3rd ed., Pearson Education, * 2010. * * ----------------------------------------------------------------------------- diff --git a/src/algorithms/signal_source/adapters/fifo_signal_source.cc b/src/algorithms/signal_source/adapters/fifo_signal_source.cc index 1064166db..12981b3ad 100644 --- a/src/algorithms/signal_source/adapters/fifo_signal_source.cc +++ b/src/algorithms/signal_source/adapters/fifo_signal_source.cc @@ -34,7 +34,7 @@ FifoSignalSource::FifoSignalSource(ConfigurationInterface const* configuration, std::string const& role, unsigned int in_streams, unsigned int out_streams, [[maybe_unused]] Concurrent_Queue* queue) : SignalSourceBase(configuration, role, "Fifo_Signal_Source"s), - item_size_(sizeof(gr_complex)), // currenty output item size is always gr_complex + item_size_(sizeof(gr_complex)), // currently output item size is always gr_complex fifo_reader_(FifoReader::make(configuration->property(role + ".filename", "./example_capture.dat"s), configuration->property(role + ".sample_type", "ishort"s))), dump_(configuration->property(role + ".dump", false)), diff --git a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h index 4bfc78cda..fa0ae8fad 100644 --- a/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h +++ b/src/algorithms/signal_source/adapters/fmcomms2_signal_source.h @@ -93,7 +93,7 @@ private: double rf_gain_rx1_; double rf_gain_rx2_; - uint64_t freq_; // frequency of local oscilator + uint64_t freq_; // frequency of local oscillator uint64_t sample_rate_; uint64_t bandwidth_; uint64_t buffer_size_; // reception buffer diff --git a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h index 96e6702ae..573ded861 100644 --- a/src/algorithms/signal_source/adapters/plutosdr_signal_source.h +++ b/src/algorithms/signal_source/adapters/plutosdr_signal_source.h @@ -87,7 +87,7 @@ private: std::string item_type_; double rf_gain_; int64_t samples_; - uint64_t freq_; // frequency of local oscilator + uint64_t freq_; // frequency of local oscillator uint64_t sample_rate_; uint64_t bandwidth_; uint64_t buffer_size_; // reception buffer diff --git a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc index dc1a444d6..7bb984596 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/rtl_tcp_signal_source_c.cc @@ -319,7 +319,7 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec, unread_++; } } - // let woker know that more data is available + // let worker know that more data is available not_empty_.notify_one(); // Read some more #if USE_BOOST_BIND_PLACEHOLDERS 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 9babb7b15..145ef861f 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 @@ -6,7 +6,7 @@ * The implementation of this block is a combination of various helpful * sources. The data format and command structure is taken from the * original Osmocom rtl_tcp_source_f (https://git.osmocom.org/gr-osmosdr). - * The aynchronous reading code comes from the examples provides + * The asynchronous reading code comes from the examples provides * by Boost.Asio and the bounded buffer producer-consumer solution is * taken from the Boost.CircularBuffer examples (https://www.boost.org/). * diff --git a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc index f3352b715..e7959c6d3 100644 --- a/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc +++ b/src/algorithms/signal_source/libs/fpga_dynamic_bit_selection.cc @@ -137,7 +137,7 @@ void Fpga_dynamic_bit_selection::bit_selection_per_rf_band(volatile unsigned *d_ } } - // update bit selection corresopnding to frequency band 1 + // update bit selection corresponding to frequency band 1 d_map_base[0] = shift_out_bits; } diff --git a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc index 5a8cd823c..66ffa1e62 100644 --- a/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc +++ b/src/algorithms/signal_source/libs/ion_gsms_chunk_data.cc @@ -138,7 +138,7 @@ template void IONGSMSChunkData::unpack_words(gr_vector_void_star& outputs, std::vector& output_items) { WT* data = static_cast(buffer_); - // TODO - Swap endiannes if needed + // TODO - Swap endianness if needed IONGSMSChunkUnpackingCtx ctx{ chunk_.Shift(), diff --git a/src/algorithms/signal_source/libs/pps_samplestamp.h b/src/algorithms/signal_source/libs/pps_samplestamp.h index df4b40929..facb0e284 100644 --- a/src/algorithms/signal_source/libs/pps_samplestamp.h +++ b/src/algorithms/signal_source/libs/pps_samplestamp.h @@ -21,7 +21,7 @@ class PpsSamplestamp { public: - uint64_t samplestamp = 0; // PPS rising edge samples counter from the beginning of rx stream opperation. Notice that it is reseted to zero if sample buffer overflow is detected on the FPGA side + uint64_t samplestamp = 0; // PPS rising edge samples counter from the beginning of rx stream operation. Notice that it is reset to zero if sample buffer overflow is detected on the FPGA side uint32_t overflow_reg = 0; // >0 indicates overflow situation in the FPGA RX buffer }; diff --git a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h index b10bed4d4..571c17be1 100644 --- a/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h +++ b/src/algorithms/telemetry_decoder/adapters/gps_l1_ca_telemetry_decoder.h @@ -32,7 +32,7 @@ * Classes for the decoding of GNSS Navigation messages. * \{ */ /** \addtogroup Telemetry_Decoder_adapters telemetry_decoder_adapters - * Wrap GNU Radio blocs for the decoding of GNSS Navigation messages with a + * Wrap GNU Radio blocks for the decoding of GNSS Navigation messages with a * TelemetryDecoderInterface * \{ */ 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 6c72f1b8c..53687a2e1 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 @@ -461,7 +461,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in d_inav_nav.reset_osnma_nav_bits_adkd4(); } - if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same blcok (and W5!) + if (d_inav_nav.have_new_ephemeris() == true) // C: tells if W1-->W4 available from same block (and W5!) { // get object for this SV (mandatory) const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_ephemeris()); @@ -496,7 +496,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in else { // If we still do not have ephemeris, check if we have a reduced CED - if ((d_band == '1') && d_use_ced && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) // C: W16 has some Eph. params, uneeded for OSNMa I guess + if ((d_band == '1') && d_use_ced && !d_first_eph_sent && (d_inav_nav.have_new_reduced_ced() == true)) { const std::shared_ptr tmp_obj = std::make_shared(d_inav_nav.get_reduced_ced()); this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj)); diff --git a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc index dd1c8ca85..ddf843a3c 100644 --- a/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc +++ b/src/algorithms/tracking/adapters/galileo_e5a_dll_pll_tracking_fpga.cc @@ -75,7 +75,7 @@ GalileoE5aDllPllTrackingFpga::GalileoE5aDllPllTrackingFpga( // GNSS-SDR instantiates the tracking channels i L1, L2, L5, E1, E5a // However E5a can use the same tracking HW accelerators as L5 (but not simultaneously). // Therefore for the proper assignment of the FPGA tracking device file numbers to the E5a tracking channels, - // the number of channels that have already been assigned to L5 must not be substracted to this channel number, + // the number of channels that have already been assigned to L5 must not be subtracted to this channel number, // so they are not counted here. uint32_t num_prev_assigned_ch_1C = configuration->property("Channels_1C.count", 0); diff --git a/src/algorithms/tracking/libs/bayesian_estimation.h b/src/algorithms/tracking/libs/bayesian_estimation.h index d7e40f86e..6190ef8ff 100644 --- a/src/algorithms/tracking/libs/bayesian_estimation.h +++ b/src/algorithms/tracking/libs/bayesian_estimation.h @@ -50,7 +50,7 @@ * a sequence of identically and independently distributed (IID) samples of a stationary * stochastic process by way of Bayesian inference using conjugate priors. The posterior * distribution is assumed to be Gaussian with mean \mathbf{\mu} and covariance \hat{\mathbf{C}}, - * which has a conjugate prior given by a normal-inverse-Wishart distribution with paramemters + * which has a conjugate prior given by a normal-inverse-Wishart distribution with parameters * \mathbf{\mu}_{0}, \kappa_{0}, \nu_{0}, and \mathbf{\Psi}. * * [1] TODO: Ref1 diff --git a/src/core/libs/gnss_crypto.cc b/src/core/libs/gnss_crypto.cc index cbe4785ff..95589535f 100644 --- a/src/core/libs/gnss_crypto.cc +++ b/src/core/libs/gnss_crypto.cc @@ -66,13 +66,13 @@ Gnss_Crypto::Gnss_Crypto() gnutls_global_init(); #if !HAVE_GNUTLS_SIGN_ECDSA_SHA256 LOG(WARNING) << "The GnuTLS library version you are linking against is too old for some OSNMA functions." - << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of GnuTLS or OpenSSL" + << " Please do not trust OSNMA outputs or upgrade your system to a newer version of GnuTLS or OpenSSL" << " and rebuild GNSS-SDR against it."; #endif #else // OpenSSL #if !(USE_OPENSSL_3 || USE_OPENSSL_111) LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." - << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of OpenSSL" + << " Please do not trust OSNMA outputs or upgrade your system to a newer version of OpenSSL" << " and rebuild GNSS-SDR against it."; #endif #endif @@ -85,13 +85,13 @@ Gnss_Crypto::Gnss_Crypto(const std::string& certFilePath, const std::string& mer gnutls_global_init(); #if !HAVE_GNUTLS_SIGN_ECDSA_SHA256 LOG(WARNING) << "The GnuTLS library version you are linking against is too old for some OSNMA functions." - << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of GnuTLS or OpenSSL" + << " Please do not trust OSNMA outputs or upgrade your system to a newer version of GnuTLS or OpenSSL" << " and rebuild GNSS-SDR against it."; #endif #else // OpenSSL #if !(USE_OPENSSL_3 || USE_OPENSSL_111) LOG(WARNING) << "The OpenSSL library version you are linking against is too old for some OSNMA functions." - << " Please do not trust OSNMA ouputs or upgrade your system to a newer version of OpenSSL" + << " Please do not trust OSNMA outputs or upgrade your system to a newer version of OpenSSL" << " and rebuild GNSS-SDR against it."; #endif #endif diff --git a/src/core/libs/osnma_msg_receiver.cc b/src/core/libs/osnma_msg_receiver.cc index 7b9fae13d..3f4338bc4 100644 --- a/src/core/libs/osnma_msg_receiver.cc +++ b/src/core/libs/osnma_msg_receiver.cc @@ -1714,7 +1714,7 @@ bool osnma_msg_receiver::verify_macseq(const MACK_message& mack) } // Fixed as well as FLX Tags share first part - Eq. 22 ICD std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmitting the tag m[1] = static_cast((GST_SFi & 0xFF000000) >> 24); m[2] = static_cast((GST_SFi & 0x00FF0000) >> 16); m[3] = static_cast((GST_SFi & 0x0000FF00) >> 8); @@ -1970,7 +1970,7 @@ std::vector osnma_msg_receiver::verify_macseq_new(const MACK_ } // Fixed as well as FLX Tags share first part - Eq. 22 ICD std::vector m(5 + 2 * flxTags.size()); // each flx tag brings two bytes - m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmiting the tag + m[0] = static_cast(mack.PRNa); // PRN_A - SVID of the satellite transmitting the tag m[1] = static_cast((GST_Sfi & 0xFF000000) >> 24); m[2] = static_cast((GST_Sfi & 0x00FF0000) >> 16); m[3] = static_cast((GST_Sfi & 0x0000FF00) >> 8); diff --git a/src/core/receiver/gnss_flowgraph.cc b/src/core/receiver/gnss_flowgraph.cc index 4ecbb3522..3dc601130 100644 --- a/src/core/receiver/gnss_flowgraph.cc +++ b/src/core/receiver/gnss_flowgraph.cc @@ -747,7 +747,7 @@ int GNSSFlowgraph::connect_signal_conditioners() reported_error.replace(pos, len, "Pass_Through"); pos = reported_error.find(replace_me, pos + 1); } - help_hint_ += " * Blocks within the Signal Conditioner are connected with mismatched input/ouput item size\n"; + help_hint_ += " * Blocks within the Signal Conditioner are connected with mismatched input/output item size\n"; help_hint_ += " Reported error: " + reported_error + '\n'; help_hint_ += " Check the Signal Conditioner documentation at https://gnss-sdr.org/docs/sp-blocks/signal-conditioner/\n"; } @@ -1310,7 +1310,7 @@ int GNSSFlowgraph::connect_acquisition_monitor() top_block_->disconnect_all(); return 1; } - DLOG(INFO) << "acqusition_monitor successfully connected to Channel blocks"; + DLOG(INFO) << "acquisition_monitor successfully connected to Channel blocks"; return 0; } diff --git a/src/core/receiver/gnss_flowgraph.h b/src/core/receiver/gnss_flowgraph.h index 2616c8025..b544079ee 100644 --- a/src/core/receiver/gnss_flowgraph.h +++ b/src/core/receiver/gnss_flowgraph.h @@ -153,7 +153,7 @@ public: } /*! - * \brief Priorize visible satellites in the specified vector + * \brief Prioritize visible satellites in the specified vector */ void priorize_satellites(const std::vector>& visible_satellites); diff --git a/src/core/system_parameters/GPS_CNAV.h b/src/core/system_parameters/GPS_CNAV.h index 7d6a41c27..4ef6816da 100644 --- a/src/core/system_parameters/GPS_CNAV.h +++ b/src/core/system_parameters/GPS_CNAV.h @@ -95,7 +95,7 @@ const std::vector > CNAV_CUC({{249, 21}}); constexpr double CNAV_CUC_LSB = TWO_N30; -// MESSAGE TYPE 30 (CLOCK, IONO, GRUP DELAY) +// MESSAGE TYPE 30 (CLOCK, IONO, GROUP DELAY) const std::vector > CNAV_TOP2({{39, 11}}); constexpr int32_t CNAV_TOP2_LSB = 300; const std::vector > CNAV_URA_NED0({{50, 5}}); diff --git a/src/core/system_parameters/Galileo_CNAV.h b/src/core/system_parameters/Galileo_CNAV.h index ebb7d5bba..b1bd4882d 100644 --- a/src/core/system_parameters/Galileo_CNAV.h +++ b/src/core/system_parameters/Galileo_CNAV.h @@ -1,6 +1,6 @@ /*! * \file Galileo_CNAV.h - * \brief Galileo CNAV mesage constants. Data from: + * \brief Galileo CNAV message constants. Data from: * Galileo High Accuracy Service Signal-In-Space Interface Control Document * (HAS SIS ICD) Issue 1.0, May 2022 * \author Carles Fernandez-Prades, 2020-2022. cfernandez(at)cttc.es @@ -57,7 +57,7 @@ constexpr size_t HAS_MSG_PHASE_DISCONTINUITY_INDICATOR_LENGTH = 2; // HAS SIS constexpr uint64_t MAX_SECONDS_REMEMBERING_MID = 150; // HAS SIS ICD 1.0 Section 6.4.1 HAS Message Completion Time-out // Galileo CNAV message structure -constexpr int32_t GALILEO_CNAV_SYMBOLS_PER_PAGE = 1000; // Total numer of symbols per HAS page including the sync pattern +constexpr int32_t GALILEO_CNAV_SYMBOLS_PER_PAGE = 1000; // Total number of symbols per HAS page including the sync pattern constexpr int32_t GALILEO_CNAV_PREAMBLE_PERIOD_SYMBOLS = 1000; constexpr int32_t GALILEO_CNAV_PAGE_MS = 1; // Duration in ms of a CNAV page constexpr int32_t GALILEO_CNAV_INTERLEAVER_ROWS = 8; // HAS SIS ICD 1.0 Table 4 diff --git a/src/core/system_parameters/Galileo_FNAV.h b/src/core/system_parameters/Galileo_FNAV.h index cef9fe26f..d94df7408 100644 --- a/src/core/system_parameters/Galileo_FNAV.h +++ b/src/core/system_parameters/Galileo_FNAV.h @@ -1,6 +1,6 @@ /*! * \file Galileo_FNAV.h - * \brief Galileo FNAV mesage constants + * \brief Galileo FNAV message constants * \author Carles Fernandez, 2020. cfernandez(at)cttc.es * * diff --git a/src/core/system_parameters/Galileo_INAV.h b/src/core/system_parameters/Galileo_INAV.h index 9c9f19315..eeea60760 100644 --- a/src/core/system_parameters/Galileo_INAV.h +++ b/src/core/system_parameters/Galileo_INAV.h @@ -1,6 +1,6 @@ /*! * \file Galileo_INAV.h - * \brief Galileo INAV mesage constants + * \brief Galileo INAV message constants * \author Carles Fernandez, 2020. cfernandez(at)cttc.es * * @@ -296,7 +296,7 @@ const std::vector> TIME_0_BIT({{7, 2}}); const std::vector> WN_0_BIT({{97, 12}}); const std::vector> TOW_0_BIT({{109, 20}}); -/* Secondary Synchronization Patters */ +/* Secondary Synchronization Patterns */ constexpr char GALILEO_INAV_PLAIN_SSP1[9] = "00000100"; constexpr char GALILEO_INAV_PLAIN_SSP2[9] = "00101011"; constexpr char GALILEO_INAV_PLAIN_SSP3[9] = "00101111"; diff --git a/src/core/system_parameters/Galileo_OSNMA.h b/src/core/system_parameters/Galileo_OSNMA.h index 2b9146cc0..89ea0ec10 100644 --- a/src/core/system_parameters/Galileo_OSNMA.h +++ b/src/core/system_parameters/Galileo_OSNMA.h @@ -1,6 +1,6 @@ /*! * \file Galileo_OSNMA.h - * \brief Galileo OSNMA mesage constants + * \brief Galileo OSNMA message constants * \author Carles Fernandez, 2023. cfernandez(at)cttc.es * * @@ -46,7 +46,7 @@ const std::unordered_map OSNMA_TABLE_2 = { {1, std::string("Nominal")}, {2, std::string("End of Chain (EOC)")}, {3, std::string("Chain Revoked (CREV)")}, - {4, std::string("New Publick Key (NPK)")}, + {4, std::string("New Public Key (NPK)")}, {5, std::string("Public Key Revoked (PKREV)")}, {6, std::string("New Merkle Tree (NMT)")}, {7, std::string("Alert Message (AM)")}}; // key: cpks, value: cpks status diff --git a/src/core/system_parameters/galileo_has_data.h b/src/core/system_parameters/galileo_has_data.h index b69eeff82..6deada5f0 100644 --- a/src/core/system_parameters/galileo_has_data.h +++ b/src/core/system_parameters/galileo_has_data.h @@ -124,7 +124,7 @@ public: uint8_t has_status; //!< HASS - HAS Status (from HAS page header). See HAS SIS ICD 1.0 Section 3.1.1 uint8_t message_id; //!< MID - Message ID (from HAS page header). See HAS SIS ICD 1.0 Section 3.1 - uint8_t Nsys; //!< Number of GNSS for which corrections are provided. See HAS SIS ICD 1.0 Setion 5.2.1 + uint8_t Nsys; //!< Number of GNSS for which corrections are provided. See HAS SIS ICD 1.0 Section 5.2.1 uint8_t Nsys_sub; //!< Number of GNSS for which corrections are provided in clock subset corrections. See HAS SIS ICD 1.0 Section 5.2.2.1 uint8_t validity_interval_index_orbit_corrections; //!< VI - Validity Interval Index for Orbit corrections. See HAS SIS ICD 1.0 Section 5.2.2.1 diff --git a/src/core/system_parameters/galileo_inav_message.cc b/src/core/system_parameters/galileo_inav_message.cc index 7f0ef6252..4152434ee 100644 --- a/src/core/system_parameters/galileo_inav_message.cc +++ b/src/core/system_parameters/galileo_inav_message.cc @@ -216,7 +216,7 @@ void Galileo_Inav_Message::split_page(std::string page_string, int32_t flag_even } -// C: tells if W1-->W4 available from same blcok +// C: tells if W1-->W4 available from same block bool Galileo_Inav_Message::have_new_ephemeris() // Check if we have a new ephemeris stored in the galileo navigation class { if ((flag_ephemeris_1 == true) and (flag_ephemeris_2 == true) and (flag_ephemeris_3 == true) and (flag_ephemeris_4 == true) and (flag_iono_and_GST == true)) diff --git a/src/core/system_parameters/glonass_gnav_navigation_message.cc b/src/core/system_parameters/glonass_gnav_navigation_message.cc index b655850fe..d30f6057f 100644 --- a/src/core/system_parameters/glonass_gnav_navigation_message.cc +++ b/src/core/system_parameters/glonass_gnav_navigation_message.cc @@ -365,7 +365,7 @@ int32_t Glonass_Gnav_Navigation_Message::string_decoder(const std::string& frame flag_TOW_new = true; } - // 4) Set time of day (tod) when ephemeris data is complety decoded + // 4) Set time of day (tod) when ephemeris data is completely decoded gnav_ephemeris.d_tod = gnav_ephemeris.d_t_k + 2 * d_string_ID; } diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index 9b9b2e907..5751e94c2 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -145,7 +145,7 @@ void Gps_CNAV_Navigation_Message::decode_page(const std::bitset(read_navigation_unsigned(data_bits, CNAV_TOC)); ephemeris_record.toc *= CNAV_TOC_LSB; @@ -159,7 +159,7 @@ void Gps_CNAV_Navigation_Message::decode_page(const std::bitset(read_navigation_signed(data_bits, CNAV_AF2)); ephemeris_record.af2 *= CNAV_AF2_LSB; // group delays - // Check if the grup delay values are not available. See IS-GPS-200, Table 30-IV. + // Check if the group delay values are not available. See IS-GPS-200, Table 30-IV. // Bit string "1000000000000" is -4096 in 2 complement ephemeris_record.TGD = static_cast(read_navigation_signed(data_bits, CNAV_TGD)); if (ephemeris_record.TGD < -4095.9) diff --git a/src/core/system_parameters/gps_navigation_message.h b/src/core/system_parameters/gps_navigation_message.h index cb31c9518..727b88005 100644 --- a/src/core/system_parameters/gps_navigation_message.h +++ b/src/core/system_parameters/gps_navigation_message.h @@ -201,7 +201,7 @@ private: // Almanac int32_t i_Toa{}; // Almanac reference time [s] int32_t i_WN_A{}; // Modulo 256 of the GPS week number to which the almanac reference time (i_Toa) is referenced - int32_t SV_Health{}; // Almanac SV healt + int32_t SV_Health{}; // Almanac SV health uint32_t a_PRN{}; // Almanac PRN double a_delta_i{}; // Inclination Angle at Reference Time (relative to i_0 = 0.30 semi-circles) double a_M_0{}; // Mean Anomaly at Reference Time [semi-circles] diff --git a/src/core/system_parameters/reed_solomon.h b/src/core/system_parameters/reed_solomon.h index 049091ae1..42eb0da82 100644 --- a/src/core/system_parameters/reed_solomon.h +++ b/src/core/system_parameters/reed_solomon.h @@ -156,7 +156,7 @@ private: int d_shortening{}; // shortening parameter uint8_t d_min_poly{}; // primitive polynomial - uint8_t d_a0{}; // auxiliar variable + uint8_t d_a0{}; // auxiliary variable }; /** \} */ diff --git a/src/main/main.cc b/src/main/main.cc index a058e6029..fa7f79555 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -40,7 +40,7 @@ #include // for ofstream #include // for operator<< #include // for unique_ptr -#include // fro std::flush +#include // for std::flush #include // for string #if USE_GLOG_AND_GFLAGS diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc index 7dddc77f6..4c5d37ea6 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/acq_performance_test.cc @@ -123,7 +123,7 @@ ABSL_FLAG(bool, plot_acq_test, false, "Plots results with gnuplot, if available" ABSL_FLAG(int32_t, acq_test_skiphead, 0, "Number of samples to skip in the input file"); #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class AcqPerfTest_msg_rx; using AcqPerfTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc index 563b41294..7e14fb453 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b1i_pcps_acquisition_test.cc @@ -62,7 +62,7 @@ namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class BeidouB1iPcpsAcquisitionTest_msg_rx; using BeidouB1iPcpsAcquisitionTest_msg_rx_sptr = std::shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc index 17cd4010a..2b492e52f 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/beidou_b3i_pcps_acquisition_test.cc @@ -61,7 +61,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class BeidouB3iPcpsAcquisitionTest_msg_rx; using BeidouB3iPcpsAcquisitionTest_msg_rx_sptr = std::shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index e28db3b6c..09fac757e 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -53,7 +53,7 @@ namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx; using GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index 103778f60..b15bb3a90 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -49,7 +49,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx; using GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 1a3886d81..3eda7db73 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -59,7 +59,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx; using GalileoE1PcpsAmbiguousAcquisitionGSoCTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc index 9be206e3f..5acb03b32 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_ambiguous_acquisition_test.cc @@ -58,7 +58,7 @@ namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx; using GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc index db50b891d..78457f584 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_cccwsr_ambiguous_acquisition_gsoc2013_test.cc @@ -52,7 +52,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx; using GalileoE1PcpsCccwsrAmbiguousAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc index 7614c7dfd..b61d6846c 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_quicksync_ambiguous_acquisition_gsoc2014_test.cc @@ -67,7 +67,7 @@ ABSL_FLAG(double, e1_value_threshold, 0.3, "Value of the threshold for the acqui ABSL_FLAG(int32_t, e1_value_CN0_dB_0, 50, "Value for the CN0_dB_0 in channel 0"); #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx; using GalileoE1PcpsQuickSyncAmbiguousAcquisitionGSoC2014Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index 093121afa..c252c0dbe 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -53,7 +53,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx; using GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc index ae1224f8f..6e1e3d8db 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc @@ -49,7 +49,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx; using GalileoE5aPcpsAcquisitionGSoC2014GensourceTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc index 34f0c1de0..b596a6f3c 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e5b_pcps_acquisition_test.cc @@ -55,7 +55,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE5bPcpsAcquisitionTest_msg_rx; using GalileoE5bPcpsAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc index 8f433b5d2..13fd07893 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/galileo_e6_pcps_acquisition_test.cc @@ -55,7 +55,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GalileoE6PcpsAcquisitionTest_msg_rx; using GalileoE6PcpsAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc index b23c989bf..5e146c9f2 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_gsoc2017_test.cc @@ -54,7 +54,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx; using GlonassL1CaPcpsAcquisitionGSoC2017Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc index 2495623e1..7bd987a41 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l1_ca_pcps_acquisition_test.cc @@ -48,7 +48,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GlonassL1CaPcpsAcquisitionTest_msg_rx; using GlonassL1CaPcpsAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc index 4f205422d..3775d845e 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/glonass_l2_ca_pcps_acquisition_test.cc @@ -52,7 +52,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GlonassL2CaPcpsAcquisitionTest_msg_rx; using GlonassL2CaPcpsAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index 70015c2d5..e8d340d27 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -54,7 +54,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx; using GpsL1CaPcpsAcquisitionGSoC2013Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc index 4aac0c104..9cb9537d1 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_acquisition_test.cc @@ -61,7 +61,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CaPcpsAcquisitionTest_msg_rx; using GpsL1CaPcpsAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc index 40f735c05..5be8d6998 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc @@ -51,7 +51,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx; using GpsL1CaPcpsOpenClAcquisitionGSoC2013Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc index d3d12b6a1..ed92fae66 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc @@ -64,7 +64,7 @@ ABSL_FLAG(double, value_threshold, 1, "Value of the threshold for the acquisitio ABSL_FLAG(int32_t, value_CN0_dB_0, 44, "Value for the CN0_dB_0 in channel 0"); #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx; using GpsL1CaPcpsQuickSyncAcquisitionGSoC2014Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc index 20e737c94..ab856b48e 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc @@ -53,7 +53,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx; using GpsL1CaPcpsTongAcquisitionGSoC2013Test_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc index bb65ec8c5..270cfe91a 100644 --- a/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc +++ b/tests/unit-tests/signal-processing-blocks/acquisition/gps_l2_m_pcps_acquisition_test.cc @@ -57,7 +57,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL2MPcpsAcquisitionTest_msg_rx; using GpsL2MPcpsAcquisitionTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h b/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h index 50d54c2e7..fc50fb353 100644 --- a/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h +++ b/tests/unit-tests/signal-processing-blocks/libs/acquisition_msg_rx.h @@ -25,7 +25,7 @@ #include -// ######## GNURADIO ACQUISITION BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO ACQUISITION BLOCK MESSAGE RECEIVER ######### class Acquisition_msg_rx; using Acquisition_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc index f66aeed57..46c9c444b 100644 --- a/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc +++ b/tests/unit-tests/signal-processing-blocks/observables/hybrid_observables_test.cc @@ -100,7 +100,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TRACKING MESSAGES ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER FOR TRACKING MESSAGES ######### class HybridObservablesTest_msg_rx; using HybridObservablesTest_msg_rx_sptr = gnss_shared_ptr; @@ -164,7 +164,7 @@ HybridObservablesTest_msg_rx::~HybridObservablesTest_msg_rx() = default; // ########################################################### -// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TLM MESSAGES ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER FOR TLM MESSAGES ######### class HybridObservablesTest_tlm_msg_rx; diff --git a/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc b/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc index f6916b29f..16bb39763 100644 --- a/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc +++ b/tests/unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc @@ -60,7 +60,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TRACKING MESSAGES ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER FOR TRACKING MESSAGES ######### class GpsL1CADllPllTelemetryDecoderTest_msg_rx; using GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr = gnss_shared_ptr; @@ -120,7 +120,7 @@ GpsL1CADllPllTelemetryDecoderTest_msg_rx::~GpsL1CADllPllTelemetryDecoderTest_msg // ########################################################### -// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TLM MESSAGES ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER FOR TLM MESSAGES ######### class GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx; using GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr = std::shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc index 7b7566f00..620729691 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_real_codes_test.cc @@ -109,7 +109,7 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTime) // local code resampler on GPU // generate local reference (1 sample per chip) gps_l1_ca_code_gen_float(own::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(float)), 1, 0); - // generate inut signal + // generate input signal std::random_device r; std::default_random_engine e1(r()); std::uniform_real_distribution uniform_dist(0, 1); @@ -215,7 +215,7 @@ TEST(CpuMulticorrelatorRealCodesTest, MeasureExecutionTimeAlloc) // local code resampler on GPU // generate local reference (1 sample per chip) gps_l1_ca_code_gen_float(d_ca_code, 1, 0); - // generate inut signal + // generate input signal std::random_device r; std::default_random_engine e1(r()); std::uniform_real_distribution uniform_dist(0, 1); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc index 7bd54c5a9..19c9cb23d 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc @@ -102,7 +102,7 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTime) // local code resampler on GPU // generate local reference (1 sample per chip) gps_l1_ca_code_gen_complex(own::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), 1, 0); - // generate inut signal + // generate input signal std::random_device r; std::default_random_engine e1(r()); std::uniform_real_distribution uniform_dist(0, 1); @@ -208,7 +208,7 @@ TEST(CpuMulticorrelatorTest, MeasureExecutionTimeAlloc) // local code resampler on GPU // generate local reference (1 sample per chip) gps_l1_ca_code_gen_complex(d_ca_code, 1, 0); - // generate inut signal + // generate input signal std::random_device r; std::default_random_engine e1(r()); std::uniform_real_distribution uniform_dist(0, 1); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc index 33770b758..55bfbb3e7 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_c_aid_tracking_test.cc @@ -42,7 +42,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GlonassL1CaDllPllCAidTrackingTest_msg_rx; using GlonassL1CaDllPllCAidTrackingTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc index 001628c2f..17ddbfe44 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/glonass_l1_ca_dll_pll_tracking_test.cc @@ -48,7 +48,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GlonassL1CaDllPllTrackingTest_msg_rx; using GlonassL1CaDllPllTrackingTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc index a7464207c..a50f07e35 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc @@ -61,7 +61,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CADllPllTrackingTest_msg_rx; using GpsL1CADllPllTrackingTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc index d5f2348af..e1717b44b 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test_fpga.cc @@ -161,7 +161,7 @@ void sending_thread(const gr::top_block_sptr &top_block, const char *file_name) } -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CADllPllTrackingTestFpga_msg_rx; using GpsL1CADllPllTrackingTestFpga_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc index 8765ac60c..0e5d64c73 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gps_l1_ca_gaussian_tracking_test.cc @@ -66,7 +66,7 @@ DEFINE_bool(plot_gps_l1_gaussian_tracking_test, false, "Plots results of GpsL1CA ABSL_FLAG(bool, plot_gps_l1_gaussian_tracking_test, false, "Plots results of GpsL1CAGaussianTrackingTest with gnuplot"); #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL1CAGaussianTrackingTest_msg_rx; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc index 995ce58dd..ffa0b1fba 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc @@ -48,7 +48,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class GpsL2MDllPllTrackingTest_msg_rx; using GpsL2MDllPllTrackingTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc index db5680d02..91eacd660 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/gpu_multicorrelator_test.cc @@ -96,7 +96,7 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime) // local code resampler on GPU // generate local reference (1 sample per chip) gps_l1_ca_code_gen_complex(own::span(d_ca_code, static_cast(GPS_L1_CA_CODE_LENGTH_CHIPS)), 1, 0); - // generate inut signal + // generate input signal for (int n = 0; n < 2 * d_vector_length; n++) { in_gpu[n] = std::complex(static_cast(rand()) / static_cast(RAND_MAX), static_cast(rand()) / static_cast(RAND_MAX)); diff --git a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc index 4241b7b6f..b13b91fbe 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test.cc @@ -74,7 +74,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO TRACKING BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO TRACKING BLOCK MESSAGE RECEIVER ######### class TrackingPullInTest_msg_rx; using TrackingPullInTest_msg_rx_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc index 351ef8e26..77f062395 100644 --- a/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc +++ b/tests/unit-tests/signal-processing-blocks/tracking/tracking_pull-in_test_fpga.cc @@ -73,7 +73,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO TRACKING BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO TRACKING BLOCK MESSAGE RECEIVER ######### class TrackingPullInTest_msg_rx_Fpga; using TrackingPullInTest_msg_rx_Fpga_sptr = gnss_shared_ptr; diff --git a/tests/unit-tests/system-parameters/has_decoding_test.cc b/tests/unit-tests/system-parameters/has_decoding_test.cc index a93b07da2..7dc0c95a5 100644 --- a/tests/unit-tests/system-parameters/has_decoding_test.cc +++ b/tests/unit-tests/system-parameters/has_decoding_test.cc @@ -49,7 +49,7 @@ namespace wht = boost; namespace wht = std; #endif -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class HasDecoderTester; using HasDecoderTester_sptr = gnss_shared_ptr; diff --git a/utils/front-end-cal/main.cc b/utils/front-end-cal/main.cc index 4da2c1730..f78e0f4a6 100644 --- a/utils/front-end-cal/main.cc +++ b/utils/front-end-cal/main.cc @@ -142,7 +142,7 @@ Concurrent_Queue channel_internal_queue; std::vector gnss_sync_vector; Gnss_Synchro gnss_synchro; -// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +// ######## GNURADIO BLOCK MESSAGE RECEIVER ######### class FrontEndCal_msg_rx; using FrontEndCal_msg_rx_sptr = gnss_shared_ptr; diff --git a/utils/matlab/libs/geoFunctions/satpos.m b/utils/matlab/libs/geoFunctions/satpos.m index b65004b52..7af0f24c9 100644 --- a/utils/matlab/libs/geoFunctions/satpos.m +++ b/utils/matlab/libs/geoFunctions/satpos.m @@ -30,7 +30,7 @@ function [satPositions, satClkCorr] = satpos(transmitTime, prnList, ... %% Initialize constants =================================================== numOfSatellites = size(prnList, 2); -% GPS constatns +% GPS constants gpsPi = 3.1415926535898; % Pi used in the GPS coordinate % system diff --git a/utils/nav-listener/nav_msg_udp_listener.cc b/utils/nav-listener/nav_msg_udp_listener.cc index 5a291b8ed..65debea37 100644 --- a/utils/nav-listener/nav_msg_udp_listener.cc +++ b/utils/nav-listener/nav_msg_udp_listener.cc @@ -41,7 +41,7 @@ Nav_Msg_Udp_Listener::Nav_Msg_Udp_Listener(unsigned short port) /* * Blocking call to read nav_message from UDP port - * return true if message parsed succesfully, false ow + * return true if message parsed successfully, false ow */ bool Nav_Msg_Udp_Listener::receive_and_parse_nav_message(gnss_sdr::navMsg &message) { diff --git a/utils/rinex2assist/README.md b/utils/rinex2assist/README.md index 4ddc4b3bd..f1f11a4bd 100644 --- a/utils/rinex2assist/README.md +++ b/utils/rinex2assist/README.md @@ -51,7 +51,7 @@ $ rinex2assist /path/to/RINEX_nav_file ``` The argument is mandatory (the name of the RINEX navigation file). The name -`gps_ephemeris.xml` is given to the output if GPS NAV data is fould. If the +`gps_ephemeris.xml` is given to the output if GPS NAV data is found. If the RINEX file contains Galileo data, the corresponding `gal_ephemeris.xml` file will be generated. The program is also able to extract parameters of the UTC and the Ionospheric models from the RINEX header, if available. They will be called From b4f373df57e1b91f5b4af45d1fe3a1c454b65eed Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 11 Feb 2025 19:07:14 +0100 Subject: [PATCH 480/499] volk_gnsssdr: improve install path detection Re-enable usage of own cpu_features if volk >= 3.1 and not found Add toolchain file for riscv64 RVV and CI tests --- .github/workflows/volk_gnsssdr_archs.yml | 39 ++++++++++++++++ CMakeLists.txt | 21 +++++---- cmake/Toolchains/rv64gcv-linux-gnu.cmake | 32 ++++++++++++++ .../volk_gnsssdr/CMakeLists.txt | 19 ++------ .../cmake/Toolchains/rv64gcv-linux-gnu.cmake | 32 ++++++++++++++ .../volk_gnsssdr_32f_index_max_32u.h | 44 +++++++++++++++++++ .../volk_gnsssdr/lib/CMakeLists.txt | 6 +-- .../volk_gnsssdr/tmpl/volk_gnsssdr.pc.in | 8 ++-- 8 files changed, 170 insertions(+), 31 deletions(-) create mode 100644 cmake/Toolchains/rv64gcv-linux-gnu.cmake create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index 567dfb1e9..1395423da 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -76,3 +76,42 @@ jobs: ./apps/volk_gnsssdr-config-info --malloc ./apps/volk_gnsssdr-config-info --cc ctest -V + + + RISCV64-RVV-tests: + runs-on: ubuntu-24.04 + name: RISCV64 RVV tests + steps: + - uses: actions/checkout@v4 + - name: Install packages + run: | + sudo apt-get update -q -y + sudo apt-get install -y python3-mako cmake qemu-user-static g++-14-riscv64-linux-gnu clang-18 + - name: Test RVV with gcc-14 VLEN=128 + run: | + mkdir -p gcc14_VLEN_128; cd gcc14_VLEN_128 + CXX=riscv64-linux-gnu-g++-14 CC=riscv64-linux-gnu-gcc-14 VLEN=128 cmake -DCMAKE_TOOLCHAIN_FILE=../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/ + make -j$(nproc) + ARGS=-V make test + cd ..; rm -rf gcc14_VLEN_128 + - name: Test RVV with gcc-14 VLEN=256 + run: | + mkdir -p gcc14_VLEN_256; cd gcc14_VLEN_256 + CXX=riscv64-linux-gnu-g++-14 CC=riscv64-linux-gnu-gcc-14 VLEN=256 cmake -DCMAKE_TOOLCHAIN_FILE=../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake -DCMAKE_BUILD_TYPE=Release ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/ + make -j$(nproc) + ARGS=-V make test + cd ..; rm -rf gcc14_VLEN_256 + - name: Test RVV with clang-18 VLEN=512 + run: | + mkdir -p clang18_VLEN_512; cd clang18_VLEN_512 + CXX=clang++-18 CC=clang-18 CFLAGS=--target=riscv64-linux-gnu VLEN=512 cmake -DCMAKE_TOOLCHAIN_FILE=../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/ + make -j$(nproc) + ARGS=-V make test + cd ..; rm -rf clang18_VLEN_512 + - name: Test RVV with clang-18 VLEN=1024 + run: | + mkdir -p clang18_VLEN_1024; cd clang18_VLEN_1024 + CXX=clang++-18 CC=clang-18 CFLAGS=--target=riscv64-linux-gnu VLEN=1024 cmake -DCMAKE_TOOLCHAIN_FILE=../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake -DCMAKE_BUILD_TYPE=Release ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/ + make -j$(nproc) + ARGS=-V make test + cd ..; rm -rf clang18_VLEN_1024 \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f333a5231..ca872b2a9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,6 @@ list(APPEND CMAKE_MODULE_PATH ${GNSSSDR_SOURCE_DIR}/cmake/Modules) # Enable them at the command line by doing 'cmake -DENABLE_XXX=ON ..' ################################################################################ include(FeatureSummary) -include(GnsssdrLibPaths) # Support of optional RF front-ends option(ENABLE_UHD "Enable the use of UHD (driver for all USRP devices)" ON) @@ -611,6 +610,13 @@ set_package_properties(Threads PROPERTIES +################################################################################ +# Set GNSSSDR_LIB_PATHS +################################################################################ +include(GnsssdrLibPaths) + + + ################################################################################ # Googletest - https://github.com/google/googletest ################################################################################ @@ -1298,9 +1304,6 @@ if(NOT VOLKGNSSSDR_FOUND) CMAKE_SYSTEM_PROCESSOR MATCHES "^loongarch") set(SUPPORTED_CPU_FEATURES_ARCH TRUE) endif() - if(${CMAKE_INSTALL_LIBDIR} MATCHES lib64) - set(VOLK_GNSSSDR_LIB_SUFFIX 64) - endif() if(CMAKE_VERSION VERSION_LESS 3.2) ExternalProject_Add(volk_gnsssdr_module PREFIX ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module @@ -1318,7 +1321,7 @@ if(NOT VOLKGNSSSDR_FOUND) else() if(SUPPORTED_CPU_FEATURES_ARCH) set(VOLK_GNSSSDR_BUILD_BYPRODUCTS - ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} + ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile ) if(ENABLE_CPUFEATURES) @@ -1341,7 +1344,7 @@ if(NOT VOLKGNSSSDR_FOUND) set_package_properties(CPUFEATURES PROPERTIES DESCRIPTION "A cross platform C99 library to get CPU features at runtime" ) - if((DEFINED VOLK_VERSION AND VOLK_VERSION VERSION_GREATER "2.3") OR (CMAKE_VERSION VERSION_LESS "3.13")) # avoid clash with volk's cpufeatures. + if((DEFINED VOLK_VERSION AND VOLK_VERSION VERSION_GREATER "2.3" AND VOLK_VERSION VERSION_LESS "3.1") OR (CMAKE_VERSION VERSION_LESS "3.13")) # avoid clash with volk's cpufeatures. set(ENABLE_CPUFEATURES OFF) else() set_package_properties(CPUFEATURES PROPERTIES @@ -1386,7 +1389,7 @@ if(NOT VOLKGNSSSDR_FOUND) UPDATE_COMMAND "" PATCH_COMMAND "" BUILD_COMMAND ${VOLK_GNSSSDR_BUILD_COMMAND} - BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} + BUILD_BYPRODUCTS ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/${CMAKE_FIND_LIBRARY_PREFIXES}volk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX} ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr_profile ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/bin/volk_gnsssdr-config-info INSTALL_DIR ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install @@ -1400,7 +1403,7 @@ if(NOT VOLKGNSSSDR_FOUND) endif() add_library(volk_gnsssdr UNKNOWN IMPORTED) - set_property(TARGET volk_gnsssdr PROPERTY IMPORTED_LOCATION ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}) + set_property(TARGET volk_gnsssdr PROPERTY IMPORTED_LOCATION ${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}) set(VOLK_GNSSSDR_INCLUDE_DIRS "${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/build/include/;${GNSSSDR_SOURCE_DIR}/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/include;${ORC_INCLUDE_DIRS}") set(VOLK_GNSSSDR_LIBRARIES volk_gnsssdr ${ORC_LIBRARIES_STATIC}) if(CPUFEATURES_FOUND) @@ -1413,7 +1416,7 @@ if(NOT VOLKGNSSSDR_FOUND) add_dependencies(Volkgnsssdr::volkgnsssdr volk_gnsssdr_module) set_target_properties(Volkgnsssdr::volkgnsssdr PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/lib${VOLK_GNSSSDR_LIB_SUFFIX}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}" + IMPORTED_LOCATION "${GNSSSDR_BINARY_DIR}/volk_gnsssdr_module/install/${CMAKE_INSTALL_LIBDIR}/libvolk_gnsssdr${CMAKE_STATIC_LIBRARY_SUFFIX}" INCLUDE_DIRECTORIES "${VOLK_GNSSSDR_INCLUDE_DIRS}" INTERFACE_INCLUDE_DIRECTORIES "${VOLK_GNSSSDR_INCLUDE_DIRS}" INTERFACE_LINK_LIBRARIES "${VOLK_GNSSSDR_LIBRARIES}" diff --git a/cmake/Toolchains/rv64gcv-linux-gnu.cmake b/cmake/Toolchains/rv64gcv-linux-gnu.cmake new file mode 100644 index 000000000..54be4cc5d --- /dev/null +++ b/cmake/Toolchains/rv64gcv-linux-gnu.cmake @@ -0,0 +1,32 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# Copyright (C) 2011-2025 (see AUTHORS file for a list of contributors) +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR riscv64) + +set(CMAKE_C_COMPILER $ENV{CC}) +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +set(CMAKE_CXX_COMPILER $ENV{CXX}) + +set(CMAKE_C_FLAGS "$ENV{CFLAGS} -march=rv64gcv" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE) +set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -g" CACHE STRING "" FORCE) + +set(CMAKE_OBJCOPY + ${RISCV64_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy + CACHE INTERNAL "objcopy tool") +set(CMAKE_SIZE_UTIL + ${RISCV64_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size + CACHE INTERNAL "size tool") + +set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH}) + +set(QEMU_VLEN $ENV{VLEN}) +if(NOT QEMU_VLEN) + set(QEMU_VLEN "128") +endif() + +set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-riscv64-static -L /usr/riscv64-linux-gnu/ -cpu rv64,zba=true,zbb=true,v=on,vlen=${QEMU_VLEN},rvv_ta_all_1s=on,rvv_ma_all_1s=on") diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 51ad77d57..7331e0fea 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -394,23 +394,12 @@ endif() ######################################################################## # Detect /lib versus /lib64 ######################################################################## -if(${CMAKE_INSTALL_LIBDIR} MATCHES lib64) - set(LIB_SUFFIX 64) -endif() +include(GNUInstallDirs) ######################################################################## # Setup the package config file ######################################################################## -# set variables found in the pc.in file -if(NOT LIB_SUFFIX) - set(LIB_SUFFIX "") -endif() -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix "\${prefix}") -set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}") -set(includedir "\${prefix}/include") - configure_file( ${PROJECT_SOURCE_DIR}/tmpl/volk_gnsssdr.pc.in ${PROJECT_BINARY_DIR}/volk_gnsssdr.pc @@ -419,7 +408,7 @@ configure_file( install( FILES ${PROJECT_BINARY_DIR}/volk_gnsssdr.pc - DESTINATION lib${LIB_SUFFIX}/pkgconfig + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig COMPONENT "volk_gnsssdr_devel" ) @@ -427,7 +416,7 @@ install( # Install all headers in the include directories ######################################################################## set(VOLK_RUNTIME_DIR bin) -set(VOLK_LIBRARY_DIR lib${LIB_SUFFIX}) +set(VOLK_LIBRARY_DIR ${CMAKE_INSTALL_LIBDIR}) set(VOLK_INCLUDE_DIR include) install( @@ -524,7 +513,7 @@ configure_file( ######################################################################## if(NOT CMAKE_MODULES_DIR) - set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake) + set(CMAKE_MODULES_DIR ${CMAKE_INSTALL_LIBDIR}/cmake) endif() install( diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake new file mode 100644 index 000000000..54be4cc5d --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Toolchains/rv64gcv-linux-gnu.cmake @@ -0,0 +1,32 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# Copyright (C) 2011-2025 (see AUTHORS file for a list of contributors) +# SPDX-License-Identifier: BSD-3-Clause + +set(CMAKE_SYSTEM_NAME Linux) +set(CMAKE_SYSTEM_PROCESSOR riscv64) + +set(CMAKE_C_COMPILER $ENV{CC}) +set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) +set(CMAKE_CXX_COMPILER $ENV{CXX}) + +set(CMAKE_C_FLAGS "$ENV{CFLAGS} -march=rv64gcv" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS} CACHE STRING "" FORCE) +set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -g" CACHE STRING "" FORCE) + +set(CMAKE_OBJCOPY + ${RISCV64_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}objcopy + CACHE INTERNAL "objcopy tool") +set(CMAKE_SIZE_UTIL + ${RISCV64_TOOLCHAIN_DIR}/${TOOLCHAIN_PREFIX}size + CACHE INTERNAL "size tool") + +set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH}) + +set(QEMU_VLEN $ENV{VLEN}) +if(NOT QEMU_VLEN) + set(QEMU_VLEN "128") +endif() + +set(CMAKE_CROSSCOMPILING_EMULATOR "qemu-riscv64-static -L /usr/riscv64-linux-gnu/ -cpu rv64,zba=true,zbb=true,v=on,vlen=${QEMU_VLEN},rvv_ta_all_1s=on,rvv_ma_all_1s=on") diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32f_index_max_32u.h b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32f_index_max_32u.h index 8d2ae5c1f..6f8b57b3e 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32f_index_max_32u.h +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/kernels/volk_gnsssdr/volk_gnsssdr_32f_index_max_32u.h @@ -534,4 +534,48 @@ static inline void volk_gnsssdr_32f_index_max_32u_neon(uint32_t* target, const f #endif /* LV_HAVE_NEON */ +#ifdef LV_HAVE_RVV +#include + +static inline void volk_gnsssdr_32f_index_max_32u_rvv(uint32_t* target, const float* src0, uint32_t num_points) +{ + if (num_points == 0) + { + return; + } + float max_val = src0[0]; + uint32_t max_idx = 0; + size_t vl; + + // Process in chunks + for (size_t i = 0; i < num_points; i += vl) + { + // Set vector length for this iteration + vl = __riscv_vsetvl_e32m1(num_points - i); + + // Load vector of values + vfloat32m1_t v_vals = __riscv_vle32_v_f32m1(&src0[i], vl); + + // Process each element in the vector + for (size_t j = 0; j < vl; j++) + { + float val = __riscv_vfmv_f_s_f32m1_f32(v_vals); + if (val > max_val) + { + max_val = val; + max_idx = i + j; + } + // Shift to next element by reloading + if (j + 1 < vl) + { + v_vals = __riscv_vle32_v_f32m1(&src0[i + j + 1], vl - j - 1); + } + } + } + + target[0] = max_idx; +} + +#endif /* LV_HAVE_RVV */ + #endif /* INCLUDED_volk_gnsssdr_32f_index_max_32u_H */ diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 5ab23bf57..984822ede 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -655,8 +655,8 @@ if(NOT (ENABLE_STATIC_LIBS AND (CMAKE_GENERATOR STREQUAL Xcode))) # Install locations install(TARGETS volk_gnsssdr EXPORT VOLK_GNSSSDR-export - LIBRARY DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_runtime" # .so file - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" # .lib file + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT "volk_gnsssdr_runtime" # .so file + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT "volk_gnsssdr_devel" # .lib file RUNTIME DESTINATION bin COMPONENT "volk_gnsssdr_runtime" # .dll file ) endif() @@ -703,7 +703,7 @@ if(ENABLE_STATIC_LIBS) install(TARGETS volk_gnsssdr_static EXPORT VOLK_GNSSSDR-export - ARCHIVE DESTINATION lib${LIB_SUFFIX} COMPONENT "volk_gnsssdr_devel" + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT "volk_gnsssdr_devel" ) endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr.pc.in b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr.pc.in index 743b1c024..c525b0343 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr.pc.in +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/tmpl/volk_gnsssdr.pc.in @@ -1,9 +1,9 @@ # SPDX-FileCopyrightText: 2014 Carles Fernandez-Prades # SPDX-License-Identifier: GPL-3.0-or-later -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=@CMAKE_INSTALL_PREFIX@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ LV_CXXFLAGS=@LV_CXXFLAGS@ From 1120c53252fec2a63b877437422197ef4c88a9d4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 12 Feb 2025 21:04:41 +0100 Subject: [PATCH 481/499] CI: update Android tests --- .github/workflows/volk_gnsssdr_android.yml | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.github/workflows/volk_gnsssdr_android.yml b/.github/workflows/volk_gnsssdr_android.yml index b10f894dd..2d5da7473 100644 --- a/.github/workflows/volk_gnsssdr_android.yml +++ b/.github/workflows/volk_gnsssdr_android.yml @@ -32,30 +32,32 @@ jobs: - name: Update repositories run: sudo apt update - name: Install dependencies - run: sudo apt install -y cmake openjdk-11-jre-headless wget unzip make python3-mako + run: sudo apt install -y cmake python3-mako + + # Setup Java + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + # Setup Android SDK, and auto-accept licenses - name: Install Android SDK run: | - wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip - mkdir android-sdk-linux - unzip -qq android-sdk.zip -d android-sdk-linux - export ANDROID_HOME=./android-sdk-linux - echo y | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --update + wget --quiet --output-document=android-sdk.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip && \ + mkdir android-sdk-linux && unzip -qq android-sdk.zip -d android-sdk-linux && export ANDROID_HOME=./android-sdk-linux && echo y | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --update && \ (echo y; echo y; echo y; echo y; echo y; echo y; echo y; echo y) | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=android-sdk-linux --licenses + # Call SDKManager to install the Android NDK - name: Install Android NDK - run: $GITHUB_WORKSPACE/android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=$GITHUB_WORKSPACE/android-sdk-linux --install "ndk;24.0.8215888" --channel=3 + run: $GITHUB_WORKSPACE/android-sdk-linux/cmdline-tools/bin/sdkmanager --sdk_root=$GITHUB_WORKSPACE/android-sdk-linux --install "ndk;27.2.12479018" --channel=3 + # Setup build directory - name: Setup ${{ matrix.arch.name }} shell: bash run: | - cd $GITHUB_WORKSPACE/ - mkdir build - cd build - cmake -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-sdk-linux/ndk/24.0.8215888/build/cmake/android.toolchain.cmake \ - -DANDROID_ABI=${{ matrix.arch.name }} \ - -DANDROID_PLATFORM=android-24 \ - ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + cd $GITHUB_WORKSPACE/ && mkdir -p build && cd build && \ + cmake -DCMAKE_TOOLCHAIN_FILE=$GITHUB_WORKSPACE/android-sdk-linux/ndk/27.2.12479018/build/cmake/android.toolchain.cmake -DANDROID_ABI=${{ matrix.arch.name }} -DANDROID_PLATFORM=android-34 ../src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr + # Build - name: Build ${{ matrix.arch.name }} shell: bash From dca58720f9f31ea73bb11295adb5496fc926ce0a Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 12 Feb 2025 22:21:22 +0100 Subject: [PATCH 482/499] volk_gnsssdr: improve 64 bit host CPU detection --- .../volk_gnsssdr/lib/CMakeLists.txt | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 984822ede..9876f3f16 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -272,18 +272,33 @@ endif() ######################################################################## if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86) include(CheckTypeSize) - check_type_size("void*[8]" SIZEOF_CPU BUILTIN_TYPES_ONLY) - if(${SIZEOF_CPU} EQUAL 64) - overrule_arch(32 "CPU width is 64 bits") - endif() - if(${SIZEOF_CPU} EQUAL 32) - overrule_arch(64 "CPU width is 32 bits") + if(CMAKE_VERSION VERSION_LESS 3.10) + check_type_size("void*[8]" SIZEOF_CPU BUILTIN_TYPES_ONLY) + if(${SIZEOF_CPU} EQUAL 64) + overrule_arch(32 "CPU width is 64 bits") + endif() + if(${SIZEOF_CPU} EQUAL 32) + overrule_arch(64 "CPU width is 32 bits") + endif() + else() + cmake_host_system_information(RESULT ASSUME_64BIT_HOST QUERY IS_64BIT) + if(ASSUME_64BIT_HOST) + overrule_arch(32 "CPU width is 64 bits") + else() + overrule_arch(64 "CPU width is 32 bits") + endif() endif() # MSVC 64 bit does not have MMX, overrule it if(MSVC) - if(${SIZEOF_CPU} EQUAL 64) - overrule_arch(mmx "No MMX for Win64") + if(CMAKE_VERSION VERSION_LESS 3.10) + if(${SIZEOF_CPU} EQUAL 64) + overrule_arch(mmx "No MMX for Win64") + endif() + else() + if(ASSUME_64BIT_HOST) + overrule_arch(mmx "No MMX for Win64") + endif() endif() force_arch(sse "Built-in for MSVC > 2013") force_arch(sse2 "Built-in for MSVC > 2013") From 7615ac48ab919daee731ed93b6035d59ae8a63bd Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 13 Feb 2025 08:49:42 +0100 Subject: [PATCH 483/499] Fix CMake formatting --- .../libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt index 9876f3f16..7e8d6642f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/CMakeLists.txt @@ -297,8 +297,8 @@ if(NOT CROSSCOMPILE_MULTILIB AND CPU_IS_x86) endif() else() if(ASSUME_64BIT_HOST) - overrule_arch(mmx "No MMX for Win64") - endif() + overrule_arch(mmx "No MMX for Win64") + endif() endif() force_arch(sse "Built-in for MSVC > 2013") force_arch(sse2 "Built-in for MSVC > 2013") From a6daa5ad7e94a2ee910fe0dff980c8d3bf05c7f6 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Thu, 13 Feb 2025 13:19:00 +0100 Subject: [PATCH 484/499] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 98321b9f9..5b6970bcc 100644 --- a/README.md +++ b/README.md @@ -475,7 +475,7 @@ For more options, please check the #### Install [Pugixml](https://pugixml.org/ "Pugixml's Homepage"), a light-weight C++ XML processing library ``` -$ wget https://github.com/zeux/pugixml/releases/download/v1.14/pugixml-1.15.tar.gz +$ wget https://github.com/zeux/pugixml/releases/download/v1.15/pugixml-1.15.tar.gz $ tar xvfz pugixml-1.15.tar.gz $ cd pugixml-1.15 $ mkdir build && cd build From fa1e9209c5a4318d55388252bf671b17f69120be Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 16 Feb 2025 22:10:20 +0100 Subject: [PATCH 485/499] CMake: centralize find paths in a single file Improve Macports/Homebrew detection. Do not hardcode /opt/local or /opt/homebrew --- CMakeLists.txt | 50 +++++----- README.md | 7 +- cmake/Modules/AvoidAccelerate.cmake | 10 +- cmake/Modules/DetectMacOSVersion.cmake | 7 +- cmake/Modules/FindCPUFEATURES.cmake | 12 +-- cmake/Modules/FindGFLAGS.cmake | 15 ++- cmake/Modules/FindGFORTRAN.cmake | 4 +- cmake/Modules/FindGLOG.cmake | 21 ++--- cmake/Modules/FindGMP.cmake | 19 ++-- cmake/Modules/FindGNSSSIMULATOR.cmake | 9 +- cmake/Modules/FindGNSSTK.cmake | 22 ++--- cmake/Modules/FindGNUPLOT.cmake | 9 +- cmake/Modules/FindGNURADIO.cmake | 29 ++---- cmake/Modules/FindGOOGLETEST.cmake | 22 +++-- cmake/Modules/FindGPERFTOOLS.cmake | 30 ++---- cmake/Modules/FindGRDBFCTTC.cmake | 16 ++-- cmake/Modules/FindGRIIO.cmake | 22 ++--- cmake/Modules/FindGRLIMESDR.cmake | 14 ++- cmake/Modules/FindGROSMOSDR.cmake | 14 ++- cmake/Modules/FindLIBAD9361.cmake | 14 ++- cmake/Modules/FindLIBIIO.cmake | 14 ++- cmake/Modules/FindLIBUNWIND.cmake | 20 +--- cmake/Modules/FindLOG4CPP.cmake | 18 ++-- cmake/Modules/FindMATIO.cmake | 8 +- cmake/Modules/FindORC.cmake | 45 ++------- cmake/Modules/FindPCAP.cmake | 12 +-- cmake/Modules/FindPUGIXML.cmake | 22 ++--- cmake/Modules/FindTELEORBIT.cmake | 16 ++-- cmake/Modules/FindUHD.cmake | 14 ++- cmake/Modules/FindVOLK.cmake | 14 ++- cmake/Modules/FindVOLKGNSSSDR.cmake | 16 ++-- cmake/Modules/FindZEROMQ.cmake | 16 ++-- cmake/Modules/GnsssdrCrypto.cmake | 9 +- cmake/Modules/GnsssdrFindPaths.cmake | 93 +++++++++++++++++++ cmake/Modules/GnsssdrLibPaths.cmake | 43 --------- docs/CHANGELOG.md | 1 + .../conditioner/adapters/CMakeLists.txt | 7 ++ .../volk_gnsssdr/CMakeLists.txt | 1 + .../cmake/Modules/DetectMacOSPackaging.cmake | 26 ++++++ .../cmake/Modules/FindCPUFEATURES.cmake | 46 ++------- .../volk_gnsssdr/cmake/Modules/FindORC.cmake | 82 +++------------- .../cmake/Modules/VolkGnsssdrFindPaths.cmake | 80 ++++++++++++++++ src/main/CMakeLists.txt | 9 +- tests/CMakeLists.txt | 2 +- utils/front-end-cal/CMakeLists.txt | 8 +- utils/rinex2assist/CMakeLists.txt | 4 +- 46 files changed, 471 insertions(+), 501 deletions(-) create mode 100644 cmake/Modules/GnsssdrFindPaths.cmake delete mode 100644 cmake/Modules/GnsssdrLibPaths.cmake create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/DetectMacOSPackaging.cmake create mode 100644 src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkGnsssdrFindPaths.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ca872b2a9..44cff2978 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -611,9 +611,9 @@ set_package_properties(Threads PROPERTIES ################################################################################ -# Set GNSSSDR_LIB_PATHS +# Set GNSSSDR_LIB_PATHS and GNSSSDR_INCLUDE_PATHS ################################################################################ -include(GnsssdrLibPaths) +include(GnsssdrFindPaths) @@ -2234,21 +2234,21 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) # Fix for macOS find_library(ARPACK_LIBRARY NAMES arpack - PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /opt/local/lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 + PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} ${GNSSSDR_LIB_PATHS} ) if(ARPACK_LIBRARY) target_link_libraries(Armadillo::armadillo INTERFACE ${ARPACK_LIBRARY}) endif() find_library(FLEXIBLAS_LIBRARY NAMES flexiblas - PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /opt/local/lib /lib64 /lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 + PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} ${GNSSSDR_LIB_PATHS} ) if(FLEXIBLAS_LIBRARY) target_link_libraries(Armadillo::armadillo INTERFACE ${FLEXIBLAS_LIBRARY}) endif() find_library(SUPERLU_LIBRARY NAMES superlu - PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} /opt/local/lib /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/local/lib64 + PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} ${GNSSSDR_LIB_PATHS} ) if(SUPERLU_LIBRARY) target_link_libraries(Armadillo::armadillo INTERFACE ${SUPERLU_LIBRARY}) @@ -2375,23 +2375,23 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR - (NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal)) + if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS ${MACOS_PACKAGES_PREFIX}/bin/glibtoolize) OR + (NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS ${MACOS_PACKAGES_PREFIX}/bin/aclocal)) message(" libtool/automake tools have not been found.") message(" You can try to install them by typing:") message(" 'sudo port install libtool automake', if you use Macports, or 'brew install libtool automake', if you use Homebrew") message(FATAL_ERROR "libtool/automake tools are required to build matio from source") endif() if(CMAKE_GENERATOR STREQUAL Xcode) - if(EXISTS /opt/local/bin/glibtoolize OR EXISTS /opt/local/bin/aclocal) + if(EXISTS ${MACOS_PACKAGES_PREFIX}/bin/glibtoolize OR EXISTS ${MACOS_PACKAGES_PREFIX}/bin/aclocal) if(NOT EXISTS /usr/local/bin/glibtoolize OR NOT EXISTS /usr/local/bin/aclocal) message(" WARNING: libtool/atomake binaries cannot be found by Xcode. Please do:") - message("sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/") - message("sudo ln -s /opt/local/bin/aclocal /usr/local/bin/") - message("sudo ln -s /opt/local/bin/autom4te /usr/local/bin/") - message("sudo ln -s /opt/local/bin/automake /usr/local/bin/") - message("sudo ln -s /opt/local/bin/autoconf /usr/local/bin/") - message("sudo ln -s /opt/local/bin/autoreconf /usr/local/bin/") # not needed by Matio, but by Protocol Buffers + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/glibtoolize /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/aclocal /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/autom4te /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/automake /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/autoconf /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/autoreconf /usr/local/bin/") # not needed by Matio, but by Protocol Buffers message(FATAL_ERROR "libtool/automake tools cannot be found by Xcode") endif() endif() @@ -2402,8 +2402,8 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS get_filename_component(HDF5_BASE_DIR2 ${HDF5_FIRST_DIR} DIRECTORY) get_filename_component(HDF5_BASE_DIR ${HDF5_BASE_DIR2} DIRECTORY) if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if(EXISTS /opt/local/include/hdf5.h) - set(HDF5_BASE_DIR /opt/local) + if(EXISTS ${MACOS_PACKAGES_PREFIX}/include/hdf5.h) + set(HDF5_BASE_DIR ${MACOS_PACKAGES_PREFIX}) endif() if(EXISTS /usr/local/include/hdf5.h) set(HDF5_BASE_DIR /usr/local) @@ -2785,23 +2785,23 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS /opt/local/bin/glibtoolize) OR - (NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS /opt/local/bin/aclocal)) + if((NOT EXISTS /usr/local/bin/glibtoolize AND NOT EXISTS ${MACOS_PACKAGES_PREFIX}/bin/glibtoolize) OR + (NOT EXISTS /usr/local/bin/aclocal AND NOT EXISTS ${MACOS_PACKAGES_PREFIX}/bin/aclocal)) message(" libtool/automake tools have not been found.") message(" You can try to install them by typing:") message(" 'sudo port install libtool automake', if you use Macports, or 'brew install libtool automake', if you use Homebrew") message(FATAL_ERROR "libtool/automake tools are required to build Protocol Buffers from source") endif() if(CMAKE_GENERATOR STREQUAL Xcode) - if(EXISTS /opt/local/bin/glibtoolize OR EXISTS /opt/local/bin/aclocal) + if(EXISTS ${MACOS_PACKAGES_PREFIX}/bin/glibtoolize OR EXISTS ${MACOS_PACKAGES_PREFIX}/bin/aclocal) if(NOT EXISTS /usr/local/bin/glibtoolize OR NOT EXISTS /usr/local/bin/aclocal) message(" WARNING: libtool/automake binaries cannot be found by Xcode. Please do:") - message("sudo ln -s /opt/local/bin/glibtoolize /usr/local/bin/") - message("sudo ln -s /opt/local/bin/aclocal /usr/local/bin/") - message("sudo ln -s /opt/local/bin/autom4te /usr/local/bin/") - message("sudo ln -s /opt/local/bin/automake /usr/local/bin/") - message("sudo ln -s /opt/local/bin/autoconf /usr/local/bin/") - message("sudo ln -s /opt/local/bin/autoreconf /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/glibtoolize /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/aclocal /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/autom4te /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/automake /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/autoconf /usr/local/bin/") + message("sudo ln -s ${MACOS_PACKAGES_PREFIX}/bin/autoreconf /usr/local/bin/") message(FATAL_ERROR "libtool/automake tools cannot be found by Xcode") endif() endif() diff --git a/README.md b/README.md index 5b6970bcc..9e304e36f 100644 --- a/README.md +++ b/README.md @@ -127,13 +127,14 @@ This section describes how to set up the compilation environment in GNU/Linux or - Tested distributions: Ubuntu 14.04 LTS and above; Debian 9.0 "stretch" and above; Arch Linux; Fedora 26 and above; OpenSUSE 42.3 and above. - Supported microprocessor architectures: - - i386: Intel x86 instruction set (32-bit microprocessors). - amd64: also known as x86-64, the 64-bit version of the x86 instruction set, originally created by AMD and implemented by AMD, Intel, VIA, and others. - armel: ARM embedded ABI, supported on ARM v4t and higher. - armhf: ARM hard float, ARMv7 + VFP3-D16 floating-point hardware extension + Thumb-2 instruction set and above. - - arm64: ARM 64 bits or ARMv8. + - arm64: ARM 64 bits or ARMv8. Also known as AArch64. + - i386: Intel x86 instruction set (32-bit microprocessors). + - loong64: 64-bit version of LoongArch, a RISC-style instruction set architecture developed by Loongson Technology. - mips: MIPS architecture (big-endian, such as those manufactured by SGI). - mipsel: MIPS architecture (little-endian, such as Loongson 3). - mips64el: 64-bit version of MIPS architecture. @@ -792,7 +793,7 @@ $ sudo port selfupdate $ sudo port upgrade outdated $ sudo port install armadillo cmake pkgconfig protobuf3-cpp pugixml openssl3 $ sudo port install gnuradio +uhd +grc +zeromq -$ sudo port install boost matio libad9361-iio libiio +$ sudo port install boost matio libad9361-iio libiio abseil $ sudo port install py313-mako $ sudo port install doxygen +docs ``` diff --git a/cmake/Modules/AvoidAccelerate.cmake b/cmake/Modules/AvoidAccelerate.cmake index 5d052296d..27d9bd6b5 100644 --- a/cmake/Modules/AvoidAccelerate.cmake +++ b/cmake/Modules/AvoidAccelerate.cmake @@ -7,6 +7,10 @@ # Avoid using the BLAS and LAPACK implementations that comes with the Accelerate # framework, which causes a bug when the BeiDou constellation is enabled +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + if(NOT BLAS_ROOT) set(BLAS_ROOT_USER_DEFINED /usr/local/lib) else() @@ -24,8 +28,8 @@ find_library(BLAS_LIBRARIES PATHS ${BLAS_ROOT_USER_DEFINED} ${BLAS_ROOT_USER_DEFINED}/lapack - /opt/local/lib/lapack - /opt/local/lib/ + ${GNSSSDR_LIB_PATHS}/lapack + ${GNSSSDR_LIB_PATHS} /usr/local/opt/lapack/lib /opt/homebrew/opt/lapack/lib NO_DEFAULT_PATH @@ -46,7 +50,7 @@ find_library(LAPACK_LIBRARIES PATHS ${BLAS_ROOT_USER_DEFINED} ${BLAS_ROOT_USER_DEFINED}/lapack - /opt/local/lib/lapack + ${GNSSSDR_LIB_PATHS}/lapack /usr/local/opt/lapack/lib /opt/homebrew/opt/lapack/lib NO_DEFAULT_PATH diff --git a/cmake/Modules/DetectMacOSVersion.cmake b/cmake/Modules/DetectMacOSVersion.cmake index c66491c94..361d3422f 100644 --- a/cmake/Modules/DetectMacOSVersion.cmake +++ b/cmake/Modules/DetectMacOSVersion.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause execute_process(COMMAND uname -v OUTPUT_VARIABLE DARWIN_VERSION) @@ -78,6 +78,7 @@ if(NOT MACOS_DISTRIBUTION) set(MACOS_DISTRIBUTION "macOS (Unknown version)") endif() +set(MACOS_PACKAGES_PREFIX "") # Detect if MacPorts is installed on this system; if so, return base path and version execute_process(COMMAND which port RESULT_VARIABLE DETECT_MACPORTS OUTPUT_VARIABLE MACPORTS_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) if(${DETECT_MACPORTS} EQUAL 0) @@ -87,6 +88,7 @@ if(${DETECT_MACPORTS} EQUAL 0) get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY) execute_process(COMMAND port version RESULT_VARIABLE DETECT_MACPORTS_VERSION OUTPUT_VARIABLE MACPORTS_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" MACPORTS_VERSION "${MACPORTS_VERSION}") + set(MACOS_PACKAGES_PREFIX ${MACPORTS_PREFIX}) endif() # Detect if Homebrew is installed on this system; if so, return base path and version @@ -94,4 +96,5 @@ execute_process(COMMAND brew --prefix RESULT_VARIABLE DETECT_HOMEBREW OUTPUT_VAR if(${DETECT_HOMEBREW} EQUAL 0) execute_process(COMMAND brew --version RESULT_VARIABLE DETECT_HOMEBREW_VERSION OUTPUT_VARIABLE HOMEBREW_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" HOMEBREW_VERSION "${HOMEBREW_VERSION}") -endif() \ No newline at end of file + set(MACOS_PACKAGES_PREFIX ${HOMEBREW_PREFIX}) +endif() diff --git a/cmake/Modules/FindCPUFEATURES.cmake b/cmake/Modules/FindCPUFEATURES.cmake index 6f4f0e58f..89587e6eb 100644 --- a/cmake/Modules/FindCPUFEATURES.cmake +++ b/cmake/Modules/FindCPUFEATURES.cmake @@ -1,13 +1,13 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2021-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause set(FPHSA_NAME_MISMATCHED ON) if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) + include(GnsssdrFindPaths) endif() find_library(CPUFEATURES_LIBRARIES @@ -18,13 +18,7 @@ find_library(CPUFEATURES_LIBRARIES find_path(CPUFEATURES_INCLUDE_DIR cpu_features_macros.h PATHS $ENV{CPUFEATURES_DIR}/include $ENV{CPUFEATURES_DIR} - /usr/include - /usr/local/include - ~/Library/Frameworks - /Library/Frameworks - /sw/include # Fink - /opt/local/include # MacPorts - /opt/csw/include # Blastwave + ${GNSSSDR_INCLUDE_PATHS} PATH_SUFFIXES cpu_features ) diff --git a/cmake/Modules/FindGFLAGS.cmake b/cmake/Modules/FindGFLAGS.cmake index cbfa07cd3..afc7ebb68 100644 --- a/cmake/Modules/FindGFLAGS.cmake +++ b/cmake/Modules/FindGFLAGS.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # - Try to find GFlags @@ -26,7 +26,7 @@ if(NOT COMMAND feature_summary) endif() if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) + include(GnsssdrFindPaths) endif() if(NOT GFLAGS_ROOT) @@ -46,9 +46,8 @@ if(APPLE) libgflags.dylib PATHS ${GFLAGS_ROOT_USER_PROVIDED}/lib - /usr/local/lib - /opt/local/lib - /opt/homebrew/opt/gflags/lib + ${GNSSSDR_LIB_PATHS} + ${GNSSSDR_LIB_PATHS}/opt/gflags/lib ) else() find_path(GFlags_ROOT_DIR @@ -68,10 +67,8 @@ if(GFlags_ROOT_DIR) PATHS ${GFlags_ROOT_DIR}/src ${GFLAGS_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include - /opt/homebrew/opt/gflags/include + ${GNSSSDR_INCLUDE_PATHS} + ${GNSSSDR_INCLUDE_PATHS}/opt/gflags/include ) # Find the libraries diff --git a/cmake/Modules/FindGFORTRAN.cmake b/cmake/Modules/FindGFORTRAN.cmake index 26764a688..c6e175b41 100644 --- a/cmake/Modules/FindGFORTRAN.cmake +++ b/cmake/Modules/FindGFORTRAN.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause if(NOT COMMAND feature_summary) @@ -9,7 +9,7 @@ if(NOT COMMAND feature_summary) endif() if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) + include(GnsssdrFindPaths) endif() if(NOT GFORTRAN_ROOT) diff --git a/cmake/Modules/FindGLOG.cmake b/cmake/Modules/FindGLOG.cmake index 8f6c880a0..ef7878a10 100644 --- a/cmake/Modules/FindGLOG.cmake +++ b/cmake/Modules/FindGLOG.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # - Try to find the Google Glog library @@ -24,14 +24,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + if(NOT DEFINED GLOG_ROOT) set(GLOG_ROOT /usr /usr/local) endif() @@ -74,7 +74,7 @@ if(MSVC) ${PC_GLOG_INCLUDEDIR} PATHS ${GLOG_ROOT}/src/windows - ${GLOG_ROOT}/src/windows/glog + PATH_SUFFIXES glog ) else() # Linux/OS X builds @@ -82,11 +82,10 @@ else() HINTS ${PC_GLOG_INCLUDEDIR} PATHS - /usr/include/glog - /usr/local/include/glog - /opt/local/include/glog # default location in Macports - /opt/homebrew/opt/glog/include/glog - ${GLOG_ROOT}/include/glog + ${GNSSSDR_INCLUDE_PATHS} + ${GNSSSDR_INCLUDE_PATHS}/opt/glog/include + ${GLOG_ROOT}/include + PATH_SUFFIXES glog ) endif() diff --git a/cmake/Modules/FindGMP.cmake b/cmake/Modules/FindGMP.cmake index 3f4db49c6..840324f44 100644 --- a/cmake/Modules/FindGMP.cmake +++ b/cmake/Modules/FindGMP.cmake @@ -1,31 +1,28 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2024-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() pkg_check_modules(PC_GMP "gmp") +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + set(GMP_DEFINITIONS ${PC_GMP_CFLAGS_OTHER}) find_path(GMP_INCLUDE_DIR NAMES gmpxx.h HINTS ${PC_GMP_INCLUDEDIR} - PATHS ${CMAKE_INSTALL_PREFIX}/include - /usr/local/include - /usr/include - /opt/local/include + PATHS ${GNSSSDR_INCLUDE_PATHS} ) set(GMP_INCLUDE_DIRS ${GMP_INCLUDE_DIR}) @@ -35,16 +32,12 @@ find_library(GMPXX_LIBRARY NAMES gmpxx HINTS ${PC_GMP_LIBDIR} PATHS ${GNSSSDR_LIB_PATHS} - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 ) find_library(GMP_LIBRARY NAMES gmp HINTS ${PC_GMP_LIBDIR} PATHS ${GNSSSDR_LIB_PATHS} - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 ) set(GMP_LIBRARIES ${GMPXX_LIBRARY} ${GMP_LIBRARY}) diff --git a/cmake/Modules/FindGNSSSIMULATOR.cmake b/cmake/Modules/FindGNSSSIMULATOR.cmake index 6a193746d..abeee05ce 100644 --- a/cmake/Modules/FindGNSSSIMULATOR.cmake +++ b/cmake/Modules/FindGNSSSIMULATOR.cmake @@ -1,9 +1,13 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2021 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + if(GNSSSIMULATOR_ROOT) set(GNSSSIMULATOR_ROOT_USER_DEFINED ${GNSSSIMULATOR_ROOT}) else() @@ -25,7 +29,8 @@ find_program(SW_GENERATOR_BIN gnss_sim ${GNSSSIMULATOR_ROOT_USER_DEFINED} /usr /usr/local - /opt/local + ${CMAKE_SYSTEM_PREFIX_PATH} + ${CMAKE_INSTALL_FULL_BINDIR} PATH_SUFFIXES bin ONLY_CMAKE_FIND_ROOT_PATH ) diff --git a/cmake/Modules/FindGNSSTK.cmake b/cmake/Modules/FindGNSSTK.cmake index e810ebee7..d49a1bc53 100644 --- a/cmake/Modules/FindGNSSTK.cmake +++ b/cmake/Modules/FindGNSSTK.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2022-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # - Find gnsstk library @@ -19,6 +19,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + if(NOT GNSSTK_ROOT) set(GNSSTK_ROOT_USER_DEFINED /usr/local) else() @@ -35,17 +39,13 @@ unset(GNSSTK_INCLUDE_DIR CACHE) unset(GNSSTK_USES_GPSTK_NAMESPACE CACHE) find_path(GNSSTK_INCLUDE_DIR gnsstk/Rinex3ObsBase.hpp PATHS ${GNSSTK_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) set(GNSSTK_NAMES ${CMAKE_FIND_LIBRARY_PREFIXES}gnsstk${CMAKE_SHARED_LIBRARY_SUFFIX}) if(NOT GNSSTK_INCLUDE_DIR) find_path(GNSSTK_INCLUDE_DIR gpstk/Rinex3ObsBase.hpp PATHS ${GNSSTK_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) if(GNSSTK_INCLUDE_DIR) set(GNSSTK_NAMES gpstk ${CMAKE_FIND_LIBRARY_PREFIXES}gpstk${CMAKE_SHARED_LIBRARY_SUFFIX}) @@ -56,12 +56,8 @@ endif() include(GNUInstallDirs) find_library(GNSSTK_LIBRARY NAMES ${GNSSTK_NAMES} - PATHS ${GNSSTK_ROOT_USER_DEFINED}/lib - ${GNSSTK_ROOT_USER_DEFINED}/${CMAKE_INSTALL_LIBDIR} - /usr/local/lib - /usr/${CMAKE_INSTALL_LIBDIR} - /usr/local/${CMAKE_INSTALL_LIBDIR} - /opt/local/lib + PATHS ${GNSSTK_ROOT_USER_DEFINED}/${CMAKE_INSTALL_LIBDIR} + ${GNSSSDR_LIB_PATHS} ) if(GNSSTK_LIBRARY AND GNSSTK_INCLUDE_DIR) diff --git a/cmake/Modules/FindGNUPLOT.cmake b/cmake/Modules/FindGNUPLOT.cmake index c464bc6b6..dbbcd04f7 100644 --- a/cmake/Modules/FindGNUPLOT.cmake +++ b/cmake/Modules/FindGNUPLOT.cmake @@ -1,18 +1,19 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2021-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() find_program(GNUPLOT_EXECUTABLE NAMES gnuplot pgnuplot PATHS - /usr/bin - /usr/local/bin - /opt/local/bin + ${GNSSSDR_BIN_PATHS} ONLY_CMAKE_FIND_ROOT_PATH ) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index d976d0e28..01553d725 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2022 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause ######################################################################## @@ -12,14 +12,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + include(FindPackageHandleStandardArgs) # if GR_REQUIRED_COMPONENTS is not defined, it will be set to the following list @@ -97,9 +97,7 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE) NAMES ${INCFILE} HINTS ${PC_INCDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) # look for libs @@ -107,8 +105,7 @@ function(GR_MODULE EXTVAR PCNAME INCFILE LIBFILE) find_library(${LIBVAR_NAME}_${libname} NAMES ${libname} ${libname}-${PC_GNURADIO_RUNTIME_VERSION} HINTS ${PC_LIBDIR} - PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib - ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/lib64 + PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/${CMAKE_INSTALL_LIBDIR} ${GNSSSDR_LIB_PATHS} ) list(APPEND ${LIBVAR_NAME} ${${LIBVAR_NAME}_${libname}}) @@ -197,9 +194,7 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION) find_file(GNURADIO_VERSION_GREATER_THAN_373 NAMES gnuradio/blocks/tsb_vector_sink_f.h PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) if(GNURADIO_VERSION_GREATER_THAN_373) set(PC_GNURADIO_RUNTIME_VERSION "3.7.4+") @@ -208,9 +203,7 @@ if(NOT PC_GNURADIO_RUNTIME_VERSION) find_file(GNURADIO_VERSION_GREATER_THAN_38 NAMES gnuradio/filter/mmse_resampler_cc.h PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) if(GNURADIO_VERSION_GREATER_THAN_38) set(PC_GNURADIO_RUNTIME_VERSION "3.8.0+") @@ -278,9 +271,7 @@ if(GNURADIO_VERSION VERSION_GREATER 3.8.99) NAMES gnuradio/iio/api.h HINTS ${PC_GNURADIO_IIO_INCLUDEDIR} PATHS ${GNURADIO_INSTALL_PREFIX_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) # look for libs diff --git a/cmake/Modules/FindGOOGLETEST.cmake b/cmake/Modules/FindGOOGLETEST.cmake index cf47a7062..268d8580a 100644 --- a/cmake/Modules/FindGOOGLETEST.cmake +++ b/cmake/Modules/FindGOOGLETEST.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause @@ -23,6 +23,10 @@ if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_GTEST gtest) if(NOT GTEST_DIR) @@ -44,10 +48,11 @@ find_path(LIBGTEST_DEV_DIR ${GTEST_DIR_USER_PROVIDED}/googletest /usr/src/googletest/googletest /usr/src/gtest - /usr/include/gtest - /usr/local/src/googletest/googletest - /opt/local/src/gtest-1.7.0 - /opt/homebrew/opt/googletest/include/googletest/googletest + ${GNSSSDR_INCLUDE_PATHS}/gtest + ${GNSSSDR_INCLUDE_PATHS}/googletest + ${CMAKE_SYSTEM_PREFIX_PATH}/src/googletest/googletest + ${CMAKE_SYSTEM_PREFIX_PATH}/src/gtest-1.7.0 + ${CMAKE_SYSTEM_PREFIX_PATH}/opt/googletest/include/googletest/googletest ) find_path(GTEST_INCLUDE_DIRS @@ -55,10 +60,9 @@ find_path(GTEST_INCLUDE_DIRS HINTS ${PC_GTEST_INCLUDEDIR} PATHS ${GTEST_DIR_USER_PROVIDED}/googletest/include - /usr/include - /usr/local/include - /opt/local/src/gtest-1.7.0/include - /opt/homebrew/opt/googletest/include + ${GNSSSDR_INCLUDE_PATHS} + ${CMAKE_SYSTEM_PREFIX_PATH}/src/gtest-1.7.0/include + ${CMAKE_SYSTEM_PREFIX_PATH}/opt/googletest/include ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGPERFTOOLS.cmake b/cmake/Modules/FindGPERFTOOLS.cmake index 4d6dd135b..63516e9a2 100644 --- a/cmake/Modules/FindGPERFTOOLS.cmake +++ b/cmake/Modules/FindGPERFTOOLS.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # Tries to find Gperftools. @@ -33,6 +33,10 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + if(NOT GPERFTOOLS_ROOT) set(GPERFTOOLS_ROOT_USER_DEFINED /usr/local) else() @@ -56,41 +60,27 @@ find_library(GPERFTOOLS_TCMALLOC NAMES tcmalloc PATHS ${GPERFTOOLS_ROOT_USER_DEFINED}/lib ${GPERFTOOLS_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(GPERFTOOLS_PROFILER NAMES profiler PATHS ${GPERFTOOLS_ROOT_USER_DEFINED}/lib ${GPERFTOOLS_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER NAMES tcmalloc_and_profiler PATHS ${GPERFTOOLS_ROOT_USER_DEFINED}/lib ${GPERFTOOLS_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) find_path(GPERFTOOLS_INCLUDE_DIR NAMES gperftools/heap-profiler.h - PATHS /usr/include - /usr/local/include - /opt/local/include - ${GPERFTOOLS_ROOT_USER_DEFINED}/include + PATHS ${GPERFTOOLS_ROOT_USER_DEFINED}/include + ${GNSSSDR_INCLUDE_PATHS} ) set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER}) diff --git a/cmake/Modules/FindGRDBFCTTC.cmake b/cmake/Modules/FindGRDBFCTTC.cmake index 72bbe8d90..09a4bbd2b 100644 --- a/cmake/Modules/FindGRDBFCTTC.cmake +++ b/cmake/Modules/FindGRDBFCTTC.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause ######################################################################## @@ -17,6 +17,10 @@ if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_GR_DBFCTTC gr-dbfcttc) if(NOT GRDBFCTTC_ROOT) @@ -46,9 +50,7 @@ find_path( NAMES dbfcttc/api.h HINTS ${PC_GR_DBFCTTC_INCLUDEDIR} PATHS ${GRDBFCTTC_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library( @@ -57,11 +59,7 @@ find_library( HINTS ${PC_GR_DBFCTTC_LIBDIR} PATHS ${GRDBFCTTC_ROOT_USER_DEFINED}/lib ${GRDBFCTTC_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindGRIIO.cmake b/cmake/Modules/FindGRIIO.cmake index 6a4352fc0..600401c42 100644 --- a/cmake/Modules/FindGRIIO.cmake +++ b/cmake/Modules/FindGRIIO.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -13,14 +13,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_IIO gnuradio-iio) if(NOT GRIIO_ROOT) @@ -28,31 +28,31 @@ if(NOT GRIIO_ROOT) else() set(GRIIO_ROOT_USER_DEFINED ${GRIIO_ROOT}) endif() + if(DEFINED ENV{GRIIO_ROOT}) set(GRIIO_ROOT_USER_DEFINED ${GRIIO_ROOT_USER_DEFINED} $ENV{GRIIO_ROOT} ) endif() + if(DEFINED ENV{IIO_DIR}) set(GRIIO_ROOT_USER_DEFINED ${GRIIO_ROOT_USER_DEFINED} $ENV{IIO_DIR} ) endif() + set(GRIIO_ROOT_USER_DEFINED ${GRIIO_ROOT_USER_DEFINED} ${CMAKE_INSTALL_PREFIX} ) - find_path(IIO_INCLUDE_DIRS NAMES gnuradio/iio/api.h HINTS ${PC_IIO_INCLUDEDIR} PATHS ${GRIIO_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) if(IIO_INCLUDE_DIRS) @@ -62,9 +62,7 @@ else() NAMES iio/api.h HINTS ${PC_IIO_INCLUDEDIR} PATHS ${GRIIO_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) set(GR_IIO_INCLUDE_HAS_GNURADIO FALSE) endif() diff --git a/cmake/Modules/FindGRLIMESDR.cmake b/cmake/Modules/FindGRLIMESDR.cmake index a0ca9a565..ff4615a14 100644 --- a/cmake/Modules/FindGRLIMESDR.cmake +++ b/cmake/Modules/FindGRLIMESDR.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # Tries to find gr-limesdr. @@ -31,14 +31,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(GRLIMESDR_PKG QUIET gnuradio-limesdr) if(NOT GRLIMESDR_ROOT) @@ -61,9 +61,7 @@ find_path(GRLIMESDR_INCLUDE_DIR ${GRLIMESDR_PKG_INCLUDEDIR} PATHS ${GRLIMESDR_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(GRLIMESDR_LIBRARIES diff --git a/cmake/Modules/FindGROSMOSDR.cmake b/cmake/Modules/FindGROSMOSDR.cmake index 15a36c32b..5184fb548 100644 --- a/cmake/Modules/FindGROSMOSDR.cmake +++ b/cmake/Modules/FindGROSMOSDR.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # Tries to find gr-osmosdr. @@ -31,14 +31,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(GROSMOSDR_PKG gnuradio-osmosdr) if(NOT GROSMOSDR_ROOT) @@ -61,9 +61,7 @@ find_path(GROSMOSDR_INCLUDE_DIR ${GROSMOSDR_PKG_INCLUDEDIR} PATHS ${GROSMOSDR_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(GROSMOSDR_LIBRARIES diff --git a/cmake/Modules/FindLIBAD9361.cmake b/cmake/Modules/FindLIBAD9361.cmake index 175a81af2..55fcd6e58 100644 --- a/cmake/Modules/FindLIBAD9361.cmake +++ b/cmake/Modules/FindLIBAD9361.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -13,14 +13,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_LIBAD9361 libad9361) if(NOT LIBAD9361_ROOT) @@ -43,9 +43,7 @@ find_path(LIBAD9361_INCLUDE_DIRS NAMES ad9361.h HINTS ${PC_LIBAD9361_INCLUDEDIR} PATHS ${LIBAD9361_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(LIBAD9361_LIBRARIES diff --git a/cmake/Modules/FindLIBIIO.cmake b/cmake/Modules/FindLIBIIO.cmake index add9215de..83aab4b81 100644 --- a/cmake/Modules/FindLIBIIO.cmake +++ b/cmake/Modules/FindLIBIIO.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -13,14 +13,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_LIBIIO libiio) if(NOT LIBIIO_ROOT) @@ -44,9 +44,7 @@ find_path( NAMES iio.h HINTS ${PC_LIBIIO_INCLUDEDIR} PATHS ${LIBIIO_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library( diff --git a/cmake/Modules/FindLIBUNWIND.cmake b/cmake/Modules/FindLIBUNWIND.cmake index b5c6a68a8..8d6adbada 100644 --- a/cmake/Modules/FindLIBUNWIND.cmake +++ b/cmake/Modules/FindLIBUNWIND.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2022 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2022-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # Find the libunwind library @@ -18,30 +18,22 @@ if(NOT COMMAND feature_summary) endif() if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) + include(GnsssdrFindPaths) endif() find_path(LIBUNWIND_INCLUDE_DIR NAMES libunwind.h unwind.h - HINTS - /usr - /usr/local - /opt/local PATH_SUFFIXES include PATHS "${LIBUNWIND_ROOT}/include" + ${GNSSSDR_INCLUDE_PATHS} ) find_library(LIBUNWIND_GENERIC_LIBRARY NAMES libunwind unwind - HINTS - /usr - /usr/local - /opt/local - PATH_SUFFIXES lib lib64 PATHS "${LIBUNWIND_ROOT}/lib" "${LIBUNWIND_ROOT}/lib64" @@ -75,12 +67,8 @@ if(LIBUNWIND_INCLUDE_DIR) NAMES libunwind-${LIBUNWIND_ARCH} "unwind-${LIBUNWIND_ARCH}" - HINTS - /usr - /usr/local - /opt/local - PATH_SUFFIXES lib lib64 PATHS "${LIBUNWIND_ROOT}" + ${GNSSSDR_LIB_PATHS} ) if(NOT LIBUNWIND_SPECIFIC_LIBRARY) message(STATUS " -- Failed to find unwind-${LIBUNWIND_ARCH}") diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index f351ebf3a..d6d5eb9b4 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # - Find Log4cpp @@ -19,14 +19,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_LOG4CPP log4cpp QUIET) if(LOG4CPP_INCLUDE_DIR) @@ -52,9 +52,7 @@ set(LOG4CPP_ROOT_USER_PROVIDED find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh ${LOG4CPP_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ${PC_LOG4CPP_INCLUDEDIR} ) @@ -77,8 +75,8 @@ find_library(LOG4CPP_LIBRARY NAMES ${LOG4CPP_NAMES} HINTS ${PC_LOG4CPP_LIBDIR} PATHS ${LOG4CPP_ROOT_USER_PROVIDED}/lib - ${LOG4CPP_ROOT_USER_PROVIDED}/lib64 - ${GNSSSDR_LIB_PATHS} + ${LOG4CPP_ROOT_USER_PROVIDED}/lib64 + ${GNSSSDR_LIB_PATHS} ) if(LOG4CPP_INCLUDE_DIR AND LOG4CPP_LIBRARY) diff --git a/cmake/Modules/FindMATIO.cmake b/cmake/Modules/FindMATIO.cmake index 73f8d053d..da256e21f 100644 --- a/cmake/Modules/FindMATIO.cmake +++ b/cmake/Modules/FindMATIO.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # FindMATIO @@ -56,7 +56,7 @@ if(NOT COMMAND feature_summary) endif() if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) + include(GnsssdrFindPaths) endif() if(NOT MATIO_ROOT) @@ -76,9 +76,7 @@ find_path(MATIO_INCLUDE_DIR NAMES matio.h PATHS ${MATIO_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include DOC "The MATIO include directory" ) diff --git a/cmake/Modules/FindORC.cmake b/cmake/Modules/FindORC.cmake index 600d0ac35..e16632c2b 100644 --- a/cmake/Modules/FindORC.cmake +++ b/cmake/Modules/FindORC.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause if(DEFINED __INCLUDED_GNSSSDR_CMAKE_FIND_ORC) @@ -13,14 +13,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_ORC "orc-0.4 > 0.4.22") if(NOT ORC_ROOT) @@ -47,18 +47,14 @@ endif() find_program(ORCC_EXECUTABLE orcc HINTS ${ORC_ROOT_USER_PROVIDED}/bin - PATHS /usr/bin - /usr/local/bin - /opt/local/bin + PATHS ${CMAKE_SYSTEM_PREFIX_PATH}/bin ) find_path(ORC_INCLUDE_DIR NAMES orc/orc.h HINTS ${PC_ORC_INCLUDEDIR} PATHS ${ORC_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} PATH_SUFFIXES orc-0.4 ) @@ -67,8 +63,6 @@ find_path(ORC_LIBRARY_DIR HINTS ${PC_ORC_LIBDIR} PATHS ${ORC_ROOT_USER_PROVIDED}/lib ${ORC_ROOT_USER_PROVIDED}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 ${GNSSSDR_LIB_PATHS} ) @@ -76,8 +70,6 @@ find_library(ORC_LIB orc-0.4 HINTS ${PC_ORC_LIBRARY_DIRS} PATHS ${ORC_ROOT_USER_PROVIDED}/lib ${ORC_ROOT_USER_PROVIDED}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 ${GNSSSDR_LIB_PATHS} ) @@ -85,30 +77,9 @@ find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STA HINTS ${PC_ORC_LIBRARY_DIRS} PATHS ${ORC_ROOT}/lib ${ORC_ROOT}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 ${ORC_ROOT_USER_PROVIDED}/lib ${ORC_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) if(PC_ORC_VERSION) diff --git a/cmake/Modules/FindPCAP.cmake b/cmake/Modules/FindPCAP.cmake index 2a3db3aff..aba931218 100644 --- a/cmake/Modules/FindPCAP.cmake +++ b/cmake/Modules/FindPCAP.cmake @@ -23,14 +23,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_PCAP libpcap QUIET) if(NOT PCAP_ROOT) @@ -81,9 +81,7 @@ else() ${PC_PCAP_INCLUDEDIR} PATHS ${PCAP_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(PCAP_LIBRARY NAMES diff --git a/cmake/Modules/FindPUGIXML.cmake b/cmake/Modules/FindPUGIXML.cmake index 4ff6419cc..6c6b34a63 100644 --- a/cmake/Modules/FindPUGIXML.cmake +++ b/cmake/Modules/FindPUGIXML.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # Find the pugixml XML parsing library. @@ -20,14 +20,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_PUGIXML pugixml QUIET) if(NOT PUGIXML_ROOT) @@ -54,11 +54,9 @@ find_path(PUGIXML_INCLUDE_DIR PATHS ${PUGIXML_ROOT_USER_DEFINED}/include ${PUGIXML_ROOT_USER_DEFINED}/include/pugixml-${PC_PUGIXML_VERSION} ${PUGIXML_ROOT_USER_DEFINED}/include/pugixml-1.9 - /usr/include - /usr/local/include - /usr/local/include/pugixml-${PC_PUGIXML_VERSION} - /usr/local/include/pugixml-1.9 - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} + ${GNSSSDR_INCLUDE_PATHS}/pugixml-${PC_PUGIXML_VERSION} + ${GNSSSDR_INCLUDE_PATHS}/pugixml-1.9 ) find_library(PUGIXML_LIBRARY @@ -71,8 +69,8 @@ find_library(PUGIXML_LIBRARY ${PUGIXML_ROOT_USER_DEFINED}}/lib/pugixml-1.9 ${PUGIXML_ROOT_USER_DEFINED}/lib64/pugixml-1.9 ${GNSSSDR_LIB_PATHS} - /usr/local/lib/pugixml-${PC_PUGIXML_VERSION} - /usr/local/lib/pugixml-1.9 + ${GNSSSDR_LIB_PATHS}/pugixml-${PC_PUGIXML_VERSION} + ${GNSSSDR_LIB_PATHS}/pugixml-1.9 ) # Support the REQUIRED and QUIET arguments, and set PUGIXML_FOUND if found. diff --git a/cmake/Modules/FindTELEORBIT.cmake b/cmake/Modules/FindTELEORBIT.cmake index db888984a..fa315cd32 100644 --- a/cmake/Modules/FindTELEORBIT.cmake +++ b/cmake/Modules/FindTELEORBIT.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -17,6 +17,10 @@ if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_TELEORBIT teleorbit QUIET) if(NOT TELEORBIT_ROOT) @@ -40,9 +44,7 @@ find_path(TELEORBIT_INCLUDE_DIRS HINTS ${PC_TELEORBIT_INCLUDEDIR} PATH_SUFFIXES gnuradio PATHS ${TELEORBIT_ROOT_USER_DEFINED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(TELEORBIT_LIBRARIES @@ -50,11 +52,7 @@ find_library(TELEORBIT_LIBRARIES HINTS ${PC_TELEORBIT_LIBDIR} PATHS ${TELEORBIT_ROOT_USER_DEFINED}/lib ${TELEORBIT_ROOT_USER_DEFINED}/lib64 - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindUHD.cmake index d30313535..356af6593 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindUHD.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -16,14 +16,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_UHD uhd) if(NOT UHD_ROOT) @@ -54,9 +54,7 @@ find_path(UHD_INCLUDE_DIRS NAMES uhd/config.hpp HINTS ${PC_UHD_INCLUDEDIR} PATHS ${UHD_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(UHD_LIBRARIES diff --git a/cmake/Modules/FindVOLK.cmake b/cmake/Modules/FindVOLK.cmake index 2247f8247..70286fbf0 100644 --- a/cmake/Modules/FindVOLK.cmake +++ b/cmake/Modules/FindVOLK.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -16,14 +16,14 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_VOLK volk QUIET) if(NOT VOLK_ROOT) @@ -52,9 +52,7 @@ find_path(VOLK_INCLUDE_DIRS NAMES volk/volk.h HINTS ${PC_VOLK_INCLUDEDIR} PATHS ${VOLK_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(VOLK_LIBRARIES diff --git a/cmake/Modules/FindVOLKGNSSSDR.cmake b/cmake/Modules/FindVOLKGNSSSDR.cmake index 64ab621d3..9de60ce30 100644 --- a/cmake/Modules/FindVOLKGNSSSDR.cmake +++ b/cmake/Modules/FindVOLKGNSSSDR.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2011-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -21,6 +21,10 @@ if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + pkg_check_modules(PC_VOLK_GNSSSDR QUIET volk_gnsssdr) if(NOT VOLKGNSSSDR_ROOT) @@ -51,9 +55,7 @@ find_path(VOLK_GNSSSDR_INCLUDE_DIRS NAMES volk_gnsssdr/volk_gnsssdr.h HINTS ${PC_VOLK_GNSSSDR_INCLUDEDIR} PATHS ${VOLKGNSSSDR_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${GNSSSDR_INCLUDE_PATHS} ) find_library(VOLK_GNSSSDR_LIBRARIES @@ -61,11 +63,7 @@ find_library(VOLK_GNSSSDR_LIBRARIES HINTS ${PC_VOLK_GNSSSDR_LIBDIR} PATHS ${VOLKGNSSSDR_ROOT_USER_PROVIDED}/lib ${VOLKGNSSSDR_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${GNSSSDR_LIB_PATHS} ) include(FindPackageHandleStandardArgs) diff --git a/cmake/Modules/FindZEROMQ.cmake b/cmake/Modules/FindZEROMQ.cmake index d42a68d2d..9d2254cd6 100644 --- a/cmake/Modules/FindZEROMQ.cmake +++ b/cmake/Modules/FindZEROMQ.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2024-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # @@ -13,26 +13,26 @@ if(NOT COMMAND feature_summary) include(FeatureSummary) endif() -if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) -endif() - if(NOT PKG_CONFIG_FOUND) include(FindPkgConfig) endif() +if(NOT GNSSSDR_LIB_PATHS) + include(GnsssdrFindPaths) +endif() + find_package(PkgConfig) pkg_check_modules(PC_ZEROMQ "libzmq") find_path(ZEROMQ_INCLUDE_DIRS NAMES zmq.hpp - HINTS ${PC_ZEROMQ_INCLUDE_DIR} ${CMAKE_INSTALL_PREFIX}/include - PATHS /usr/local/include /usr/include /opt/local/include + HINTS ${PC_ZEROMQ_INCLUDE_DIR} + PATHS ${GNSSSDR_INCLUDE_PATHS} ) find_library(ZEROMQ_LIBRARIES NAMES zmq libzmq.so.5 ${ZEROMQ_LIBRARY_NAME} - HINTS ${PC_ZEROMQ_LIBDIR} ${CMAKE_INSTALL_PREFIX}/lib ${CMAKE_INSTALL_PREFIX}/lib64 + HINTS ${PC_ZEROMQ_LIBDIR} PATHS ${GNSSSDR_LIB_PATHS} ) diff --git a/cmake/Modules/GnsssdrCrypto.cmake b/cmake/Modules/GnsssdrCrypto.cmake index a9d89e6be..36f2be03a 100644 --- a/cmake/Modules/GnsssdrCrypto.cmake +++ b/cmake/Modules/GnsssdrCrypto.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2024 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2024-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause if(NOT COMMAND feature_summary) @@ -9,7 +9,7 @@ if(NOT COMMAND feature_summary) endif() if(NOT GNSSSDR_LIB_PATHS) - include(GnsssdrLibPaths) + include(GnsssdrFindPaths) endif() ################################################################################ @@ -65,10 +65,7 @@ else() find_path(GNUTLS_INCLUDE_DIR NAMES gnutls/gnutls.h PATHS - /usr/include - /usr/local/include - /opt/local/include # default location in Macports - /opt/homebrew/opt/gnutls/include/ + ${GNSSSDR_INCLUDE_PATHS} ${GNUTLS_ROOT_DIR}/include/ ) diff --git a/cmake/Modules/GnsssdrFindPaths.cmake b/cmake/Modules/GnsssdrFindPaths.cmake new file mode 100644 index 000000000..1ebda4f58 --- /dev/null +++ b/cmake/Modules/GnsssdrFindPaths.cmake @@ -0,0 +1,93 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(GNSSSDR_LIB_PATHS) + return() +endif() + +if(NOT CMAKE_INSTALL_LIBDIR) + include(GNUInstallDirs) +endif() + +set(GNSSSDR_LIB_PATHS + /usr/lib + /usr/lib64 + /usr/lib/aarch64-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/i386-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/i386-linux-gnu + /usr/lib/loongarch64-linux-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/local/lib + /usr/local/lib64 + /usr/local/lib/i386 + ${CMAKE_INSTALL_FULL_LIBDIR} + ${CMAKE_SYSTEM_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR} + ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 +) + +set(GNSSSDR_INCLUDE_PATHS + /usr/include + /usr/local/include + ${CMAKE_INSTALL_FULL_INCLUDEDIR} + ${CMAKE_SYSTEM_PREFIX_PATH}/include + ${CMAKE_INSTALL_PREFIX}/include +) + +set(GNSSSDR_BIN_PATHS + /usr/bin + /usr/local/bin + ${CMAKE_INSTALL_PREFIX}/bin + ${CMAKE_INSTALL_FULL_BINDIR} + ${CMAKE_SYSTEM_PREFIX_PATH}/bin + /bin + /sbin + /usr/sbin +) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT MACOS_PACKAGES_PREFIX) + include(DetectMacOSVersion) + endif() + set(GNSSSDR_LIB_PATHS ${GNSSSDR_LIB_PATHS} + ${MACOS_PACKAGES_PREFIX}/${CMAKE_INSTALL_LIBDIR} + ${MACOS_PACKAGES_PREFIX}/lib + ${MACOS_PACKAGES_PREFIX}/lib64 + ) + set(GNSSSDR_INCLUDE_PATHS ${GNSSSDR_INCLUDE_PATHS} + ${MACOS_PACKAGES_PREFIX}/include + ~/Library/Frameworks + /Library/Frameworks + /sw/include # Fink + /opt/csw/include # Blastwave + ) + set(GNSSSDR_BIN_PATHS ${GNSSSDR_BIN_PATHS} + ${MACOS_PACKAGES_PREFIX}/bin + ) +endif() + +list(REMOVE_DUPLICATES GNSSSDR_LIB_PATHS) +list(REMOVE_DUPLICATES GNSSSDR_INCLUDE_PATHS) diff --git a/cmake/Modules/GnsssdrLibPaths.cmake b/cmake/Modules/GnsssdrLibPaths.cmake deleted file mode 100644 index 9f76e362f..000000000 --- a/cmake/Modules/GnsssdrLibPaths.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -# This file is part of GNSS-SDR. -# -# SPDX-FileCopyrightText: 2011-2024 C. Fernandez-Prades cfernandez(at)cttc.es -# SPDX-License-Identifier: BSD-3-Clause - -if(GNSSSDR_LIB_PATHS) - return() -endif() - -set(GNSSSDR_LIB_PATHS - /usr/lib - /usr/lib/aarch64-linux-gnu - /usr/lib/alpha-linux-gnu - /usr/lib/arm-linux-gnueabi - /usr/lib/arm-linux-gnueabihf - /usr/lib/hppa-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/i386-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/i386-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/mipsel-linux-gnu - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/x86_64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib64 - /usr/local/lib - /usr/local/lib/i386 - /usr/local/lib64 - /opt/local/lib -) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 34896899e..5f14a5255 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -109,6 +109,7 @@ All notable changes to GNSS-SDR will be documented in this file. place and, if not found, then it looks for GnuTLS as a fallback. - Allow linking against Boost 1.87.0. - Replace the System V queues by boost::interprocess, improving portability. +- Improve detection of Homebrew or Macports in macOS. ### Reliability diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index 59432f3e9..fe0bc95f6 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -39,6 +39,13 @@ target_link_libraries(conditioner_adapters Gnuradio::runtime ) +if(GNURADIO_VERSION VERSION_LESS 3.9) + target_link_libraries(conditioner_adapters + PUBLIC + Boost::headers + ) +endif() + if(ENABLE_GLOG_AND_GFLAGS) target_link_libraries(conditioner_adapters PRIVATE Gflags::gflags Glog::glog) target_compile_definitions(conditioner_adapters PRIVATE -DUSE_GLOG_AND_GFLAGS=1) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 7331e0fea..258110f96 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -208,6 +208,7 @@ set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_MINOR_VERSION 0) set(VERSION_INFO_MAINT_VERSION 19) include(VolkGnsssdrVersion) # setup version info +include(VolkGnsssdrFindPaths) # set VOLK_GNSSSDR_LIB_PATHS and VOLK_GNSSSDR_INCLUDE_PATHS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/DetectMacOSPackaging.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/DetectMacOSPackaging.cmake new file mode 100644 index 000000000..5be83478e --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/DetectMacOSPackaging.cmake @@ -0,0 +1,26 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2025 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +set(MACOS_PACKAGES_PREFIX "") +# Detect if MacPorts is installed on this system; if so, return base path and version +execute_process(COMMAND which port RESULT_VARIABLE DETECT_MACPORTS OUTPUT_VARIABLE MACPORTS_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) +if(${DETECT_MACPORTS} EQUAL 0) + # "/opt/local/bin/port", so we get the parent directory + get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY) + # "/opt/local/bin", so we get the parent directory + get_filename_component(MACPORTS_PREFIX ${MACPORTS_PREFIX} DIRECTORY) + execute_process(COMMAND port version RESULT_VARIABLE DETECT_MACPORTS_VERSION OUTPUT_VARIABLE MACPORTS_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" MACPORTS_VERSION "${MACPORTS_VERSION}") + set(MACOS_PACKAGES_PREFIX ${MACPORTS_PREFIX}) +endif() + +# Detect if Homebrew is installed on this system; if so, return base path and version +execute_process(COMMAND brew --prefix RESULT_VARIABLE DETECT_HOMEBREW OUTPUT_VARIABLE HOMEBREW_PREFIX ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) +if(${DETECT_HOMEBREW} EQUAL 0) + execute_process(COMMAND brew --version RESULT_VARIABLE DETECT_HOMEBREW_VERSION OUTPUT_VARIABLE HOMEBREW_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE) + string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" HOMEBREW_VERSION "${HOMEBREW_VERSION}") + set(MACOS_PACKAGES_PREFIX ${HOMEBREW_PREFIX}) +endif() diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake index 7c25e69c2..0cf9c286d 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindCPUFEATURES.cmake @@ -1,55 +1,25 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2021-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause set(FPHSA_NAME_MISMATCHED ON) +if(NOT VOLK_GNSSSDR_LIB_PATHS) + include(VolkGnsssdrFindPaths) +endif() + find_library(CPUFEATURES_LIBRARIES NAMES cpu_features - PATHS /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + PATHS $ENV{CPUFEATURES_DIR}/lib + ${VOLK_GNSSSDR_LIB_PATHS} ) find_path(CPUFEATURES_INCLUDE_DIR cpu_features_macros.h PATHS $ENV{CPUFEATURES_DIR}/include $ENV{CPUFEATURES_DIR} - /usr/include - /usr/local/include - ~/Library/Frameworks - /Library/Frameworks - /sw/include # Fink - /opt/local/include # MacPorts - /opt/csw/include # Blastwave + ${VOLK_GNSSSDR_INCLUDE_PATHS} PATH_SUFFIXES cpu_features ) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake index 9ac9f5ccb..22e7f943b 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/FindORC.cmake @@ -1,13 +1,18 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# Copyright (C) 2015-2020 (see AUTHORS file for a list of contributors) +# Copyright (C) 2015-2025 (see AUTHORS file for a list of contributors) # SPDX-License-Identifier: BSD-3-Clause set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE) set(FPHSA_NAME_MISMATCHED ON) include(FindPkgConfig) + +if(NOT VOLK_GNSSSDR_LIB_PATHS) + include(VolkGnsssdrFindPaths) +endif() + pkg_check_modules(PC_ORC "orc-0.4 > 0.4.22") if(NOT ORC_ROOT) @@ -36,16 +41,14 @@ find_program(ORCC_EXECUTABLE orcc HINTS ${ORC_ROOT_USER_PROVIDED}/bin PATHS /usr/bin /usr/local/bin - /opt/local/bin + ${CMAKE_SYSTEM_PREFIX_PATH}/bin ) find_path(ORC_INCLUDE_DIR NAMES orc/orc.h HINTS ${PC_ORC_INCLUDEDIR} PATHS ${ORC_ROOT_USER_PROVIDED}/include - /usr/include - /usr/local/include - /opt/local/include + ${VOLK_GNSSSDR_INCLUDE_PATHS} PATH_SUFFIXES orc-0.4 ) @@ -54,86 +57,23 @@ find_path(ORC_LIBRARY_DIR HINTS ${PC_ORC_LIBDIR} PATHS ${ORC_ROOT_USER_PROVIDED}/lib ${ORC_ROOT_USER_PROVIDED}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${VOLK_GNSSSDR_LIB_PATHS} ) find_library(ORC_LIB orc-0.4 HINTS ${PC_ORC_LIBRARY_DIRS} PATHS ${ORC_ROOT_USER_PROVIDED}/lib ${ORC_ROOT_USER_PROVIDED}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${VOLK_GNSSSDR_LIB_PATHS} ) find_library(ORC_LIBRARY_STATIC ${CMAKE_STATIC_LIBRARY_PREFIX}orc-0.4${CMAKE_STATIC_LIBRARY_SUFFIX} HINTS ${PC_ORC_LIBRARY_DIRS} PATHS ${ORC_ROOT}/lib ${ORC_ROOT}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - ${CMAKE_INSTALL_PREFIX}/lib64 ${ORC_ROOT_USER_PROVIDED}/lib ${ORC_ROOT_USER_PROVIDED}/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/lib/loongarch64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib + ${VOLK_GNSSSDR_LIB_PATHS} ) if(PC_ORC_VERSION) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkGnsssdrFindPaths.cmake b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkGnsssdrFindPaths.cmake new file mode 100644 index 000000000..6ce8d50f1 --- /dev/null +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Modules/VolkGnsssdrFindPaths.cmake @@ -0,0 +1,80 @@ +# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. +# This file is part of GNSS-SDR. +# +# SPDX-FileCopyrightText: 2011-2025 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-License-Identifier: BSD-3-Clause + +if(VOLK_GNSSSDR_LIB_PATHS) + return() +endif() + +if(NOT CMAKE_INSTALL_LIBDIR) + include(GNUInstallDirs) +endif() + +set(VOLK_GNSSSDR_LIB_PATHS + /usr/lib + /usr/lib64 + /usr/lib/aarch64-linux-gnu + /usr/lib/alpha-linux-gnu + /usr/lib/arm-linux-gnueabi + /usr/lib/arm-linux-gnueabihf + /usr/lib/hppa-linux-gnu + /usr/lib/hppa-linux-gnu + /usr/lib/i386-gnu + /usr/lib/i386-kfreebsd-gnu + /usr/lib/i386-linux-gnu + /usr/lib/loongarch64-linux-gnu + /usr/lib/m68k-linux-gnu + /usr/lib/mips-linux-gnu + /usr/lib/mips64el-linux-gnuabi64 + /usr/lib/mipsel-linux-gnu + /usr/lib/powerpc-linux-gnu + /usr/lib/powerpc-linux-gnuspe + /usr/lib/powerpc64-linux-gnu + /usr/lib/powerpc64le-linux-gnu + /usr/lib/riscv64-linux-gnu + /usr/lib/s390x-linux-gnu + /usr/lib/sh4-linux-gnu + /usr/lib/sparc64-linux-gnu + /usr/lib/x86_64-kfreebsd-gnu + /usr/lib/x86_64-linux-gnu + /usr/lib/x86_64-linux-gnux32 + /usr/local/lib + /usr/local/lib64 + /usr/local/lib/i386 + ${CMAKE_INSTALL_FULL_LIBDIR} + ${CMAKE_SYSTEM_PREFIX_PATH}/${CMAKE_INSTALL_LIBDIR} + ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 +) + +set(VOLK_GNSSSDR_INCLUDE_PATHS + /usr/include + /usr/local/include + ${CMAKE_INSTALL_FULL_INCLUDEDIR} + ${CMAKE_SYSTEM_PREFIX_PATH}/include + ${CMAKE_INSTALL_PREFIX}/include +) + +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + if(NOT MACOS_PACKAGES_PREFIX) + include(DetectMacOSPackaging) + endif() + set(VOLK_GNSSSDR_LIB_PATHS + ${VOLK_GNSSSDR_LIB_PATHS} + ${MACOS_PACKAGES_PREFIX}/${CMAKE_INSTALL_LIBDIR} + ${MACOS_PACKAGES_PREFIX}/lib + ${MACOS_PACKAGES_PREFIX}/lib64 + ) + set(VOLK_GNSSSDR_INCLUDE_PATHS ${VOLK_GNSSSDR_INCLUDE_PATHS} + ${MACOS_PACKAGES_PREFIX}/include + ~/Library/Frameworks + /Library/Frameworks + /sw/include # Fink + /opt/csw/include # Blastwave + ) +endif() + +list(REMOVE_DUPLICATES VOLK_GNSSSDR_LIB_PATHS) +list(REMOVE_DUPLICATES VOLK_GNSSSDR_INCLUDE_PATHS) diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index c58266231..a5e68b546 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -120,13 +120,8 @@ if(NOT VOLKGNSSSDR_FOUND) ) endif() -find_program(GZIP - gzip - /bin - /usr/bin - /usr/local/bin - /opt/local/bin - /sbin +find_program(GZIP gzip + ${GNSSSDR_BIN_PATHS} ) if(NOT GZIP_NOTFOUND) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 78171ae9d..4d93fcf01 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -318,7 +318,7 @@ if(ENABLE_UNIT_TESTING_EXTRA OR ENABLE_SYSTEM_TESTING_EXTRA OR ENABLE_FPGA) GIT_TAG ${GNSSSDR_GNSS_SIM_LOCAL_VERSION} SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gnss-sim BINARY_DIR ${GNSSSDR_BINARY_DIR}/gnss-sim - CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} ${CROSS_INSTALL_DIR} ${TOOLCHAIN_ARG_GNSS_SIM} + CMAKE_ARGS ${GTEST_COMPILER} ${TOOLCHAIN_ARG} ${CROSS_INSTALL_DIR} ${TOOLCHAIN_ARG_GNSS_SIM} -DBoost_DIR=${Boost_DIR} BUILD_COMMAND ${GNSS_SIM_BUILD_COMMAND} UPDATE_COMMAND "" PATCH_COMMAND "" diff --git a/utils/front-end-cal/CMakeLists.txt b/utils/front-end-cal/CMakeLists.txt index 8e328b089..1dd300b1f 100644 --- a/utils/front-end-cal/CMakeLists.txt +++ b/utils/front-end-cal/CMakeLists.txt @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2010-2020 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2010-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause @@ -140,11 +140,7 @@ install(TARGETS front-end-cal ) find_program(GZIP gzip - /bin - /usr/bin - /usr/local/bin - /opt/local/bin - /sbin + ${GNSSSDR_BIN_PATHS} ) if(NOT GZIP_NOTFOUND) diff --git a/utils/rinex2assist/CMakeLists.txt b/utils/rinex2assist/CMakeLists.txt index 277a924b1..6337b9319 100644 --- a/utils/rinex2assist/CMakeLists.txt +++ b/utils/rinex2assist/CMakeLists.txt @@ -54,9 +54,7 @@ if(CMAKE_VERSION VERSION_LESS 3.5) endif() find_program(UNCOMPRESS_EXECUTABLE uncompress - PATHS /bin - /usr/bin - /usr/sbin + PATHS ${GNSSSDR_BIN_PATHS} ) if(TARGET Boost::iostreams AND TARGET Boost::serialization) From b9fe78cf0a8cfaa0e7170583b43291a4eb3c791b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sun, 16 Feb 2025 22:15:08 +0100 Subject: [PATCH 486/499] Fix formatting --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e304e36f..ded9eabb1 100644 --- a/README.md +++ b/README.md @@ -134,7 +134,8 @@ This section describes how to set up the compilation environment in GNU/Linux or Thumb-2 instruction set and above. - arm64: ARM 64 bits or ARMv8. Also known as AArch64. - i386: Intel x86 instruction set (32-bit microprocessors). - - loong64: 64-bit version of LoongArch, a RISC-style instruction set architecture developed by Loongson Technology. + - loong64: 64-bit version of LoongArch, a RISC-style instruction set + architecture developed by Loongson Technology. - mips: MIPS architecture (big-endian, such as those manufactured by SGI). - mipsel: MIPS architecture (little-endian, such as Loongson 3). - mips64el: 64-bit version of MIPS architecture. From 08ac861f31b9fb2e143505feaad5657c33e9c0a5 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 27 Feb 2025 13:00:42 +0100 Subject: [PATCH 487/499] When using the FPGA, enable automatic selection of the acquisition resampler in the L1/E1 band to apply the lowest possible sample rate during acquisition and automatically manage zero-padding. --- ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 64 ++++-- ...lileo_e1_pcps_ambiguous_acquisition_fpga.h | 19 +- .../galileo_e5a_pcps_acquisition_fpga.cc | 62 ++++-- .../galileo_e5a_pcps_acquisition_fpga.h | 19 +- .../galileo_e5b_pcps_acquisition_fpga.cc | 62 ++++-- .../galileo_e5b_pcps_acquisition_fpga.h | 19 +- .../gps_l1_ca_pcps_acquisition_fpga.cc | 58 +++-- .../gps_l1_ca_pcps_acquisition_fpga.h | 19 +- .../gps_l2_m_pcps_acquisition_fpga.cc | 55 +++-- .../adapters/gps_l2_m_pcps_acquisition_fpga.h | 13 +- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 61 ++++-- .../adapters/gps_l5i_pcps_acquisition_fpga.h | 20 +- .../gnuradio_blocks/pcps_acquisition_fpga.cc | 57 ++--- .../gnuradio_blocks/pcps_acquisition_fpga.h | 14 +- .../acquisition/libs/acq_conf_fpga.cc | 97 +++++++-- .../acquisition/libs/acq_conf_fpga.h | 24 ++- .../acquisition/libs/fpga_acquisition.cc | 204 ++++++++++-------- .../acquisition/libs/fpga_acquisition.h | 104 ++++++--- 18 files changed, 589 insertions(+), 382 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 1610bb3c5..6a3bbd6f3 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -49,7 +49,27 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( out_streams_(out_streams), acquire_pilot_(configuration->property(role + ".acquire_pilot", false)) { - acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); + // Set acquisition parameters + acq_parameters_.SetFromConfiguration(configuration, role_, DEFAULT_FPGA_BLK_EXP, GALILEO_E1_CODE_CHIP_RATE_CPS, GALILEO_E1_B_CODE_LENGTH_CHIPS); + + // Query the capabilities of the instantiated FPGA Acquisition IP Core + std::vector> downsampling_filter_specs; + uint32_t max_FFT_size; + acquisition_fpga_ = pcps_make_acquisition_fpga(&acq_parameters_, ACQ_BUFF_0, downsampling_filter_specs, max_FFT_size); + + // Configure the automatic resampler according to the capabilities of the instantiated FPGA Acquisition IP Core. + // When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + bool acq_configuration_valid = acq_parameters_.ConfigureAutomaticResampler(downsampling_filter_specs, max_FFT_size, GALILEO_E1_OPT_ACQ_FS_SPS); + + if (!acq_configuration_valid) + { + std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; + exit(1); + } + + DLOG(INFO) << "role " << role; + + generate_galileo_e1_prn_codes(); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) @@ -64,10 +84,21 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( #endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } +} + +void GalileoE1PcpsAmbiguousAcquisitionFpga::generate_galileo_e1_prn_codes() +{ uint32_t code_length = acq_parameters_.code_length; - uint32_t nsamples_total = acq_parameters_.samples_per_code; + uint32_t nsamples_total = acq_parameters_.fft_size; // compute all the GALILEO E1 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -76,7 +107,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( volk_gnsssdr::vector fft_codes_padded(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 - float max; // temporary maxima search + float max; int32_t tmp; int32_t tmp2; int32_t local_code; @@ -90,13 +121,13 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // set local signal generator to Galileo E1 pilot component (1C) std::array pilot_signal = {{'1', 'C', '\0'}}; galileo_e1_code_gen_complex_sampled(code, pilot_signal, - cboc, PRN, fs_in_, 0, false); + cboc, PRN, acq_parameters_.resampled_fs, 0, false); } else { std::array data_signal = {{'1', 'B', '\0'}}; galileo_e1_code_gen_complex_sampled(code, data_signal, - cboc, PRN, fs_in_, 0, false); + cboc, PRN, acq_parameters_.resampled_fs, 0, false); } if (acq_parameters_.enable_zero_padding) @@ -129,30 +160,17 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits); // put together the real part and the imaginary part - fft_data = local_code & select_all_code_bits; + tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part + fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; } } acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - - DLOG(INFO) << "role " << role_; - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); - - if (in_streams_ > 1) - { - LOG(ERROR) << "This implementation only supports one input stream"; - } - if (out_streams_ > 0) - { - LOG(ERROR) << "This implementation does not provide an output stream"; - } } - void GalileoE1PcpsAmbiguousAcquisitionFpga::stop_acquisition() { // stop the acquisition and the other FPGA modules. diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h index cb90f39d5..6e660fa7c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.h @@ -182,17 +182,15 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: - static const uint32_t downsampling_factor_default = 4; - static const uint32_t fpga_buff_num = 0; // L1/E1 band - static const uint32_t fpga_blk_exp = 13; // default block exponent + static const uint32_t ACQ_BUFF_0 = 0; // FPGA Acquisition IP buffer containing L1/E1 frequency band samples by default. + static const uint32_t DEFAULT_FPGA_BLK_EXP = 13; // default block exponent + static const uint32_t QUANT_BITS_LOCAL_CODE = 16; + static const uint32_t SELECT_LSBITS = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word + static const uint32_t SELECT_MSBITS = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word + static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word + static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits - // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA - // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. - static const uint32_t quant_bits_local_code = 16; - static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word - static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word - static const uint32_t shl_code_bits = 65536; // shift left by 10 bits + void generate_galileo_e1_prn_codes(); pcps_acquisition_fpga_sptr acquisition_fpga_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts @@ -200,7 +198,6 @@ private: Gnss_Synchro* gnss_synchro_; Acq_Conf_Fpga acq_parameters_; std::string role_; - int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 0fa8a554a..e121aa265 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -48,7 +48,27 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( acq_pilot_(configuration->property(role + ".acquire_pilot", false)), acq_iq_(configuration->property(role + ".acquire_iq", false)) { - acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); + // Set acquisition parameters + acq_parameters_.SetFromConfiguration(configuration, role_, DEFAULT_FPGA_BLK_EXP, GALILEO_E5A_CODE_CHIP_RATE_CPS, GALILEO_E5A_CODE_LENGTH_CHIPS); + + // Query the capabilities of the instantiated FPGA Acquisition IP Core. When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + std::vector> downsampling_filter_specs; + uint32_t max_FFT_size; + acquisition_fpga_ = pcps_make_acquisition_fpga(&acq_parameters_, ACQ_BUFF_1, downsampling_filter_specs, max_FFT_size); + + // When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + // Check whether the acquisition configuration is supported by the FPGA. + bool acq_configuration_valid = acq_parameters_.Is_acq_config_valid(max_FFT_size); + + if (!acq_configuration_valid) + { + std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; + exit(1); + } + + DLOG(INFO) << "role " << role; + + generate_galileo_e5a_prn_codes(); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) @@ -63,10 +83,21 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( #endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } +} + +void GalileoE5aPcpsAcquisitionFpga::generate_galileo_e5a_prn_codes() +{ uint32_t code_length = acq_parameters_.code_length; - uint32_t nsamples_total = acq_parameters_.samples_per_code; + uint32_t nsamples_total = acq_parameters_.fft_size; // compute all the GALILEO E5 PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -80,7 +111,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( acq_pilot_ = false; } - float max; // temporary maxima search + float max; int32_t tmp; int32_t tmp2; int32_t local_code; @@ -105,7 +136,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( signal_[1] = 'I'; } - galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0); + galileo_e5_a_code_gen_complex_sampled(code, PRN, signal_, acq_parameters_.fs_in, 0); if (acq_parameters_.enable_zero_padding) { @@ -136,30 +167,17 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits); // put together the real part and the imaginary part - fft_data = local_code & select_all_code_bits; + tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part + fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; } } acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - - DLOG(INFO) << "role " << role_; - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); - - if (in_streams_ > 1) - { - LOG(ERROR) << "This implementation only supports one input stream"; - } - if (out_streams_ > 0) - { - LOG(ERROR) << "This implementation does not provide an output stream"; - } } - void GalileoE5aPcpsAcquisitionFpga::stop_acquisition() { // stop the acquisition and the other FPGA modules. diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h index ed3716155..2b210c729 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.h @@ -189,17 +189,15 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: - static const uint32_t downsampling_factor_default = 1; - static const uint32_t fpga_buff_num = 1; // L5/E5a band - static const uint32_t fpga_blk_exp = 13; // default block exponent + static const uint32_t ACQ_BUFF_1 = 1; // FPGA Acquisition IP buffer containing L2 or L5/E5 frequency band samples by default. + static const uint32_t DEFAULT_FPGA_BLK_EXP = 13; // default block exponent + static const uint32_t QUANT_BITS_LOCAL_CODE = 16; + static const uint32_t SELECT_LSBITS = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word + static const uint32_t SELECT_MSBITS = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word + static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word + static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits - // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA - // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. - static const uint32_t quant_bits_local_code = 16; - static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word - static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word - static const uint32_t shl_code_bits = 65536; // shift left by 10 bits + void generate_galileo_e5a_prn_codes(); pcps_acquisition_fpga_sptr acquisition_fpga_; std::weak_ptr channel_fsm_; @@ -207,7 +205,6 @@ private: Gnss_Synchro* gnss_synchro_; Acq_Conf_Fpga acq_parameters_; std::string role_; - int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index 295ba4f23..210d0f29c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -48,7 +48,28 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration acq_pilot_(configuration->property(role + ".acquire_pilot", false)), acq_iq_(configuration->property(role + ".acquire_iq", false)) { - acq_parameters_.SetFromConfiguration(configuration, role_, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); + // Set acquisition parameters + acq_parameters_.SetFromConfiguration(configuration, role_, DEFAULT_FPGA_BLK_EXP, GALILEO_E5B_CODE_CHIP_RATE_CPS, GALILEO_E5B_CODE_LENGTH_CHIPS); + + // Query the capabilities of the instantiated FPGA Acquisition IP Core. When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + std::vector> downsampling_filter_specs; + uint32_t max_FFT_size; + acquisition_fpga_ = pcps_make_acquisition_fpga(&acq_parameters_, ACQ_BUFF_1, downsampling_filter_specs, max_FFT_size); + + // When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + // Check whether the acquisition configuration is supported by the FPGA. + bool acq_configuration_valid = acq_parameters_.Is_acq_config_valid(max_FFT_size); + + if (!acq_configuration_valid) + { + std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the E5b band. Please update the sampling frequency in the configuration file." << std::endl; + exit(1); + } + + DLOG(INFO) << "role " << role; + + generate_galileo_e5b_prn_codes(); + #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { @@ -62,10 +83,21 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration #endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } +} + +void GalileoE5bPcpsAcquisitionFpga::generate_galileo_e5b_prn_codes() +{ uint32_t code_length = acq_parameters_.code_length; - uint32_t nsamples_total = acq_parameters_.samples_per_code; + uint32_t nsamples_total = acq_parameters_.fft_size; // compute all the GALILEO E5b PRN Codes (this is done only once in the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -79,7 +111,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration acq_pilot_ = false; } - float max; // temporary maxima search + float max; int32_t tmp; int32_t tmp2; int32_t local_code; @@ -104,7 +136,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration signal_[1] = 'I'; } - galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, fs_in_, 0); + galileo_e5_b_code_gen_complex_sampled(code, PRN, signal_, acq_parameters_.fs_in, 0); if (acq_parameters_.enable_zero_padding) { @@ -135,29 +167,17 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits); // put together the real part and the imaginary part - fft_data = local_code & select_all_code_bits; + tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part + fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; } } acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); - - if (in_streams_ > 1) - { - LOG(ERROR) << "This implementation only supports one input stream"; - } - if (out_streams_ > 0) - { - LOG(ERROR) << "This implementation does not provide an output stream"; - } } - void GalileoE5bPcpsAcquisitionFpga::stop_acquisition() { // this command causes the SW to reset the HW. diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h index ce8e14e7b..68707647c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.h @@ -188,17 +188,15 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: - static const uint32_t downsampling_factor_default = 1; - static const uint32_t fpga_buff_num = 1; // E5b band - static const uint32_t fpga_blk_exp = 13; // default block exponent + static const uint32_t ACQ_BUFF_1 = 1; // FPGA Acquisition IP buffer containing L2 or L5/E5 frequency band samples by default. + static const uint32_t DEFAULT_FPGA_BLK_EXP = 13; // default block exponent + static const uint32_t QUANT_BITS_LOCAL_CODE = 16; + static const uint32_t SELECT_LSBITS = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word + static const uint32_t SELECT_MSBITS = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word + static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word + static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits - // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA - // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. - static const uint32_t quant_bits_local_code = 16; - static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word - static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word - static const uint32_t shl_code_bits = 65536; // shift left by 10 bits + void generate_galileo_e5b_prn_codes(); pcps_acquisition_fpga_sptr acquisition_fpga_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts @@ -207,7 +205,6 @@ private: Gnss_Synchro* gnss_synchro_; Acq_Conf_Fpga acq_parameters_; std::string role_; - int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 892f2de6a..4d2c0da50 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -48,10 +48,28 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - acq_parameters_.SetFromConfiguration(configuration, role, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_CODE_LENGTH_CHIPS); + // set acquisition parameters + acq_parameters_.SetFromConfiguration(configuration, role_, DEFAULT_FPGA_BLK_EXP, GPS_L1_CA_CODE_RATE_CPS, GPS_L1_CA_CODE_LENGTH_CHIPS); + + // Query the capabilities of the instantiated FPGA Acquisition IP Core + std::vector> downsampling_filter_specs; + uint32_t max_FFT_size; + acquisition_fpga_ = pcps_make_acquisition_fpga(&acq_parameters_, ACQ_BUFF_0, downsampling_filter_specs, max_FFT_size); + + // Configure the automatic resampler according to the capabilities of the instantiated FPGA Acquisition IP Core. + // When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + bool acq_configuration_valid = acq_parameters_.ConfigureAutomaticResampler(downsampling_filter_specs, max_FFT_size, GPS_L1_CA_OPT_ACQ_FS_SPS); + + if (!acq_configuration_valid) + { + std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; + exit(1); + } DLOG(INFO) << "role " << role; + generate_gps_l1_ca_prn_codes(); + #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) { @@ -65,10 +83,21 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( #endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } +} + +void GpsL1CaPcpsAcquisitionFpga::generate_gps_l1_ca_prn_codes() +{ uint32_t code_length = acq_parameters_.code_length; - uint32_t nsamples_total = acq_parameters_.samples_per_code; + uint32_t nsamples_total = acq_parameters_.fft_size; // compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -85,7 +114,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // temporary maxima search for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in_, 0); // generate PRN code + gps_l1_ca_code_gen_complex_sampled(code, PRN, acq_parameters_.resampled_fs, 0); // generate PRN code if (acq_parameters_.enable_zero_padding) { @@ -116,30 +145,17 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits); // put together the real part and the imaginary part - fft_data = local_code & select_all_code_bits; + tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part + fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; } } - // acq_parameters acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); - - if (in_streams_ > 1) - { - LOG(ERROR) << "This implementation only supports one input stream"; - } - if (out_streams_ > 0) - { - LOG(ERROR) << "This implementation does not provide an output stream"; - } } - void GpsL1CaPcpsAcquisitionFpga::stop_acquisition() { // stop the acquisition and the other FPGA modules. diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h index b8eadb373..e0dc57672 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.h @@ -185,18 +185,16 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: + static const uint32_t ACQ_BUFF_0 = 0; // FPGA Acquisition IP buffer containing L1/E1 frequency band samples by default. + static const uint32_t DEFAULT_FPGA_BLK_EXP = 10; // default block exponent static const uint32_t NUM_PRNs = 32; - static const uint32_t downsampling_factor_default = 4; - static const uint32_t fpga_buff_num = 0; // L1/E1 band - static const uint32_t fpga_blk_exp = 10; // default block exponent + static const uint32_t QUANT_BITS_LOCAL_CODE = 16; + static const uint32_t SELECT_LSBITS = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word + static const uint32_t SELECT_MSBITS = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word + static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word + static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits - // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA - // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. - static const uint32_t quant_bits_local_code = 16; - static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word - static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word - static const uint32_t shl_code_bits = 65536; // shift left by 10 bits + void generate_gps_l1_ca_prn_codes(); pcps_acquisition_fpga_sptr acquisition_fpga_; std::weak_ptr channel_fsm_; @@ -204,7 +202,6 @@ private: Gnss_Synchro* gnss_synchro_; Acq_Conf_Fpga acq_parameters_; std::string role_; - int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 79a652358..0f78c2d6e 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -48,9 +48,27 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - acq_parameters_.SetFromConfiguration(configuration, role, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GPS_L2_M_CODE_RATE_CPS, GPS_L2_M_CODE_LENGTH_CHIPS); + // Set acquisition parameters + acq_parameters_.SetFromConfiguration(configuration, role_, DEFAULT_FPGA_BLK_EXP, GPS_L2_M_CODE_RATE_CPS, GPS_L2_M_CODE_LENGTH_CHIPS); - LOG(INFO) << "role " << role; + // Query the capabilities of the instantiated FPGA Acquisition IP Core. When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + std::vector> downsampling_filter_specs; + uint32_t max_FFT_size; + acquisition_fpga_ = pcps_make_acquisition_fpga(&acq_parameters_, ACQ_BUFF_1, downsampling_filter_specs, max_FFT_size); + + // When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + // Check whether the acquisition configuration is supported by the FPGA. + bool acq_configuration_valid = acq_parameters_.Is_acq_config_valid(max_FFT_size); + + if (!acq_configuration_valid) + { + std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L2 band. Please update the sampling frequency in the configuration file." << std::endl; + exit(1); + } + + DLOG(INFO) << "role " << role; + + generate_gps_l2c_m_prn_codes(); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) @@ -65,10 +83,21 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( #endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } +} + +void GpsL2MPcpsAcquisitionFpga::generate_gps_l2c_m_prn_codes() +{ uint32_t code_length = acq_parameters_.code_length; - uint32_t nsamples_total = acq_parameters_.samples_per_code; + uint32_t nsamples_total = acq_parameters_.fft_size; // compute all the GPS L2C PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -78,7 +107,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( volk_gnsssdr::vector> fft_codes_padded(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32 - float max; // temporary maxima search + float max; int32_t tmp; int32_t tmp2; int32_t local_code; @@ -86,7 +115,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l2c_m_code_gen_complex_sampled(code, PRN, fs_in_); + gps_l2c_m_code_gen_complex_sampled(code, PRN, acq_parameters_.fs_in); if (acq_parameters_.enable_zero_padding) { @@ -118,7 +147,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( { tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - local_code = (tmp & SELECT_LSBits) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBbits); // put together the real part and the imaginary part + local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; @@ -128,20 +157,8 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( } acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); - - if (in_streams_ > 1) - { - LOG(ERROR) << "This implementation only supports one input stream"; - } - if (out_streams_ > 0) - { - LOG(ERROR) << "This implementation does not provide an output stream"; - } } - void GpsL2MPcpsAcquisitionFpga::stop_acquisition() { // stop the acquisition and the other FPGA modules. diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h index 6ecc0ed41..4e1b8c8ac 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.h @@ -150,24 +150,23 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: - static const uint32_t downsampling_factor_default = 1; - static const uint32_t fpga_buff_num = 0; // L2 band - static const uint32_t fpga_blk_exp = 13; // default block exponent - + static const uint32_t ACQ_BUFF_1 = 1; // FPGA Acquisition IP buffer containing L2 or L5/E5 frequency band samples by default. + static const uint32_t DEFAULT_FPGA_BLK_EXP = 13; // default block exponent static const uint32_t NUM_PRNs = 32; static const uint32_t QUANT_BITS_LOCAL_CODE = 16; - static const uint32_t SELECT_LSBits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t SELECT_MSBbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word + static const uint32_t SELECT_LSBITS = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word + static const uint32_t SELECT_MSBITS = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits + void generate_gps_l2c_m_prn_codes(); + pcps_acquisition_fpga_sptr acquisition_fpga_; volk_gnsssdr::vector d_all_fft_codes_; // memory that contains all the code ffts std::weak_ptr channel_fsm_; Gnss_Synchro* gnss_synchro_; Acq_Conf_Fpga acq_parameters_; std::string role_; - int64_t fs_in_; float threshold_; unsigned int channel_; unsigned int doppler_max_; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 924034987..19b9339f6 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -49,9 +49,27 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( in_streams_(in_streams), out_streams_(out_streams) { - acq_parameters_.SetFromConfiguration(configuration, role, fpga_buff_num, fpga_blk_exp, downsampling_factor_default, GPS_L5I_CODE_RATE_CPS, GPS_L5I_CODE_LENGTH_CHIPS); + // Set acquisition parameters + acq_parameters_.SetFromConfiguration(configuration, role_, DEFAULT_FPGA_BLK_EXP, GPS_L5I_CODE_RATE_CPS, GPS_L5I_CODE_LENGTH_CHIPS); - LOG(INFO) << "role " << role; + // Query the capabilities of the instantiated FPGA Acquisition IP Core. When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + std::vector> downsampling_filter_specs; + uint32_t max_FFT_size; + acquisition_fpga_ = pcps_make_acquisition_fpga(&acq_parameters_, ACQ_BUFF_1, downsampling_filter_specs, max_FFT_size); + + // When the FPGA is in use, the acquisition resampler operates only in the L1/E1 frequency band. + // Check whether the acquisition configuration is supported by the FPGA. + bool acq_configuration_valid = acq_parameters_.Is_acq_config_valid(max_FFT_size); + + if (!acq_configuration_valid) + { + std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; + exit(1); + } + + DLOG(INFO) << "role " << role; + + generate_gps_l5i_prn_codes(); #if USE_GLOG_AND_GFLAGS if (FLAGS_doppler_max != 0) @@ -66,10 +84,21 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( #endif doppler_max_ = acq_parameters_.doppler_max; doppler_step_ = static_cast(acq_parameters_.doppler_step); - fs_in_ = acq_parameters_.fs_in; + if (in_streams_ > 1) + { + LOG(ERROR) << "This implementation only supports one input stream"; + } + if (out_streams_ > 0) + { + LOG(ERROR) << "This implementation does not provide an output stream"; + } +} + +void GpsL5iPcpsAcquisitionFpga::generate_gps_l5i_prn_codes() +{ uint32_t code_length = acq_parameters_.code_length; - uint32_t nsamples_total = acq_parameters_.samples_per_code; + uint32_t nsamples_total = acq_parameters_.fft_size; // compute all the GPS L5 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time // a channel is assigned) @@ -78,7 +107,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( volk_gnsssdr::vector> fft_codes_padded(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32 - float max; // temporary maxima search + float max; int32_t tmp; int32_t tmp2; int32_t local_code; @@ -86,7 +115,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( for (uint32_t PRN = 1; PRN <= NUM_PRNs; PRN++) { - gps_l5i_code_gen_complex_sampled(code, PRN, fs_in_); + gps_l5i_code_gen_complex_sampled(code, PRN, acq_parameters_.fs_in); if (acq_parameters_.enable_zero_padding) { @@ -117,29 +146,17 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, quant_bits_local_code - 1) - 1) / max)); - local_code = (tmp & select_lsbits) | ((tmp2 * shl_code_bits) & select_msbits); // put together the real part and the imaginary part - fft_data = local_code & select_all_code_bits; + tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part + fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; } } acq_parameters_.all_fft_codes = d_all_fft_codes_.data(); - - acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters_); - - if (in_streams_ > 1) - { - LOG(ERROR) << "This implementation only supports one input stream"; - } - if (out_streams_ > 0) - { - LOG(ERROR) << "This implementation does not provide an output stream"; - } } - void GpsL5iPcpsAcquisitionFpga::stop_acquisition() { // stop the acquisition and the other FPGA modules. diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h index 1a41a35d8..e3b97df39 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.h @@ -185,19 +185,16 @@ public: void set_resampler_latency(uint32_t latency_samples __attribute__((unused))) override {}; private: + static const uint32_t ACQ_BUFF_1 = 1; // FPGA Acquisition IP buffer containing L2 or L5/E5 frequency band samples by default. + static const uint32_t DEFAULT_FPGA_BLK_EXP = 13; // default block exponent static const uint32_t NUM_PRNs = 32; - static const uint32_t downsampling_factor_default = 1; - static const uint32_t fpga_buff_num = 1; // L5/E5a band - static const uint32_t fpga_blk_exp = 13; // default block exponent - - // the following flags are FPGA-specific and they are using arrange the values of the fft of the local code in the way the FPGA - // expects. This arrangement is done in the initialisation to avoid consuming unnecessary clock cycles during tracking. - static const uint32_t quant_bits_local_code = 16; - static const uint32_t select_lsbits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t select_msbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word - static const uint32_t select_all_code_bits = 0xFFFFFFFF; // Select a 20 bit word - static const uint32_t shl_code_bits = 65536; // shift left by 10 bits + static const uint32_t QUANT_BITS_LOCAL_CODE = 16; + static const uint32_t SELECT_LSBITS = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word + static const uint32_t SELECT_MSBITS = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word + static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word + static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits + void generate_gps_l5i_prn_codes(); float calculate_threshold(float pfa); pcps_acquisition_fpga_sptr acquisition_fpga_; @@ -206,7 +203,6 @@ private: Gnss_Synchro* gnss_synchro_; Acq_Conf_Fpga acq_parameters_; std::string role_; - int64_t fs_in_; int32_t doppler_center_; uint32_t channel_; uint32_t doppler_max_; diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc index eff195cb1..d7b99b57a 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.cc @@ -32,13 +32,13 @@ #include #endif -pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_) +pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga *conf, uint32_t acq_buff_num, std::vector> &downsampling_filter_specs, uint32_t &max_FFT_size) { - return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); + return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf, acq_buff_num, downsampling_filter_specs, max_FFT_size)); } -pcps_acquisition_fpga::pcps_acquisition_fpga(Acq_Conf_Fpga& conf_) +pcps_acquisition_fpga::pcps_acquisition_fpga(Acq_Conf_Fpga *conf_, uint32_t acq_buff_num, std::vector> &downsampling_filter_specs, uint32_t &max_FFT_size) : d_acq_parameters(conf_), d_gnss_synchro(nullptr), d_sample_counter(0ULL), @@ -46,37 +46,34 @@ pcps_acquisition_fpga::pcps_acquisition_fpga(Acq_Conf_Fpga& conf_) d_mag(0), d_input_power(0.0), d_test_statistics(0.0), - d_doppler_step2(d_acq_parameters.doppler_step2), + d_doppler_step2(d_acq_parameters->doppler_step2), d_doppler_center_step_two(0.0), d_doppler_center(0U), d_state(0), d_doppler_index(0U), d_channel(0U), d_doppler_step(0U), - d_doppler_max(d_acq_parameters.doppler_max), - d_fft_size(d_acq_parameters.samples_per_code), + d_doppler_max(d_acq_parameters->doppler_max), d_num_doppler_bins(0U), - d_downsampling_factor(d_acq_parameters.downsampling_factor), - d_select_queue_Fpga(d_acq_parameters.select_queue_Fpga), - d_total_block_exp(d_acq_parameters.total_block_exp), - d_num_doppler_bins_step2(d_acq_parameters.num_doppler_bins_step2), - d_max_num_acqs(d_acq_parameters.max_num_acqs), + d_total_block_exp(d_acq_parameters->total_block_exp), + d_num_doppler_bins_step2(d_acq_parameters->num_doppler_bins_step2), + d_max_num_acqs(d_acq_parameters->max_num_acqs), d_active(false), - d_make_2_steps(d_acq_parameters.make_2_steps) + d_make_2_steps(d_acq_parameters->make_2_steps) { - d_acquisition_fpga = std::make_unique(d_acq_parameters.device_name, d_acq_parameters.code_length, d_acq_parameters.doppler_max, d_fft_size, - d_acq_parameters.fs_in, d_acq_parameters.select_queue_Fpga, d_acq_parameters.all_fft_codes, d_acq_parameters.excludelimit); + d_acquisition_fpga = std::make_unique(d_acq_parameters->device_name, acq_buff_num, + downsampling_filter_specs, max_FFT_size); } - void pcps_acquisition_fpga::set_local_code() { d_acquisition_fpga->set_local_code(d_gnss_synchro->PRN); } - void pcps_acquisition_fpga::init() { + d_acquisition_fpga->init(d_acq_parameters->code_length, d_doppler_max, d_acq_parameters->fft_size, + d_acq_parameters->resampled_fs, d_acq_parameters->downsampling_filter_num, d_acq_parameters->excludelimit, d_acq_parameters->all_fft_codes); d_gnss_synchro->Flag_valid_acquisition = false; d_gnss_synchro->Flag_valid_symbol_output = false; d_gnss_synchro->Flag_valid_pseudorange = false; @@ -90,7 +87,6 @@ void pcps_acquisition_fpga::init() d_num_doppler_bins = static_cast(std::ceil(static_cast(static_cast(d_doppler_max) - static_cast(-d_doppler_max)) / static_cast(d_doppler_step))) + 1; } - void pcps_acquisition_fpga::set_state(int32_t state) { d_state = state; @@ -147,7 +143,7 @@ void pcps_acquisition_fpga::send_negative_acquisition() << ", magnitude " << d_mag << ", input signal power " << d_input_power; - if (d_acq_parameters.repeat_satellite == true) + if (d_acq_parameters->repeat_satellite == true) { d_channel_fsm.lock()->Event_failed_acquisition_repeat(); } @@ -164,14 +160,13 @@ void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t float firstpeak = 0.0; float secondpeak = 0.0; uint32_t total_block_exp; - uint64_t initial_sample; d_acquisition_fpga->set_doppler_sweep(num_doppler_bins, doppler_step, doppler_min); d_acquisition_fpga->run_acquisition(); d_acquisition_fpga->read_acquisition_results(&indext, &firstpeak, &secondpeak, - &initial_sample, + &d_sample_counter, &d_input_power, &d_doppler_index, &total_block_exp); @@ -197,26 +192,8 @@ void pcps_acquisition_fpga::acquisition_core(uint32_t num_doppler_bins, uint32_t } d_gnss_synchro->Acq_doppler_hz = static_cast(doppler); - d_sample_counter = initial_sample; - - if (d_select_queue_Fpga == 0) - { - if (d_downsampling_factor > 1) - { - d_gnss_synchro->Acq_delay_samples = static_cast(d_downsampling_factor * (indext)); - d_gnss_synchro->Acq_samplestamp_samples = d_downsampling_factor * static_cast(d_sample_counter) - static_cast(44); // 33; // 41; // + 81*0.5; // delay due to the downsampling filter in the acquisition - } - else - { - d_gnss_synchro->Acq_delay_samples = static_cast(indext); - d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; // delay due to the downsampling filter in the acquisition - } - } - else - { - d_gnss_synchro->Acq_delay_samples = static_cast(indext); - d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; // delay due to the downsampling filter in the acquisition - } + d_gnss_synchro->Acq_delay_samples = static_cast(indext); + d_gnss_synchro->Acq_samplestamp_samples = d_sample_counter; } diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h index ded4ba660..d1fca2179 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_fpga.h @@ -32,7 +32,8 @@ #include // for uint32_t #include // for shared_ptr #include // for string -#include // for move +#include // for for std::move, std::pair +#include // for std::vector /** \addtogroup Acquisition * \{ */ @@ -46,7 +47,7 @@ class pcps_acquisition_fpga; using pcps_acquisition_fpga_sptr = std::shared_ptr; -pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_); +pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga* conf_, uint32_t acq_buff_num, std::vector>& downsampling_filter_specs, uint32_t& max_FFT_size); /*! * \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA. @@ -168,8 +169,8 @@ public: void stop_acquisition(); private: - friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga& conf_); - explicit pcps_acquisition_fpga(Acq_Conf_Fpga& conf_); + friend pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(Acq_Conf_Fpga* conf, uint32_t acq_buff_num, std::vector>& downsampling_filter_specs, uint32_t& max_FFT_size); + explicit pcps_acquisition_fpga(Acq_Conf_Fpga* conf, uint32_t acq_buff_num, std::vector>& downsampling_filter_specs, uint32_t& max_FFT_size); void send_negative_acquisition(); void send_positive_acquisition(); @@ -179,7 +180,7 @@ private: std::shared_ptr d_acquisition_fpga; std::weak_ptr d_channel_fsm; - Acq_Conf_Fpga d_acq_parameters; + Acq_Conf_Fpga* d_acq_parameters; Gnss_Synchro* d_gnss_synchro; @@ -199,10 +200,7 @@ private: uint32_t d_channel; uint32_t d_doppler_step; uint32_t d_doppler_max; - uint32_t d_fft_size; uint32_t d_num_doppler_bins; - uint32_t d_downsampling_factor; - uint32_t d_select_queue_Fpga; uint32_t d_total_block_exp; uint32_t d_num_doppler_bins_step2; uint32_t d_max_num_acqs; diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc index 79f02b477..db4c0db42 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.cc +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -29,37 +29,47 @@ #endif void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configuration, - const std::string &role, uint32_t sel_queue_fpga, uint32_t blk_exp, uint32_t downsampling_factor_default, double chip_rate, double code_length_chips) + const std::string &role, uint32_t blk_exp, double code_chips_per_sec, double num_chips_per_code) { // sampling frequency const int64_t fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", fs_in); fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); + // resampling frequency + resampled_fs = fs_in; + // max doppler doppler_max = configuration->property(role + ".doppler_max", doppler_max); - // downsampling factor - downsampling_factor = configuration->property(role + ".downsampling_factor", downsampling_factor_default); + // code chips per second + code_rate_cps = code_chips_per_sec; - fs_in = fs_in / downsampling_factor; + // code length chips + code_length_chips = num_chips_per_code; // code length in samples - code_length = static_cast(std::round(static_cast(fs_in) / (chip_rate / code_length_chips))); + code_length = static_cast(std::round(static_cast(fs_in) / (code_rate_cps / code_length_chips))); - enable_zero_padding = configuration->property(role + ".enable_zero_padding", true); + // zero padding + if (((code_length & (code_length - 1)) != 0)) + { + // If the code length (in samples) is not a power of two, zero padding is required. + enable_zero_padding = true; + } - // The FPGA can only use FFT lengths that are a power of two. - float factor = enable_zero_padding ? 2.0F : 1.0F; - samples_per_code = pow(2, ceilf(log2f(static_cast(code_length) * factor))); + // FFT length + float zero_padding_adjustment = enable_zero_padding ? 2.0F : 1.0F; + fft_size = pow(2, ceilf(log2f(static_cast(code_length) * zero_padding_adjustment))); + + // Exclude limit value for the second maxima search + excludelimit = static_cast(1 + ceil((1.0 / code_rate_cps) * static_cast(resampled_fs))); // repeat satellite repeat_satellite = configuration->property(role + ".repeat_satellite", false); - // FPGA buffer number - select_queue_Fpga = configuration->property(role + ".select_queue_Fpga", sel_queue_fpga); - // UIO device file std::string device_io_name; + // find the uio device file corresponding to the acquisition if (find_uio_dev_file_name(device_io_name, acquisition_device_name, 0) < 0) { @@ -68,10 +78,7 @@ void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configura } device_name = std::move(device_io_name); - // exclusion limit - excludelimit = static_cast(1 + ceil((1.0 / chip_rate) * static_cast(fs_in))); - - // acquisition step 2 parameters + // parameters for the second acquisition step num_doppler_bins_step2 = configuration->property(role + ".second_nbins", num_doppler_bins_step2); doppler_step2 = configuration->property(role + ".second_doppler_step", doppler_step2); doppler_step = configuration->property(role + ".doppler_step", doppler_step); @@ -81,3 +88,61 @@ void Acq_Conf_Fpga::SetFromConfiguration(const ConfigurationInterface *configura // reference for the FPGA FFT-IFFT attenuation factor total_block_exp = configuration->property(role + ".total_block_exp", blk_exp); } + +bool Acq_Conf_Fpga::ConfigureAutomaticResampler(std::vector> downsampling_filter_specs, uint32_t max_FFT_size, double opt_freq) +{ + bool acq_configuration_valid = false; + uint32_t optimal_downsampling_factor = fs_in / opt_freq; + + if (optimal_downsampling_factor > 1) + { + for (auto it = downsampling_filter_specs.begin(); it != downsampling_filter_specs.end(); ++it) + { + uint32_t dec_factor = it->first; + uint32_t filter_delay = it->second; + // Select the FPGA-supported downsampling factor that is the closest to, but smaller than, the target downsampling factor + if (optimal_downsampling_factor >= dec_factor) + { + // check if the required FFT size is supported in the FPGA + uint32_t fft_size_downsampled = (fft_size / dec_factor); + if (fft_size_downsampled <= max_FFT_size) + { + downsampling_filter_num++; + downsampling_factor = dec_factor; + downsampling_filter_delay = filter_delay; + + // update the resampling frequency, the code length, the FFT size, and the exclude limit parameter taking into account the downsampling factor + resampled_fs = fs_in / downsampling_factor; + code_length = static_cast(std::round(static_cast(resampled_fs) / (code_rate_cps / code_length_chips))); + float zero_padding_adjustment = enable_zero_padding ? 2.0F : 1.0F; + fft_size = pow(2, ceilf(log2f(static_cast(code_length) * zero_padding_adjustment))); + excludelimit = static_cast(1 + ceil((1.0 / code_rate_cps) * static_cast(resampled_fs))); + acq_configuration_valid = true; + } + break; + } + } + } + else + { + // the buffer containing L2 or L5/E5a frequency band samples by default does not implement a downsampling filter + if (fft_size <= max_FFT_size) + { + acq_configuration_valid = true; + } + } + + return acq_configuration_valid; +} + +bool Acq_Conf_Fpga::Is_acq_config_valid(uint32_t max_FFT_size) +{ + if (fft_size <= max_FFT_size) + { + return true; + } + else + { + return false; + } +} diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.h b/src/algorithms/acquisition/libs/acq_conf_fpga.h index fd20ad953..379fdd3d4 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.h +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.h @@ -22,6 +22,8 @@ #include #include #include +#include // for std::move, std::pair +#include // for std::vector /** \addtogroup Acquisition * \{ */ @@ -35,29 +37,33 @@ class Acq_Conf_Fpga public: Acq_Conf_Fpga() = default; - void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, uint32_t sel_queue_fpga, uint32_t blk_exp, uint32_t downsampling_factor_default, double chip_rate, double code_length_chips); + void SetFromConfiguration(const ConfigurationInterface *configuration, const std::string &role, uint32_t blk_exp, double code_chips_per_sec, double num_chips_per_code); + + bool ConfigureAutomaticResampler(std::vector> downsampling_filter_specs, uint32_t max_FFT_size, double opt_freq); + + bool Is_acq_config_valid(uint32_t max_FFT_size); /* PCPS Acquisition configuration */ std::string device_name = "uio0"; uint32_t *all_fft_codes = NULL; // pointer to memory that contains all the code ffts + double code_rate_cps; + double code_length_chips; int64_t fs_in{4000000LL}; - + int64_t resampled_fs{4000000LL}; float doppler_step{250.0}; float doppler_step2{125.0}; - uint32_t num_doppler_bins_step2{4U}; - int32_t doppler_max{5000}; - - uint32_t select_queue_Fpga{0U}; - uint32_t downsampling_factor{4U}; + uint32_t downsampling_filter_num{0U}; + uint32_t downsampling_factor{1U}; + uint32_t downsampling_filter_delay{0U}; uint32_t total_block_exp{13U}; uint32_t excludelimit{5U}; uint32_t max_num_acqs{2U}; - uint32_t samples_per_code{1U}; + uint32_t fft_size{1U}; uint32_t code_length{16000U}; bool make_2_steps{false}; - bool enable_zero_padding{true}; + bool enable_zero_padding{false}; bool repeat_satellite{false}; private: diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.cc b/src/algorithms/acquisition/libs/fpga_acquisition.cc index def42d9d8..72fae5b51 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.cc +++ b/src/algorithms/acquisition/libs/fpga_acquisition.cc @@ -26,7 +26,6 @@ #include // for operator<< #include // libraries used by the GIPO #include // for write, close, read, ssize_t -#include // for move #if USE_GLOG_AND_GFLAGS #include @@ -47,36 +46,51 @@ }) #endif - Fpga_Acquisition::Fpga_Acquisition(std::string device_name, - uint32_t nsamples, - uint32_t doppler_max, - uint32_t nsamples_total, - int64_t fs_in, uint32_t select_queue, - uint32_t *all_fft_codes, - uint32_t excludelimit) : d_device_name(std::move(device_name)), - d_fs_in(fs_in), - d_fd(0), // driver descriptor - d_map_base(nullptr), // driver memory map - d_all_fft_codes(all_fft_codes), - d_vector_length(nsamples_total), - d_excludelimit(excludelimit), - d_nsamples_total(nsamples_total), - d_nsamples(nsamples), // number of samples not including padding - d_select_queue(select_queue), - d_doppler_max(doppler_max), - d_doppler_step(0), - d_PRN(0) + std::vector> &downsampling_filter_specs, + uint32_t &max_FFT_size) : d_device_name(device_name), + d_resampled_fs(0), + d_map_base(nullptr), // driver memory map + d_all_fft_codes(nullptr), + d_fd(0), // driver descriptor + d_fft_size(0), + d_excludelimit(0), + d_nsamples(0), // number of samples not including padding + d_filter_num(0), + d_downsampling_factor(1), + d_downsampling_filter_delay(0), + d_select_queue(select_queue), + d_doppler_max(0), + d_doppler_step(0), + d_PRN(0), + d_IP_core_version(0) { Fpga_Acquisition::open_device(); Fpga_Acquisition::reset_acquisition(); Fpga_Acquisition::fpga_acquisition_test_register(); + Fpga_Acquisition::read_ipcore_info(downsampling_filter_specs, max_FFT_size); Fpga_Acquisition::close_device(); - DLOG(INFO) << "Acquisition FPGA class created"; } +void Fpga_Acquisition::init(uint32_t nsamples, uint32_t doppler_max, uint32_t fft_size, + int64_t resampled_fs, uint32_t downsampling_filter_num, uint32_t excludelimit, uint32_t *all_fft_codes) +{ + d_resampled_fs = resampled_fs; + d_all_fft_codes = all_fft_codes; + d_fft_size = fft_size; + d_excludelimit = excludelimit; + d_nsamples = nsamples; + d_filter_num = downsampling_filter_num; + if (d_filter_num > 0) + { + d_downsampling_factor = d_downsampling_filter_specs[d_filter_num - 1].first; + d_downsampling_filter_delay = d_downsampling_filter_specs[d_filter_num - 1].second; + } + d_doppler_max = doppler_max; +} + bool Fpga_Acquisition::set_local_code(uint32_t PRN) { @@ -88,11 +102,11 @@ bool Fpga_Acquisition::set_local_code(uint32_t PRN) void Fpga_Acquisition::write_local_code() { - d_map_base[9] = LOCAL_CODE_CLEAR_MEM; + d_map_base[CLEAR_MEM_REG_ADDR] = LOCAL_CODE_CLEAR_MEM; // write local code - for (uint32_t k = 0; k < d_vector_length; k++) + for (uint32_t k = 0; k < d_fft_size; k++) { - d_map_base[6] = d_all_fft_codes[d_nsamples_total * (d_PRN - 1) + k]; + d_map_base[PROG_MEM_ADDR] = d_all_fft_codes[d_fft_size * (d_PRN - 1) + k]; } } @@ -118,15 +132,12 @@ void Fpga_Acquisition::open_device() void Fpga_Acquisition::fpga_acquisition_test_register() { - // sanity check : check test register - const uint32_t writeval = TEST_REG_SANITY_CHECK; - // write value to test register - d_map_base[15] = writeval; + d_map_base[TEST_REG_ADDR] = TEST_REG_SANITY_CHECK; // read value from test register - const uint32_t readval = d_map_base[15]; + const uint32_t readval = d_map_base[TEST_REG_ADDR]; - if (writeval != readval) + if (readval != TEST_REG_SANITY_CHECK) { LOG(WARNING) << "Acquisition test register sanity check failed"; } @@ -136,6 +147,50 @@ void Fpga_Acquisition::fpga_acquisition_test_register() } } +void Fpga_Acquisition::read_ipcore_info(std::vector> &downsampling_filter_specs, uint32_t &max_FFT_size) +{ + d_IP_core_version = d_map_base[FPGA_IP_CORE_VERSION_REG_ADDR]; + if (d_IP_core_version == FPGA_ACQ_IP_VERSION_1) + { + // FPGA acquisition IP core version FPGA_ACQ_IP_VERSION_1 + max_FFT_size = d_map_base[MAX_FFT_SIZE_REG_ADDR]; + if (d_select_queue == ACQ_BUFF_0) + { + // Check if the requested downsampling filter is available on the FPGA and read its implemented latency. + uint32_t downsampling_filter_dec_factors = d_map_base[DOWNSAMPLING_FILTER_DEC_FACTORS_REG_ADDR]; + uint32_t downsampling_filter_latencies = d_map_base[DOWNSAMPLING_FILTER_LATENCIES_REG_ADDR]; + for (uint32_t filt_num = 1; filt_num <= MAX_FILTERS_AVAILABLE; filt_num++) + { + // The information about the instantiated downsampling filters in the FPGA is ordered such that the largest downsampling factor is stored in the least significant bits (LSBs), while the smallest downsampling factor is stored in the most significant bits (MSBs). + uint32_t dec_factor = downsampling_filter_dec_factors & BIT_MASK_4; + downsampling_filter_dec_factors = downsampling_filter_dec_factors >> RSHIFT_4_BITS; + + uint32_t filter_latency = downsampling_filter_latencies & BIT_MASK_8; + downsampling_filter_latencies = downsampling_filter_latencies >> RSHIFT_8_BITS; + if (dec_factor != 0) + { + downsampling_filter_specs.emplace_back(dec_factor, filter_latency); + } + else + { + break; + } + } + } + } + else + { + // FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1 + max_FFT_size = DEFAULT_MAX_FFT_SIZE; + if (d_select_queue == ACQ_BUFF_0) + { + // An acquisition resampler with a downsampling factor of DEFAULT_DOWNSAMPLING_FACTOR is implemented in the L1/E1 frequency band + downsampling_filter_specs.emplace_back(DEFAULT_DOWNSAMPLING_FACTOR, DEFAULT_DOWNSAMPLING_FILTER_DELAY); + } + } + + d_downsampling_filter_specs = downsampling_filter_specs; +} void Fpga_Acquisition::run_acquisition() { @@ -149,7 +204,7 @@ void Fpga_Acquisition::run_acquisition() } // launch the acquisition process - d_map_base[8] = LAUNCH_ACQUISITION; // writing a 1 to reg 8 launches the acquisition process + d_map_base[ACQ_COMMAND_FLAGS_REG_ADDR] = LAUNCH_ACQUISITION; // writing a 1 to reg 8 launches the acquisition process int32_t irq_count; // wait for interrupt @@ -164,7 +219,7 @@ void Fpga_Acquisition::run_acquisition() void Fpga_Acquisition::set_block_exp(uint32_t total_block_exp) { - d_map_base[11] = total_block_exp; + d_map_base[MAX_FFT_SCALING_FACTOR_REG_ADDR] = total_block_exp; } @@ -172,59 +227,47 @@ void Fpga_Acquisition::set_doppler_sweep(uint32_t num_sweeps, uint32_t doppler_s { // The doppler step can never be outside the range -pi to +pi, otherwise there would be aliasing // The FPGA expects phase_step_rad between -1 (-pi) to +1 (+pi) - float phase_step_rad_real = 2.0F * (doppler_min) / static_cast(d_fs_in); - auto phase_step_rad_int = static_cast(phase_step_rad_real * (POW_2_31)); - d_map_base[3] = phase_step_rad_int; + float phase_step_rad_real = 2.0F * (doppler_min) / static_cast(d_resampled_fs); + d_map_base[DOPPLER_MIN_REG_ADDR] = static_cast(phase_step_rad_real * (POW_2_31)); // repeat the calculation with the doppler step - phase_step_rad_real = 2.0F * (doppler_step) / static_cast(d_fs_in); - phase_step_rad_int = static_cast(phase_step_rad_real * (POW_2_31)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings - d_map_base[4] = phase_step_rad_int; + phase_step_rad_real = 2.0F * (doppler_step) / static_cast(d_resampled_fs); + d_map_base[DOPPLER_STEP_REG_ADDR] = static_cast(phase_step_rad_real * (POW_2_31)); // * 2^29 (in total it makes x2^31 in two steps to avoid the warnings // write number of doppler sweeps - d_map_base[5] = num_sweeps; + d_map_base[NUM_DOPPLER_SEARCH_STEPS_REG_ADDR] = num_sweeps; } void Fpga_Acquisition::configure_acquisition() { // Fpga_Acquisition::(); - d_map_base[0] = d_select_queue; - d_map_base[1] = d_vector_length; - d_map_base[2] = d_nsamples; - d_map_base[7] = static_cast(std::log2(static_cast(d_vector_length))); // log2 FFTlength - d_map_base[12] = d_excludelimit; + d_map_base[FREQ_BAND_DOWNSAMPLE_REG_ADDR] = d_select_queue | (d_filter_num << 4); + d_map_base[FFT_LENGTH_REG_ADDR] = d_fft_size; + d_map_base[CORR_NSAMPLES_REG_ADDR] = d_nsamples; + d_map_base[LOG2_FFT_LENGTH_REG_ADDR] = static_cast(std::log2(static_cast(d_fft_size))); // log2 FFTlength + d_map_base[EXCL_LIM_REG_ADDR] = d_excludelimit; } void Fpga_Acquisition::read_acquisition_results(uint32_t *max_index, float *firstpeak, float *secondpeak, uint64_t *initial_sample, float *power_sum, uint32_t *doppler_index, uint32_t *total_blk_exp) { - uint32_t readval = d_map_base[1]; // read sample counter (LSW) - auto initial_sample_tmp = static_cast(readval); - - uint64_t readval_long = d_map_base[2]; // read sample counter (MSW) - uint64_t readval_long_shifted = readval_long << 32; // 2^32 - - initial_sample_tmp += readval_long_shifted; // 2^32 + uint64_t initial_sample_tmp = (static_cast(d_map_base[SAMPLESTAMP_MSW_REG_ADDR]) << 32) + (static_cast(d_map_base[SAMPLESTAMP_LSW_REG_ADDR])); + uint32_t max_index_tmp = d_map_base[ACQ_DELAY_SAMPLES_REG_ADDR]; // read max index position + if (d_downsampling_factor > 1) + { + initial_sample_tmp *= static_cast(d_downsampling_factor); // take into account the downsampling factor for the sample stamp + initial_sample_tmp -= static_cast(d_downsampling_filter_delay); // take into account the downsampling filter delay + max_index_tmp *= d_downsampling_factor; // take into account the downsampling factor for the acq. delay + } *initial_sample = initial_sample_tmp; - - readval = d_map_base[3]; // read first peak value - *firstpeak = static_cast(readval); - - readval = d_map_base[4]; // read second peak value - *secondpeak = static_cast(readval); - - readval = d_map_base[5]; // read max index position - *max_index = readval; - - *power_sum = 0; // power sum is not used - - readval = d_map_base[7]; // read doppler index -- this read releases the interrupt line - *doppler_index = readval; - - readval = d_map_base[8]; // read FFT block exponent - *total_blk_exp = readval; + *max_index = max_index_tmp; + *firstpeak = d_map_base[MAG_SQ_FIRST_PEAK_REG_ADDR]; // read first peak value + *secondpeak = d_map_base[MAG_SQ_SECOND_PEAK_REG_ADDR]; // read second peak value + *power_sum = 0; // The FPGA does not currently support power sum. + *doppler_index = d_map_base[DOPPLER_INDEX_REG_ADDR]; // read doppler index -- this read releases the interrupt line + *total_blk_exp = d_map_base[FFT_SCALING_FACTOR_REG_ADDR]; // read FFT block exponent } @@ -241,30 +284,13 @@ void Fpga_Acquisition::close_device() void Fpga_Acquisition::reset_acquisition() { - d_map_base[8] = RESET_ACQUISITION; // setting bit 2 of d_map_base[8] resets the acquisition. This causes a reset of all - // the FPGA HW modules including the multicorrelators + d_map_base[ACQ_COMMAND_FLAGS_REG_ADDR] = RESET_ACQUISITION; // setting bit 2 resets the acquisition. This causes a reset of all + // the FPGA HW modules including the multicorrelators } void Fpga_Acquisition::stop_acquisition() { - d_map_base[8] = STOP_ACQUISITION; // setting bit 3 of d_map_base[8] stops the acquisition module. This stops all - // the FPGA HW modules including the multicorrelators -} - - -// this function is only used for the unit tests -void Fpga_Acquisition::read_fpga_total_scale_factor(uint32_t *total_scale_factor, uint32_t *fw_scale_factor) -{ - uint32_t readval = d_map_base[8]; - *total_scale_factor = readval; - // only the total scale factor is used for the tests (fw scale factor to be removed) - *fw_scale_factor = 0; -} - - -void Fpga_Acquisition::read_result_valid(uint32_t *result_valid) -{ - uint32_t readval = d_map_base[0]; - *result_valid = readval; + d_map_base[ACQ_COMMAND_FLAGS_REG_ADDR] = STOP_ACQUISITION; // setting bit 3 stops the acquisition module. This stops all + // the FPGA HW modules including the multicorrelators } diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.h b/src/algorithms/acquisition/libs/fpga_acquisition.h index 5a0b633f9..3e73ddf00 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.h +++ b/src/algorithms/acquisition/libs/fpga_acquisition.h @@ -24,6 +24,8 @@ #include #include +#include // for std::move, std::pair +#include // for std::vector /** \addtogroup Acquisition * \{ */ @@ -42,19 +44,22 @@ public: */ Fpga_Acquisition( std::string device_name, - uint32_t nsamples, - uint32_t doppler_max, - uint32_t nsamples_total, - int64_t fs_in, uint32_t select_queue, - uint32_t *all_fft_codes, - uint32_t excludelimit); + std::vector> &downsampling_filter_specs, + uint32_t &max_FFT_size); /*! * \brief Destructor */ ~Fpga_Acquisition() = default; + /*! + * \brief Initialize acquisition parameters + */ + // void init(uint32_t samples_per_code, uint32_t code_length, int64_t resampled_fs, uint32_t *all_fft_codes); + void init(uint32_t nsamples, uint32_t doppler_max, uint32_t d_fft_size, + int64_t resampled_fs, uint32_t downsampling_filter_num, uint32_t excludelimit, uint32_t *all_fft_codes); + /*! * \brief Select the code with the chosen PRN */ @@ -110,11 +115,6 @@ public: */ void stop_acquisition(); - /*! - * \brief Read the scaling factor that has been used by the FFT-IFFT - */ - void read_fpga_total_scale_factor(uint32_t *total_scale_factor, uint32_t *fw_scale_factor); - /*! * \brief Set the block exponent of the FFT in the FPGA. */ @@ -141,6 +141,42 @@ public: void close_device(); private: + // FPGA IP Core version + static const uint32_t FPGA_ACQ_IP_VERSION_1 = 0x0001; // FPGA IP core version + + // FPGA register addresses + + // write-only registers + static const uint32_t FREQ_BAND_DOWNSAMPLE_REG_ADDR = 0; // Select frequency band and downsampling filter + static const uint32_t FFT_LENGTH_REG_ADDR = 1; // Length of the FFT + static const uint32_t CORR_NSAMPLES_REG_ADDR = 2; // Correlation length + static const uint32_t DOPPLER_MIN_REG_ADDR = 3; // Doppler min + static const uint32_t DOPPLER_STEP_REG_ADDR = 4; // Doppler step + static const uint32_t NUM_DOPPLER_SEARCH_STEPS_REG_ADDR = 5; // Number of Doppler search steps + static const uint32_t PROG_MEM_ADDR = 6; // Access to the memory storing the PRN code of the target satellite. + static const uint32_t LOG2_FFT_LENGTH_REG_ADDR = 7; // Log2(FFT_LENGTH) + static const uint32_t ACQ_COMMAND_FLAGS_REG_ADDR = 8; // Flags that reset, start, and stop the acquisition process. + static const uint32_t CLEAR_MEM_REG_ADDR = 9; // Flag that resets the write address of the PRN code memory. + static const uint32_t MAX_FFT_SCALING_FACTOR_REG_ADDR = 11; // Reference FFT scaling factor + static const uint32_t EXCL_LIM_REG_ADDR = 12; // Exclude Limit value for the second FFT peak search process + + // read-write registers + static const uint32_t TEST_REG_ADDR = 15; + + // read-only registers + static const uint32_t RESULT_VALID_REG_ADDR = 0; // Flag that indicates a valid result + static const uint32_t SAMPLESTAMP_LSW_REG_ADDR = 1; // Sample stamp LSW + static const uint32_t SAMPLESTAMP_MSW_REG_ADDR = 2; // Sample stamp MSW + static const uint32_t MAG_SQ_FIRST_PEAK_REG_ADDR = 3; // magnitude squared of the first peak + static const uint32_t MAG_SQ_SECOND_PEAK_REG_ADDR = 4; // magnitude squared of the second peak + static const uint32_t ACQ_DELAY_SAMPLES_REG_ADDR = 5; // acquisition delay in samples + static const uint32_t DOPPLER_INDEX_REG_ADDR = 7; // Doppler index + static const uint32_t FFT_SCALING_FACTOR_REG_ADDR = 8; // Scaling factor applied by the FFT + static const uint32_t MAX_FFT_SIZE_REG_ADDR = 9; // Maximum FFT size supported by the FPGA + static const uint32_t DOWNSAMPLING_FILTER_DEC_FACTORS_REG_ADDR = 10; // Available decimation factors + static const uint32_t DOWNSAMPLING_FILTER_LATENCIES_REG_ADDR = 11; // Available downsampling filter latencies + static const uint32_t FPGA_IP_CORE_VERSION_REG_ADDR = 14; // FPGA acquisition IP core version + // FPGA register parameters static const uint32_t FPGA_PAGE_SIZE = 0x1000; // default page size for the multicorrelator memory map static const uint32_t LAUNCH_ACQUISITION = 1; // command to launch the acquisition process @@ -152,30 +188,40 @@ private: static const uint32_t POW_2_2 = 4; // 2^2 (used for the conversion of floating point numbers to integers) static const uint32_t POW_2_31 = 2147483648; // 2^31 (used for the conversion of floating point numbers to integers) - static const uint32_t SELECT_LSBits = 0x0000FFFF; // Select the 10 LSbits out of a 20-bit word - static const uint32_t SELECT_MSBbits = 0xFFFF0000; // Select the 10 MSbits out of a 20-bit word - static const uint32_t SELECT_ALL_CODE_BITS = 0xFFFFFFFF; // Select a 20 bit word - static const uint32_t SHL_CODE_BITS = 65536; // shift left by 10 bits + static const uint32_t MAX_FILTERS_AVAILABLE = 2; // maximum number of downsampling filters available in the FPGA by default + static const uint32_t DEFAULT_DOWNSAMPLING_FILTER_DELAY = 40; // default downsampling filter delay (for FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1) + static const uint32_t DEFAULT_DOWNSAMPLING_FACTOR = 4; // default downsampling factor (for FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1) + static const uint32_t DEFAULT_MAX_FFT_SIZE = 32768; // default maximum FFT size supported by the FPGA + static const uint32_t ACQ_BUFF_0 = 0; // FPGA Acquisition IP buffer containing L1/E1 frequency band samples by default. + static const uint32_t ACQ_BUFF_1 = 0; // FPGA Acquisition IP buffer containing L2 or L5/E5a frequency band samples by default. - // FPGA private functions + // bit manipulation + static const uint32_t RSHIFT_4_BITS = 0x4; + static const uint32_t RSHIFT_8_BITS = 0x8; + static const uint32_t BIT_MASK_4 = 0xF; + static const uint32_t BIT_MASK_8 = 0xFF; + + // private methods void fpga_acquisition_test_register(void); - void read_result_valid(uint32_t *result_valid); + void read_ipcore_info(std::vector> &downsampling_filter_specs, uint32_t &max_FFT_size); - std::string d_device_name; // HW device name - - int64_t d_fs_in; - // data related to the hardware module and the driver - int32_t d_fd; // driver descriptor + std::vector> d_downsampling_filter_specs; + std::string d_device_name; // HW device name + int64_t d_resampled_fs; // sampling frequency volatile uint32_t *d_map_base; // driver memory map uint32_t *d_all_fft_codes; // memory that contains all the code ffts - uint32_t d_vector_length; // number of samples including padding and number of ms + int32_t d_fd; // driver descriptor + uint32_t d_fft_size; // number of samples including padding uint32_t d_excludelimit; - uint32_t d_nsamples_total; // number of samples including padding - uint32_t d_nsamples; // number of samples not including padding - uint32_t d_select_queue; // queue selection - uint32_t d_doppler_max; // max doppler - uint32_t d_doppler_step; // doppler step - uint32_t d_PRN; // PRN + uint32_t d_nsamples; // number of samples not including padding + uint32_t d_filter_num; // Selected downsampling filter + uint32_t d_downsampling_factor; // downsampling_factor + uint32_t d_downsampling_filter_delay; // Impulse response delay of the downsampling filter + uint32_t d_select_queue; // queue selection + uint32_t d_doppler_max; // max doppler + uint32_t d_doppler_step; // doppler step + uint32_t d_PRN; // PRN + uint32_t d_IP_core_version; // FPGA acquisition IP core version }; From 3651822265e4b04d570528ec9afc440cf355c871 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 27 Feb 2025 14:22:19 +0100 Subject: [PATCH 488/499] Updated controlled termination behavior when the FPGA does not support the requested sampling frequency. --- .../adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc | 2 +- .../acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 6a3bbd6f3..40d5aed16 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -64,7 +64,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( if (!acq_configuration_valid) { std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; - exit(1); + exit(0); } DLOG(INFO) << "role " << role; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index e121aa265..11e4bc2c6 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -63,7 +63,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( if (!acq_configuration_valid) { std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; - exit(1); + exit(0); } DLOG(INFO) << "role " << role; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index 210d0f29c..c5440568c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -63,7 +63,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration if (!acq_configuration_valid) { std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the E5b band. Please update the sampling frequency in the configuration file." << std::endl; - exit(1); + exit(0); } DLOG(INFO) << "role " << role; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 4d2c0da50..b0546c8e5 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -63,7 +63,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( if (!acq_configuration_valid) { std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; - exit(1); + exit(0); } DLOG(INFO) << "role " << role; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 0f78c2d6e..8e178f18d 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -63,7 +63,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( if (!acq_configuration_valid) { std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L2 band. Please update the sampling frequency in the configuration file." << std::endl; - exit(1); + exit(0); } DLOG(INFO) << "role " << role; diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 19b9339f6..48fcdcbe0 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -64,7 +64,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( if (!acq_configuration_valid) { std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; - exit(1); + exit(0); } DLOG(INFO) << "role " << role; From 8bc9e362ead1e9797319b29a35a844cc58db1729 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 27 Feb 2025 14:30:44 +0100 Subject: [PATCH 489/499] Updated output message for unsupported sampling frequency in FPGA acquisition IP. --- .../adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc | 2 +- .../acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc | 2 +- .../acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 40d5aed16..94f4c6367 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -63,7 +63,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga( if (!acq_configuration_valid) { - std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; + std::cout << "The FPGA acquisition IP does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; exit(0); } diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 11e4bc2c6..54d5d4f5c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -62,7 +62,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga( if (!acq_configuration_valid) { - std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; + std::cout << "The FPGA acquisition IP does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; exit(0); } diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index c5440568c..e099ec320 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -62,7 +62,7 @@ GalileoE5bPcpsAcquisitionFpga::GalileoE5bPcpsAcquisitionFpga(const Configuration if (!acq_configuration_valid) { - std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the E5b band. Please update the sampling frequency in the configuration file." << std::endl; + std::cout << "The FPGA acquisition IP does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the E5b band. Please update the sampling frequency in the configuration file." << std::endl; exit(0); } diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index b0546c8e5..7c8a24cd0 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -62,7 +62,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( if (!acq_configuration_valid) { - std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; + std::cout << "The FPGA acquisition IP does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L1/E1 band. Please update the sampling frequency in the configuration file." << std::endl; exit(0); } diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index 8e178f18d..d59f984bc 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -62,7 +62,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga( if (!acq_configuration_valid) { - std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L2 band. Please update the sampling frequency in the configuration file." << std::endl; + std::cout << "The FPGA acquisition IP does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L2 band. Please update the sampling frequency in the configuration file." << std::endl; exit(0); } diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 48fcdcbe0..2a395eb51 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -63,7 +63,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga( if (!acq_configuration_valid) { - std::cout << "The FPGA does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; + std::cout << "The FPGA acquisition IP does not support the required sampling frequency of " << acq_parameters_.fs_in << " SPS for the L5/E5a band. Please update the sampling frequency in the configuration file." << std::endl; exit(0); } From 61d393f7cd1b35d4877fa4826644ebe9fc032070 Mon Sep 17 00:00:00 2001 From: Marc Majoral Date: Thu, 27 Feb 2025 15:17:56 +0100 Subject: [PATCH 490/499] Fix automatic resampler configuration. --- src/algorithms/acquisition/libs/acq_conf_fpga.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/algorithms/acquisition/libs/acq_conf_fpga.cc b/src/algorithms/acquisition/libs/acq_conf_fpga.cc index db4c0db42..1f77f0ff2 100644 --- a/src/algorithms/acquisition/libs/acq_conf_fpga.cc +++ b/src/algorithms/acquisition/libs/acq_conf_fpga.cc @@ -96,10 +96,10 @@ bool Acq_Conf_Fpga::ConfigureAutomaticResampler(std::vector 1) { - for (auto it = downsampling_filter_specs.begin(); it != downsampling_filter_specs.end(); ++it) + for (uint32_t k = 0; k < downsampling_filter_specs.size(); k++) { - uint32_t dec_factor = it->first; - uint32_t filter_delay = it->second; + uint32_t dec_factor = downsampling_filter_specs[k].first; + uint32_t filter_delay = downsampling_filter_specs[k].second; // Select the FPGA-supported downsampling factor that is the closest to, but smaller than, the target downsampling factor if (optimal_downsampling_factor >= dec_factor) { @@ -107,7 +107,7 @@ bool Acq_Conf_Fpga::ConfigureAutomaticResampler(std::vector Date: Fri, 28 Feb 2025 15:15:13 +0100 Subject: [PATCH 491/499] Fix handling of zero padding option when disabled. --- ...ileo_e1_pcps_ambiguous_acquisition_fpga.cc | 24 +++++++------- .../galileo_e5a_pcps_acquisition_fpga.cc | 24 +++++++------- .../galileo_e5b_pcps_acquisition_fpga.cc | 24 +++++++------- .../gps_l1_ca_pcps_acquisition_fpga.cc | 25 +++++++-------- .../gps_l2_m_pcps_acquisition_fpga.cc | 32 ++++++++----------- .../adapters/gps_l5i_pcps_acquisition_fpga.cc | 25 +++++++-------- 6 files changed, 74 insertions(+), 80 deletions(-) diff --git a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc index 94f4c6367..12c0426f8 100644 --- a/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e1_pcps_ambiguous_acquisition_fpga.cc @@ -104,7 +104,7 @@ void GalileoE1PcpsAmbiguousAcquisitionFpga::generate_galileo_e1_prn_codes() // a channel is assigned) auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT volk_gnsssdr::vector> code(nsamples_total); // buffer for the local code - volk_gnsssdr::vector fft_codes_padded(nsamples_total); + volk_gnsssdr::vector fft_code(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * GALILEO_E1_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 float max; @@ -134,34 +134,34 @@ void GalileoE1PcpsAmbiguousAcquisitionFpga::generate_galileo_e1_prn_codes() { // Duplicate the code sequence std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); } - // Fill in zero padding for the rest - std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); - std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer - fft_if->execute(); // Run the FFT of local code - volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer + fft_if->execute(); // Run the FFT of local code + volk_32fc_conjugate_32fc(fft_code.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values // normalize the code max = 0; // initialize maximum value for (uint32_t i = 0; i < nsamples_total; i++) // search for maxima { - if (std::abs(fft_codes_padded[i].real()) > max) + if (std::abs(fft_code[i].real()) > max) { - max = std::abs(fft_codes_padded[i].real()); + max = std::abs(fft_code[i].real()); } - if (std::abs(fft_codes_padded[i].imag()) > max) + if (std::abs(fft_code[i].imag()) > max) { - max = std::abs(fft_codes_padded[i].imag()); + max = std::abs(fft_code[i].imag()); } } // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp = static_cast(floor(fft_code[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_code[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; diff --git a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc index 54d5d4f5c..c43787c84 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5a_pcps_acquisition_fpga.cc @@ -103,7 +103,7 @@ void GalileoE5aPcpsAcquisitionFpga::generate_galileo_e5a_prn_codes() // a channel is assigned) auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT volk_gnsssdr::vector> code(nsamples_total); - volk_gnsssdr::vector> fft_codes_padded(nsamples_total); + volk_gnsssdr::vector> fft_code(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * GALILEO_E5A_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 if (acq_iq_) @@ -142,33 +142,33 @@ void GalileoE5aPcpsAcquisitionFpga::generate_galileo_e5a_prn_codes() { // Duplicate the code sequence std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); } - // Fill in zero padding for the rest - std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); - std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer - fft_if->execute(); // Run the FFT of local code - volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer + fft_if->execute(); // Run the FFT of local code + volk_32fc_conjugate_32fc(fft_code.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values max = 0; // initialize maximum value for (uint32_t i = 0; i < nsamples_total; i++) // search for maxima { - if (std::abs(fft_codes_padded[i].real()) > max) + if (std::abs(fft_code[i].real()) > max) { - max = std::abs(fft_codes_padded[i].real()); + max = std::abs(fft_code[i].real()); } - if (std::abs(fft_codes_padded[i].imag()) > max) + if (std::abs(fft_code[i].imag()) > max) { - max = std::abs(fft_codes_padded[i].imag()); + max = std::abs(fft_code[i].imag()); } } // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp = static_cast(floor(fft_code[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_code[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; diff --git a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc index e099ec320..b83eb623c 100644 --- a/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/galileo_e5b_pcps_acquisition_fpga.cc @@ -103,7 +103,7 @@ void GalileoE5bPcpsAcquisitionFpga::generate_galileo_e5b_prn_codes() // a channel is assigned) auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT volk_gnsssdr::vector> code(nsamples_total); // Buffer for local code - volk_gnsssdr::vector> fft_codes_padded(nsamples_total); + volk_gnsssdr::vector> fft_code(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * GALILEO_E5B_NUMBER_OF_CODES); // memory containing all the possible fft codes for PRN 0 to 32 if (acq_iq_) @@ -142,33 +142,33 @@ void GalileoE5bPcpsAcquisitionFpga::generate_galileo_e5b_prn_codes() { // Duplicate the code sequence std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); } - // Fill in zero padding for the rest - std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); - std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer - fft_if->execute(); // Run the FFT of local code - volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer + fft_if->execute(); // Run the FFT of local code + volk_32fc_conjugate_32fc(fft_code.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values max = 0; // initialize maximum value for (uint32_t i = 0; i < nsamples_total; i++) // search for maxima { - if (std::abs(fft_codes_padded[i].real()) > max) + if (std::abs(fft_code[i].real()) > max) { - max = std::abs(fft_codes_padded[i].real()); + max = std::abs(fft_code[i].real()); } - if (std::abs(fft_codes_padded[i].imag()) > max) + if (std::abs(fft_code[i].imag()) > max) { - max = std::abs(fft_codes_padded[i].imag()); + max = std::abs(fft_code[i].imag()); } } // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp = static_cast(floor(fft_code[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_code[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; diff --git a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc index 7c8a24cd0..226078036 100644 --- a/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l1_ca_pcps_acquisition_fpga.cc @@ -104,7 +104,7 @@ void GpsL1CaPcpsAcquisitionFpga::generate_gps_l1_ca_prn_codes() auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // allocate memory to compute all the PRNs and compute all the possible codes volk_gnsssdr::vector> code(nsamples_total); - volk_gnsssdr::vector> fft_codes_padded(nsamples_total); + volk_gnsssdr::vector> fft_code(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32 float max; int32_t tmp; @@ -120,33 +120,32 @@ void GpsL1CaPcpsAcquisitionFpga::generate_gps_l1_ca_prn_codes() { // Duplicate the code sequence std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); } - // Fill in zero padding for the rest - std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); - - std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer - fft_if->execute(); // Run the FFT of local code - volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer + fft_if->execute(); // Run the FFT of local code + volk_32fc_conjugate_32fc(fft_code.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values max = 0; // initialize maximum value for (uint32_t i = 0; i < nsamples_total; i++) // search for maxima { - if (std::abs(fft_codes_padded[i].real()) > max) + if (std::abs(fft_code[i].real()) > max) { - max = std::abs(fft_codes_padded[i].real()); + max = std::abs(fft_code[i].real()); } - if (std::abs(fft_codes_padded[i].imag()) > max) + if (std::abs(fft_code[i].imag()) > max) { - max = std::abs(fft_codes_padded[i].imag()); + max = std::abs(fft_code[i].imag()); } } // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp = static_cast(floor(fft_code[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_code[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; diff --git a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc index d59f984bc..91c90db90 100644 --- a/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l2_m_pcps_acquisition_fpga.cc @@ -104,7 +104,7 @@ void GpsL2MPcpsAcquisitionFpga::generate_gps_l2c_m_prn_codes() auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT // allocate memory to compute all the PRNs and compute all the possible codes volk_gnsssdr::vector> code(nsamples_total); - volk_gnsssdr::vector> fft_codes_padded(nsamples_total); + volk_gnsssdr::vector> fft_codes(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32 float max; @@ -121,38 +121,34 @@ void GpsL2MPcpsAcquisitionFpga::generate_gps_l2c_m_prn_codes() { // Duplicate the code sequence std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); } - // Fill in zero padding for the rest - std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); - - std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer - fft_if->execute(); // Run the FFT of local code - volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values - max = 0; // initialize maximum value - for (unsigned int i = 0; i < nsamples_total; i++) // search for maxima + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer + fft_if->execute(); // Run the FFT of local code + volk_32fc_conjugate_32fc(fft_codes.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values + max = 0; // initialize maximum value + for (unsigned int i = 0; i < nsamples_total; i++) // search for maxima { - if (std::abs(fft_codes_padded[i].real()) > max) + if (std::abs(fft_codes[i].real()) > max) { - max = std::abs(fft_codes_padded[i].real()); + max = std::abs(fft_codes[i].real()); } - if (std::abs(fft_codes_padded[i].imag()) > max) + if (std::abs(fft_codes[i].imag()) > max) { - max = std::abs(fft_codes_padded[i].imag()); + max = std::abs(fft_codes[i].imag()); } } // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp = static_cast(floor(fft_codes[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; - - // d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)), - // static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max))); } } diff --git a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc index 2a395eb51..29b1a1887 100644 --- a/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc +++ b/src/algorithms/acquisition/adapters/gps_l5i_pcps_acquisition_fpga.cc @@ -104,7 +104,7 @@ void GpsL5iPcpsAcquisitionFpga::generate_gps_l5i_prn_codes() // a channel is assigned) auto fft_if = gnss_fft_fwd_make_unique(nsamples_total); // Direct FFT volk_gnsssdr::vector> code(nsamples_total); - volk_gnsssdr::vector> fft_codes_padded(nsamples_total); + volk_gnsssdr::vector> fft_codes(nsamples_total); d_all_fft_codes_ = volk_gnsssdr::vector(nsamples_total * NUM_PRNs); // memory containing all the possible fft codes for PRN 0 to 32 float max; @@ -121,33 +121,32 @@ void GpsL5iPcpsAcquisitionFpga::generate_gps_l5i_prn_codes() { // Duplicate the code sequence std::copy(code.begin(), code.begin() + code_length, code.begin() + code_length); + // Fill in zero padding for the rest + std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); } - // Fill in zero padding for the rest - std::fill(code.begin() + (acq_parameters_.enable_zero_padding ? 2 * code_length : code_length), code.end(), std::complex(0.0, 0.0)); - - std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer - fft_if->execute(); // Run the FFT of local code - volk_32fc_conjugate_32fc(fft_codes_padded.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values + std::copy_n(code.data(), nsamples_total, fft_if->get_inbuf()); // copy to FFT buffer + fft_if->execute(); // Run the FFT of local code + volk_32fc_conjugate_32fc(fft_codes.data(), fft_if->get_outbuf(), nsamples_total); // conjugate values max = 0; // initialize maximum value for (uint32_t i = 0; i < nsamples_total; i++) // search for maxima { - if (std::abs(fft_codes_padded[i].real()) > max) + if (std::abs(fft_codes[i].real()) > max) { - max = std::abs(fft_codes_padded[i].real()); + max = std::abs(fft_codes[i].real()); } - if (std::abs(fft_codes_padded[i].imag()) > max) + if (std::abs(fft_codes[i].imag()) > max) { - max = std::abs(fft_codes_padded[i].imag()); + max = std::abs(fft_codes[i].imag()); } } // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs // and package codes in a format that is ready to be written to the FPGA for (uint32_t i = 0; i < nsamples_total; i++) { - tmp = static_cast(floor(fft_codes_padded[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); - tmp2 = static_cast(floor(fft_codes_padded[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp = static_cast(floor(fft_codes[i].real() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); + tmp2 = static_cast(floor(fft_codes[i].imag() * (pow(2, QUANT_BITS_LOCAL_CODE - 1) - 1) / max)); local_code = (tmp & SELECT_LSBITS) | ((tmp2 * SHL_CODE_BITS) & SELECT_MSBITS); // put together the real part and the imaginary part fft_data = local_code & SELECT_ALL_CODE_BITS; d_all_fft_codes_[i + (nsamples_total * (PRN - 1))] = fft_data; From 9908be730b97dbd57d7dd8a0a537c2d8d013d95e Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 5 Mar 2025 16:47:58 +0100 Subject: [PATCH 492/499] Bump local version of Protocol Buffers to 30.0 --- CMakeLists.txt | 5 ++++- cmake/Modules/BuildProtobuf.cmake | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44cff2978..baddc40ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,7 +359,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.2.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.3") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.0") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.15") set(GNSSSDR_GTEST_LOCAL_VERSION "1.16.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") @@ -396,6 +396,9 @@ if(CMAKE_VERSION VERSION_LESS "3.4") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.10") endif() +if(CMAKE_VERSION VERSION_LESS "3.16") + set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "29.3") +endif() if(CMAKE_CROSSCOMPILING OR CMAKE_VERSION VERSION_LESS "3.13" OR ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0.0)) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0")) OR diff --git a/cmake/Modules/BuildProtobuf.cmake b/cmake/Modules/BuildProtobuf.cmake index 5590943db..dcea7e07c 100644 --- a/cmake/Modules/BuildProtobuf.cmake +++ b/cmake/Modules/BuildProtobuf.cmake @@ -1,7 +1,7 @@ # GNSS-SDR is a Global Navigation Satellite System software-defined receiver. # This file is part of GNSS-SDR. # -# SPDX-FileCopyrightText: 2023 C. Fernandez-Prades cfernandez(at)cttc.es +# SPDX-FileCopyrightText: 2023-2025 C. Fernandez-Prades cfernandez(at)cttc.es # SPDX-License-Identifier: BSD-3-Clause # Downloads and builds the protoc compiler and static libraries of Protocol @@ -13,7 +13,7 @@ if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION) - set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "25.0") + set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.0") endif() if(NOT GNSSSDR_BINARY_DIR) @@ -55,6 +55,11 @@ list(APPEND UTF8_LIBRARIES ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}/${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}utf8_range${CMAKE_STATIC_LIBRARY_SUFFIX} ) +set(ABSL_OPTION "") +if(CMAKE_VERSION VERSION_LESS "3.16" OR GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION VERSION_LESS "30.0") + set(ABSL_OPTION "-Dprotobuf_ABSL_PROVIDER=package") +endif() + ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} PREFIX ${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/protocolbuffers/protobuf @@ -73,7 +78,7 @@ ExternalProject_Add(protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} -DCMAKE_VISIBILITY_INLINES_HIDDEN=1 -DCMAKE_INSTALL_PREFIX=${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION} -Dprotobuf_BUILD_TESTS=OFF - -Dprotobuf_ABSL_PROVIDER=package + ${ABSL_OPTION} ${USE_ZLIB} BUILD_COMMAND ${CMAKE_COMMAND} "--build" "${GNSSSDR_BINARY_DIR}/protobuf-${GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION}" From 7a30041401ae0c24a2bad4eb83b7ba321e185a48 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 11 Mar 2025 09:09:30 +0100 Subject: [PATCH 493/499] Fix cross-compilation in old environments --- .../acquisition/libs/fpga_acquisition.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/algorithms/acquisition/libs/fpga_acquisition.h b/src/algorithms/acquisition/libs/fpga_acquisition.h index 3e73ddf00..4cada480b 100644 --- a/src/algorithms/acquisition/libs/fpga_acquisition.h +++ b/src/algorithms/acquisition/libs/fpga_acquisition.h @@ -187,13 +187,10 @@ private: static const uint32_t MEM_LOCAL_CODE_WR_ENABLE = 0x0C000000; // command to enable the ENA and WR pins of the internal memory of the multicorrelator static const uint32_t POW_2_2 = 4; // 2^2 (used for the conversion of floating point numbers to integers) static const uint32_t POW_2_31 = 2147483648; // 2^31 (used for the conversion of floating point numbers to integers) - - static const uint32_t MAX_FILTERS_AVAILABLE = 2; // maximum number of downsampling filters available in the FPGA by default - static const uint32_t DEFAULT_DOWNSAMPLING_FILTER_DELAY = 40; // default downsampling filter delay (for FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1) - static const uint32_t DEFAULT_DOWNSAMPLING_FACTOR = 4; // default downsampling factor (for FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1) - static const uint32_t DEFAULT_MAX_FFT_SIZE = 32768; // default maximum FFT size supported by the FPGA - static const uint32_t ACQ_BUFF_0 = 0; // FPGA Acquisition IP buffer containing L1/E1 frequency band samples by default. - static const uint32_t ACQ_BUFF_1 = 0; // FPGA Acquisition IP buffer containing L2 or L5/E5a frequency band samples by default. + static const uint32_t MAX_FILTERS_AVAILABLE = 2; // maximum number of downsampling filters available in the FPGA by default + static const uint32_t DEFAULT_MAX_FFT_SIZE = 32768; // default maximum FFT size supported by the FPGA + static const uint32_t ACQ_BUFF_0 = 0; // FPGA Acquisition IP buffer containing L1/E1 frequency band samples by default. + static const uint32_t ACQ_BUFF_1 = 0; // FPGA Acquisition IP buffer containing L2 or L5/E5a frequency band samples by default. // bit manipulation static const uint32_t RSHIFT_4_BITS = 0x4; @@ -201,6 +198,10 @@ private: static const uint32_t BIT_MASK_4 = 0xF; static const uint32_t BIT_MASK_8 = 0xFF; + // Downsampling default constants + const uint32_t DEFAULT_DOWNSAMPLING_FILTER_DELAY = 40; // default downsampling filter delay (for FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1) + const uint32_t DEFAULT_DOWNSAMPLING_FACTOR = 4; // default downsampling factor (for FPGA Acquisition IP core versions earlier than FPGA_ACQ_IP_VERSION_1) + // private methods void fpga_acquisition_test_register(void); void read_ipcore_info(std::vector> &downsampling_filter_specs, uint32_t &max_FFT_size); From b60368038a484c3fb18d9b5e6ea36454aa6d8897 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 15 Mar 2025 09:10:23 +0100 Subject: [PATCH 494/499] Bump local version of Protocol Buffers to v30.1 --- CMakeLists.txt | 2 +- cmake/Modules/BuildProtobuf.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index baddc40ab..467e24d10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,7 +359,7 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.2.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.0") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.1") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.15") set(GNSSSDR_GTEST_LOCAL_VERSION "1.16.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") diff --git a/cmake/Modules/BuildProtobuf.cmake b/cmake/Modules/BuildProtobuf.cmake index dcea7e07c..03d7b09d8 100644 --- a/cmake/Modules/BuildProtobuf.cmake +++ b/cmake/Modules/BuildProtobuf.cmake @@ -13,7 +13,7 @@ if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION) - set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.0") + set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.1") endif() if(NOT GNSSSDR_BINARY_DIR) From b0b41b194f8475afe5c67fb001fc521c88a3584f Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Sat, 15 Mar 2025 09:41:05 +0100 Subject: [PATCH 495/499] Replace apt-get by apt --- .github/workflows/gnss-sdr_archs.yml | 4 +-- .github/workflows/main.yml | 6 ++--- .github/workflows/volk_gnsssdr_archs.yml | 8 +++--- CMakeLists.txt | 26 +++++++++---------- README.md | 12 ++++----- cmake/Modules/GnsssdrCrypto.cmake | 2 +- docs/doxygen/other/main_page.dox | 2 +- .../volk_gnsssdr/README.md | 2 +- utils/rinex2assist/CMakeLists.txt | 2 +- utils/rinex2assist/README.md | 2 +- 10 files changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/gnss-sdr_archs.yml b/.github/workflows/gnss-sdr_archs.yml index ca9595187..f3e86bb1f 100644 --- a/.github/workflows/gnss-sdr_archs.yml +++ b/.github/workflows/gnss-sdr_archs.yml @@ -58,8 +58,8 @@ jobs: CXX: ${{ matrix.compiler.cxx }} shell: /bin/sh install: | - apt-get update -q -y - apt-get install -q -y ${{ matrix.compiler.name }} git ninja-build cmake \ + apt update + apt install -y ${{ matrix.compiler.name }} git ninja-build cmake \ libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev \ libboost-thread-dev libboost-chrono-dev libboost-serialization-dev \ liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev \ diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 613d7fde2..5466c4f6a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,9 +18,9 @@ jobs: - uses: actions/checkout@v4 - name: install dependencies run: | - sudo apt-get update -y + sudo apt update sudo apt install -y libunwind-dev - sudo apt-get install -y --no-install-recommends ninja-build cmake \ + sudo apt install -y --no-install-recommends ninja-build cmake \ libboost-dev libboost-date-time-dev libboost-system-dev libboost-filesystem-dev \ libboost-thread-dev libboost-chrono-dev libboost-serialization-dev \ liblog4cpp5-dev gnuradio-dev gr-osmosdr libpugixml-dev libpcap-dev libblas-dev \ @@ -170,7 +170,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: install dependencies - run: sudo apt-get install python3-pip && sudo pip3 install cpplint + run: sudo apt install python3-pip && sudo pip3 install cpplint - name: run checks run: "find ./src/ ./utils ./tests -iname *.h -o -iname *.cc | xargs cpplint --filter=-,+build/class,+build/deprecated,+build/explicit_make_pair,\ diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index 1395423da..600ac8a3c 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -62,8 +62,8 @@ jobs: CXX: ${{ matrix.compiler.cxx }} shell: /bin/sh install: | - apt-get update -q -y - apt-get install -q -y git cmake python3-mako liborc-dev ${{ matrix.compiler.name }} + apt update + apt install -y git cmake python3-mako liborc-dev ${{ matrix.compiler.name }} run: | git config --global --add safe.directory /volk_gnsssdr cd /volk_gnsssdr @@ -85,8 +85,8 @@ jobs: - uses: actions/checkout@v4 - name: Install packages run: | - sudo apt-get update -q -y - sudo apt-get install -y python3-mako cmake qemu-user-static g++-14-riscv64-linux-gnu clang-18 + sudo apt update + sudo apt install -y python3-mako cmake qemu-user-static g++-14-riscv64-linux-gnu clang-18 - name: Test RVV with gcc-14 VLEN=128 run: | mkdir -p gcc14_VLEN_128; cd gcc14_VLEN_128 diff --git a/CMakeLists.txt b/CMakeLists.txt index 467e24d10..ed5638606 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1155,7 +1155,7 @@ if(NOT VOLKGNSSSDR_FOUND) elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(STATUS " sudo zypper install ${PYTHON_NAME}-Mako") else() - message(STATUS " sudo apt-get install ${PYTHON_NAME}-mako") + message(STATUS " sudo apt install ${PYTHON_NAME}-mako") endif() endif() message(FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR") @@ -1172,7 +1172,7 @@ if(NOT VOLKGNSSSDR_FOUND) elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(STATUS " sudo zypper install ${PYTHON_NAME}-six") else() - message(STATUS " sudo apt-get install ${PYTHON_NAME}-six") + message(STATUS " sudo apt install ${PYTHON_NAME}-six") endif() endif() message(FATAL_ERROR "six - python 2 and 3 compatibility library required to build VOLK_GNSSSDR") @@ -1799,7 +1799,7 @@ if(NOT absl_FOUND) elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install automake") else() - message(" sudo apt-get install automake") + message(" sudo apt install automake") endif() message(FATAL_ERROR "aclocal is required to build glog from source") endif() @@ -1811,7 +1811,7 @@ if(NOT absl_FOUND) elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install libtoool") else() - message(" sudo apt-get install libtool") + message(" sudo apt install libtool") endif() message(FATAL_ERROR "libtool is required to build glog from source") endif() @@ -2014,7 +2014,7 @@ if(NOT BLAS_FOUND) if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(" sudo yum install blas-devel") else() - message(" sudo apt-get install libblas-dev") + message(" sudo apt install libblas-dev") endif() endif() message(FATAL_ERROR "BLAS is required to build gnss-sdr") @@ -2051,7 +2051,7 @@ if(NOT LAPACK_FOUND) elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install lapack-devel") else() - message(" sudo apt-get install liblapack-dev") + message(" sudo apt install liblapack-dev") endif() endif() message(FATAL_ERROR "LAPACK is required to build gnss-sdr") @@ -2130,7 +2130,7 @@ if(NOT ARMADILLO_FOUND OR ENABLE_OWN_ARMADILLO) elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(STATUS " sudo zypper install gcc-fortran") else() - message(STATUS " sudo apt-get install gfortran") + message(STATUS " sudo apt install gfortran") endif() message(FATAL_ERROR "gfortran is required to build gnss-sdr") endif() @@ -2334,7 +2334,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(STATUS " sudo zypper install hdf5-devel") else() - message(STATUS " sudo apt-get install libhdf5-dev") + message(STATUS " sudo apt install libhdf5-dev") endif() endif() message(FATAL_ERROR "*** The hdf5 library is required to build Matio from source.") @@ -2351,7 +2351,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install libtoool") else() - message(" sudo apt-get install libtool") + message(" sudo apt install libtool") endif() message(FATAL_ERROR "libtool is required to build matio from source.") endif() @@ -2371,7 +2371,7 @@ if(NOT MATIO_FOUND OR MATIO_VERSION_STRING VERSION_LESS ${GNSSSDR_MATIO_MIN_VERS elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install automake") else() - message(" sudo apt-get install automake") + message(" sudo apt install automake") endif() message(FATAL_ERROR "aclocal is required to build matio from source.") endif() @@ -2762,7 +2762,7 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install libtoool") else() - message(" sudo apt-get install libtool") + message(" sudo apt install libtool") endif() message(FATAL_ERROR "libtool is required to build Protocol Buffers from source") endif() @@ -2782,7 +2782,7 @@ if((NOT Protobuf_FOUND) OR (NOT Protobuf_PROTOC_EXECUTABLE) OR (${Protobuf_VERSI elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(" sudo zypper install automake") else() - message(" sudo apt-get install automake") + message(" sudo apt install automake") endif() message(FATAL_ERROR "aclocal is required to build Protocol Buffers from source") endif() @@ -3044,7 +3044,7 @@ else() if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(STATUS " or simply by doing 'sudo yum install doxygen-latex'.") else() - message(STATUS " or simply by doing 'sudo apt-get install doxygen-latex'.") + message(STATUS " or simply by doing 'sudo apt install doxygen-latex'.") endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/README.md b/README.md index ded9eabb1..8f55be8a0 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ If you are using Debian 9, Ubuntu 14.10 or above, this can be done by copying and pasting the following line in a terminal: ``` -$ sudo apt-get install build-essential cmake git pkg-config libboost-dev libboost-date-time-dev \ +$ sudo apt install build-essential cmake git pkg-config libboost-dev libboost-date-time-dev \ libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \ libboost-serialization-dev liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr \ libblas-dev liblapack-dev libarmadillo-dev libgflags-dev libgoogle-glog-dev \ @@ -315,7 +315,7 @@ tutorial. First of all, install some basic packages: ``` -$ sudo apt-get install git python3-pip +$ sudo apt install git python3-pip ``` Download, build and install PyBOMBS: @@ -384,7 +384,7 @@ or manually as explained below, and then please follow instructions on how to #### Install [Armadillo](https://arma.sourceforge.net/ "Armadillo's Homepage"), a C++ linear algebra library ``` -$ sudo apt-get install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint +$ sudo apt install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint $ sudo yum install lapack-devel blas-devel # For Fedora/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux @@ -439,7 +439,7 @@ v20240116 is available in your system. #### Install the OpenSSL libraries ``` -$ sudo apt-get install libssl-dev # For Debian/Ubuntu/LinuxMint +$ sudo apt install libssl-dev # For Debian/Ubuntu/LinuxMint $ sudo yum install openssl-devel # For Fedora/CentOS/RHEL $ sudo zypper install openssl-devel # For OpenSUSE $ sudo pacman -S openssl # For Arch Linux @@ -604,7 +604,7 @@ directory at your preferred location and store your own configuration and data files there. You could be interested in creating the documentation (requires: -`sudo apt-get install doxygen-latex` in Ubuntu/Debian) by doing: +`sudo apt install doxygen-latex` in Ubuntu/Debian) by doing: ``` $ cmake --build build --target doc @@ -683,7 +683,7 @@ libraries and [gr-iio](https://github.com/analogdevicesinc/gr-iio.git) (>v0.3) gnuradio block: ``` -$ sudo apt-get install libxml2-dev bison flex +$ sudo apt install libxml2-dev bison flex $ git clone https://github.com/analogdevicesinc/libiio.git $ cd libiio $ mkdir build diff --git a/cmake/Modules/GnsssdrCrypto.cmake b/cmake/Modules/GnsssdrCrypto.cmake index 36f2be03a..db530a709 100644 --- a/cmake/Modules/GnsssdrCrypto.cmake +++ b/cmake/Modules/GnsssdrCrypto.cmake @@ -76,7 +76,7 @@ else() if(${LINUX_DISTRIBUTION} MATCHES "Fedora" OR ${LINUX_DISTRIBUTION} MATCHES "Red Hat") message(" sudo yum install openssl-devel") else() - message(" sudo apt-get install libgnutls28-dev") + message(" sudo apt install libgnutls28-dev") endif() endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") diff --git a/docs/doxygen/other/main_page.dox b/docs/doxygen/other/main_page.dox index b9c16742a..d5de316d6 100644 --- a/docs/doxygen/other/main_page.dox +++ b/docs/doxygen/other/main_page.dox @@ -165,7 +165,7 @@ $ make pdfmanual will create a PDF manual at gnss-sdr/docs/GNSS-SDR_manual.pdf. Please note that the PDF generation requires some fonts to be installed on the host system. In Ubuntu, those fonts do not come by default. You can install them by doing: \verbatim -$ sudo apt-get install texlive-fonts-recommended +$ sudo apt install texlive-fonts-recommended \endverbatim and then run cmake ../ and make pdfmanual again. diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/README.md b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/README.md index 2bbf9ebd8..393f9b71f 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/README.md +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/README.md @@ -67,7 +67,7 @@ and will make use of it if already installed, thus avoiding to install it twice. First, make sure that the required dependencies are installed in your machine: ``` -$ sudo apt-get install build-essential python3-mako cmake git ca-certificates \ +$ sudo apt install build-essential python3-mako cmake git ca-certificates \ libboost-dev libboost-filesystem-dev libboost-system-dev ``` diff --git a/utils/rinex2assist/CMakeLists.txt b/utils/rinex2assist/CMakeLists.txt index 6337b9319..f4cabcd3d 100644 --- a/utils/rinex2assist/CMakeLists.txt +++ b/utils/rinex2assist/CMakeLists.txt @@ -154,7 +154,7 @@ else() elseif(${LINUX_DISTRIBUTION} MATCHES "openSUSE") message(STATUS " sudo zypper install libboost_iostreams-devel") else() - message(STATUS " sudo apt-get install libboost-iostreams-dev") + message(STATUS " sudo apt install libboost-iostreams-dev") endif() endif() endif() diff --git a/utils/rinex2assist/README.md b/utils/rinex2assist/README.md index f1f11a4bd..55c746cca 100644 --- a/utils/rinex2assist/README.md +++ b/utils/rinex2assist/README.md @@ -32,7 +32,7 @@ The building requires two extra dependencies: the Boost Iostreams library and the program `uncompress`: - The Boost Iostreams library can be installed through a package: - - In Debian / Ubuntu: `sudo apt-get install libboost-iostreams-dev` + - In Debian / Ubuntu: `sudo apt install libboost-iostreams-dev` - In Fedora / CentOS: `sudo yum install boost-iostreams` - In OpenSUSE: `sudo zypper install libboost_iostreams-devel` - In Arch Linux: included in `boost-libs` package. From 49f8395688fee7570c7634c6b22063a010c2c999 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Wed, 26 Mar 2025 22:50:48 +0100 Subject: [PATCH 496/499] Bump local ProtocolBuffers version to 30.2 and Google Benchmark to 1.9.2 --- CMakeLists.txt | 4 ++-- cmake/Modules/BuildProtobuf.cmake | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed5638606..ac52f8dc8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,12 +359,12 @@ set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.2.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") -set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.1") +set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.2") set(GNSSSDR_PUGIXML_LOCAL_VERSION "1.15") set(GNSSSDR_GTEST_LOCAL_VERSION "1.16.0") set(GNSSSDR_GNSS_SIM_LOCAL_VERSION "origin/master") set(GNSSSDR_GNSSTK_LOCAL_VERSION "14.3.0") -set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.1") +set(GNSSSDR_BENCHMARK_LOCAL_VERSION "1.9.2") set(GNSSSDR_MATHJAX_EXTERNAL_VERSION "2.7.7") set(GNSSSDR_ABSL_LOCAL_VERSION "origin/master") # live at head (see https://abseil.io/about/releases) diff --git a/cmake/Modules/BuildProtobuf.cmake b/cmake/Modules/BuildProtobuf.cmake index 03d7b09d8..8f7c60278 100644 --- a/cmake/Modules/BuildProtobuf.cmake +++ b/cmake/Modules/BuildProtobuf.cmake @@ -13,7 +13,7 @@ if(NOT GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION) - set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.1") + set(GNSSSDR_PROTOCOLBUFFERS_LOCAL_VERSION "30.2") endif() if(NOT GNSSSDR_BINARY_DIR) From d2f737df858ed408276ac0535c49a09fe8fbb5d1 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Fri, 28 Mar 2025 16:49:01 +0100 Subject: [PATCH 497/499] Update local Armadillo version to 14.4.x branch --- CMakeLists.txt | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac52f8dc8..c7c313763 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -355,7 +355,7 @@ set(GNSSSDR_ABSEIL_MIN_VERSION "20240116") ################################################################################ # Versions to download and build (but not to install system-wide) if not found ################################################################################ -set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.2.x") +set(GNSSSDR_ARMADILLO_LOCAL_VERSION "14.4.x") set(GNSSSDR_GFLAGS_LOCAL_VERSION "2.2.2") set(GNSSSDR_GLOG_LOCAL_VERSION "0.7.1") set(GNSSSDR_MATIO_LOCAL_VERSION "1.5.28") diff --git a/README.md b/README.md index 8f55be8a0..de5550ef6 100644 --- a/README.md +++ b/README.md @@ -388,9 +388,9 @@ $ sudo apt install libblas-dev liblapack-dev # For Debian/Ubuntu/LinuxMint $ sudo yum install lapack-devel blas-devel # For Fedora/RHEL $ sudo zypper install lapack-devel blas-devel # For OpenSUSE $ sudo pacman -S blas lapack # For Arch Linux -$ wget https://sourceforge.net/projects/arma/files/armadillo-14.2.3.tar.xz -$ tar xvfz armadillo-14.2.3.tar.xz -$ cd armadillo-14.2.3 +$ wget https://sourceforge.net/projects/arma/files/armadillo-14.4.1.tar.xz +$ tar xvfz armadillo-14.4.1.tar.xz +$ cd armadillo-14.4.1 $ cmake . $ make $ sudo make install From b95366c5b6e72d312ea59c7c70fdb072cc862d87 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 1 Apr 2025 09:12:23 +0200 Subject: [PATCH 498/499] Bump max version of CMake to 4.0 --- CMakeLists.txt | 31 ++++++++++++++++--- .../volk_gnsssdr/CMakeLists.txt | 2 +- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ac52f8dc8..4bc27e62b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ endif() # Build type can still be overridden by setting -DCMAKE_BUILD_TYPE= set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") -cmake_minimum_required(VERSION 2.8.12...3.31) +cmake_minimum_required(VERSION 2.8.12...4.0) project(gnss-sdr CXX C) set(GNSSSDR_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) # Allows to be a sub-project @@ -1610,16 +1610,37 @@ if(NOT absl_FOUND) if((CMAKE_VERSION VERSION_GREATER 3.12.0) AND NOT (CMAKE_GENERATOR STREQUAL Xcode)) set(PARALLEL_BUILD "--parallel 2") endif() - ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + if(CMAKE_VERSION VERSION_LESS 4.0) + ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + GIT_REPOSITORY https://github.com/gflags/gflags.git + GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} + SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} + CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + -DBUILD_STATIC_LIBS=ON + -DBUILD_gflags_LIB=ON + -DBUILD_gflags_nothreads_LIB=ON + -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} + ${GFLAGS_TOOLCHAIN_FILE} + -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> + BUILD_COMMAND "${GFLAGS_BUILD_COMMAND} ${PARALLEL_BUILD}" + BUILD_BYPRODUCTS ${GFLAGS_BUILD_BYPRODUCTS} + UPDATE_COMMAND "" + PATCH_COMMAND "" + INSTALL_COMMAND "" + ) + # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch + else() + ExternalProject_Add(gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} PREFIX ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} GIT_REPOSITORY https://github.com/gflags/gflags.git - GIT_TAG v${GNSSSDR_GFLAGS_LOCAL_VERSION} + GIT_TAG 52e94563eba1968783864942fedf6e87e3c611f4 SOURCE_DIR ${GNSSSDR_BINARY_DIR}/thirdparty/gflags/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} BINARY_DIR ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION} CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF -DBUILD_STATIC_LIBS=ON -DBUILD_gflags_LIB=ON - -DBUILD_gflags_nothreads_LIB=ON -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} ${GFLAGS_TOOLCHAIN_FILE} -DCMAKE_BUILD_TYPE=$<$:Debug>$<$:Release>$<$:RelWithDebInfo>$<$:MinSizeRel>$<$:Debug>$<$:Debug>$<$:RelWithDebInfo>$<$:RelWithDebInfo>$<$:Debug> @@ -1629,8 +1650,8 @@ if(NOT absl_FOUND) PATCH_COMMAND "" INSTALL_COMMAND "" ) + endif() endif() - # Note: -DBUILD_gflags_nothreads_LIB=ON is required as a workaround to a bug in gflags 2.2.2. This is fixed in gflags master branch set(GFlags_INCLUDE_DIRS ${GNSSSDR_BINARY_DIR}/gflags-${GNSSSDR_GFLAGS_LOCAL_VERSION}/include CACHE PATH "Local Gflags headers" diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 258110f96..bd1d39c6a 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -8,7 +8,7 @@ ######################################################################## # Project setup ######################################################################## -cmake_minimum_required(VERSION 2.8.12...3.31) +cmake_minimum_required(VERSION 2.8.12...4.0) set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel") project(volk_gnsssdr) enable_language(CXX) From 9c1754e79d299ae2c7894891bd3c7d3a14dd3219 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 1 Apr 2025 14:18:44 +0200 Subject: [PATCH 499/499] Bump version to 0.0.20 --- .github/workflows/volk_gnsssdr_archs.yml | 3 - CITATION.cff | 6 +- CMakeLists.txt | 6 +- docs/CHANGELOG.md | 58 ++++++++++--------- docs/manpage/gnss-sdr-manpage | 2 +- .../volk_gnsssdr/CMakeLists.txt | 2 +- .../volk_gnsssdr-config-info-manpage | 2 +- .../Packaging/volk_gnsssdr_profile-manpage | 2 +- src/main/main.cc | 2 +- 9 files changed, 41 insertions(+), 42 deletions(-) diff --git a/.github/workflows/volk_gnsssdr_archs.yml b/.github/workflows/volk_gnsssdr_archs.yml index 600ac8a3c..7e5625e02 100644 --- a/.github/workflows/volk_gnsssdr_archs.yml +++ b/.github/workflows/volk_gnsssdr_archs.yml @@ -33,9 +33,6 @@ jobs: - arch: armv7 distro: ubuntu22.04 compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 } - - arch: ppc64le - distro: ubuntu22.04 - compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 } - arch: s390x distro: ubuntu22.04 compiler: { name: g++-12, cc: gcc-12, cxx: g++-12 } diff --git a/CITATION.cff b/CITATION.cff index 337e4d42a..5aebc8b3c 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-3.0-or-later -# SPDX-FileCopyrightText: 2024 C. Fernandez-Prades carles.fernandez(at)cttc.es +# SPDX-FileCopyrightText: 2024-2025 C. Fernandez-Prades carles.fernandez(at)cttc.es --- authors: - affiliation: "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)" @@ -134,7 +134,7 @@ authors: family-names: "van der Linden" given-names: Stefan cff-version: "1.2.0" -date-released: "2024-01-23" +date-released: "2025-04-01" identifiers: - description: "The concept DOI of the work. This is a DOI always pointing to the latest stable release." type: doi @@ -342,4 +342,4 @@ repository-code: "https://github.com/gnss-sdr/gnss-sdr" title: GNSS-SDR type: software url: "https://gnss-sdr.org" -version: "0.0.19" +version: "0.0.20" diff --git a/CMakeLists.txt b/CMakeLists.txt index ed6f1d382..839744f3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,7 +161,7 @@ option(ENABLE_ORC "Use (if available) the Optimized Inner Loop Runtime Compiler ################################################################################ # GNSS-SDR version information ################################################################################ -set(THIS_IS_A_RELEASE OFF) # only related to version name, no further implications. +set(THIS_IS_A_RELEASE ON) # only related to version name, no further implications. if(NOT ${THIS_IS_A_RELEASE}) find_package(Git) set_package_properties(Git PROPERTIES @@ -197,9 +197,9 @@ endif() set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_API_COMPAT 0) if(${THIS_IS_A_RELEASE}) - set(VERSION_INFO_MINOR_VERSION 19) + set(VERSION_INFO_MINOR_VERSION 20) else() - set(VERSION_INFO_MINOR_VERSION 19.git-${GIT_BRANCH}-${GIT_COMMIT_HASH}) + set(VERSION_INFO_MINOR_VERSION 20.git-${GIT_BRANCH}-${GIT_COMMIT_HASH}) endif() set(VERSION ${VERSION_INFO_MAJOR_VERSION}.${VERSION_INFO_API_COMPAT}.${VERSION_INFO_MINOR_VERSION}) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5f14a5255..09f08e120 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -4,7 +4,7 @@ SPDX-License-Identifier: GPL-3.0-or-later ) [comment]: # ( -SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades +SPDX-FileCopyrightText: 2011-2025 Carles Fernandez-Prades ) @@ -12,7 +12,7 @@ SPDX-FileCopyrightText: 2011-2024 Carles Fernandez-Prades = 3.24, otherwise it has no effect). - This change has a downside in maintainability, since the source code becomes - plagued with preprocessor directives required to maintain compatibility both - with gflags and glog, and with Abseil. + signs of aging. The latest version of gflags dates back six years now, + although the master branch seems to be maintained. Glog remains well + maintained, with its latest version v0.7.1 released in June 2024, but with no + active development of new features and stuck at C++14. Abseil, on the other + hand, represents a contemporary evolution in software development, supports + C++17 and C++20, and has absorbed the functionalities of flags and logging + from its predecessors. Furthermore, as Abseil has become a prerequisite for + the latest versions of Protocol Buffers, its eventual inclusion in GNSS-SDR's + indirect dependencies is inevitable. Leveraging Abseil allows for eliminating + the need for gflags and glog, thereby reducing the number of mandatory + dependencies for GNSS-SDR in forthcoming GNU/Linux distributions. For seamless + integration, GNSS-SDR requires a quite recent minimum version of Abseil, + v20240116. If an older version is detected, the library will not be utilized, + and GNSS-SDR will fall back to using gflags and glog, which still can be used + and are fully supported. A new CMake configuration option + `-DENABLE_GLOG_AND_GFLAGS=ON` is available to force the usage of glog and + gflags instead of Abseil, even if a valid version of that library is present. + If the Abseil version installed in your system is too old but you still want + to try it, you can also force the downloading and building of a recent version + with the new CMake configuration flag `-DENABLE_OWN_ABSEIL=ON` (requires + CMake >= 3.24, otherwise it has no effect). This change has a downside in + maintainability, since the source code becomes plagued with preprocessor + directives required to maintain compatibility both with gflags and glog, and + with Abseil. - Historically, GNSS-SDR linked against the GnuTLS library for cryptographic functions. If GnuTLS was not found, then the building system looked for and linked against OpenSSL as a fallback. This was due to the OpenSSL 1.x dual @@ -106,12 +106,14 @@ All notable changes to GNSS-SDR will be documented in this file. distributions. This issue was solved with the release of OpenSSL 3.0.0, which transitioned to the Apache License 2.0, fully compatible with GPL v3.0. Accordingly, the GNSS-SDR building system now looks for OpenSSL in the first - place and, if not found, then it looks for GnuTLS as a fallback. + place and, if not found, then it looks for GnuTLS as a fallback. The new CMake + configuration option `-DENABLE_GNUTLS=ON` allows linking against GnuTLS + instead of OpenSSL. - Allow linking against Boost 1.87.0. - Replace the System V queues by boost::interprocess, improving portability. - Improve detection of Homebrew or Macports in macOS. -### Reliability +### Improvements in Reliability - Implementation of the Galileo Open Service Navigation Message Authentication (OSNMA), a data authentication function for the Galileo Open Service worldwide diff --git a/docs/manpage/gnss-sdr-manpage b/docs/manpage/gnss-sdr-manpage index 60e2564e4..958ffbe6a 100644 --- a/docs/manpage/gnss-sdr-manpage +++ b/docs/manpage/gnss-sdr-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH gnss\-sdr 1 "23 Jan 2024" "0.0.19" "gnss\-sdr man page" +.TH gnss\-sdr 1 "1 Apr 2025" "0.0.20" "gnss\-sdr man page" .SH NAME \fBgnss\-sdr\fR \- GNSS Software Defined Receiver. .SH SYNOPSIS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index bd1d39c6a..b2b83fe95 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -206,7 +206,7 @@ message(STATUS "Build type set to ${CMAKE_BUILD_TYPE}.") set(VERSION_INFO_MAJOR_VERSION 0) set(VERSION_INFO_MINOR_VERSION 0) -set(VERSION_INFO_MAINT_VERSION 19) +set(VERSION_INFO_MAINT_VERSION 20) include(VolkGnsssdrVersion) # setup version info include(VolkGnsssdrFindPaths) # set VOLK_GNSSSDR_LIB_PATHS and VOLK_GNSSSDR_INCLUDE_PATHS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage index b1fbc390d..f077f66b8 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr-config-info-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH volk_gnsssdr\-config\-info 1 "23 Jan 2024" "0.0.19" "volk_gnsssdr\-config\-info man page" +.TH volk_gnsssdr\-config\-info 1 "1 Apr 2025" "0.0.20" "volk_gnsssdr\-config\-info man page" .SH NAME \fBvolk_gnsssdr\-config\-info\fR \- Prints configuration information of libvolk_gnsssdr functions. .SH SYNOPSIS diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage index 36febf4e3..933a464b3 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/cmake/Packaging/volk_gnsssdr_profile-manpage @@ -2,7 +2,7 @@ .\" SPDX-License-Identifier: GPL-3.0-or-later .\" SPDX-FileCopyrightText: Carles Fernandez-Prades .\" Contact carles.fernandez@cttc.es to correct errors or typos. -.TH volk_gnsssdr_profile 1 "23 Jan 2024" "0.0.19" "volk_gnsssdr_profile man page" +.TH volk_gnsssdr_profile 1 "1 Apr 2025" "0.0.20" "volk_gnsssdr_profile man page" .SH NAME \fBvolk_gnsssdr_profile\fR \- Profiler application for libvolk_gnsssdr functions. .SH SYNOPSIS diff --git a/src/main/main.cc b/src/main/main.cc index fa7f79555..c32b9f081 100644 --- a/src/main/main.cc +++ b/src/main/main.cc @@ -18,7 +18,7 @@ */ #ifndef GNSS_SDR_VERSION -#define GNSS_SDR_VERSION "0.0.19" +#define GNSS_SDR_VERSION "0.0.20" #endif #ifndef GOOGLE_STRIP_LOG